[gnome-panel] [libpanel-applet] Port to GtkBuilder
- From: Vincent Untz <vuntz src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gnome-panel] [libpanel-applet] Port to GtkBuilder
- Date: Tue, 11 Aug 2009 13:59:51 +0000 (UTC)
commit 416a70267e2928cfce1903b6bbfbb3011fba18d3
Author: Diego Escalante Urrelo <diegoe gnome org>
Date: Tue Aug 11 14:48:46 2009 +0200
[libpanel-applet] Port to GtkBuilder
configure.in | 2 +-
libpanel-applet/Makefile.am | 8 +-
libpanel-applet/panel-test-applets.c | 39 +++--
libpanel-applet/panel-test-applets.glade | 288 ------------------------------
libpanel-applet/panel-test-applets.ui | 203 +++++++++++++++++++++
po/POTFILES.in | 2 +-
6 files changed, 233 insertions(+), 309 deletions(-)
---
diff --git a/configure.in b/configure.in
index 2942ceb..c3bd3ee 100644
--- a/configure.in
+++ b/configure.in
@@ -75,7 +75,7 @@ PKG_CHECK_MODULES(PANEL, ORBit-2.0 >= $ORBIT_REQUIRED gdk-pixbuf-2.0 >= $GDK_PIX
AC_SUBST(PANEL_CFLAGS)
AC_SUBST(PANEL_LIBS)
-PKG_CHECK_MODULES(LIBPANEL_APPLET, ORBit-2.0 >= $ORBIT_REQUIRED gtk+-2.0 >= $GTK_REQUIRED libglade-2.0 >= $LIBGLADE_REQUIRED libbonoboui-2.0 >= $LIBBONOBOUI_REQUIRED gconf-2.0 >= $GCONF_REQUIRED)
+PKG_CHECK_MODULES(LIBPANEL_APPLET, ORBit-2.0 >= $ORBIT_REQUIRED gtk+-2.0 >= $GTK_REQUIRED libbonoboui-2.0 >= $LIBBONOBOUI_REQUIRED gconf-2.0 >= $GCONF_REQUIRED)
AC_SUBST(LIBPANEL_APPLET_CFLAGS)
AC_SUBST(LIBPANEL_APPLET_LIBS)
diff --git a/libpanel-applet/Makefile.am b/libpanel-applet/Makefile.am
index d0686d9..140ff41 100644
--- a/libpanel-applet/Makefile.am
+++ b/libpanel-applet/Makefile.am
@@ -1,7 +1,7 @@
INCLUDES = \
-I$(top_builddir)/libpanel-applet \
-DPANEL_APPLET_DATADIR=\""$(datadir)"\" \
- -DPANEL_APPLET_GLADEDIR=\""$(gladedir)"\" \
+ -DPANEL_APPLET_BUILDERDIR=\""$(uidir)"\" \
-DGNOMELOCALEDIR=\""$(prefix)/$(DATADIRNAME)/locale"\" \
$(LIBPANEL_APPLET_CFLAGS) \
$(DISABLE_DEPRECATED_CFLAGS) \
@@ -74,7 +74,7 @@ EXTRA_DIST = \
panel-applet-marshal.list \
libpanelapplet-2.0.pc.in \
libpanelapplet-2.0-uninstalled.pc.in \
- panel-test-applets.glade
+ panel-test-applets.ui
panel-applet-marshal.h: panel-applet-marshal.list $(GLIB_GENMARSHAL)
$(AM_V_GEN)$(GLIB_GENMARSHAL) $< --header --prefix=panel_applet_marshal > $@
@@ -113,8 +113,8 @@ panel-applet-enums.h: @REBUILD@ $(panel_applet_enum_headers)
--eprod "GType @enum_name _get_type (void);\n" \
$(panel_applet_enum_headers) > $@
-gladedir = $(datadir)/gnome-panel/glade
-glade_DATA = panel-test-applets.glade
+uidir = $(datadir)/gnome-panel/ui
+ui_DATA = panel-test-applets.ui
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libpanelapplet-2.0.pc
diff --git a/libpanel-applet/panel-test-applets.c b/libpanel-applet/panel-test-applets.c
index d368876..f7b2d30 100644
--- a/libpanel-applet/panel-test-applets.c
+++ b/libpanel-applet/panel-test-applets.c
@@ -8,7 +8,6 @@
*/
#include <config.h>
-#include <glade/glade.h>
#include <glib/gi18n.h>
#include <gtk/gtk.h>
#include <bonobo/bonobo-exception.h>
@@ -282,9 +281,9 @@ setup_options (void)
int
main (int argc, char **argv)
{
- GladeXML *gui;
- char *gladefile;
- GError *error;
+ GtkBuilder *builder;
+ char *uifile;
+ GError *error;
bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
@@ -314,20 +313,30 @@ main (int argc, char **argv)
return 0;
}
- gladefile = PANEL_APPLET_GLADEDIR "/panel-test-applets.glade";
- gui = glade_xml_new (gladefile, "toplevel", NULL);
- if (!gui) {
- g_warning ("Error loading `%s'", gladefile);
+ builder = gtk_builder_new ();
+
+ uifile = PANEL_APPLET_BUILDERDIR "/panel-test-applets.ui";
+ gtk_builder_add_from_file (builder, uifile, &error);
+
+ if (error) {
+ g_warning ("Error loading \"%s\": %s", uifile, error->message);
+ g_error_free (error);
return 1;
}
- glade_xml_signal_autoconnect (gui);
-
- win = glade_xml_get_widget (gui, "toplevel");
- applet_combo = glade_xml_get_widget (gui, "applet-combo");
- prefs_dir_entry = glade_xml_get_widget (gui, "prefs-dir-entry");
- orient_combo = glade_xml_get_widget (gui, "orient-combo");
- size_combo = glade_xml_get_widget (gui, "size-combo");
+ gtk_builder_connect_signals (builder, NULL);
+
+ win = GTK_WIDGET (gtk_builder_get_object (builder,
+ "toplevel"));
+ applet_combo = GTK_WIDGET (gtk_builder_get_object (builder,
+ "applet-combo"));
+ prefs_dir_entry = GTK_WIDGET (gtk_builder_get_object (builder,
+ "prefs-dir-entry"));
+ orient_combo = GTK_WIDGET (gtk_builder_get_object (builder,
+ "orient-combo"));
+ size_combo = GTK_WIDGET (gtk_builder_get_object (builder,
+ "size-combo"));
+ g_object_unref (builder);
setup_options ();
diff --git a/libpanel-applet/panel-test-applets.ui b/libpanel-applet/panel-test-applets.ui
new file mode 100644
index 0000000..05916cf
--- /dev/null
+++ b/libpanel-applet/panel-test-applets.ui
@@ -0,0 +1,203 @@
+<?xml version="1.0"?>
+<interface>
+ <!-- interface-requires gtk+ 2.6 -->
+ <!-- interface-naming-policy toplevel-contextual -->
+ <object class="GtkDialog" id="toplevel">
+ <property name="visible">True</property>
+ <property name="title" translatable="yes" comments="This is an utility to easily test various applets">Test applet utility</property>
+ <property name="resizable">False</property>
+ <property name="type_hint">dialog</property>
+ <property name="has_separator">False</property>
+ <signal name="destroy" handler="gtk_main_quit"/>
+ <child internal-child="vbox">
+ <object class="GtkVBox" id="dialog-vbox1">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">8</property>
+ <child>
+ <object class="GtkTable" id="table2">
+ <property name="visible">True</property>
+ <property name="border_width">2</property>
+ <property name="n_rows">5</property>
+ <property name="n_columns">2</property>
+ <property name="column_spacing">4</property>
+ <property name="row_spacing">4</property>
+ <child>
+ <object class="GtkLabel" id="size-label">
+ <property name="visible">True</property>
+ <property name="xalign">1</property>
+ <property name="label" translatable="yes">_Size:</property>
+ <property name="use_underline">True</property>
+ <property name="justify">center</property>
+ <property name="mnemonic_widget">size-combo</property>
+ </object>
+ <packing>
+ <property name="top_attach">4</property>
+ <property name="bottom_attach">5</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="applet-label">
+ <property name="visible">True</property>
+ <property name="xalign">1</property>
+ <property name="label" translatable="yes">_Applet:</property>
+ <property name="use_underline">True</property>
+ <property name="justify">center</property>
+ <property name="mnemonic_widget">applet-combo</property>
+ </object>
+ <packing>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="orient-label">
+ <property name="visible">True</property>
+ <property name="xalign">1</property>
+ <property name="label" translatable="yes">_Orientation:</property>
+ <property name="use_underline">True</property>
+ <property name="justify">center</property>
+ <property name="mnemonic_widget">orient-combo</property>
+ </object>
+ <packing>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="prefs-label">
+ <property name="visible">True</property>
+ <property name="xalign">1</property>
+ <property name="label" translatable="yes">_Prefs Dir:</property>
+ <property name="use_underline">True</property>
+ <property name="justify">center</property>
+ <property name="mnemonic_widget">prefs-dir-entry</property>
+ </object>
+ <packing>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="prefs-dir-entry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkComboBox" id="applet-combo">
+ <property name="visible">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="y_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkComboBox" id="orient-combo">
+ <property name="visible">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
+ <property name="y_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkComboBox" id="size-combo">
+ <property name="visible">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">4</property>
+ <property name="bottom_attach">5</property>
+ <property name="y_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHSeparator" id="hseparator2">
+ <property name="visible">True</property>
+ </object>
+ <packing>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="y_options">GTK_FILL</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child internal-child="action_area">
+ <object class="GtkHButtonBox" id="dialog-action_area1">
+ <property name="visible">True</property>
+ <property name="layout_style">end</property>
+ <child>
+ <object class="GtkButton" id="ok-button">
+ <property name="label">gtk-execute</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="can_default">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_stock">True</property>
+ <signal name="clicked" handler="on_execute_button_clicked"/>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="button1">
+ <property name="label">gtk-close</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="can_default">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_stock">True</property>
+ <signal name="clicked" handler="gtk_main_quit"/>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="pack_type">end</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ <action-widgets>
+ <action-widget response="0">ok-button</action-widget>
+ <action-widget response="-7">button1</action-widget>
+ </action-widgets>
+ </object>
+</interface>
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 1b27b31..8efc58f 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -78,4 +78,4 @@ gnome-panel/panel-util.c
gnome-panel/panel.c
libpanel-applet/GNOME_Panel_TestApplet.server.in
libpanel-applet/panel-test-applets.c
-libpanel-applet/panel-test-applets.glade
+libpanel-applet/panel-test-applets.ui
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]