[gnome-settings-daemon] Remove libglade dependency from media-keys plugin
- From: Felix Riemann <friemann src gnome org>
- To: svn-commits-list gnome org
- Subject: [gnome-settings-daemon] Remove libglade dependency from media-keys plugin
- Date: Thu, 9 Jul 2009 15:15:00 +0000 (UTC)
commit af538d56997c407db8302137c2243fe947e6b02f
Author: Felix Riemann <friemann gnome org>
Date: Tue Jul 7 22:06:21 2009 +0200
Remove libglade dependency from media-keys plugin
plugins/media-keys/Makefile.am | 14 ++++----
plugins/media-keys/acme.glade | 55 ----------------------------
plugins/media-keys/acme.ui | 41 +++++++++++++++++++++
plugins/media-keys/gsd-media-keys-window.c | 24 ++++++++-----
4 files changed, 63 insertions(+), 71 deletions(-)
---
diff --git a/plugins/media-keys/Makefile.am b/plugins/media-keys/Makefile.am
index 54a3340..fae8a5e 100644
--- a/plugins/media-keys/Makefile.am
+++ b/plugins/media-keys/Makefile.am
@@ -41,7 +41,7 @@ libmedia_keys_la_CPPFLAGS = \
-I$(top_srcdir)/plugins/common \
-I$(top_srcdir)/plugins/media-keys/cut-n-paste \
-DPIXMAPDIR=\""$(pkgdatadir)"\" \
- -DGLADEDIR=\""$(pkgdatadir)"\" \
+ -DGTKBUILDERDIR=\""$(pkgdatadir)"\" \
-DGNOME_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \
$(AM_CPPFLAGS)
@@ -80,7 +80,7 @@ test_media_window_CPPFLAGS = \
-I$(top_srcdir)/gnome-settings-daemon \
-I$(top_srcdir)/plugins/media-keys/cut-n-paste \
-DPIXMAPDIR=\""$(pkgdatadir)"\" \
- -DGLADEDIR=\""$(pkgdatadir)"\" \
+ -DGTKBUILDERDIR=\""$(pkgdatadir)"\" \
-DGNOME_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \
$(AM_CPPFLAGS)
@@ -108,7 +108,7 @@ test_media_keys_CPPFLAGS = \
-I$(top_srcdir)/plugins/common \
-I$(top_srcdir)/plugins/media-keys/cut-n-paste \
-DPIXMAPDIR=\""$(pkgdatadir)"\" \
- -DGLADEDIR=\""$(pkgdatadir)"\" \
+ -DGTKBUILDERDIR=\""$(pkgdatadir)"\" \
-DGNOME_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \
$(AM_CPPFLAGS)
@@ -128,9 +128,9 @@ if HAVE_PULSE
test_media_keys_LDADD += $(top_builddir)/plugins/media-keys/cut-n-paste/libgvc.la
endif
-gladedir = $(pkgdatadir)
-glade_DATA = \
- acme.glade \
+gtkbuilderdir = $(pkgdatadir)
+gtkbuilder_DATA = \
+ acme.ui \
$(NULL)
pixmapsdir = $(pkgdatadir)
@@ -144,7 +144,7 @@ EXTRA_DIST = \
gsd-media-keys-manager.xml \
gsd-marshal.list \
$(plugin_in_files) \
- $(glade_DATA) \
+ $(gtkbuilder_DATA) \
$(pixmaps_DATA)
CLEANFILES = \
diff --git a/plugins/media-keys/acme.ui b/plugins/media-keys/acme.ui
new file mode 100644
index 0000000..3222ecb
--- /dev/null
+++ b/plugins/media-keys/acme.ui
@@ -0,0 +1,41 @@
+<?xml version="1.0"?>
+<interface>
+ <!-- interface-requires gtk+ 2.6 -->
+ <!-- interface-naming-policy toplevel-contextual -->
+ <object class="GtkWindow" id="dialog">
+ <child>
+ <object class="GtkFrame" id="acme_frame">
+ <property name="visible">True</property>
+ <property name="label_xalign">0</property>
+ <property name="shadow_type">out</property>
+ <child>
+ <object class="GtkVBox" id="acme_vbox">
+ <property name="visible">True</property>
+ <property name="border_width">12</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkImage" id="acme_image">
+ <property name="visible">True</property>
+ <property name="icon_name">audio-volume-high</property>
+ <property name="icon-size">6</property>
+ </object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkProgressBar" id="acme_volume_progressbar">
+ <property name="visible">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>
+</interface>
diff --git a/plugins/media-keys/gsd-media-keys-window.c b/plugins/media-keys/gsd-media-keys-window.c
index e4bab6f..3eca69b 100644
--- a/plugins/media-keys/gsd-media-keys-window.c
+++ b/plugins/media-keys/gsd-media-keys-window.c
@@ -27,8 +27,6 @@
#include <glib/gi18n.h>
#include <gtk/gtk.h>
-#include <glade/glade.h>
-
#include "gsd-media-keys-window.h"
#define DIALOG_TIMEOUT 2000 /* dialog timeout in ms */
@@ -953,21 +951,29 @@ gsd_media_keys_window_init (GsdMediaKeysWindow *window)
window->priv->fade_out_alpha = 1.0;
} else {
- GladeXML *xml;
+ GtkBuilder *builder;
+ gchar *objects[] = {"acme_frame", NULL};
GtkWidget *frame;
- xml = glade_xml_new (GLADEDIR "/acme.glade", "acme_frame", NULL);
-
- window->priv->image = GTK_IMAGE (glade_xml_get_widget (xml, "acme_image"));
- window->priv->progress = glade_xml_get_widget (xml, "acme_volume_progressbar");
- frame = glade_xml_get_widget (xml, "acme_frame");
+ builder = gtk_builder_new ();
+ gtk_builder_add_objects_from_file (builder,
+ GTKBUILDERDIR "/acme.ui",
+ objects,
+ NULL);
- g_object_unref (xml);
+ window->priv->image = GTK_IMAGE (gtk_builder_get_object (builder, "acme_image"));
+ window->priv->progress = GTK_WIDGET (gtk_builder_get_object (builder, "acme_volume_progressbar"));
+ frame = GTK_WIDGET (gtk_builder_get_object (builder,
+ "acme_frame"));
if (frame != NULL) {
gtk_container_add (GTK_CONTAINER (window), frame);
gtk_widget_show_all (frame);
}
+
+ /* The builder needs to stay alive until the window
+ takes ownership of the frame (and its children) */
+ g_object_unref (builder);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]