summaryrefslogtreecommitdiff
path: root/cpufreq
diff options
context:
space:
mode:
authorrbuj <[email protected]>2020-07-18 23:59:25 +0200
committerraveit65 <[email protected]>2020-07-30 18:26:25 +0200
commitfd1a917a0ca74063ed52f9798c9491556b08c8f4 (patch)
treec59a951d7d9e4c362b130e1f075c0601dc173476 /cpufreq
parentc7077cfd71cc74222db699a910f8507c5c68b98c (diff)
downloadmate-applets-fd1a917a0ca74063ed52f9798c9491556b08c8f4.tar.bz2
mate-applets-fd1a917a0ca74063ed52f9798c9491556b08c8f4.tar.xz
cpufreq: Load menu and ui file from resources
Diffstat (limited to 'cpufreq')
-rw-r--r--cpufreq/Makefile.am40
-rw-r--r--cpufreq/cpufreq-resources.gresource.xml7
-rw-r--r--cpufreq/src/Makefile.am19
-rw-r--r--cpufreq/src/cpufreq-applet.c8
-rw-r--r--cpufreq/src/cpufreq-prefs.c3
5 files changed, 48 insertions, 29 deletions
diff --git a/cpufreq/Makefile.am b/cpufreq/Makefile.am
index f8136efc..a14f0053 100644
--- a/cpufreq/Makefile.am
+++ b/cpufreq/Makefile.am
@@ -1,3 +1,5 @@
+NULL =
+
SUBDIRS = help pixmaps src
cpufreq_gschema_in_files = org.mate.panel.applet.cpufreq.gschema.xml.in
@@ -26,25 +28,23 @@ org.mate.panel.applet.CPUFreqAppletFactory.service: $(service_in_files)
-e "s|\@LIBEXECDIR\@|$(libexecdir)|" \
$< > $@
-builder_DATA = cpufreq-preferences.ui
-
-uidir = $(datadir)/mate/ui
-ui_DATA = cpufreq-applet-menu.xml
-
-CLEANFILES = \
- $(applet_DATA) \
- $(applet_in_files) \
- $(service_DATA) \
- $(gsettings_SCHEMAS) \
- *.gschema.valid \
- *.bak \
- *.gladep
-
-EXTRA_DIST = \
- $(applet_in_files).in \
- $(service_in_files) \
- $(cpufreq_gschema_in_files) \
- $(builder_DATA) \
- $(ui_DATA)
+CLEANFILES = \
+ $(applet_DATA) \
+ $(applet_in_files) \
+ $(service_DATA) \
+ $(gsettings_SCHEMAS) \
+ *.gschema.valid \
+ $(NULL)
+
+EXTRA_DIST = \
+ $(applet_in_files).in \
+ $(service_in_files) \
+ $(cpufreq_gschema_in_files) \
+ $(builder_DATA) \
+ $(ui_DATA) \
+ cpufreq-applet-menu.xml \
+ cpufreq-preferences.ui \
+ cpufreq-resources.gresource.xml \
+ $(NULL)
-include $(top_srcdir)/git.mk
diff --git a/cpufreq/cpufreq-resources.gresource.xml b/cpufreq/cpufreq-resources.gresource.xml
new file mode 100644
index 00000000..6ae8945a
--- /dev/null
+++ b/cpufreq/cpufreq-resources.gresource.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<gresources>
+ <gresource prefix="/org/mate/mate-applets/cpufreq">
+ <file compressed="true">cpufreq-applet-menu.xml</file>
+ <file compressed="true">cpufreq-preferences.ui</file>
+ </gresource>
+</gresources>
diff --git a/cpufreq/src/Makefile.am b/cpufreq/src/Makefile.am
index 83ed7faa..cd64db9e 100644
--- a/cpufreq/src/Makefile.am
+++ b/cpufreq/src/Makefile.am
@@ -5,7 +5,7 @@ endif
SUBDIRS = $(selector_SUBDIR)
AM_CPPFLAGS = \
- -DCPUFREQ_MENU_UI_DIR=\""$(datadir)/mate/ui"\" \
+ -DCPUFREQ_RESOURCE_PATH=\""/org/mate/mate-applets/cpufreq/"\" \
$(MATE_APPLETS4_CFLAGS)
libexec_PROGRAMS = mate-cpufreq-applet
@@ -14,7 +14,13 @@ if HAVE_LIBCPUFREQ
cpufreq_files=cpufreq-monitor-libcpufreq.c cpufreq-monitor-libcpufreq.h
endif
-mate_cpufreq_applet_SOURCES = \
+BUILT_SOURCES = \
+ cpufreq-resources.c cpufreq-resources.h
+
+nodist_mate_cpufreq_applet_SOURCES = \
+ $(BUILT_SOURCES)
+
+mate_cpufreq_applet_SOURCES = \
cpufreq-applet.c cpufreq-applet.h \
cpufreq-utils.c cpufreq-utils.h \
cpufreq-prefs.c cpufreq-prefs.h \
@@ -34,4 +40,13 @@ mate_cpufreq_applet_LDADD = \
$(MATE_APPLETS4_LIBS) \
$(LIBCPUFREQ_LIBS)
+cpufreq-resources.c: $(top_srcdir)/cpufreq/cpufreq-resources.gresource.xml $(shell $(GLIB_COMPILE_RESOURCES) --sourcedir=$(top_srcdir)/cpufreq --generate-dependencies $(top_srcdir)/cpufreq/cpufreq-resources.gresource.xml)
+ $(AM_V_GEN)$(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=$(top_srcdir)/cpufreq --generate --c-name cpufreq $<
+
+cpufreq-resources.h: $(top_srcdir)/cpufreq/cpufreq-resources.gresource.xml $(shell $(GLIB_COMPILE_RESOURCES) --sourcedir=$(top_srcdir)/cpufreq --generate-dependencies $(top_srcdir)/cpufreq/cpufreq-resources.gresource.xml)
+ $(AM_V_GEN)$(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=$(top_srcdir)/cpufreq --generate --c-name cpufreq $<
+
+CLEANFILES = \
+ $(BUILT_SOURCES)
+
-include $(top_srcdir)/git.mk
diff --git a/cpufreq/src/cpufreq-applet.c b/cpufreq/src/cpufreq-applet.c
index a93d5fea..8412b17e 100644
--- a/cpufreq/src/cpufreq-applet.c
+++ b/cpufreq/src/cpufreq-applet.c
@@ -787,7 +787,6 @@ static void
cpufreq_applet_setup (CPUFreqApplet *applet)
{
GtkActionGroup *action_group;
- gchar *ui_path;
AtkObject *atk_obj;
GSettings *settings;
@@ -830,10 +829,9 @@ cpufreq_applet_setup (CPUFreqApplet *applet)
cpufreq_applet_menu_actions,
G_N_ELEMENTS (cpufreq_applet_menu_actions),
applet);
- ui_path = g_build_filename (CPUFREQ_MENU_UI_DIR, "cpufreq-applet-menu.xml", NULL);
- mate_panel_applet_setup_menu_from_file (MATE_PANEL_APPLET (applet),
- ui_path, action_group);
- g_free (ui_path);
+ mate_panel_applet_setup_menu_from_resource (MATE_PANEL_APPLET (applet),
+ CPUFREQ_RESOURCE_PATH "cpufreq-applet-menu.xml",
+ action_group);
if (mate_panel_applet_get_locked_down (MATE_PANEL_APPLET (applet))) {
GtkAction *action;
diff --git a/cpufreq/src/cpufreq-prefs.c b/cpufreq/src/cpufreq-prefs.c
index dfa6128a..0f425021 100644
--- a/cpufreq/src/cpufreq-prefs.c
+++ b/cpufreq/src/cpufreq-prefs.c
@@ -520,8 +520,7 @@ cpufreq_prefs_dialog_create (CPUFreqPrefs *prefs)
{
GtkBuilder *builder;
- builder = gtk_builder_new ();
- gtk_builder_add_from_file (builder, GTK_BUILDERDIR "/cpufreq-preferences.ui", NULL);
+ builder = gtk_builder_new_from_resource (CPUFREQ_RESOURCE_PATH "cpufreq-preferences.ui");
prefs->priv->dialog = GTK_WIDGET (gtk_builder_get_object (builder, "prefs_dialog"));