PROP_GDAEX,
PROP_SQL,
PROP_SHOW_CLEAN,
+ PROP_SHOW_NEW,
PROP_SHOW_OPEN,
PROP_SHOW_BROWSE
};
GdkEvent *event,
gpointer user_data);
+static void gtk_form_decoder_on_btn_new_clicked (GtkButton *button,
+ gpointer user_data);
+
static void gtk_form_decoder_on_btn_open_clicked (GtkButton *button,
gpointer user_data);
{
GtkWidget *hbox;
GtkWidget *txt_decoded;
+ GtkWidget *btn_new;
GtkWidget *btn_open;
GtkWidget *btn_browse;
GtkWidget *lbl_key;
FALSE,
G_PARAM_READWRITE));
+ g_object_class_install_property (object_class, PROP_SHOW_NEW,
+ g_param_spec_boolean ("show-btn-new",
+ "Show new button",
+ "Whether to show the new button",
+ FALSE,
+ G_PARAM_READWRITE));
+
g_object_class_install_property (object_class, PROP_SHOW_OPEN,
g_param_spec_boolean ("show-btn-open",
"Show open button",
G_TYPE_BOOLEAN,
1, G_TYPE_INT);
+ /**
+ * GtkFormDecoder::btn_new_clicked:
+ * @gtk_form_decoder:
+ *
+ */
+ klass->btn_new_clicked_signal_id = g_signal_new ("btn-new-clicked",
+ G_TYPE_FROM_CLASS (object_class),
+ G_SIGNAL_RUN_LAST,
+ 0,
+ NULL,
+ NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE,
+ 0);
+
/**
* GtkFormDecoder::btn_open_clicked:
* @gtk_form_decoder:
GtkWidget *icon;
- priv->hbox = gtk_hbox_new (FALSE, 3);
+ priv->hbox = gtk_hbox_new (FALSE, 1);
gtk_container_add (GTK_CONTAINER (decoder), priv->hbox);
gtk_widget_show (priv->hbox);
g_signal_connect (G_OBJECT (priv->txt_decoded), "icon-press",
G_CALLBACK (gtk_form_decoder_on_btn_clean_clicked), (gpointer)decoder);
+ priv->btn_new = gtk_button_new ();
+ gtk_widget_set_tooltip_text (priv->btn_new, _("New"));
+ gtk_box_pack_start (GTK_BOX (priv->hbox), priv->btn_new, FALSE, FALSE, 0);
+ gtk_widget_set_no_show_all (priv->btn_new, TRUE);
+ icon = gtk_image_new_from_stock ("gtk-new", GTK_ICON_SIZE_MENU);
+ gtk_container_add (GTK_CONTAINER (priv->btn_new), icon);
+ gtk_widget_show (icon);
+
+ g_signal_connect (G_OBJECT (priv->btn_new), "clicked",
+ G_CALLBACK (gtk_form_decoder_on_btn_new_clicked), (gpointer)decoder);
+
priv->btn_open = gtk_button_new ();
gtk_widget_set_tooltip_text (priv->btn_open, _("Open"));
gtk_box_pack_start (GTK_BOX (priv->hbox), priv->btn_open, FALSE, FALSE, 0);
gtk_entry_set_icon_sensitive (GTK_ENTRY (priv->txt_decoded), GTK_ENTRY_ICON_SECONDARY, visible);
}
+void
+gtk_form_decoder_show_btn_new (GtkFormDecoder *decoder, gboolean visible)
+{
+ GtkFormDecoderPrivate *priv = GTK_FORM_DECODER_GET_PRIVATE (decoder);
+
+ gtk_widget_set_visible (priv->btn_new, visible);
+}
+
void
gtk_form_decoder_show_btn_open (GtkFormDecoder *decoder, gboolean visible)
{
return gtk_entry_get_icon_stock (GTK_ENTRY (priv->txt_decoded), GTK_ENTRY_ICON_SECONDARY) != NULL;
}
+gboolean
+gtk_form_decoder_btn_new_is_visible (GtkFormDecoder *decoder)
+{
+ GtkFormDecoderPrivate *priv = GTK_FORM_DECODER_GET_PRIVATE (decoder);
+
+ return gtk_widget_get_visible (priv->btn_new);
+}
+
gboolean
gtk_form_decoder_btn_open_is_visible (GtkFormDecoder *decoder)
{
gtk_form_decoder_show_btn_clean (decoder, g_value_get_boolean (value));
break;
+ case PROP_SHOW_NEW:
+ gtk_form_decoder_show_btn_new (decoder, g_value_get_boolean (value));
+ break;
+
case PROP_SHOW_OPEN:
gtk_form_decoder_show_btn_open (decoder, g_value_get_boolean (value));
break;
g_value_set_boolean (value, gtk_form_decoder_btn_clean_is_visible (decoder));
break;
+ case PROP_SHOW_NEW:
+ g_value_set_boolean (value, gtk_form_decoder_btn_new_is_visible (decoder));
+ break;
+
case PROP_SHOW_OPEN:
g_value_set_boolean (value, gtk_form_decoder_btn_open_is_visible (decoder));
break;
}
}
+static void
+gtk_form_decoder_on_btn_new_clicked (GtkButton *button,
+ gpointer user_data)
+{
+ GtkFormDecoderClass *klass = GTK_FORM_DECODER_GET_CLASS ((GtkFormDecoder *)user_data);
+
+ g_signal_emit (G_OBJECT (user_data), klass->btn_new_clicked_signal_id, 0);
+}
+
static void
gtk_form_decoder_on_btn_open_clicked (GtkButton *button,
gpointer user_data)
GtkBinClass parent_class;
guint btn_clean_clicked_signal_id;
+ guint btn_new_clicked_signal_id;
guint btn_open_clicked_signal_id;
guint btn_browse_clicked_signal_id;
};
gchar *gtk_form_decoder_get_decoded (GtkFormDecoder *decoder);
void gtk_form_decoder_show_btn_clean (GtkFormDecoder *decoder, gboolean visible);
+void gtk_form_decoder_show_btn_new (GtkFormDecoder *decoder, gboolean visible);
void gtk_form_decoder_show_btn_open (GtkFormDecoder *decoder, gboolean visible);
void gtk_form_decoder_show_btn_browse (GtkFormDecoder *decoder, gboolean visible);
gboolean gtk_form_decoder_btn_clean_is_visible (GtkFormDecoder *decoder);
+gboolean gtk_form_decoder_btn_new_is_visible (GtkFormDecoder *decoder);
gboolean gtk_form_decoder_btn_open_is_visible (GtkFormDecoder *decoder);
gboolean gtk_form_decoder_btn_browse_is_visible (GtkFormDecoder *decoder);
return FALSE;
}
-static void
+static gboolean
+on_btn_new_clicked (gpointer instance, gpointer user_data)
+{
+ g_debug ("New clicked.");
+ return FALSE;
+}
+
+static gboolean
on_btn_open_clicked (gpointer instance, gpointer user_data)
{
g_debug ("Open clicked.");
+ return FALSE;
}
-static void
+static gboolean
on_btn_browse_clicked (gpointer instance, gpointer user_data)
{
gtk_form_decoder_set_key (GTK_FORM_DECODER (decoder), "1");
+ return FALSE;
}
gboolean
" FROM customers"
" WHERE id = ##key0::gint",
"show-btn-clean", TRUE,
+ "show-btn-new", TRUE,
"show-btn-open", TRUE,
NULL);
g_signal_connect (G_OBJECT (decoder), "btn_clean_clicked",
G_CALLBACK (on_btn_clean_clicked), NULL);
+ g_signal_connect (G_OBJECT (decoder), "btn_new_clicked",
+ G_CALLBACK (on_btn_new_clicked), NULL);
g_signal_connect (G_OBJECT (decoder), "btn_open_clicked",
G_CALLBACK (on_btn_open_clicked), NULL);
g_signal_connect (G_OBJECT (decoder), "btn_browse_clicked",