Skip to content
Permalink
Browse files

wncklet: Convert to GResource

  • Loading branch information...
vuntz authored and raveit65 committed Feb 2, 2012
1 parent 6b461de commit ff613c4f6a3a33c21cacc885116cacf87ef4bf03
@@ -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
@@ -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);
@@ -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");

@@ -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();
@@ -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>
@@ -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
@@ -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");

0 comments on commit ff613c4

Please sign in to comment.
You can’t perform that action at this time.