[nautilus] progress-ui: add a "Show Details" action to the notification



commit 046927432a01f7a4bb7a4dc9c96005548950ca79
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Thu Feb 3 17:19:45 2011 -0500

    progress-ui: add a "Show Details" action to the notification

 src/nautilus-progress-ui-handler.c |   24 ++++++++++++++++++++++++
 1 files changed, 24 insertions(+), 0 deletions(-)
---
diff --git a/src/nautilus-progress-ui-handler.c b/src/nautilus-progress-ui-handler.c
index 00cd0c9..abd66ce 100644
--- a/src/nautilus-progress-ui-handler.c
+++ b/src/nautilus-progress-ui-handler.c
@@ -67,6 +67,8 @@ G_DEFINE_TYPE (NautilusProgressUIHandler, nautilus_progress_ui_handler, G_TYPE_O
  * - in the same case, but the window was showing, we just hide the window
  */
 
+#define ACTION_DETAILS "details"
+
 static void
 status_icon_activate_cb (GtkStatusIcon *icon,
 			 NautilusProgressUIHandler *self)
@@ -76,6 +78,22 @@ status_icon_activate_cb (GtkStatusIcon *icon,
 }
 
 static void
+notification_show_details_cb (NotifyNotification *notification,
+			      char *action_name,
+			      gpointer user_data)
+{
+	NautilusProgressUIHandler *self = user_data;
+
+
+	if (g_strcmp0 (action_name, ACTION_DETAILS) != 0) {
+		return;
+	}
+
+	notify_notification_close (self->priv->progress_notification, NULL);
+	gtk_window_present (GTK_WINDOW (self->priv->progress_window));
+}
+
+static void
 progress_ui_handler_ensure_notification (NautilusProgressUIHandler *self)
 {
 	NotifyNotification *notify;
@@ -91,6 +109,12 @@ progress_ui_handler_ensure_notification (NautilusProgressUIHandler *self)
 	notify_notification_set_category (notify, "transfer");
 	notify_notification_set_hint (notify, "resident",
 				      g_variant_new_boolean (TRUE));
+
+	notify_notification_add_action (notify, ACTION_DETAILS,
+					_("Show Details"),
+					notification_show_details_cb,
+					self,
+					NULL);
 }
 
 static void



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]