[drwright] Add 'Settings...' action to the notification
- From: Christopher Aillon <caillon src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [drwright] Add 'Settings...' action to the notification
- Date: Thu, 3 Mar 2011 22:36:05 +0000 (UTC)
commit a832e4393e796166152a325de53cc2a382488138
Author: Christopher Aillon <caillon redhat com>
Date: Thu Mar 3 13:30:48 2011 -0800
Add 'Settings...' action to the notification
GNOME bug 643535 part 4
src/drwright.c | 29 +++++++++++++++++++++++++++++
1 files changed, 29 insertions(+), 0 deletions(-)
---
diff --git a/src/drwright.c b/src/drwright.c
index 32fca55..40762e3 100644
--- a/src/drwright.c
+++ b/src/drwright.c
@@ -95,6 +95,9 @@ notification_action_cb (NotifyNotification *notification,
const char *action,
DrWright *dr)
{
+ GAppInfo *app_info;
+ GdkAppLaunchContext *launch_context;
+
g_assert (action != NULL);
if (g_strcmp0 (action, "take-break") == 0) {
@@ -103,6 +106,28 @@ notification_action_cb (NotifyNotification *notification,
maybe_change_state (dr);
}
}
+ else if (g_strcmp0 (action, "settings") == 0) {
+ GError *error = NULL;
+
+ launch_context = gdk_display_get_app_launch_context (gdk_display_get_default ());
+
+ app_info = g_app_info_create_from_commandline (BINDIR "/gnome-control-center typing-break",
+ NULL,
+ G_APP_INFO_CREATE_SUPPORTS_STARTUP_NOTIFICATION,
+ &error);
+ if (error) {
+ g_warning ("%s", error->message);
+ goto out;
+ }
+
+ g_app_info_launch (app_info, NULL, G_APP_LAUNCH_CONTEXT (launch_context), &error);
+ if (error) {
+ g_warning ("%s", error->message);
+ }
+out:
+ g_clear_error (&error);
+ g_object_unref (launch_context);
+ }
else {
g_warning ("Unknown action: %s", action);
}
@@ -161,6 +186,10 @@ show_warning_notification (DrWright *dr, gboolean show)
notify_notification_set_hint (notification, "resident",
g_variant_new_boolean (TRUE));
notify_notification_add_action (notification,
+ "settings", _("Settingsâ?¦"),
+ NOTIFY_ACTION_CALLBACK (notification_action_cb),
+ dr, NULL);
+ notify_notification_add_action (notification,
"take-break", _("Take Break Now"),
NOTIFY_ACTION_CALLBACK (notification_action_cb),
dr, NULL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]