X-Git-Url: https://vcs.maemo.org/git/?a=blobdiff_plain;f=src%2Fhildon-color-chooser-dialog.c;h=39618b80086dfbd61c42329106104d5c0af19baa;hb=a8bd03bf755fdbfbd7253dbaf7534d00c2046250;hp=ddfc3493506111cc6f9bb58e3d7318fc7cda3858;hpb=e5628fa0ea046803e810fe407598548787d6105a;p=hildon diff --git a/src/hildon-color-chooser-dialog.c b/src/hildon-color-chooser-dialog.c index ddfc349..39618b8 100644 --- a/src/hildon-color-chooser-dialog.c +++ b/src/hildon-color-chooser-dialog.c @@ -1,5 +1,5 @@ /* - * This file is part of hildon-libs + * This file is a part of hildon * * Copyright (C) 2005, 2006 Nokia Corporation, all rights reserved. * @@ -23,6 +23,25 @@ * */ +/** + * SECTION:hildon-color-chooser-dialog + * @short_description: A dialog used to select a color from HSV colorspace. + * @see_also: #HildonColorButton + * + * HildonColorChooserDialog enables the user to + * select an arbitrary color from a HSV colorspace. + * The color is stored in one of the predefined color + * slots and can be reselected later on. + * + * Additionally the user can choose one of the standard "factory" + * colors. + * + */ + +#ifdef HAVE_CONFIG_H +#include +#endif + #include #include #include @@ -153,7 +172,7 @@ hildon_color_chooser_dialog_get_type (void) NULL }; - dialog_type = g_type_register_static (HILDON_TYPE_COLOR_CHOOSER_DIALOG, + dialog_type = g_type_register_static (GTK_TYPE_DIALOG, "HildonColorChooserDialog", &dialog_info, 0); } @@ -172,6 +191,7 @@ hildon_color_chooser_dialog_init (HildonColorChooserDialog *objec priv->hbox = gtk_hbox_new (FALSE, 0); priv->vbox = gtk_vbox_new (FALSE, 0); + priv->chooser = hildon_color_chooser_new (); gtk_box_pack_start (GTK_BOX (priv->hbox), priv->chooser, TRUE, TRUE, 0); gtk_box_pack_end (GTK_BOX (priv->hbox), priv->vbox, FALSE, FALSE, 0); @@ -292,6 +312,8 @@ hildon_color_chooser_dialog_class_init (HildonColorChooserDialogClass * GDK_TYPE_COLOR, G_PARAM_READABLE)); } + + g_type_class_add_private (object_klass, sizeof (HildonColorChooserDialogPrivate)); } static void @@ -757,6 +779,17 @@ hildon_color_chooser_dialog_destroy (GtkObject *object) GTK_OBJECT_CLASS (parent_class)->destroy (object); } +/** + * hildon_color_chooser_dialog_set_color: + * @dialog: a #HildonColorChooserDialog + * @color: a color to set on the #HildonColorChooserDialog + * + * Sets the dialog to point at the given color. It'll first try to + * search the palette of the existing colors to match the passed color. + * If the color is not found in the pallette, the color in the currently + * selected box will be modified. + * + */ void hildon_color_chooser_dialog_set_color (HildonColorChooserDialog *dialog, GdkColor *color) @@ -931,11 +964,11 @@ hildon_color_chooser_dialog_color_changed (HildonColorChooser *chooser, HildonColorChooserDialogPrivate *priv = HILDON_COLOR_CHOOSER_DIALOG_GET_PRIVATE (data); char key[128], color_str[13]; int tmp; - GdkColor *color; + GdkColor *color = g_new (GdkColor, 1); g_assert (priv); - g_object_get (G_OBJECT (chooser), "color", &color, NULL); + hildon_color_chooser_get_color (chooser, color); tmp = (priv->style_info.num_buttons.left * priv->style_info.num_buttons.right); @@ -1087,7 +1120,9 @@ hildon_color_chooser_dialog_new (void) /** * hildon_color_chooser_dialog_get_color: * @dialog: a #HildonColorChooserDialog - * @color: a color to fill with new values + * @color: a color structure to fill with the currently selected color + * + * Retrives the currently selected color in the color chooser dialog. * */ void @@ -1099,7 +1134,8 @@ hildon_color_chooser_dialog_get_color (HildonColorChooserDialog *dialo g_return_if_fail (HILDON_IS_COLOR_CHOOSER_DIALOG (dialog)); priv = HILDON_COLOR_CHOOSER_DIALOG_GET_PRIVATE (dialog); + g_assert (priv); - g_object_get (G_OBJECT (priv->chooser), "color", &color, NULL); + hildon_color_chooser_get_color (HILDON_COLOR_CHOOSER (priv->chooser), color); }