]> saetta.ns0.it Git - libgtkform/commitdiff
Added the signal GtkFormDecorator::btn-clean-clicked.
authorAndrea Zagli <azagli@libero.it>
Sun, 1 May 2011 08:17:52 +0000 (10:17 +0200)
committerAndrea Zagli <azagli@libero.it>
Sun, 1 May 2011 08:17:52 +0000 (10:17 +0200)
ui/gtkformdecoder.c
ui/test/decoder.c

index cc6f02864cd4b7f2b9d3d081775a19a199c6024a..96f3e475a0304759509a7d3283520ede42b7c9f6 100644 (file)
@@ -138,6 +138,21 @@ gtk_form_decoder_class_init (GtkFormDecoderClass *klass)
                                                       g_cclosure_marshal_VOID__VOID,
                                                       G_TYPE_NONE,
                                                       0);
+
+       /**
+        * GtkFormDecoder::btn_clean_clicked:
+        * @gtk_form_decoder:
+        *
+        */
+       klass->btn_clean_clicked_signal_id = g_signal_new ("btn-clean-clicked",
+                                                      G_TYPE_FROM_CLASS (object_class),
+                                                      G_SIGNAL_RUN_LAST,
+                                                      0,
+                                                      NULL,
+                                                      NULL,
+                                                      g_cclosure_marshal_BOOLEAN__FLAGS,
+                                                      G_TYPE_BOOLEAN,
+                                                      1, G_TYPE_INT);
 }
 
 static void
@@ -465,9 +480,17 @@ gtk_form_decoder_on_btn_clean_clicked (GtkEntry *entry,
                                        GdkEvent *event,
                                        gpointer user_data)
 {
+       gboolean ret;
+
        GtkFormDecoder *decoder = (GtkFormDecoder *)user_data;
        GtkFormDecoderPrivate *priv = GTK_FORM_DECODER_GET_PRIVATE (decoder);
        GtkFormDecoderClass *klass = GTK_FORM_DECODER_GET_CLASS (decoder);
 
-       gtk_form_decoder_set_key (decoder, "0");
+       ret = FALSE;
+       g_signal_emit (G_OBJECT (user_data), klass->btn_clean_clicked_signal_id, 0, 0, &ret);
+
+       if (!ret)
+               {
+                       gtk_form_decoder_set_key (decoder, "0");
+               }
 }
index 917cf3a96513f19b88235e99ffdd0c708b755345..bd6512d89f553c751b1dd9dc89a666ac518b276a 100644 (file)
@@ -33,6 +33,12 @@ on_btn_browse_clicked (gpointer instance, gpointer user_data)
        gtk_form_decoder_set_key (GTK_FORM_DECODER (decoder), "1");
 }
 
+static gboolean
+on_btn_clean_clicked (gpointer instance, gint arg1, gpointer user_data)
+{
+       return FALSE;
+}
+
 gboolean
 on_w_delete_event (GtkWidget *widget,
                    GdkEvent *event,
@@ -69,6 +75,8 @@ main (int argc, char **argv)
 
        g_signal_connect (G_OBJECT (decoder), "btn_browse_clicked",
                          G_CALLBACK (on_btn_browse_clicked), NULL);
+       g_signal_connect (G_OBJECT (decoder), "btn_clean_clicked",
+                         G_CALLBACK (on_btn_clean_clicked), NULL);
 
        gtk_widget_show_all (w);