From: Andrea Zagli Date: Sun, 1 May 2011 08:17:52 +0000 (+0200) Subject: Added the signal GtkFormDecorator::btn-clean-clicked. X-Git-Tag: 0.3.1~7 X-Git-Url: https://saetta.ns0.it/gitweb?a=commitdiff_plain;h=dceb0792f7a75b8745af24bc567c49142ccbd8d7;p=libgtkform Added the signal GtkFormDecorator::btn-clean-clicked. --- diff --git a/ui/gtkformdecoder.c b/ui/gtkformdecoder.c index cc6f028..96f3e47 100644 --- a/ui/gtkformdecoder.c +++ b/ui/gtkformdecoder.c @@ -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"); + } } diff --git a/ui/test/decoder.c b/ui/test/decoder.c index 917cf3a..bd6512d 100644 --- a/ui/test/decoder.c +++ b/ui/test/decoder.c @@ -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);