[gnome-settings-daemon] Remove libglade dependency from keyboard plugin



commit 2b22063e966fa88dfb791e0d77a79be62fde2a97
Author: Felix Riemann <friemann gnome org>
Date:   Fri Jul 10 23:39:48 2009 +0200

    Remove libglade dependency from keyboard plugin

 plugins/keyboard/Makefile.am         |    6 +-
 plugins/keyboard/gsd-xmodmap.c       |   37 ++--
 plugins/keyboard/modmap-dialog.glade |  414 ----------------------------------
 plugins/keyboard/modmap-dialog.ui    |  273 ++++++++++++++++++++++
 po/POTFILES.in                       |    2 +-
 5 files changed, 300 insertions(+), 432 deletions(-)
---
diff --git a/plugins/keyboard/Makefile.am b/plugins/keyboard/Makefile.am
index 783b049..3d6f395 100644
--- a/plugins/keyboard/Makefile.am
+++ b/plugins/keyboard/Makefile.am
@@ -4,8 +4,8 @@ plugin_LTLIBRARIES = \
 	libkeyboard.la		\
 	$(NULL)
 
-Gladedir   = $(pkgdatadir)
-Glade_DATA = modmap-dialog.glade
+uidir   = $(pkgdatadir)
+ui_DATA = modmap-dialog.ui
 
 libkeyboard_la_SOURCES = 	\
 	gsd-keyboard-plugin.h	\
@@ -49,7 +49,7 @@ plugin_DATA = $(plugin_in_files:.gnome-settings-plugin.in=.gnome-settings-plugin
 
 EXTRA_DIST = 			\
 	$(plugin_in_files)	\
-	$(Glade_DATA)		\
+	$(ui_DATA)		\
 	$(NULL)
 
 CLEANFILES = 			\
diff --git a/plugins/keyboard/gsd-xmodmap.c b/plugins/keyboard/gsd-xmodmap.c
index 8b8d11c..4b36e48 100644
--- a/plugins/keyboard/gsd-xmodmap.c
+++ b/plugins/keyboard/gsd-xmodmap.c
@@ -27,7 +27,6 @@
 #include <glib.h>
 #include <gtk/gtk.h>
 #include <gconf/gconf-client.h>
-#include <glade/glade.h>
 
 #include "gsd-xmodmap.h"
 
@@ -259,7 +258,9 @@ out:
 void
 gsd_modmap_dialog_call (void)
 {
-        GladeXML          *xml;
+        GtkBuilder        *builder;
+        guint              res;
+        GError            *error;
         GtkWidget         *load_dialog;
         GtkListStore      *tree;
         GtkCellRenderer   *cell_renderer;
@@ -283,39 +284,47 @@ gsd_modmap_dialog_call (void)
         if (homeDir == NULL)
                 return;
 
-        xml = glade_xml_new (DATADIR "/modmap-dialog.glade", "dialog1", NULL);
+        error = NULL;
+        builder = gtk_builder_new ();
+        res = gtk_builder_add_from_file (builder,
+                                         DATADIR "/modmap-dialog.ui",
+                                         &error);
 
-        if (!xml) {
-                g_warning ("Could not find glade file");
+        if (res == 0) {
+                g_warning ("Could not load UI file: %s", error->message);
+                g_error_free (error);
+                g_object_unref (builder);
                 g_dir_close (homeDir);
                 return;
         }
 
-        load_dialog = glade_xml_get_widget (xml, "dialog1");
+        load_dialog = GTK_WIDGET (gtk_builder_get_object (builder, "dialog1"));
         gtk_window_set_modal (GTK_WINDOW (load_dialog), TRUE);
         g_signal_connect (load_dialog,
                           "response",
                           G_CALLBACK (response_callback),
-                          xml);
-        add_button = glade_xml_get_widget (xml, "button7");
+                          builder);
+        add_button =  GTK_WIDGET (gtk_builder_get_object (builder, "button7"));
         g_signal_connect (add_button,
                           "clicked",
                           G_CALLBACK (load_button_clicked_callback),
                           load_dialog);
-        remove_button = glade_xml_get_widget (xml, "button6");
+        remove_button =  GTK_WIDGET (gtk_builder_get_object (builder,
+                                                             "button6"));
         g_signal_connect (remove_button,
                           "clicked",
                           G_CALLBACK (remove_button_clicked_callback),
                           load_dialog);
-        chk_button = glade_xml_get_widget (xml, "checkbutton1");
+        chk_button =  GTK_WIDGET (gtk_builder_get_object (builder,
+                                                          "checkbutton1"));
         g_signal_connect (chk_button,
                           "toggled",
                           G_CALLBACK (check_button_callback),
                           NULL);
         g_object_set_data (G_OBJECT (load_dialog), "check_button", chk_button);
-        treeview = glade_xml_get_widget (xml, "treeview1");
+        treeview = GTK_WIDGET (gtk_builder_get_object (builder, "treeview1"));
         g_object_set_data (G_OBJECT (load_dialog), "treeview1", treeview);
-        treeview = glade_xml_get_widget (xml, "treeview2");
+        treeview =  GTK_WIDGET (gtk_builder_get_object (builder, "treeview2"));
         g_object_set_data (G_OBJECT (load_dialog), "loaded-treeview", treeview);
         tree = gtk_list_store_new (1, G_TYPE_STRING);
         cell_renderer = gtk_cell_renderer_text_new ();
@@ -350,7 +359,7 @@ gsd_modmap_dialog_call (void)
         g_dir_close (homeDir);
 
         /* Left treeview */
-        treeview1 = glade_xml_get_widget (xml, "treeview1");
+        treeview1 =  GTK_WIDGET (gtk_builder_get_object (builder, "treeview1"));
         tree = gtk_list_store_new (1, G_TYPE_STRING);
         cell_renderer = gtk_cell_renderer_text_new ();
         column = gtk_tree_view_column_new_with_attributes ("modmap",
@@ -386,5 +395,5 @@ gsd_modmap_dialog_call (void)
         gtk_tree_selection_set_mode (GTK_TREE_SELECTION (selection),
                                      GTK_SELECTION_MULTIPLE);
         g_object_set_data (G_OBJECT (load_dialog), "tree", tree);
-        g_object_unref (xml);
+        g_object_unref (builder);
 }
diff --git a/plugins/keyboard/modmap-dialog.ui b/plugins/keyboard/modmap-dialog.ui
new file mode 100644
index 0000000..b5b319a
--- /dev/null
+++ b/plugins/keyboard/modmap-dialog.ui
@@ -0,0 +1,273 @@
+<?xml version="1.0"?>
+<interface>
+  <!-- interface-requires gtk+ 2.6 -->
+  <!-- interface-naming-policy toplevel-contextual -->
+  <object class="GtkDialog" id="dialog1">
+    <property name="visible">True</property>
+    <property name="title" translatable="yes">Load modmap files</property>
+    <property name="type_hint">dialog</property>
+    <child internal-child="vbox">
+      <object class="GtkVBox" id="dialog-vbox4">
+        <property name="visible">True</property>
+        <child>
+          <object class="GtkVBox" id="vbox44">
+            <property name="visible">True</property>
+            <child>
+              <object class="GtkLabel" id="label62">
+                <property name="visible">True</property>
+                <property name="label" translatable="yes">Would you like to load the modmap file(s)?</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkHBox" id="hbox32">
+                <property name="visible">True</property>
+                <property name="border_width">12</property>
+                <property name="spacing">6</property>
+                <child>
+                  <object class="GtkVBox" id="vbox45">
+                    <property name="visible">True</property>
+                    <property name="spacing">6</property>
+                    <child>
+                      <object class="GtkLabel" id="label63">
+                        <property name="visible">True</property>
+                        <property name="xalign">0</property>
+                        <property name="label" translatable="yes">_Loaded files:</property>
+                        <property name="use_underline">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="scrolledwindow7">
+                        <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="treeview1">
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="headers_visible">False</property>
+                          </object>
+                        </child>
+                      </object>
+                      <packing>
+                        <property name="position">1</property>
+                      </packing>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="position">0</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkVBox" id="vbox46">
+                    <property name="visible">True</property>
+                    <property name="border_width">6</property>
+                    <property name="spacing">12</property>
+                    <child>
+                      <object class="GtkLabel" id="label64">
+                        <property name="visible">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="button7">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">False</property>
+                        <child>
+                          <object class="GtkAlignment" id="alignment1">
+                            <property name="visible">True</property>
+                            <property name="xscale">0</property>
+                            <property name="yscale">0</property>
+                            <child>
+                              <object class="GtkHBox" id="hbox33">
+                                <property name="visible">True</property>
+                                <property name="spacing">2</property>
+                                <child>
+                                  <object class="GtkImage" id="image1">
+                                    <property name="visible">True</property>
+                                    <property name="stock">gtk-add</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="label66">
+                                    <property name="visible">True</property>
+                                    <property name="label" translatable="yes">_Load</property>
+                                    <property name="use_underline">True</property>
+                                  </object>
+                                  <packing>
+                                    <property name="expand">False</property>
+                                    <property name="fill">False</property>
+                                    <property name="position">1</property>
+                                  </packing>
+                                </child>
+                              </object>
+                            </child>
+                          </object>
+                        </child>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
+                        <property name="position">1</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkButton" id="button6">
+                        <property name="label">gtk-remove</property>
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">False</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>
+                    <child>
+                      <placeholder/>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">False</property>
+                    <property name="position">1</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkVBox" id="vbox47">
+                    <property name="visible">True</property>
+                    <property name="spacing">6</property>
+                    <child>
+                      <object class="GtkLabel" id="label65">
+                        <property name="visible">True</property>
+                        <property name="xalign">0</property>
+                        <property name="label" translatable="yes">A_vailable files:</property>
+                        <property name="use_underline">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="scrolledwindow8">
+                        <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="treeview2">
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="headers_visible">False</property>
+                          </object>
+                        </child>
+                      </object>
+                      <packing>
+                        <property name="position">1</property>
+                      </packing>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="position">2</property>
+                  </packing>
+                </child>
+              </object>
+              <packing>
+                <property name="position">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkCheckButton" id="checkbutton1">
+                <property name="label" translatable="yes">_Do not show this message again</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="active">True</property>
+                <property name="draw_indicator">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="position">2</property>
+          </packing>
+        </child>
+        <child internal-child="action_area">
+          <object class="GtkHButtonBox" id="dialog-action_area3">
+            <property name="visible">True</property>
+            <property name="layout_style">end</property>
+            <child>
+              <object class="GtkButton" id="helpbutton2">
+                <property name="label">gtk-help</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>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="okbutton1">
+                <property name="label">gtk-ok</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>
+              </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="pack_type">end</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+    <action-widgets>
+      <action-widget response="-11">helpbutton2</action-widget>
+      <action-widget response="-5">okbutton1</action-widget>
+    </action-widgets>
+  </object>
+</interface>
diff --git a/po/POTFILES.in b/po/POTFILES.in
index fd63548..11989e2 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -22,7 +22,7 @@ plugins/housekeeping/gsd-disk-space.c
 plugins/keybindings/gsd-keybindings-manager.c
 [type: gettext/ini]plugins/keybindings/keybindings.gnome-settings-plugin.in
 [type: gettext/ini]plugins/keyboard/keyboard.gnome-settings-plugin.in
-plugins/keyboard/modmap-dialog.glade
+[type: gettext/glade]plugins/keyboard/modmap-dialog.ui
 plugins/media-keys/gsd-media-keys-manager.c
 plugins/media-keys/cut-n-paste/gvc-mixer-control.c
 [type: gettext/ini]plugins/media-keys/media-keys.gnome-settings-plugin.in



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