2008-04-14 16:52:59 <timj@imendio.com>
[hildon] / src / hildon-color-button.c
index 249dcc3..0a57a1e 100644 (file)
@@ -8,7 +8,7 @@
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public License
  * as published by the Free Software Foundation; version 2.1 of
- * the License.
+ * the License, or (at your option) any later version.
  *
  * This library is distributed in the hope that it will be useful, but
  * WITHOUT ANY WARRANTY; without even the implied warranty of
 
 #define                                         INNER_BORDER_THICKNESS 2
 
-enum 
+enum
+{
+    SETUP_DIALOG,
+    LAST_SIGNAL
+};
+
+enum
 {
     PROP_0,
     PROP_COLOR,
-    PROP_IS_POPPED
+    PROP_POPUP_SHOWN
 };
 
 static void
@@ -143,6 +149,7 @@ draw_grid                                       (GdkDrawable *drawable,
                                                  gint h);
 
 static gpointer                                 parent_class = NULL;
+static guint                                    signals [LAST_SIGNAL] = { 0, };
 
 /**
  * hildon_color_button_get_type:
@@ -199,6 +206,16 @@ hildon_color_button_class_init                  (HildonColorButtonClass *klass)
     button_class->clicked           = hildon_color_button_clicked;
     widget_class->mnemonic_activate = hildon_color_button_mnemonic_activate;
 
+   signals[SETUP_DIALOG] =
+       g_signal_new ("setup-dialog",
+                     G_TYPE_FROM_CLASS (klass),
+                     G_SIGNAL_RUN_LAST,
+                     0,
+                     NULL, NULL,
+                     gtk_marshal_VOID__OBJECT,
+                     G_TYPE_NONE, 1,
+                     HILDON_TYPE_COLOR_CHOOSER_DIALOG);
+
     /**
      * HildonColorButton:color:
      *
@@ -212,14 +229,14 @@ hildon_color_button_class_init                  (HildonColorButtonClass *klass)
                 G_PARAM_READWRITE));
 
     /**
-     * HildonColorButton:is-popped:
+     * HildonColorButton:popup-shown:
      *
-     * If the color selection dialog is currently popped-down (visible)
+     * If the color selection dialog is currently popped-up (visible)
      */
-    g_object_class_install_property (gobject_class, PROP_IS_POPPED,
-            g_param_spec_boolean ("is-popped",
+    g_object_class_install_property (gobject_class, PROP_POPUP_SHOWN,
+            g_param_spec_boolean ("popup-shown",
                 "IsPopped",
-                "If the color selection dialog is popped down",
+                "If the color selection dialog is popped up",
                 FALSE,
                 G_PARAM_READABLE));
 
@@ -427,6 +444,8 @@ hildon_color_button_clicked                     (GtkButton *button)
         cs_dialog = HILDON_COLOR_CHOOSER_DIALOG (priv->dialog);
         if (parent)
             gtk_window_set_transient_for (GTK_WINDOW (cs_dialog), GTK_WINDOW (parent));
+
+        g_signal_emit (button, signals[SETUP_DIALOG], 0, priv->dialog);
     }
 
     /* Set the initial color for the color selector dialog */
@@ -504,7 +523,7 @@ hildon_color_button_get_property                (GObject *object,
             g_value_set_boxed (value, &priv->color);
             break;
 
-        case PROP_IS_POPPED:
+        case PROP_POPUP_SHOWN:
             g_value_set_boolean (value, priv->popped);
 
         default:
@@ -561,17 +580,17 @@ hildon_color_button_set_color                   (HildonColorButton *button,
 }
 
 /**
- * hildon_color_button_get_is_popped
+ * hildon_color_button_get_popup_shown
  * @button: a #HildonColorButton
  *
  * This function checks if the color button has the color 
- * selection dialog currently popped-down. 
+ * selection dialog currently popped-up. 
  * 
- * Returns: TRUE if the dialog is popped-down (visible to user).
+ * Returns: TRUE if the dialog is popped-up (visible to user).
  *
  */
 gboolean
-hildon_color_button_get_is_popped               (HildonColorButton *button)
+hildon_color_button_get_popup_shown             (HildonColorButton *button)
 {
     HildonColorButtonPrivate *priv = NULL; 
     g_return_val_if_fail (HILDON_IS_COLOR_BUTTON (button), FALSE);
@@ -583,15 +602,15 @@ hildon_color_button_get_is_popped               (HildonColorButton *button)
 }
 
 /**
- * hildon_color_button_pop_up
+ * hildon_color_button_popdown
  * @button: a #HildonColorButton
  *
- * If the color selection dialog is currently popped-down (visible)
- * it will be popped-up (hidden).
+ * If the color selection dialog is currently popped-up (visible)
+ * it will be popped-down (hidden).
  *
  */
 void
-hildon_color_button_pop_up                      (HildonColorButton *button)
+hildon_color_button_popdown                     (HildonColorButton *button)
 {
     HildonColorButtonPrivate *priv = NULL; 
     g_return_if_fail (HILDON_IS_COLOR_BUTTON (button));