[gnome-panel] wncklet: Convert to GResource
- From: Vincent Untz <vuntz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-panel] wncklet: Convert to GResource
- Date: Thu, 2 Feb 2012 14:26:35 +0000 (UTC)
commit 9fbca7dfa21448e983b71d6530fcf7ea337bdd16
Author: Vincent Untz <vuntz gnome org>
Date: Thu Feb 2 12:22:04 2012 +0100
wncklet: Convert to GResource
applets/wncklet/Makefile.am | 32 +++++++++++++++++++-------------
applets/wncklet/window-list.c | 18 ++++--------------
applets/wncklet/wncklet.gresource.xml | 9 +++++++++
applets/wncklet/wncklet.h | 2 ++
applets/wncklet/workspace-switcher.c | 18 ++++--------------
5 files changed, 38 insertions(+), 41 deletions(-)
---
diff --git a/applets/wncklet/Makefile.am b/applets/wncklet/Makefile.am
index 4fc39f4..71ff0b8 100644
--- a/applets/wncklet/Makefile.am
+++ b/applets/wncklet/Makefile.am
@@ -6,9 +6,6 @@ AM_CPPFLAGS = \
-I$(top_srcdir)/libpanel-applet \
-I$(top_builddir)/libpanel-applet \
-DGNOMELOCALEDIR=\""$(prefix)/$(DATADIRNAME)/locale"\" \
- -DPAGER_BUILDERDIR=\""$(uidir)"\" \
- -DTASKLIST_BUILDERDIR=\""$(uidir)"\" \
- -DWNCK_MENU_UI_DIR=\""$(xmluidir)"\" \
-DWNCK_I_KNOW_THIS_IS_UNSTABLE \
$(DISABLE_DEPRECATED_CFLAGS)
@@ -24,7 +21,8 @@ WNCKLET_SOURCES = \
workspace-switcher.c \
workspace-switcher.h \
showdesktop.c \
- showdesktop.h
+ showdesktop.h \
+ $(BUILT_SOURCES)
WNCKLET_LDADD = \
../../libpanel-applet/libpanel-applet-4.la \
@@ -75,20 +73,28 @@ org.gnome.panel.applet.WnckletFactory.service: $(service_in_files)
$< > $@
endif
-uidir = $(datadir)/gnome-panel/ui
-ui_DATA = workspace-switcher.ui window-list.ui
+ui_FILES = \
+ window-list-menu.xml \
+ window-list.ui \
+ workspace-switcher-menu.xml \
+ workspace-switcher.ui
-xmluidir = $(datadir)/gnome-panel/ui
-xmlui_DATA = \
- workspace-switcher-menu.xml \
- window-list-menu.xml
+
+wncklet-resources.c: wncklet.gresource.xml $(shell $(GLIB_COMPILE_RESOURCES) --generate-dependencies wncklet.gresource.xml)
+ $(AM_V_GEN)$(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=$(srcdir) --generate --c-name wncklet $(srcdir)/$<
+
+wncklet-resources.h: wncklet.gresource.xml $(shell $(GLIB_COMPILE_RESOURCES) --generate-dependencies wncklet.gresource.xml)
+ $(AM_V_GEN)$(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=$(srcdir) --generate --c-name wncklet $(srcdir)/$<
+
+BUILT_SOURCES = \
+ wncklet-resources.c \
+ wncklet-resources.h
EXTRA_DIST = \
org.gnome.panel.Wncklet.panel-applet.in.in \
$(service_in_files) \
- $(xmlui_DATA) \
- $(ui_DATA)
+ $(ui_FILES)
-CLEANFILES = $(applet_DATA) $(applet_DATA).in $(service_DATA)
+CLEANFILES = $(BUILT_SOURCES) $(applet_DATA) $(applet_DATA).in $(service_DATA)
-include $(top_srcdir)/git.mk
diff --git a/applets/wncklet/window-list.c b/applets/wncklet/window-list.c
index 4dbc4d4..25ea962 100644
--- a/applets/wncklet/window-list.c
+++ b/applets/wncklet/window-list.c
@@ -358,7 +358,6 @@ window_list_applet_fill (PanelApplet *applet)
TasklistData *tasklist;
GtkActionGroup *action_group;
GtkAction *action;
- gchar *ui_path;
tasklist = g_new0 (TasklistData, 1);
@@ -434,10 +433,9 @@ window_list_applet_fill (PanelApplet *applet)
tasklist_menu_actions,
G_N_ELEMENTS (tasklist_menu_actions),
tasklist);
- ui_path = g_build_filename (WNCK_MENU_UI_DIR, "window-list-menu.xml", NULL);
- panel_applet_setup_menu_from_file (PANEL_APPLET (tasklist->applet),
- ui_path, action_group);
- g_free (ui_path);
+ panel_applet_setup_menu_from_resource (PANEL_APPLET (tasklist->applet),
+ WNCKLET_RESOURCE_PATH "window-list-menu.xml",
+ action_group);
action = gtk_action_group_get_action (action_group, "TasklistPreferences");
g_object_bind_property (tasklist->applet, "locked-down",
@@ -589,18 +587,10 @@ display_properties_dialog (GtkAction *action,
{
if (tasklist->properties_dialog == NULL) {
GtkBuilder *builder;
- GError *error;
builder = gtk_builder_new ();
gtk_builder_set_translation_domain (builder, GETTEXT_PACKAGE);
-
- error = NULL;
- gtk_builder_add_from_file (builder, TASKLIST_BUILDERDIR "/window-list.ui", &error);
- if (error) {
- g_warning ("Error loading preferences: %s", error->message);
- g_error_free (error);
- return;
- }
+ gtk_builder_add_from_resource (builder, WNCKLET_RESOURCE_PATH "window-list.ui", NULL);
tasklist->properties_dialog = WID ("tasklist_properties_dialog");
diff --git a/applets/wncklet/wncklet.gresource.xml b/applets/wncklet/wncklet.gresource.xml
new file mode 100644
index 0000000..e4c7eee
--- /dev/null
+++ b/applets/wncklet/wncklet.gresource.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<gresources>
+ <gresource prefix="/org/gnome/panel/applet/wncklet">
+ <file compressed="true">window-list.ui</file>
+ <file compressed="true">window-list-menu.xml</file>
+ <file compressed="true">workspace-switcher.ui</file>
+ <file compressed="true">workspace-switcher-menu.xml</file>
+ </gresource>
+</gresources>
diff --git a/applets/wncklet/wncklet.h b/applets/wncklet/wncklet.h
index 154741d..2485c16 100644
--- a/applets/wncklet/wncklet.h
+++ b/applets/wncklet/wncklet.h
@@ -30,6 +30,8 @@
#include <gtk/gtk.h>
#include <panel-applet.h>
+#define WNCKLET_RESOURCE_PATH "/org/gnome/panel/applet/wncklet/"
+
G_BEGIN_DECLS
void wncklet_display_help (GtkWidget *widget,
diff --git a/applets/wncklet/workspace-switcher.c b/applets/wncklet/workspace-switcher.c
index 9d5cdd4..8041046 100644
--- a/applets/wncklet/workspace-switcher.c
+++ b/applets/wncklet/workspace-switcher.c
@@ -307,7 +307,6 @@ workspace_switcher_applet_fill (PanelApplet *applet)
PagerData *pager;
GtkActionGroup *action_group;
GtkAction *action;
- gchar *ui_path;
gboolean display_names;
panel_applet_add_preferences (applet, "/schemas/apps/workspace_switcher_applet/prefs", NULL);
@@ -384,10 +383,9 @@ workspace_switcher_applet_fill (PanelApplet *applet)
pager_menu_actions,
G_N_ELEMENTS (pager_menu_actions),
pager);
- ui_path = g_build_filename (WNCK_MENU_UI_DIR, "workspace-switcher-menu.xml", NULL);
- panel_applet_setup_menu_from_file (PANEL_APPLET (pager->applet),
- ui_path, action_group);
- g_free (ui_path);
+ panel_applet_setup_menu_from_resource (PANEL_APPLET (pager->applet),
+ WNCKLET_RESOURCE_PATH "workspace-switcher-menu.xml",
+ action_group);
action = gtk_action_group_get_action (action_group, "PagerPreferences");
g_object_bind_property (pager->applet, "locked-down",
@@ -787,18 +785,10 @@ display_properties_dialog (GtkAction *action,
{
if (pager->properties_dialog == NULL) {
GtkBuilder *builder;
- GError *error;
builder = gtk_builder_new ();
gtk_builder_set_translation_domain (builder, GETTEXT_PACKAGE);
-
- error = NULL;
- gtk_builder_add_from_file (builder, PAGER_BUILDERDIR "/workspace-switcher.ui", &error);
- if (error) {
- g_warning ("Error loading preferences: %s", error->message);
- g_error_free (error);
- return;
- }
+ gtk_builder_add_from_resource (builder, WNCKLET_RESOURCE_PATH "workspace-switcher.ui", NULL);
pager->properties_dialog = WID ("pager_properties_dialog");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]