[gnome-session] [capplet, gsm] Port to GtkBuilder and remove glade dependency



commit 3c6baf8ac65200db0d40f547b27b0301bd114962
Author: Vincent Untz <vuntz gnome org>
Date:   Mon Jun 22 01:14:09 2009 +0200

    [capplet,gsm] Port to GtkBuilder and remove glade dependency
    
    http://bugzilla.gnome.org/show_bug.cgi?id=571467

 capplet/Makefile.am                |    2 +-
 capplet/gsm-app-dialog.c           |   43 +++--
 capplet/gsm-properties-dialog.c    |   51 +++--
 configure.in                       |    5 +-
 data/Makefile.am                   |   10 +-
 data/gsm-inhibit-dialog.glade      |  103 ---------
 data/gsm-inhibit-dialog.ui         |   60 ++++++
 data/session-properties.glade      |  411 ------------------------------------
 data/session-properties.ui         |  323 ++++++++++++++++++++++++++++
 gnome-session/Makefile.am          |    3 +-
 gnome-session/gsm-inhibit-dialog.c |   40 +++--
 po/POTFILES.in                     |    4 +-
 12 files changed, 479 insertions(+), 576 deletions(-)
---
diff --git a/capplet/Makefile.am b/capplet/Makefile.am
index cf1af9c..4d69ffb 100644
--- a/capplet/Makefile.am
+++ b/capplet/Makefile.am
@@ -10,7 +10,7 @@ INCLUDES =						\
 	-I$(top_srcdir)/egg				\
 	-I$(top_srcdir)/gnome-session			\
 	-DLOCALE_DIR=\""$(datadir)/locale"\"		\
-	-DGLADEDIR=\""$(pkgdatadir)"\"		\
+	-DGTKBUILDER_DIR=\""$(pkgdatadir)"\"		\
 	$(NULL)
 
 gnome_session_properties_LDADD =			\
diff --git a/capplet/gsm-app-dialog.c b/capplet/gsm-app-dialog.c
index da5f709..3a2364e 100644
--- a/capplet/gsm-app-dialog.c
+++ b/capplet/gsm-app-dialog.c
@@ -24,13 +24,11 @@
 #include <glib/gi18n.h>
 #include <gtk/gtk.h>
 
-#include <glade/glade-xml.h>
-
 #include "gsm-util.h"
 
 #include "gsm-app-dialog.h"
 
-#define GLADE_XML_FILE "session-properties.glade"
+#define GTKBUILDER_FILE "session-properties.ui"
 
 #define CAPPLET_NAME_ENTRY_WIDGET_NAME    "session_properties_name_entry"
 #define CAPPLET_COMMAND_ENTRY_WIDGET_NAME "session_properties_command_entry"
@@ -153,19 +151,30 @@ on_entry_activate (GtkEntry     *entry,
 static void
 setup_dialog (GsmAppDialog *dialog)
 {
-        GtkWidget *widget;
-        GladeXML  *xml;
-
-        xml = glade_xml_new (GLADEDIR "/" GLADE_XML_FILE,
-                             "main-table",
-                             GETTEXT_PACKAGE);
-        g_assert (xml != NULL);
+        GtkWidget  *widget;
+        GtkBuilder *xml;
+        GError     *error;
+
+        xml = gtk_builder_new ();
+        gtk_builder_set_translation_domain(xml, PACKAGE);
+
+        error = NULL;
+        if (!gtk_builder_add_from_file (xml,
+                                        GTKBUILDER_DIR "/" GTKBUILDER_FILE,
+                                        &error)) {
+                if (error) {
+                        g_warning ("Could not load capplet UI file: %s",
+                                   error->message);
+                        g_error_free (error);
+                } else {
+                        g_warning ("Could not load capplet UI file.");
+                }
+        }
 
-        widget = glade_xml_get_widget (xml, "main-table");
+        widget = GTK_WIDGET (gtk_builder_get_object (xml, "main-table"));
         gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), widget);
 
-        gtk_container_set_border_width (GTK_CONTAINER (dialog), 12);
-        gtk_container_set_border_width (GTK_CONTAINER (widget), 5);
+        gtk_container_set_border_width (GTK_CONTAINER (dialog), 6);
         gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
         gtk_window_set_icon_name (GTK_WINDOW (dialog), "session-properties");
 
@@ -189,7 +198,7 @@ setup_dialog (GsmAppDialog *dialog)
                                        GTK_STOCK_SAVE, GTK_RESPONSE_OK);
         }
 
-        dialog->priv->name_entry = glade_xml_get_widget (xml, CAPPLET_NAME_ENTRY_WIDGET_NAME);
+        dialog->priv->name_entry = GTK_WIDGET (gtk_builder_get_object (xml, CAPPLET_NAME_ENTRY_WIDGET_NAME));
         g_signal_connect (dialog->priv->name_entry,
                           "activate",
                           G_CALLBACK (on_entry_activate),
@@ -198,13 +207,13 @@ setup_dialog (GsmAppDialog *dialog)
                 gtk_entry_set_text (GTK_ENTRY (dialog->priv->name_entry), dialog->priv->name);
         }
 
-        dialog->priv->browse_button = glade_xml_get_widget (xml, CAPPLET_BROWSE_WIDGET_NAME);
+        dialog->priv->browse_button = GTK_WIDGET (gtk_builder_get_object (xml, CAPPLET_BROWSE_WIDGET_NAME));
         g_signal_connect (dialog->priv->browse_button,
                           "clicked",
                           G_CALLBACK (on_browse_button_clicked),
                           dialog);
 
-        dialog->priv->command_entry = glade_xml_get_widget (xml, CAPPLET_COMMAND_ENTRY_WIDGET_NAME);
+        dialog->priv->command_entry = GTK_WIDGET (gtk_builder_get_object (xml, CAPPLET_COMMAND_ENTRY_WIDGET_NAME));
         g_signal_connect (dialog->priv->command_entry,
                           "activate",
                           G_CALLBACK (on_entry_activate),
@@ -213,7 +222,7 @@ setup_dialog (GsmAppDialog *dialog)
                 gtk_entry_set_text (GTK_ENTRY (dialog->priv->command_entry), dialog->priv->command);
         }
 
-        dialog->priv->comment_entry = glade_xml_get_widget (xml, CAPPLET_COMMENT_ENTRY_WIDGET_NAME);
+        dialog->priv->comment_entry = GTK_WIDGET (gtk_builder_get_object (xml, CAPPLET_COMMENT_ENTRY_WIDGET_NAME));
         g_signal_connect (dialog->priv->comment_entry,
                           "activate",
                           G_CALLBACK (on_entry_activate),
diff --git a/capplet/gsm-properties-dialog.c b/capplet/gsm-properties-dialog.c
index c2606c0..7256fad 100644
--- a/capplet/gsm-properties-dialog.c
+++ b/capplet/gsm-properties-dialog.c
@@ -27,7 +27,6 @@
 #include <glib/gi18n.h>
 #include <gtk/gtk.h>
 
-#include <glade/glade-xml.h>
 #include <gconf/gconf-client.h>
 
 #include "gsm-properties-dialog.h"
@@ -44,12 +43,9 @@
 #define REALLY_IDENTICAL_STRING(a, b)                   \
         ((a && b && !strcmp (a, b)) || (!a && !b))
 
-#define GLADE_XML_FILE "session-properties.glade"
+#define GTKBUILDER_FILE "session-properties.ui"
 
-#define CAPPLET_DIALOG_WIDGET_NAME        "session_properties_capplet"
 #define CAPPLET_TREEVIEW_WIDGET_NAME      "session_properties_treeview"
-#define CAPPLET_CLOSE_WIDGET_NAME         "session_properties_close_button"
-#define CAPPLET_HELP_WIDGET_NAME          "session_properties_help_button"
 #define CAPPLET_ADD_WIDGET_NAME           "session_properties_add_button"
 #define CAPPLET_DELETE_WIDGET_NAME        "session_properties_delete_button"
 #define CAPPLET_EDIT_WIDGET_NAME          "session_properties_edit_button"
@@ -63,7 +59,7 @@
 
 struct GsmPropertiesDialogPrivate
 {
-        GladeXML          *xml;
+        GtkBuilder        *xml;
         GtkListStore      *list_store;
         GtkTreeModel      *tree_filter;
 
@@ -466,7 +462,8 @@ setup_dialog (GsmPropertiesDialog *dialog)
         gtk_tree_model_filter_set_visible_column (GTK_TREE_MODEL_FILTER (tree_filter),
                                                   STORE_COL_VISIBLE);
 
-        treeview = GTK_TREE_VIEW (glade_xml_get_widget (dialog->priv->xml, CAPPLET_TREEVIEW_WIDGET_NAME));
+        treeview = GTK_TREE_VIEW (gtk_builder_get_object (dialog->priv->xml,
+                                                          CAPPLET_TREEVIEW_WIDGET_NAME));
         dialog->priv->treeview = treeview;
 
         gtk_tree_view_set_model (treeview, tree_filter);
@@ -542,21 +539,24 @@ setup_dialog (GsmPropertiesDialog *dialog)
                                               GTK_SORT_ASCENDING);
 
 
-        button = glade_xml_get_widget (dialog->priv->xml, CAPPLET_ADD_WIDGET_NAME);
+        button = GTK_WIDGET (gtk_builder_get_object (dialog->priv->xml,
+                                                     CAPPLET_ADD_WIDGET_NAME));
         dialog->priv->add_button = button;
         g_signal_connect (button,
                           "clicked",
                           G_CALLBACK (on_add_app_clicked),
                           dialog);
 
-        button = glade_xml_get_widget (dialog->priv->xml, CAPPLET_DELETE_WIDGET_NAME);
+        button = GTK_WIDGET (gtk_builder_get_object (dialog->priv->xml,
+                                                     CAPPLET_DELETE_WIDGET_NAME));
         dialog->priv->delete_button = button;
         g_signal_connect (button,
                           "clicked",
                           G_CALLBACK (on_delete_app_clicked),
                           dialog);
 
-        button = glade_xml_get_widget (dialog->priv->xml, CAPPLET_EDIT_WIDGET_NAME);
+        button = GTK_WIDGET (gtk_builder_get_object (dialog->priv->xml,
+                                                     CAPPLET_EDIT_WIDGET_NAME));
         dialog->priv->edit_button = button;
         g_signal_connect (button,
                           "clicked",
@@ -564,7 +564,8 @@ setup_dialog (GsmPropertiesDialog *dialog)
                           dialog);
 
         client = gconf_client_get_default ();
-        button = glade_xml_get_widget (dialog->priv->xml, CAPPLET_REMEMBER_WIDGET_NAME);
+        button = GTK_WIDGET (gtk_builder_get_object (dialog->priv->xml,
+                                                     CAPPLET_REMEMBER_WIDGET_NAME));
         dialog->priv->remember_toggle = button;
         gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button),
                                       gconf_client_get_bool (client, SPC_GCONF_AUTOSAVE_KEY, NULL));
@@ -581,7 +582,8 @@ setup_dialog (GsmPropertiesDialog *dialog)
                           G_CALLBACK (on_autosave_value_toggled),
                           dialog);
 
-        button = glade_xml_get_widget (dialog->priv->xml, CAPPLET_SAVE_WIDGET_NAME);
+        button = GTK_WIDGET (gtk_builder_get_object (dialog->priv->xml,
+                                                     CAPPLET_SAVE_WIDGET_NAME));
         g_signal_connect (button,
                           "clicked",
                           G_CALLBACK (on_save_session_clicked),
@@ -655,6 +657,7 @@ gsm_properties_dialog_init (GsmPropertiesDialog *dialog)
 {
         GtkWidget   *widget;
         GConfClient *client;
+        GError      *error;
 
         dialog->priv = GSM_PROPERTIES_DIALOG_GET_PRIVATE (dialog);
 
@@ -664,16 +667,28 @@ gsm_properties_dialog_init (GsmPropertiesDialog *dialog)
                               GCONF_CLIENT_PRELOAD_ONELEVEL,
                               NULL);
 
-        dialog->priv->xml = glade_xml_new (GLADEDIR "/" GLADE_XML_FILE,
-                                           "main-notebook",
-                                           GETTEXT_PACKAGE);
-        g_assert (dialog->priv->xml != NULL);
+        dialog->priv->xml = gtk_builder_new ();
+        gtk_builder_set_translation_domain(dialog->priv->xml, PACKAGE);
+
+        error = NULL;
+        if (!gtk_builder_add_from_file (dialog->priv->xml,
+                                        GTKBUILDER_DIR "/" GTKBUILDER_FILE,
+                                        &error)) {
+                if (error) {
+                        g_warning ("Could not load capplet UI file: %s",
+                                   error->message);
+                        g_error_free (error);
+                } else {
+                        g_warning ("Could not load capplet UI file.");
+                }
+        }
 
-        widget = glade_xml_get_widget (dialog->priv->xml, "main-notebook");
+        widget = GTK_WIDGET (gtk_builder_get_object (dialog->priv->xml,
+                                                     "main-notebook"));
         gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), widget);
 
         gtk_window_set_resizable (GTK_WINDOW (dialog), TRUE);
-        gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
+        gtk_container_set_border_width (GTK_CONTAINER (dialog), 6);
         gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->vbox), 2);
         gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
         gtk_window_set_icon_name (GTK_WINDOW (dialog), "session-properties");
diff --git a/configure.in b/configure.in
index 9ef742a..1b8067c 100644
--- a/configure.in
+++ b/configure.in
@@ -46,8 +46,7 @@ fi
 
 GLIB_REQUIRED=2.16.0
 LIBGNOMEUI_REQUIRED=2.2.0
-GTK_REQUIRED=2.11.1
-GLADE_REQUIRED=2.3.6
+GTK_REQUIRED=2.12.0
 DBUS_GLIB_REQUIRED=0.76
 POLKIT_GNOME_REQUIRED=0.7
 
@@ -61,13 +60,11 @@ PKG_CHECK_MODULES(GNOME_SESSION,
         gio-2.0 >= $GLIB_REQUIRED
         gtk+-2.0 >= $GTK_REQUIRED
         dbus-glib-1 >= $DBUS_GLIB_REQUIRED
-        libglade-2.0 >= $GLADE_REQUIRED
 )
 
 PKG_CHECK_MODULES(SESSION_PROPERTIES,
         glib-2.0 >= $GLIB_REQUIRED
         gtk+-2.0 >= $GTK_REQUIRED
-        libglade-2.0 >= $GLADE_REQUIRED
 )
 
 PKG_CHECK_MODULES(SPLASH,
diff --git a/data/Makefile.am b/data/Makefile.am
index f0568d7..a6919c2 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -1,10 +1,10 @@
 NULL =
 SUBDIRS = icons
 
-gladedir = $(pkgdatadir)
-glade_DATA = \
-	session-properties.glade	\
-	gsm-inhibit-dialog.glade	\
+uidir = $(pkgdatadir)
+ui_DATA = \
+	session-properties.ui	\
+	gsm-inhibit-dialog.ui	\
 	$(NULL)
 
 @INTLTOOL_DESKTOP_RULE@
@@ -41,7 +41,7 @@ EXTRA_DIST =					\
 	gnome-wm				\
 	$(xsession_in_files)			\
 	$(schemas_in_files)			\
-	$(glade_DATA)				\
+	$(ui_DATA)				\
 	$(pixmap_DATA)
 
 CLEANFILES =					\
diff --git a/data/gsm-inhibit-dialog.ui b/data/gsm-inhibit-dialog.ui
new file mode 100644
index 0000000..89ca636
--- /dev/null
+++ b/data/gsm-inhibit-dialog.ui
@@ -0,0 +1,60 @@
+<?xml version="1.0"?>
+<interface>
+  <requires lib="gtk+" version="2.16"/>
+  <!-- interface-naming-policy toplevel-contextual -->
+  <object class="GtkVBox" id="main-box">
+    <property name="visible">True</property>
+    <property name="border_width">6</property>
+    <property name="orientation">vertical</property>
+    <property name="spacing">6</property>
+    <child>
+      <object class="GtkLabel" id="header-label">
+        <property name="visible">True</property>
+        <property name="xalign">0</property>
+        <property name="label" translatable="yes">&lt;b&gt;Some programs are still running:&lt;/b&gt;</property>
+        <property name="use_markup">True</property>
+        <property name="wrap">True</property>
+      </object>
+      <packing>
+        <property name="expand">False</property>
+        <property name="fill">False</property>
+        <property name="position">0</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkScrolledWindow" id="scrolledwindow1">
+        <property name="visible">True</property>
+        <property name="can_focus">True</property>
+        <property name="hscrollbar_policy">automatic</property>
+        <property name="vscrollbar_policy">automatic</property>
+        <property name="shadow_type">in</property>
+        <child>
+          <object class="GtkTreeView" id="inhibitors-treeview">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="headers_visible">False</property>
+            <property name="enable_search">False</property>
+            <property name="show_expanders">False</property>
+          </object>
+        </child>
+      </object>
+      <packing>
+        <property name="expand">False</property>
+        <property name="fill">False</property>
+        <property name="position">1</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkLabel" id="description-label">
+        <property name="visible">True</property>
+        <property name="xalign">0</property>
+        <property name="yalign">0</property>
+        <property name="label" translatable="yes">Waiting for program to finish.  Interrupting program may cause you to lose work.</property>
+        <property name="wrap">True</property>
+      </object>
+      <packing>
+        <property name="position">2</property>
+      </packing>
+    </child>
+  </object>
+</interface>
diff --git a/data/session-properties.ui b/data/session-properties.ui
new file mode 100644
index 0000000..ee07529
--- /dev/null
+++ b/data/session-properties.ui
@@ -0,0 +1,323 @@
+<?xml version="1.0"?>
+<interface>
+  <requires lib="gtk+" version="2.16"/>
+  <!-- interface-naming-policy toplevel-contextual -->
+  <object class="GtkNotebook" id="main-notebook">
+    <property name="visible">True</property>
+    <property name="can_focus">True</property>
+    <property name="border_width">6</property>
+    <child>
+      <object class="GtkVBox" id="vbox1">
+        <property name="visible">True</property>
+        <property name="border_width">12</property>
+        <property name="orientation">vertical</property>
+        <property name="spacing">3</property>
+        <child>
+          <object class="GtkLabel" id="label6">
+            <property name="visible">True</property>
+            <property name="xalign">0</property>
+            <property name="xpad">3</property>
+            <property name="ypad">3</property>
+            <property name="label" translatable="yes">Additional startup _programs:</property>
+            <property name="use_underline">True</property>
+            <property name="mnemonic_widget">session_properties_treeview</property>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkHBox" id="hbox1">
+            <property name="visible">True</property>
+            <property name="spacing">6</property>
+            <child>
+              <object class="GtkScrolledWindow" id="scrolledwindow1">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="hscrollbar_policy">never</property>
+                <property name="vscrollbar_policy">automatic</property>
+                <property name="shadow_type">etched-in</property>
+                <child>
+                  <object class="GtkTreeView" id="session_properties_treeview">
+                    <property name="height_request">210</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                  </object>
+                </child>
+              </object>
+              <packing>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkVButtonBox" id="vbuttonbox1">
+                <property name="visible">True</property>
+                <property name="spacing">6</property>
+                <property name="layout_style">start</property>
+                <child>
+                  <object class="GtkButton" id="session_properties_add_button">
+                    <property name="label">gtk-add</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">True</property>
+                    <property name="use_stock">True</property>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">False</property>
+                    <property name="position">0</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkButton" id="session_properties_delete_button">
+                    <property name="label">gtk-remove</property>
+                    <property name="visible">True</property>
+                    <property name="sensitive">False</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">True</property>
+                    <property name="use_stock">True</property>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">False</property>
+                    <property name="position">1</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkButton" id="session_properties_edit_button">
+                    <property name="label">gtk-edit</property>
+                    <property name="visible">True</property>
+                    <property name="sensitive">False</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">True</property>
+                    <property name="use_stock">True</property>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">False</property>
+                    <property name="position">2</property>
+                  </packing>
+                </child>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="position">1</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+    <child type="tab">
+      <object class="GtkLabel" id="label4">
+        <property name="visible">True</property>
+        <property name="label" translatable="yes">Startup Programs</property>
+      </object>
+      <packing>
+        <property name="tab_fill">False</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkVBox" id="vbox3">
+        <property name="visible">True</property>
+        <property name="border_width">12</property>
+        <property name="orientation">vertical</property>
+        <property name="spacing">6</property>
+        <child>
+          <object class="GtkCheckButton" id="session_properties_remember_toggle">
+            <property name="label" translatable="yes">_Automatically remember running applications when logging out</property>
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="receives_default">False</property>
+            <property name="use_underline">True</property>
+            <property name="draw_indicator">True</property>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">False</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkHButtonBox" id="hbuttonbox1">
+            <property name="visible">True</property>
+            <child>
+              <object class="GtkButton" id="session_properties_save_button">
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <child>
+                  <object class="GtkHBox" id="hbox2">
+                    <property name="visible">True</property>
+                    <property name="spacing">4</property>
+                    <child>
+                      <object class="GtkImage" id="image1">
+                        <property name="visible">True</property>
+                        <property name="stock">gtk-save</property>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
+                        <property name="position">0</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkLabel" id="label7">
+                        <property name="visible">True</property>
+                        <property name="label" translatable="yes">_Remember Currently Running Application</property>
+                        <property name="use_underline">True</property>
+                      </object>
+                      <packing>
+                        <property name="position">1</property>
+                      </packing>
+                    </child>
+                  </object>
+                </child>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">False</property>
+            <property name="position">1</property>
+          </packing>
+        </child>
+      </object>
+      <packing>
+        <property name="position">1</property>
+      </packing>
+    </child>
+    <child type="tab">
+      <object class="GtkLabel" id="label5">
+        <property name="visible">True</property>
+        <property name="label" translatable="yes">Options</property>
+      </object>
+      <packing>
+        <property name="position">1</property>
+        <property name="tab_fill">False</property>
+      </packing>
+    </child>
+  </object>
+  <object class="GtkTable" id="main-table">
+    <property name="visible">True</property>
+    <property name="border_width">6</property>
+    <property name="n_rows">3</property>
+    <property name="n_columns">2</property>
+    <property name="column_spacing">12</property>
+    <property name="row_spacing">6</property>
+    <child>
+      <object class="GtkHBox" id="hbox3">
+        <property name="visible">True</property>
+        <property name="spacing">12</property>
+        <child>
+          <object class="GtkEntry" id="session_properties_command_entry">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="invisible_char">&#x25CF;</property>
+          </object>
+          <packing>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkButton" id="session_properties_browse_button">
+            <property name="label" translatable="yes">Browse...</property>
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="receives_default">True</property>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">False</property>
+            <property name="position">1</property>
+          </packing>
+        </child>
+      </object>
+      <packing>
+        <property name="left_attach">1</property>
+        <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>
+    <child>
+      <object class="GtkEntry" id="session_properties_comment_entry">
+        <property name="visible">True</property>
+        <property name="can_focus">True</property>
+        <property name="invisible_char">&#x25CF;</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">GTK_FILL</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkEntry" id="session_properties_name_entry">
+        <property name="visible">True</property>
+        <property name="can_focus">True</property>
+        <property name="invisible_char">&#x25CF;</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="GtkLabel" id="label3">
+        <property name="visible">True</property>
+        <property name="xalign">0</property>
+        <property name="label" translatable="yes">Comm_ent:</property>
+        <property name="use_underline">True</property>
+        <property name="mnemonic_widget">label2</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">GTK_FILL</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkLabel" id="label2">
+        <property name="visible">True</property>
+        <property name="xalign">0</property>
+        <property name="label" translatable="yes">Co_mmand:</property>
+        <property name="use_underline">True</property>
+        <property name="mnemonic_widget">session_properties_command_entry</property>
+      </object>
+      <packing>
+        <property name="top_attach">1</property>
+        <property name="bottom_attach">2</property>
+        <property name="x_options">GTK_FILL</property>
+        <property name="y_options">GTK_FILL</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkLabel" id="label1">
+        <property name="visible">True</property>
+        <property name="xalign">0</property>
+        <property name="label" translatable="yes">_Name:</property>
+        <property name="use_underline">True</property>
+        <property name="mnemonic_widget">session_properties_name_entry</property>
+      </object>
+      <packing>
+        <property name="x_options">GTK_FILL</property>
+        <property name="y_options">GTK_FILL</property>
+      </packing>
+    </child>
+  </object>
+</interface>
diff --git a/gnome-session/Makefile.am b/gnome-session/Makefile.am
index ab9cedb..d5cb98c 100644
--- a/gnome-session/Makefile.am
+++ b/gnome-session/Makefile.am
@@ -23,7 +23,7 @@ INCLUDES =					\
 	-DDATA_DIR=\""$(datadir)/gnome-session"\" \
 	-DDBUS_LAUNCH=\"dbus-launch\"		\
 	-DLIBEXECDIR=\"$(libexecdir)\"		\
-	-DGLADEDIR=\""$(pkgdatadir)"\"		\
+	-DGTKBUILDER_DIR=\""$(pkgdatadir)"\"		\
 	-DGCONF_SANITY_CHECK=\""$(GCONF_SANITY_CHECK)"\" \
 	-DGCONFTOOL_CMD=\"$(GCONFTOOL)\"
 
@@ -144,7 +144,6 @@ CLEANFILES =					\
 	$(BUILT_SOURCES)
 
 EXTRA_DIST =						\
-	$(glade_DATA)					\
 	README						\
 	gsm-marshal.list        			\
 	org.gnome.SessionManager.xml			\
diff --git a/gnome-session/gsm-inhibit-dialog.c b/gnome-session/gsm-inhibit-dialog.c
index f7e83c2..4ffa497 100644
--- a/gnome-session/gsm-inhibit-dialog.c
+++ b/gnome-session/gsm-inhibit-dialog.c
@@ -31,7 +31,6 @@
 #include <gtk/gtk.h>
 #include <gdk/gdkx.h>
 
-#include <glade/glade-xml.h>
 #include <gconf/gconf-client.h>
 
 #include "gsm-inhibit-dialog.h"
@@ -49,7 +48,7 @@
 
 #define IS_STRING_EMPTY(x) ((x)==NULL||(x)[0]=='\0')
 
-#define GLADE_XML_FILE "gsm-inhibit-dialog.glade"
+#define GTKBUILDER_FILE "gsm-inhibit-dialog.ui"
 
 #ifndef DEFAULT_ICON_SIZE
 #define DEFAULT_ICON_SIZE 32
@@ -63,7 +62,7 @@
 
 struct GsmInhibitDialogPrivate
 {
-        GladeXML          *xml;
+        GtkBuilder        *xml;
         int                action;
         gboolean           is_done;
         GsmStore          *inhibitors;
@@ -672,7 +671,8 @@ update_dialog_text (GsmInhibitDialog *dialog)
                 description_text = _("Waiting for programs to finish.  Interrupting these programs may cause you to lose work.");
         }
 
-        widget = glade_xml_get_widget (dialog->priv->xml, "header-label");
+        widget = GTK_WIDGET (gtk_builder_get_object (dialog->priv->xml,
+                                                     "header-label"));
         if (widget != NULL) {
                 char *markup;
                 markup = g_strdup_printf ("<b>%s</b>", header_text);
@@ -680,7 +680,8 @@ update_dialog_text (GsmInhibitDialog *dialog)
                 g_free (markup);
         }
 
-        widget = glade_xml_get_widget (dialog->priv->xml, "description-label");
+        widget = GTK_WIDGET (gtk_builder_get_object (dialog->priv->xml,
+                                                     "description-label"));
         if (widget != NULL) {
                 gtk_label_set_text (GTK_LABEL (widget), description_text);
         }
@@ -939,7 +940,8 @@ setup_dialog (GsmInhibitDialog *dialog)
                                                        G_TYPE_STRING,
                                                        G_TYPE_STRING);
 
-        treeview = glade_xml_get_widget (dialog->priv->xml, "inhibitors-treeview");
+        treeview = GTK_WIDGET (gtk_builder_get_object (dialog->priv->xml,
+                                                       "inhibitors-treeview"));
         gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (treeview), FALSE);
         gtk_tree_view_set_model (GTK_TREE_VIEW (treeview),
                                  GTK_TREE_MODEL (dialog->priv->list_store));
@@ -1087,19 +1089,31 @@ static void
 gsm_inhibit_dialog_init (GsmInhibitDialog *dialog)
 {
         GtkWidget *widget;
+        GError    *error;
 
         dialog->priv = GSM_INHIBIT_DIALOG_GET_PRIVATE (dialog);
 
-        dialog->priv->xml = glade_xml_new (GLADEDIR "/" GLADE_XML_FILE,
-                                           "main-box",
-                                           PACKAGE);
-        g_assert (dialog->priv->xml != NULL);
+        dialog->priv->xml = gtk_builder_new ();
+        gtk_builder_set_translation_domain(dialog->priv->xml, PACKAGE);
+
+        error = NULL;
+        if (!gtk_builder_add_from_file (dialog->priv->xml,
+                                        GTKBUILDER_DIR "/" GTKBUILDER_FILE,
+                                        &error)) {
+                if (error) {
+                        g_warning ("Could not load inhibitor UI file: %s",
+                                   error->message);
+                        g_error_free (error);
+                } else {
+                        g_warning ("Could not load inhibitor UI file.");
+                }
+        }
 
-        widget = glade_xml_get_widget (dialog->priv->xml, "main-box");
+        widget = GTK_WIDGET (gtk_builder_get_object (dialog->priv->xml,
+                                                     "main-box"));
         gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), widget);
 
-        gtk_container_set_border_width (GTK_CONTAINER (dialog), 12);
-        gtk_container_set_border_width (GTK_CONTAINER (widget), 12);
+        gtk_container_set_border_width (GTK_CONTAINER (dialog), 6);
         gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
         gtk_window_set_icon_name (GTK_WINDOW (dialog), "system-log-out");
         gtk_window_set_title (GTK_WINDOW (dialog), "");
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 0b74d42..47b9d1a 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -9,9 +9,9 @@ compat/gnome-settings-daemon-helper.desktop.in.in.in
 data/gnome.desktop.in
 data/gnome-session.schemas.in
 data/gnome-wm.desktop.in.in
-data/gsm-inhibit-dialog.glade
+[type: gettext/glade]data/gsm-inhibit-dialog.ui
 data/session-properties.desktop.in.in
-data/session-properties.glade
+[type: gettext/glade]data/session-properties.ui
 egg/eggdesktopfile.c
 egg/eggsmclient.c
 gnome-session/gsm-gconf.c



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]