summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrbuj <[email protected]>2020-02-16 10:09:54 +0100
committerraveit65 <[email protected]>2020-02-27 12:03:36 +0100
commit199af60bcf16b99dc737302216e337066fdf5563 (patch)
tree0f3d37bf19014453cda833958288650b8fef9227 /src
parent044a21367b5968592d438fff980219dd08773952 (diff)
downloadmate-power-manager-199af60bcf16b99dc737302216e337066fdf5563.tar.bz2
mate-power-manager-199af60bcf16b99dc737302216e337066fdf5563.tar.xz
Read authors (updated) from mate-power-manager.about
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am10
-rw-r--r--src/gpm-tray-icon.c36
2 files changed, 39 insertions, 7 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index aed9cc9..1778cef 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -151,6 +151,14 @@ mate_power_preferences_CFLAGS = \
$(WARN_CFLAGS) \
$(NULL)
+mate-power-manager-resources.h mate-power-manager-resources.c: $(srcdir)/../data/org.mate.power-manager.manager.gresource.xml Makefile $(shell $(GLIB_COMPILE_RESOURCES) --generate-dependencies --sourcedir $(srcdir)/../data $(srcdir)/../data/org.mate.power-manager.manager.gresource.xml)
+ $(AM_V_GEN) XMLLINT=$(XMLLINT) $(GLIB_COMPILE_RESOURCES) --target $@ --sourcedir $(srcdir)/../data --generate --c-name preferences $<
+
+nodist_mate_power_manager_SOURCES = \
+ mate-power-manager-resources.h \
+ mate-power-manager-resources.c \
+ $(NULL)
+
mate_power_manager_SOURCES = \
gpm-dpms.h \
gpm-dpms.c \
@@ -316,6 +324,8 @@ clean-local:
CLEANFILES = \
$(BUILT_SOURCES) \
+ mate-power-manager-resources.h \
+ mate-power-manager-resources.c \
mate-power-preferences-resources.h \
mate-power-preferences-resources.c \
mate-power-statistics-resources.h \
diff --git a/src/gpm-tray-icon.c b/src/gpm-tray-icon.c
index f87506f..56e87b4 100644
--- a/src/gpm-tray-icon.c
+++ b/src/gpm-tray-icon.c
@@ -165,6 +165,9 @@ gpm_tray_icon_show_preferences_cb (GtkMenuItem *item, gpointer data)
egg_warning ("Couldn't execute command: %s", command);
}
+#define ABOUT_GROUP "About"
+#define EMAILIFY(string) (g_strdelimit ((string), "%", '@'))
+
/**
* gpm_tray_icon_show_about_cb:
* @action: A valid GtkAction
@@ -172,13 +175,30 @@ gpm_tray_icon_show_preferences_cb (GtkMenuItem *item, gpointer data)
static void
gpm_tray_icon_show_about_cb (GtkMenuItem *item, gpointer data)
{
- const gchar *authors[] =
- {
- "Perberos",
- "Steve Zesch",
- "Stefano Karapetsas",
- NULL
- };
+ GKeyFile *key_file;
+ GBytes *bytes;
+ const guint8 *data_resource;
+ gsize data_resource_len;
+ GError *error = NULL;
+ char **authors;
+ gsize n_authors = 0, i;
+
+ bytes = g_resources_lookup_data ("/org/mate/powermanager/manager/mate-power-manager.about",
+ G_RESOURCE_LOOKUP_FLAGS_NONE, &error);
+ g_assert_no_error (error);
+
+ data_resource = g_bytes_get_data (bytes, &data_resource_len);
+ key_file = g_key_file_new ();
+ g_key_file_load_from_data (key_file, (const char *) data_resource, data_resource_len, 0, &error);
+ g_assert_no_error (error);
+
+ authors = g_key_file_get_string_list (key_file, ABOUT_GROUP, "Authors", &n_authors, NULL);
+
+ g_key_file_free (key_file);
+ g_bytes_unref (bytes);
+
+ for (i = 0; i < n_authors; ++i)
+ authors[i] = EMAILIFY (authors[i]);
gtk_show_about_dialog (NULL,
"program-name", _("Power Manager"),
@@ -195,6 +215,8 @@ gpm_tray_icon_show_about_cb (GtkMenuItem *item, gpointer data)
"logo-icon-name", "mate-power-manager",
"website", "https://mate-desktop.org",
NULL);
+
+ g_strfreev (authors);
}
/**