From 56d60fbea5e407de4eaaf9b98a8552c81122fcf7 Mon Sep 17 00:00:00 2001 From: Andrea Zagli Date: Sat, 30 Apr 2011 16:38:04 +0200 Subject: [PATCH] Started Glade catalog for GtkFormUI. --- configure.ac | 17 +++++++++ ui/Makefile.am | 4 +++ ui/glade/Makefile.am | 16 +++++++++ ui/glade/gtkformui.xml | 15 ++++++++ ui/glade/icons/Makefile.am | 1 + ui/glade/icons/hicolor/16x16/Makefile.am | 1 + .../icons/hicolor/16x16/actions/Makefile.am | 5 +++ .../widget-gtkformui-gtkformdecoder.png | Bin 0 -> 164 bytes ui/glade/icons/hicolor/22x22/Makefile.am | 1 + .../icons/hicolor/22x22/actions/Makefile.am | 5 +++ .../widget-gtkformui-gtkformdecoder.png | Bin 0 -> 177 bytes ui/glade/icons/hicolor/Makefile.am | 1 + ui/gtkformdecoder.c | 33 +++++++++++++++++- ui/gtkformdecoder.h | 6 ++-- 14 files changed, 102 insertions(+), 3 deletions(-) create mode 100644 ui/glade/Makefile.am create mode 100644 ui/glade/gtkformui.xml create mode 100644 ui/glade/icons/Makefile.am create mode 100644 ui/glade/icons/hicolor/16x16/Makefile.am create mode 100644 ui/glade/icons/hicolor/16x16/actions/Makefile.am create mode 100644 ui/glade/icons/hicolor/16x16/actions/widget-gtkformui-gtkformdecoder.png create mode 100644 ui/glade/icons/hicolor/22x22/Makefile.am create mode 100644 ui/glade/icons/hicolor/22x22/actions/Makefile.am create mode 100644 ui/glade/icons/hicolor/22x22/actions/widget-gtkformui-gtkformdecoder.png create mode 100644 ui/glade/icons/hicolor/Makefile.am diff --git a/configure.ac b/configure.ac index a8e5423..da603b4 100644 --- a/configure.ac +++ b/configure.ac @@ -39,6 +39,10 @@ AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", AM_GLIB_GNU_GETTEXT # Checks for libraries. +PKG_CHECK_EXISTS(gladeui-1.0 >= 3.2.0, [GLADEUI_FOUND=yes], [GLADEUI_FOUND=no]) + +AM_CONDITIONAL(GLADEUI, test $GLADEUI_FOUND = yes) + PKG_CHECK_MODULES(GTKFORM, [gtk+-2.0 >= 2.12.0 libxml-2.0 >= 2.0.0 libgdaex >= 0.1.0 @@ -73,4 +77,17 @@ AC_CONFIG_FILES([ data/Makefile po/Makefile.in ]) + +if test $GLADEUI_FOUND = yes; then +AC_CONFIG_FILES([ + ui/glade/Makefile + ui/glade/icons/Makefile + ui/glade/icons/hicolor/Makefile + ui/glade/icons/hicolor/16x16/Makefile + ui/glade/icons/hicolor/16x16/actions/Makefile + ui/glade/icons/hicolor/22x22/Makefile + ui/glade/icons/hicolor/22x22/actions/Makefile +]) +fi + AC_OUTPUT diff --git a/ui/Makefile.am b/ui/Makefile.am index 649b3d8..54a8f2b 100644 --- a/ui/Makefile.am +++ b/ui/Makefile.am @@ -1,3 +1,7 @@ +if GLADEUI +SUBDIRS = glade +endif + AM_CPPFLAGS = $(WARN_CFLAGS) \ $(DISABLE_DEPRECATED_CFLAGS) \ $(GTKFORMUI_CFLAGS) \ diff --git a/ui/glade/Makefile.am b/ui/glade/Makefile.am new file mode 100644 index 0000000..8d22cb8 --- /dev/null +++ b/ui/glade/Makefile.am @@ -0,0 +1,16 @@ +SUBDIRS = icons + +moduledir = `pkg-config --variable=moduledir gladeui-1.0` + +catalogsdir = `pkg-config --variable=catalogdir gladeui-1.0` + +catalogs_DATA = gtkformui.xml + +EXTRA_DIST = $(catalogs_DATA) + +install-exec-hook: + cd $(moduledir) && \ + ln -s -f $(libdir)/libgtkformui.so . + +uninstall-hook: + rm -f $(moduledir)/libgtkformui.so diff --git a/ui/glade/gtkformui.xml b/ui/glade/gtkformui.xml new file mode 100644 index 0000000..48be43e --- /dev/null +++ b/ui/glade/gtkformui.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/ui/glade/icons/Makefile.am b/ui/glade/icons/Makefile.am new file mode 100644 index 0000000..658356b --- /dev/null +++ b/ui/glade/icons/Makefile.am @@ -0,0 +1 @@ +SUBDIRS = hicolor diff --git a/ui/glade/icons/hicolor/16x16/Makefile.am b/ui/glade/icons/hicolor/16x16/Makefile.am new file mode 100644 index 0000000..0224d45 --- /dev/null +++ b/ui/glade/icons/hicolor/16x16/Makefile.am @@ -0,0 +1 @@ +SUBDIRS = actions diff --git a/ui/glade/icons/hicolor/16x16/actions/Makefile.am b/ui/glade/icons/hicolor/16x16/actions/Makefile.am new file mode 100644 index 0000000..ccf8100 --- /dev/null +++ b/ui/glade/icons/hicolor/16x16/actions/Makefile.am @@ -0,0 +1,5 @@ +iconsdir = `pkg-config --variable=pixmapdir gladeui-1.0`/hicolor/16x16/actions + +icons_DATA = widget-gtkformui-gtkformdecoder.png + +EXTRA_DIST = $(icons_DATA) diff --git a/ui/glade/icons/hicolor/16x16/actions/widget-gtkformui-gtkformdecoder.png b/ui/glade/icons/hicolor/16x16/actions/widget-gtkformui-gtkformdecoder.png new file mode 100644 index 0000000000000000000000000000000000000000..ec4e622ff3796a561a8957ebd06a1316d06ec333 GIT binary patch literal 164 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`*`6+rAr`0KPIBaGFyLV+KWd-n zZ#(Py7sg-B|JK%bsB3~*s8}8P7+nyUj=*Z3@)~K b^MLW?(^QA6``^C-x`Dyd)z4*}Q$iB}jK)M` literal 0 HcmV?d00001 diff --git a/ui/glade/icons/hicolor/Makefile.am b/ui/glade/icons/hicolor/Makefile.am new file mode 100644 index 0000000..fc1d169 --- /dev/null +++ b/ui/glade/icons/hicolor/Makefile.am @@ -0,0 +1 @@ +SUBDIRS = 16x16 22x22 diff --git a/ui/gtkformdecoder.c b/ui/gtkformdecoder.c index a651d96..9ec781a 100644 --- a/ui/gtkformdecoder.c +++ b/ui/gtkformdecoder.c @@ -43,6 +43,9 @@ static void gtk_form_decoder_get_property (GObject *object, GValue *value, GParamSpec *pspec); +static void gtk_form_decoder_on_btn_browse_clicked (GtkButton *button, + gpointer user_data); + static GtkWidgetClass *parent_class = NULL; @@ -76,6 +79,21 @@ gtk_form_decoder_class_init (GtkFormDecoderClass *klass) widget_class->size_request = gtk_form_decoder_size_request; widget_class->size_allocate = gtk_form_decoder_size_allocate; + + /** + * GtkFormDecoder::btn_browse_clicked: + * @gtk_form_decoder: + * + */ + klass->btn_browse_clicked_signal_id = g_signal_new ("btn-browse-clicked", + G_TYPE_FROM_CLASS (object_class), + G_SIGNAL_RUN_LAST, + 0, + NULL, + NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, + 0); } static void @@ -83,12 +101,13 @@ gtk_form_decoder_init (GtkFormDecoder *decoder) { GtkFormDecoderPrivate *priv = GTK_FORM_DECODER_GET_PRIVATE (decoder); - priv->hbox = gtk_hbox_new (FALSE, 0); + priv->hbox = gtk_hbox_new (FALSE, 5); gtk_container_add (GTK_CONTAINER (decoder), priv->hbox); gtk_widget_show (priv->hbox); priv->txt_decoded = gtk_entry_new (); gtk_box_pack_start (GTK_BOX (priv->hbox), priv->txt_decoded, TRUE, TRUE, 0); + gtk_editable_set_editable (GTK_EDITABLE (priv->txt_decoded), FALSE); gtk_widget_show (priv->txt_decoded); priv->btn_browse = gtk_button_new_with_label ("..."); @@ -96,6 +115,9 @@ gtk_form_decoder_init (GtkFormDecoder *decoder) gtk_widget_set_no_show_all (priv->btn_browse, TRUE); gtk_widget_show (priv->btn_browse); + g_signal_connect (G_OBJECT (priv->btn_browse), "clicked", + G_CALLBACK (gtk_form_decoder_on_btn_browse_clicked), (gpointer)decoder); + priv->lbl_key = gtk_label_new (""); gtk_box_pack_start (GTK_BOX (priv->hbox), priv->lbl_key, FALSE, FALSE, 0); gtk_widget_set_no_show_all (priv->lbl_key, TRUE); @@ -212,3 +234,12 @@ gtk_form_decoder_size_allocate (GtkWidget *widget, gtk_widget_size_allocate (bin->child, &child_allocation); } } + +static void +gtk_form_decoder_on_btn_browse_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_browse_clicked_signal_id, 0); +} diff --git a/ui/gtkformdecoder.h b/ui/gtkformdecoder.h index c7a09c7..12dcf18 100644 --- a/ui/gtkformdecoder.h +++ b/ui/gtkformdecoder.h @@ -29,10 +29,10 @@ G_BEGIN_DECLS #define GTK_TYPE_FORM_DECODER (gtk_form_decoder_get_type ()) #define GTK_FORM_DECODER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_FORM_DECODER, GtkFormDecoder)) -#define GTK_FORM_DECODER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_FORM_DECODER, GtkFormDecoder)) +#define GTK_FORM_DECODER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_FORM_DECODER, GtkFormDecoderClass)) #define GTK_IS_FORM_DECODER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_FORM_DECODER)) #define GTK_IS_FORM_DECODER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_FORM_DECODER)) -#define GTK_FORM_DECODER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_FORM_DECODER, GtkFormDecoder)) +#define GTK_FORM_DECODER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_FORM_DECODER, GtkFormDecoderClass)) typedef struct _GtkFormDecoder GtkFormDecoder; @@ -47,6 +47,8 @@ struct _GtkFormDecoder struct _GtkFormDecoderClass { GtkBinClass parent_class; + + guint btn_browse_clicked_signal_id; }; -- 2.49.0