Skip to content

Commit

Permalink
panel: Convert to GResource
Browse files Browse the repository at this point in the history
  • Loading branch information
vuntz authored and raveit65 committed Apr 26, 2018
1 parent ee07e90 commit 1b7c43a
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 74 deletions.
50 changes: 36 additions & 14 deletions mate-panel/Makefile.am
Expand Up @@ -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 \
Expand Down Expand Up @@ -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 = \
Expand Down Expand Up @@ -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
Expand All @@ -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)
Expand Down
28 changes: 3 additions & 25 deletions mate-panel/panel-properties-dialog.c
Expand Up @@ -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>
Expand Down Expand Up @@ -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 =
Expand All @@ -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);

Expand Down
27 changes: 4 additions & 23 deletions mate-panel/panel-run-dialog.c
Expand Up @@ -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"
Expand Down Expand Up @@ -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;
Expand All @@ -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);

Expand Down
13 changes: 1 addition & 12 deletions mate-panel/panel-test-applets.c
Expand Up @@ -335,7 +335,6 @@ int
main (int argc, char **argv)
{
GtkBuilder *builder;
char *uifile;
char *applets_dir;
GError *error;

Expand Down Expand Up @@ -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);

Expand Down
6 changes: 6 additions & 0 deletions 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>
8 changes: 8 additions & 0 deletions 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>

0 comments on commit 1b7c43a

Please sign in to comment.