aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/service.c6
-rw-r--r--src/utils.c52
-rw-r--r--src/utils.h3
3 files changed, 61 insertions, 0 deletions
diff --git a/src/service.c b/src/service.c
index c86df15..25806e4 100644
--- a/src/service.c
+++ b/src/service.c
@@ -819,6 +819,12 @@ on_statistics_activated (GSimpleAction * a G_GNUC_UNUSED,
execute_command (cmd);
g_free (cmd);
}
+ else
+ {
+ zenity_warning ("dialog-warning",
+ _("Warning"),
+ _("The Ayatana Power Indicator does not support evoking the\npower statistics application your desktop environment, yet.\n\nPlease report this to the developers at:\nhttps://github.com/ArcticaProject/ayatana-indicator-power/issues"));
+ }
}
static void
diff --git a/src/utils.c b/src/utils.c
index 2e4c4cb..4bb063b 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -40,6 +40,52 @@ execute_command (const gchar * cmd)
}
}
+gboolean
+zenity_warning (const char * icon_name,
+ const char * title,
+ const char * text)
+{
+ char * command_line;
+ int exit_status;
+ GError * error;
+ gboolean confirmed;
+ char * zenity;
+
+ confirmed = FALSE;
+ zenity = g_find_program_in_path ("zenity");
+
+ if (zenity)
+ {
+ command_line = g_strdup_printf ("%s"
+ " --warning"
+ " --icon-name=\"%s\""
+ " --title=\"%s\""
+ " --text=\"%s\""
+ " --no-wrap",
+ zenity,
+ icon_name,
+ title,
+ text);
+
+ /* Treat errors as user confirmation.
+ Otherwise how will the user ever log out? */
+ exit_status = -1;
+ error = NULL;
+ if (!g_spawn_command_line_sync (command_line, NULL, NULL, &exit_status, &error))
+ {
+ confirmed = TRUE;
+ }
+ else
+ {
+ confirmed = g_spawn_check_exit_status (exit_status, &error);
+ }
+
+ g_free (command_line);
+ }
+ g_free (zenity);
+ return confirmed;
+}
+
void
utils_handle_settings_request (void)
{
@@ -80,6 +126,12 @@ utils_handle_settings_request (void)
g_free (path);
}
+ else
+ {
+ zenity_warning ("dialog-warning",
+ _("Warning"),
+ _("The Ayatana Power Indicator does not support evoking the\npower settings dialog for your desktop environment, yet.\n\nPlease report this to the developers at:\nhttps://github.com/ArcticaProject/ayatana-indicator-power/issues"));
+ }
}
execute_command (control_center_cmd);
diff --git a/src/utils.h b/src/utils.h
index ad32aad..3143625 100644
--- a/src/utils.h
+++ b/src/utils.h
@@ -18,11 +18,14 @@
#define __INDICATOR_POWER_UTILS_H__
#include <glib.h>
+#include <glib/gi18n.h>
#include <string.h>
void execute_command (const gchar * cmd);
void utils_handle_settings_request(void);
+gboolean zenity_warning (const char * icon_name, const char * title, const char * text);
+
gboolean is_unity();
gboolean is_gnome();
gboolean is_mate();