diff options
author | Vincent Untz <[email protected]> | 2012-02-02 14:54:58 +0100 |
---|---|---|
committer | raveit65 <[email protected]> | 2018-04-26 13:01:37 +0200 |
commit | 1b7c43adfa25eee678661e4d56dfa37888ff27c0 (patch) | |
tree | 0da6e30fd46ec17040d7aec92bc24040983eb8ac | |
parent | ee07e90d14c15dbf45899d6c70614fe2068cd640 (diff) | |
download | mate-panel-1b7c43adfa25eee678661e4d56dfa37888ff27c0.tar.bz2 mate-panel-1b7c43adfa25eee678661e4d56dfa37888ff27c0.tar.xz |
panel: Convert to GResource
origin commits:
https://git.gnome.org/browse/gnome-panel/commit/?h=gnome-3-4&id=9fca67f
https://git.gnome.org/browse/gnome-panel/commit/?h=gnome-3-4&id=695d30c
https://git.gnome.org/browse/gnome-panel/patch/?id=00f9870cb28e6ef657d1
-rw-r--r-- | mate-panel/Makefile.am | 50 | ||||
-rw-r--r-- | mate-panel/panel-properties-dialog.c | 28 | ||||
-rw-r--r-- | mate-panel/panel-run-dialog.c | 27 | ||||
-rw-r--r-- | mate-panel/panel-test-applets.c | 13 | ||||
-rw-r--r-- | mate-panel/panel-test-applets.gresource.xml | 6 | ||||
-rw-r--r-- | mate-panel/panel.gresource.xml | 8 |
6 files changed, 58 insertions, 74 deletions
diff --git a/mate-panel/Makefile.am b/mate-panel/Makefile.am index b108288b..6de930be 100644 --- a/mate-panel/Makefile.am +++ b/mate-panel/Makefile.am @@ -13,19 +13,14 @@ AM_CPPFLAGS = \ -I$(top_builddir)/mate-panel \ -I$(top_builddir)/mate-panel/libpanel-util \ -DMATELOCALEDIR=\""$(prefix)/$(DATADIRNAME)/locale"\" \ - -DBUILDERDIR=\""$(uidir)"\" \ -DPANELDATADIR=\""$(datadir)/mate-panel"\" \ - -DDATADIR=\""$(datadir)"\" - -DICONDIR=\""$(datadir)/mate-panel/pixmaps"\" \ + -DDATADIR=\""$(datadir)"\" \ $(DISABLE_DEPRECATED_CFLAGS) AM_CFLAGS = $(WARN_CFLAGS) panel_sources = \ - panel-typebuiltins.c \ - panel-typebuiltins.h \ - panel-marshal.c \ - panel-marshal.h \ + $(mate_panel_BUILT_SOURCES) \ main.c \ panel-widget.c \ button-widget.c \ @@ -159,10 +154,10 @@ mate_desktop_item_edit_LDADD = \ -lX11 mate_panel_test_applets_SOURCES = \ + $(panel_test_applets_BUILT_SOURCES) \ panel-modules.c \ panel-applet-info.c \ panel-applets-manager.c \ - panel-marshal.c \ panel-test-applets.c mate_panel_test_applets_CPPFLAGS = \ @@ -218,17 +213,41 @@ panel-typebuiltins.h: @REBUILD@ $(panel_enum_headers) --eprod "GType @enum_name@_get_type (void);\n" \ $(panel_enum_headers) > $@ -BUILT_SOURCES = \ +mate_panel_BUILT_SOURCES = \ panel-typebuiltins.c \ panel-typebuiltins.h \ + panel-resources.c \ + panel-resources.h \ panel-marshal.c \ panel-marshal.h -uidir = $(datadir)/mate-panel/ui -ui_DATA = \ +panel_test_applets_BUILT_SOURCES = \ + panel-test-applets-resources.c \ + panel-test-applets-resources.h \ + panel-marshal.c \ + panel-marshal.h + +BUILT_SOURCES = \ + $(mate_panel_BUILT_SOURCES) \ + $(panel_test_applets_BUILT_SOURCES) + +ui_FILES = \ panel-properties-dialog.ui \ - panel-run-dialog.ui \ - panel-test-applets.ui + panel-run-dialog.ui + +panel-resources.c: panel.gresource.xml $(shell $(GLIB_COMPILE_RESOURCES) --sourcedir=$(srcdir) --generate-dependencies $(srcdir)/panel.gresource.xml) + $(AM_V_GEN)$(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=$(srcdir) --generate --c-name panel $< + +panel-resources.h: panel.gresource.xml $(shell $(GLIB_COMPILE_RESOURCES) --sourcedir=$(srcdir) --generate-dependencies $(srcdir)/panel.gresource.xml) + $(AM_V_GEN)$(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=$(srcdir) --generate --c-name panel $< + +uitest_FILES = panel-test-applets.ui + +panel-test-applets-resources.c: panel-test-applets.gresource.xml $(shell $(GLIB_COMPILE_RESOURCES) --sourcedir=$(srcdir) --generate-dependencies $(srcdir)/panel-test-applets.gresource.xml) + $(AM_V_GEN)$(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=$(srcdir) --generate --c-name panel $< + +panel-test-applets-resources.h: panel-test-applets.gresource.xml $(shell $(GLIB_COMPILE_RESOURCES) --sourcedir=$(srcdir) --generate-dependencies $(srcdir)/panel-test-applets.gresource.xml) + $(AM_V_GEN)$(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=$(srcdir) --generate --c-name panel $< desktopdir = $(datadir)/applications desktop_in_files = mate-panel.desktop.in @@ -237,7 +256,10 @@ desktop_DATA = $(desktop_in_files:.desktop.in=.desktop) @INTLTOOL_DESKTOP_RULE@ EXTRA_DIST = \ - $(ui_DATA) \ + $(ui_FILES) \ + panel.gresource.xml \ + $(uitest_FILES) \ + panel-test-applets.gresource.xml \ panel-marshal.list \ $(entries_DATA) \ $(desktop_in_files) diff --git a/mate-panel/panel-properties-dialog.c b/mate-panel/panel-properties-dialog.c index 809d7ff8..97a9babd 100644 --- a/mate-panel/panel-properties-dialog.c +++ b/mate-panel/panel-properties-dialog.c @@ -30,7 +30,6 @@ #include <glib/gi18n.h> #include <gio/gio.h> -#include <libpanel-util/panel-error.h> #include <libpanel-util/panel-glib.h> #include <libpanel-util/panel-gtk.h> #include <libpanel-util/panel-icon-chooser.h> @@ -911,7 +910,6 @@ panel_properties_dialog_present (PanelToplevel *toplevel) { PanelPropertiesDialog *dialog; GtkBuilder *gui; - GError *error; if (!panel_properties_dialog_quark) panel_properties_dialog_quark = @@ -927,29 +925,9 @@ panel_properties_dialog_present (PanelToplevel *toplevel) gui = gtk_builder_new (); gtk_builder_set_translation_domain (gui, GETTEXT_PACKAGE); - - error = NULL; - gtk_builder_add_from_file (gui, - BUILDERDIR "/panel-properties-dialog.ui", - &error); - - if (error) { - char *secondary; - - secondary = g_strdup_printf (_("Unable to load file '%s': %s."), - BUILDERDIR"/panel-properties-dialog.ui", - error->message); - panel_error_dialog (GTK_WINDOW (toplevel), - gtk_window_get_screen (GTK_WINDOW (toplevel)), - "cannot_display_properties_dialog", TRUE, - _("Could not display properties dialog"), - secondary); - g_free (secondary); - g_error_free (error); - g_object_unref (gui); - - return; - } + gtk_builder_add_from_resource (gui, + PANEL_RESOURCE_PATH "panel-properties-dialog.ui", + NULL); dialog = panel_properties_dialog_new (toplevel, gui); diff --git a/mate-panel/panel-run-dialog.c b/mate-panel/panel-run-dialog.c index 7729c56b..bb7172c7 100644 --- a/mate-panel/panel-run-dialog.c +++ b/mate-panel/panel-run-dialog.c @@ -55,6 +55,7 @@ #include "panel-globals.h" #include "panel-enums.h" #include "panel-profile.h" +#include "panel-schemas.h" #include "panel-stock-icons.h" #include "panel-multiscreen.h" #include "menu.h" @@ -2011,7 +2012,6 @@ panel_run_dialog_present (GdkScreen *screen, guint32 activate_time) { GtkBuilder *gui; - GError *error; if (panel_lockdown_get_disable_command_line ()) return; @@ -2026,28 +2026,9 @@ panel_run_dialog_present (GdkScreen *screen, gui = gtk_builder_new (); gtk_builder_set_translation_domain (gui, GETTEXT_PACKAGE); - - error = NULL; - gtk_builder_add_from_file (gui, - BUILDERDIR "/panel-run-dialog.ui", - &error); - - if (error) { - char *secondary; - - secondary = g_strdup_printf (_("Unable to load file '%s': %s."), - BUILDERDIR"/panel-run-dialog.ui", - error->message); - panel_error_dialog (NULL, screen, "cannot_display_run_dialog", - TRUE, - _("Could not display run dialog"), - secondary); - g_free (secondary); - g_error_free (error); - g_object_unref (gui); - - return; - } + gtk_builder_add_from_resource (gui, + PANEL_RESOURCE_PATH "panel-run-dialog.ui", + NULL); static_dialog = panel_run_dialog_new (screen, gui, activate_time); diff --git a/mate-panel/panel-test-applets.c b/mate-panel/panel-test-applets.c index f7100e52..8123a882 100644 --- a/mate-panel/panel-test-applets.c +++ b/mate-panel/panel-test-applets.c @@ -335,7 +335,6 @@ int main (int argc, char **argv) { GtkBuilder *builder; - char *uifile; char *applets_dir; GError *error; @@ -374,17 +373,7 @@ main (int argc, char **argv) builder = gtk_builder_new (); gtk_builder_set_translation_domain (builder, GETTEXT_PACKAGE); - - uifile = BUILDERDIR "/panel-test-applets.ui"; - gtk_builder_add_from_file (builder, uifile, &error); - - if (error) { - g_warning ("Error loading \"%s\": %s", uifile, error->message); - g_error_free (error); - panel_cleanup_do (); - - return 1; - } + gtk_builder_add_from_resource (builder, "/org/mate/panel/test/panel-test-applets.ui", NULL); gtk_builder_connect_signals (builder, NULL); diff --git a/mate-panel/panel-test-applets.gresource.xml b/mate-panel/panel-test-applets.gresource.xml new file mode 100644 index 00000000..9408f7d8 --- /dev/null +++ b/mate-panel/panel-test-applets.gresource.xml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> +<gresources> + <gresource prefix="/org/mate/panel/test"> + <file compressed="true">panel-test-applets.ui</file> + </gresource> +</gresources> diff --git a/mate-panel/panel.gresource.xml b/mate-panel/panel.gresource.xml new file mode 100644 index 00000000..c49541d0 --- /dev/null +++ b/mate-panel/panel.gresource.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<gresources> + <gresource prefix="/org/mate/panel"> + <file compressed="true">panel-properties-dialog.ui</file> + <file compressed="true">panel-run-dialog.ui</file> + <file alias="anim/wanda.png">../applets/fish/wanda.png</file> + </gresource> +</gresources> |