lib_LTLIBRARIES = libzakgtkdecoder.la
+decodermarshal.c: decodermarshal.h decoder_marshal.list $(GLIB_GENMARSHAL)
+ $(GLIB_GENMARSHAL) $(srcdir)/decoder_marshal.list --body --prefix=_zak_gtk_decoder_marshal > $(srcdir)/$@
+
+decodermarshal.h: decoder_marshal.list $(GLIB_GENMARSHAL)
+ $(GLIB_GENMARSHAL) $(srcdir)/decoder_marshal.list --header --prefix=_zak_gtk_decoder_marshal > $(srcdir)/$@
+
libzakgtkdecoder_la_SOURCES = \
+ decodermarshal.c \
zakgtkdecoder.c
libzakgtkdecoder_la_LDFLAGS = -no-undefined
zakgtkdecoder.h
libzakgtkdecoder_includedir = $(includedir)/libzakgtkdecoder
+
+noinst_HEADERS = \
+ decodermarshal.h
#include <windows.h>
#endif
+#include "decodermarshal.h"
+
#include "zakgtkdecoder.h"
enum
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE,
0);
+
+ /**
+ * ZakGtkDecoder::decode:
+ * @zak_gtk_decoder:
+ *
+ */
+ klass->decode_signal_id = g_signal_new ("decode",
+ G_TYPE_FROM_CLASS (object_class),
+ G_SIGNAL_RUN_LAST,
+ 0,
+ NULL,
+ NULL,
+ _zak_gtk_decoder_marshal_STRING__STRING,
+ G_TYPE_STRING,
+ 1,
+ G_TYPE_STRING);
}
static void
zak_gtk_decoder_decode (ZakGtkDecoder *decoder)
{
ZakGtkDecoderPrivate *priv;
+ ZakGtkDecoderClass *klass;
+
+ gchar *ret;
g_return_if_fail (ZAK_GTK_IS_DECODER (decoder));
+ klass = ZAK_GTK_DECODER_GET_CLASS (decoder);
+
priv = ZAK_GTK_DECODER_GET_PRIVATE (decoder);
+ ret = NULL;
+ g_signal_emit (decoder, klass->decode_signal_id,
+ 0,
+ gtk_label_get_text (GTK_LABEL (priv->lbl_key)),
+ &ret);
+
+ if (ret == NULL)
+ {
+ ret = g_strdup ("");
+ }
+
+ gtk_entry_set_text (GTK_ENTRY (priv->txt_decoded), ret);
}
void
GtkWidget *w;
GtkWidget *decoder;
+static gchar
+*on_decode (gpointer instance, gchar *key, gpointer user_data)
+{
+ g_message ("Decoding.");
+ return g_strdup_printf ("Decode for key «%s»", key);
+}
+
static gboolean
-on_btn_clean_clicked (gpointer instance, gint arg1, gpointer user_data)
+on_btn_clean_clicked (gpointer instance, gpointer user_data)
{
+ g_message ("Clean clicked.");
return FALSE;
}
static gboolean
on_btn_new_clicked (gpointer instance, gpointer user_data)
{
- g_debug ("New clicked.");
+ g_message ("New clicked.");
return FALSE;
}
static gboolean
on_btn_open_clicked (gpointer instance, gpointer user_data)
{
- g_debug ("Open clicked.");
+ g_message ("Open clicked.");
return FALSE;
}
static gboolean
on_btn_browse_clicked (gpointer instance, gpointer user_data)
{
+ g_message ("Browse clicked.");
zak_gtk_decoder_set_key (ZAK_GTK_DECODER (decoder), "1");
return FALSE;
}
g_signal_connect (w, "destroy", gtk_main_quit, NULL);
decoder = zak_gtk_decoder_new ();
+ zak_gtk_decoder_show_btn_new (ZAK_GTK_DECODER (decoder), TRUE);
+ zak_gtk_decoder_show_btn_clean (ZAK_GTK_DECODER (decoder), TRUE);
+ zak_gtk_decoder_show_btn_open (ZAK_GTK_DECODER (decoder), TRUE);
gtk_container_add (GTK_CONTAINER (w), decoder);
g_signal_connect (G_OBJECT (decoder), "btn_clean_clicked",
g_signal_connect (G_OBJECT (decoder), "btn_browse_clicked",
G_CALLBACK (on_btn_browse_clicked), NULL);
+ g_signal_connect (G_OBJECT (decoder), "decode",
+ G_CALLBACK (on_decode), NULL);
+
gtk_widget_show_all (w);
gtk_main ();