Skip to content

File tree

7 files changed

+47
-52
lines changed

7 files changed

+47
-52
lines changed

‎applets/wncklet/Makefile.am‎

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@ AM_CPPFLAGS = \
66
-I$(top_srcdir)/libmate-panel-applet \
77
-I$(top_builddir)/libmate-panel-applet \
88
-DMATELOCALEDIR=\""$(prefix)/$(DATADIRNAME)/locale"\" \
9-
-DPAGER_BUILDERDIR=\""$(uidir)"\" \
10-
-DTASKLIST_BUILDERDIR=\""$(uidir)"\" \
11-
-DWNCK_MENU_UI_DIR=\""$(xmluidir)"\" \
129
$(DISABLE_DEPRECATED_CFLAGS)
1310

1411
AM_CFLAGS = $(WARN_CFLAGS)
@@ -23,7 +20,8 @@ WNCKLET_SOURCES = \
2320
workspace-switcher.c \
2421
workspace-switcher.h \
2522
showdesktop.c \
26-
showdesktop.h
23+
showdesktop.h \
24+
$(BUILT_SOURCES)
2725

2826
WNCKLET_LDADD = \
2927
../../libmate-panel-applet/libmate-panel-applet-4.la \
@@ -74,15 +72,23 @@ org.mate.panel.applet.WnckletFactory.service: $(service_in_files)
7472
$< > $@
7573
endif
7674

77-
uidir = $(datadir)/mate-panel/ui
78-
ui_DATA = workspace-switcher.ui window-list.ui
79-
80-
xmluidir = $(datadir)/mate-panel/ui
81-
xmlui_DATA = \
75+
ui_FILES = \
76+
showdesktop-menu.xml \
77+
window-list-menu.xml \
78+
window-list.ui \
8279
window-menu-menu.xml \
8380
workspace-switcher-menu.xml \
84-
showdesktop-menu.xml \
85-
window-list-menu.xml
81+
workspace-switcher.ui
82+
83+
wncklet-resources.c: wncklet.gresource.xml $(shell $(GLIB_COMPILE_RESOURCES) --sourcedir=$(srcdir) --generate-dependencies $(srcdir)/wncklet.gresource.xml)
84+
$(AM_V_GEN)$(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=$(srcdir) --generate --c-name wncklet $<
85+
86+
wncklet-resources.h: wncklet.gresource.xml $(shell $(GLIB_COMPILE_RESOURCES) --sourcedir=$(srcdir) --generate-dependencies $(srcdir)/wncklet.gresource.xml)
87+
$(AM_V_GEN)$(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=$(srcdir) --generate --c-name wncklet $<
88+
89+
BUILT_SOURCES = \
90+
wncklet-resources.c \
91+
wncklet-resources.h
8692

8793
wncklet_gschemas_in = \
8894
org.mate.panel.applet.window-list.gschema.xml.in \
@@ -95,10 +101,10 @@ gsettings_SCHEMAS = $(wncklet_gschemas_in:.xml.in=.xml)
95101
EXTRA_DIST = \
96102
org.mate.panel.Wncklet.mate-panel-applet.in.in \
97103
$(service_in_files) \
98-
$(xmlui_DATA) \
99104
$(wncklet_gschemas_in) \
100-
$(ui_DATA)
105+
$(ui_FILES) \
106+
wncklet.gresource.xml
101107

102-
CLEANFILES = $(applet_DATA) $(applet_DATA).in $(service_DATA) $(gsettings_SCHEMAS)
108+
CLEANFILES = $(BUILT_SOURCES) $(applet_DATA) $(applet_DATA).in $(service_DATA) $(gsettings_SCHEMAS)
103109

104110
-include $(top_srcdir)/git.mk

‎applets/wncklet/showdesktop.c‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,6 @@ gboolean show_desktop_applet_fill(MatePanelApplet* applet)
372372
{
373373
ShowDesktopData* sdd;
374374
GtkActionGroup* action_group;
375-
gchar* ui_path;
376375
AtkObject* atk_obj;
377376
GtkCssProvider *provider;
378377

@@ -440,9 +439,9 @@ gboolean show_desktop_applet_fill(MatePanelApplet* applet)
440439
action_group = gtk_action_group_new("ShowDesktop Applet Actions");
441440
gtk_action_group_set_translation_domain(action_group, GETTEXT_PACKAGE);
442441
gtk_action_group_add_actions(action_group, show_desktop_menu_actions, G_N_ELEMENTS (show_desktop_menu_actions), sdd);
443-
ui_path = g_build_filename(WNCK_MENU_UI_DIR, "showdesktop-menu.xml", NULL);
444-
mate_panel_applet_setup_menu_from_file(MATE_PANEL_APPLET(sdd->applet), ui_path, action_group);
445-
g_free(ui_path);
442+
mate_panel_applet_setup_menu_from_resource (MATE_PANEL_APPLET (sdd->applet),
443+
WNCKLET_RESOURCE_PATH "showdesktop-menu.xml",
444+
action_group);
446445
g_object_unref(action_group);
447446

448447
g_signal_connect(G_OBJECT(sdd->applet), "destroy", G_CALLBACK(applet_destroyed), sdd);

‎applets/wncklet/window-list.c‎

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,6 @@ gboolean window_list_applet_fill(MatePanelApplet* applet)
372372
{
373373
TasklistData* tasklist;
374374
GtkActionGroup* action_group;
375-
gchar* ui_path;
376375
GtkCssProvider *provider;
377376
GdkScreen *screen;
378377

@@ -468,9 +467,9 @@ gboolean window_list_applet_fill(MatePanelApplet* applet)
468467
/* end of system monitor item */
469468

470469

471-
ui_path = g_build_filename(WNCK_MENU_UI_DIR, "window-list-menu.xml", NULL);
472-
mate_panel_applet_setup_menu_from_file(MATE_PANEL_APPLET(tasklist->applet), ui_path, action_group);
473-
g_free(ui_path);
470+
mate_panel_applet_setup_menu_from_resource (MATE_PANEL_APPLET (tasklist->applet),
471+
WNCKLET_RESOURCE_PATH "window-list-menu.xml",
472+
action_group);
474473

475474
if (mate_panel_applet_get_locked_down(MATE_PANEL_APPLET(tasklist->applet)))
476475
{
@@ -649,20 +648,10 @@ static void display_properties_dialog(GtkAction* action, TasklistData* tasklist)
649648
if (tasklist->properties_dialog == NULL)
650649
{
651650
GtkBuilder* builder;
652-
GError* error;
653651

654652
builder = gtk_builder_new();
655653
gtk_builder_set_translation_domain(builder, GETTEXT_PACKAGE);
656-
657-
error = NULL;
658-
gtk_builder_add_from_file(builder, TASKLIST_BUILDERDIR "/window-list.ui", &error);
659-
660-
if (error)
661-
{
662-
g_warning("Error loading preferences: %s", error->message);
663-
g_error_free(error);
664-
return;
665-
}
654+
gtk_builder_add_from_resource (builder, WNCKLET_RESOURCE_PATH "window-list.ui", NULL);
666655

667656
tasklist->properties_dialog = WID("tasklist_properties_dialog");
668657

‎applets/wncklet/window-menu.c‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,6 @@ gboolean window_menu_applet_fill(MatePanelApplet* applet)
221221
{
222222
WindowMenu* window_menu;
223223
GtkActionGroup* action_group;
224-
gchar* ui_path;
225224

226225
window_menu = g_new0(WindowMenu, 1);
227226

@@ -238,9 +237,9 @@ gboolean window_menu_applet_fill(MatePanelApplet* applet)
238237
action_group = gtk_action_group_new("WindowMenu Applet Actions");
239238
gtk_action_group_set_translation_domain(action_group, GETTEXT_PACKAGE);
240239
gtk_action_group_add_actions(action_group, window_menu_actions, G_N_ELEMENTS(window_menu_actions), window_menu);
241-
ui_path = g_build_filename(WNCK_MENU_UI_DIR, "window-menu-menu.xml", NULL);
242-
mate_panel_applet_setup_menu_from_file(applet, ui_path, action_group);
243-
g_free(ui_path);
240+
mate_panel_applet_setup_menu_from_resource (MATE_PANEL_APPLET (window_menu->applet),
241+
WNCKLET_RESOURCE_PATH "window-menu-menu.xml",
242+
action_group);
244243
g_object_unref(action_group);
245244

246245
window_menu->selector = wnck_selector_new();
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<gresources>
3+
<gresource prefix="/org/mate/panel/applet/wncklet">
4+
<file compressed="true">showdesktop-menu.xml</file>
5+
<file compressed="true">window-list.ui</file>
6+
<file compressed="true">window-list-menu.xml</file>
7+
<file compressed="true">window-menu-menu.xml</file>
8+
<file compressed="true">workspace-switcher.ui</file>
9+
<file compressed="true">workspace-switcher-menu.xml</file>
10+
</gresource>
11+
</gresources>

‎applets/wncklet/wncklet.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
#include <gtk/gtk.h>
3131
#include <mate-panel-applet.h>
3232

33+
#define WNCKLET_RESOURCE_PATH "/org/mate/panel/applet/wncklet/"
34+
3335
#ifdef __cplusplus
3436
extern "C" {
3537
#endif

‎applets/wncklet/workspace-switcher.c‎

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,6 @@ gboolean workspace_switcher_applet_fill(MatePanelApplet* applet)
492492
{
493493
PagerData* pager;
494494
GtkActionGroup* action_group;
495-
gchar* ui_path;
496495
gboolean display_names;
497496
GtkCssProvider *provider;
498497

@@ -577,9 +576,9 @@ gboolean workspace_switcher_applet_fill(MatePanelApplet* applet)
577576
action_group = gtk_action_group_new("WorkspaceSwitcher Applet Actions");
578577
gtk_action_group_set_translation_domain(action_group, GETTEXT_PACKAGE);
579578
gtk_action_group_add_actions(action_group, pager_menu_actions, G_N_ELEMENTS(pager_menu_actions), pager);
580-
ui_path = g_build_filename(WNCK_MENU_UI_DIR, "workspace-switcher-menu.xml", NULL);
581-
mate_panel_applet_setup_menu_from_file(MATE_PANEL_APPLET(pager->applet), ui_path, action_group);
582-
g_free(ui_path);
579+
mate_panel_applet_setup_menu_from_resource (MATE_PANEL_APPLET (pager->applet),
580+
WNCKLET_RESOURCE_PATH "workspace-switcher-menu.xml",
581+
action_group);
583582

584583
if (mate_panel_applet_get_locked_down(MATE_PANEL_APPLET(pager->applet)))
585584
{
@@ -968,20 +967,10 @@ static void display_properties_dialog(GtkAction* action, PagerData* pager)
968967
if (pager->properties_dialog == NULL)
969968
{
970969
GtkBuilder* builder;
971-
GError* error;
972970

973971
builder = gtk_builder_new();
974972
gtk_builder_set_translation_domain(builder, GETTEXT_PACKAGE);
975-
976-
error = NULL;
977-
gtk_builder_add_from_file(builder, PAGER_BUILDERDIR "/workspace-switcher.ui", &error);
978-
979-
if (error)
980-
{
981-
g_warning("Error loading preferences: %s", error->message);
982-
g_error_free(error);
983-
return;
984-
}
973+
gtk_builder_add_from_resource (builder, WNCKLET_RESOURCE_PATH "workspace-switcher.ui", NULL);
985974

986975
pager->properties_dialog = WID("pager_properties_dialog");
987976

0 commit comments

Comments
 (0)