summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Untz <[email protected]>2012-02-02 12:22:04 +0100
committerraveit65 <[email protected]>2018-04-26 13:05:22 +0200
commitff613c4f6a3a33c21cacc885116cacf87ef4bf03 (patch)
treed175805da384b7ac73d919f6cde0601b0fb338de
parent6b461deac9fb64ff6c92958475497b7050b0bc94 (diff)
downloadmate-panel-ff613c4f6a3a33c21cacc885116cacf87ef4bf03.tar.bz2
mate-panel-ff613c4f6a3a33c21cacc885116cacf87ef4bf03.tar.xz
wncklet: Convert to GResource
origin commits: https://git.gnome.org/browse/gnome-panel/commit/?h=gnome-3-4&id=9fbca7d https://git.gnome.org/browse/gnome-panel/commit/?h=gnome-3-4&id=695d30c https://git.gnome.org/browse/gnome-panel/commit/?h=gnome-3-4&id=00f9870
-rw-r--r--applets/wncklet/Makefile.am34
-rw-r--r--applets/wncklet/showdesktop.c7
-rw-r--r--applets/wncklet/window-list.c19
-rw-r--r--applets/wncklet/window-menu.c7
-rw-r--r--applets/wncklet/wncklet.gresource.xml11
-rw-r--r--applets/wncklet/wncklet.h2
-rw-r--r--applets/wncklet/workspace-switcher.c19
7 files changed, 47 insertions, 52 deletions
diff --git a/applets/wncklet/Makefile.am b/applets/wncklet/Makefile.am
index db61f873..84682ee9 100644
--- a/applets/wncklet/Makefile.am
+++ b/applets/wncklet/Makefile.am
@@ -6,9 +6,6 @@ AM_CPPFLAGS = \
-I$(top_srcdir)/libmate-panel-applet \
-I$(top_builddir)/libmate-panel-applet \
-DMATELOCALEDIR=\""$(prefix)/$(DATADIRNAME)/locale"\" \
- -DPAGER_BUILDERDIR=\""$(uidir)"\" \
- -DTASKLIST_BUILDERDIR=\""$(uidir)"\" \
- -DWNCK_MENU_UI_DIR=\""$(xmluidir)"\" \
$(DISABLE_DEPRECATED_CFLAGS)
AM_CFLAGS = $(WARN_CFLAGS)
@@ -23,7 +20,8 @@ WNCKLET_SOURCES = \
workspace-switcher.c \
workspace-switcher.h \
showdesktop.c \
- showdesktop.h
+ showdesktop.h \
+ $(BUILT_SOURCES)
WNCKLET_LDADD = \
../../libmate-panel-applet/libmate-panel-applet-4.la \
@@ -74,15 +72,23 @@ org.mate.panel.applet.WnckletFactory.service: $(service_in_files)
$< > $@
endif
-uidir = $(datadir)/mate-panel/ui
-ui_DATA = workspace-switcher.ui window-list.ui
-
-xmluidir = $(datadir)/mate-panel/ui
-xmlui_DATA = \
+ui_FILES = \
+ showdesktop-menu.xml \
+ window-list-menu.xml \
+ window-list.ui \
window-menu-menu.xml \
workspace-switcher-menu.xml \
- showdesktop-menu.xml \
- window-list-menu.xml
+ workspace-switcher.ui
+
+wncklet-resources.c: wncklet.gresource.xml $(shell $(GLIB_COMPILE_RESOURCES) --sourcedir=$(srcdir) --generate-dependencies $(srcdir)/wncklet.gresource.xml)
+ $(AM_V_GEN)$(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=$(srcdir) --generate --c-name wncklet $<
+
+wncklet-resources.h: wncklet.gresource.xml $(shell $(GLIB_COMPILE_RESOURCES) --sourcedir=$(srcdir) --generate-dependencies $(srcdir)/wncklet.gresource.xml)
+ $(AM_V_GEN)$(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=$(srcdir) --generate --c-name wncklet $<
+
+BUILT_SOURCES = \
+ wncklet-resources.c \
+ wncklet-resources.h
wncklet_gschemas_in = \
org.mate.panel.applet.window-list.gschema.xml.in \
@@ -95,10 +101,10 @@ gsettings_SCHEMAS = $(wncklet_gschemas_in:.xml.in=.xml)
EXTRA_DIST = \
org.mate.panel.Wncklet.mate-panel-applet.in.in \
$(service_in_files) \
- $(xmlui_DATA) \
$(wncklet_gschemas_in) \
- $(ui_DATA)
+ $(ui_FILES) \
+ wncklet.gresource.xml
-CLEANFILES = $(applet_DATA) $(applet_DATA).in $(service_DATA) $(gsettings_SCHEMAS)
+CLEANFILES = $(BUILT_SOURCES) $(applet_DATA) $(applet_DATA).in $(service_DATA) $(gsettings_SCHEMAS)
-include $(top_srcdir)/git.mk
diff --git a/applets/wncklet/showdesktop.c b/applets/wncklet/showdesktop.c
index c1ab01ca..72b71763 100644
--- a/applets/wncklet/showdesktop.c
+++ b/applets/wncklet/showdesktop.c
@@ -372,7 +372,6 @@ gboolean show_desktop_applet_fill(MatePanelApplet* applet)
{
ShowDesktopData* sdd;
GtkActionGroup* action_group;
- gchar* ui_path;
AtkObject* atk_obj;
GtkCssProvider *provider;
@@ -440,9 +439,9 @@ gboolean show_desktop_applet_fill(MatePanelApplet* applet)
action_group = gtk_action_group_new("ShowDesktop Applet Actions");
gtk_action_group_set_translation_domain(action_group, GETTEXT_PACKAGE);
gtk_action_group_add_actions(action_group, show_desktop_menu_actions, G_N_ELEMENTS (show_desktop_menu_actions), sdd);
- ui_path = g_build_filename(WNCK_MENU_UI_DIR, "showdesktop-menu.xml", NULL);
- mate_panel_applet_setup_menu_from_file(MATE_PANEL_APPLET(sdd->applet), ui_path, action_group);
- g_free(ui_path);
+ mate_panel_applet_setup_menu_from_resource (MATE_PANEL_APPLET (sdd->applet),
+ WNCKLET_RESOURCE_PATH "showdesktop-menu.xml",
+ action_group);
g_object_unref(action_group);
g_signal_connect(G_OBJECT(sdd->applet), "destroy", G_CALLBACK(applet_destroyed), sdd);
diff --git a/applets/wncklet/window-list.c b/applets/wncklet/window-list.c
index b4c7d123..602f6ecf 100644
--- a/applets/wncklet/window-list.c
+++ b/applets/wncklet/window-list.c
@@ -372,7 +372,6 @@ gboolean window_list_applet_fill(MatePanelApplet* applet)
{
TasklistData* tasklist;
GtkActionGroup* action_group;
- gchar* ui_path;
GtkCssProvider *provider;
GdkScreen *screen;
@@ -468,9 +467,9 @@ gboolean window_list_applet_fill(MatePanelApplet* applet)
/* end of system monitor item */
- ui_path = g_build_filename(WNCK_MENU_UI_DIR, "window-list-menu.xml", NULL);
- mate_panel_applet_setup_menu_from_file(MATE_PANEL_APPLET(tasklist->applet), ui_path, action_group);
- g_free(ui_path);
+ mate_panel_applet_setup_menu_from_resource (MATE_PANEL_APPLET (tasklist->applet),
+ WNCKLET_RESOURCE_PATH "window-list-menu.xml",
+ action_group);
if (mate_panel_applet_get_locked_down(MATE_PANEL_APPLET(tasklist->applet)))
{
@@ -649,20 +648,10 @@ static void display_properties_dialog(GtkAction* action, TasklistData* tasklist)
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/window-menu.c b/applets/wncklet/window-menu.c
index 5deb32e9..de8b7928 100644
--- a/applets/wncklet/window-menu.c
+++ b/applets/wncklet/window-menu.c
@@ -221,7 +221,6 @@ gboolean window_menu_applet_fill(MatePanelApplet* applet)
{
WindowMenu* window_menu;
GtkActionGroup* action_group;
- gchar* ui_path;
window_menu = g_new0(WindowMenu, 1);
@@ -238,9 +237,9 @@ gboolean window_menu_applet_fill(MatePanelApplet* applet)
action_group = gtk_action_group_new("WindowMenu Applet Actions");
gtk_action_group_set_translation_domain(action_group, GETTEXT_PACKAGE);
gtk_action_group_add_actions(action_group, window_menu_actions, G_N_ELEMENTS(window_menu_actions), window_menu);
- ui_path = g_build_filename(WNCK_MENU_UI_DIR, "window-menu-menu.xml", NULL);
- mate_panel_applet_setup_menu_from_file(applet, ui_path, action_group);
- g_free(ui_path);
+ mate_panel_applet_setup_menu_from_resource (MATE_PANEL_APPLET (window_menu->applet),
+ WNCKLET_RESOURCE_PATH "window-menu-menu.xml",
+ action_group);
g_object_unref(action_group);
window_menu->selector = wnck_selector_new();
diff --git a/applets/wncklet/wncklet.gresource.xml b/applets/wncklet/wncklet.gresource.xml
new file mode 100644
index 00000000..c4a3adbc
--- /dev/null
+++ b/applets/wncklet/wncklet.gresource.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<gresources>
+ <gresource prefix="/org/mate/panel/applet/wncklet">
+ <file compressed="true">showdesktop-menu.xml</file>
+ <file compressed="true">window-list.ui</file>
+ <file compressed="true">window-list-menu.xml</file>
+ <file compressed="true">window-menu-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 a2230536..d561937f 100644
--- a/applets/wncklet/wncklet.h
+++ b/applets/wncklet/wncklet.h
@@ -30,6 +30,8 @@
#include <gtk/gtk.h>
#include <mate-panel-applet.h>
+#define WNCKLET_RESOURCE_PATH "/org/mate/panel/applet/wncklet/"
+
#ifdef __cplusplus
extern "C" {
#endif
diff --git a/applets/wncklet/workspace-switcher.c b/applets/wncklet/workspace-switcher.c
index 09a81d0b..2a13cebe 100644
--- a/applets/wncklet/workspace-switcher.c
+++ b/applets/wncklet/workspace-switcher.c
@@ -492,7 +492,6 @@ gboolean workspace_switcher_applet_fill(MatePanelApplet* applet)
{
PagerData* pager;
GtkActionGroup* action_group;
- gchar* ui_path;
gboolean display_names;
GtkCssProvider *provider;
@@ -577,9 +576,9 @@ gboolean workspace_switcher_applet_fill(MatePanelApplet* applet)
action_group = gtk_action_group_new("WorkspaceSwitcher Applet Actions");
gtk_action_group_set_translation_domain(action_group, GETTEXT_PACKAGE);
gtk_action_group_add_actions(action_group, pager_menu_actions, G_N_ELEMENTS(pager_menu_actions), pager);
- ui_path = g_build_filename(WNCK_MENU_UI_DIR, "workspace-switcher-menu.xml", NULL);
- mate_panel_applet_setup_menu_from_file(MATE_PANEL_APPLET(pager->applet), ui_path, action_group);
- g_free(ui_path);
+ mate_panel_applet_setup_menu_from_resource (MATE_PANEL_APPLET (pager->applet),
+ WNCKLET_RESOURCE_PATH "workspace-switcher-menu.xml",
+ action_group);
if (mate_panel_applet_get_locked_down(MATE_PANEL_APPLET(pager->applet)))
{
@@ -968,20 +967,10 @@ static void display_properties_dialog(GtkAction* action, PagerData* pager)
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");