[gnome-flashback] libend-session-dialog: add support for more dialog actions



commit 8b486bb7df91b57cb1a382008eff9b2948a332bb
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Wed Oct 22 21:53:54 2014 +0300

    libend-session-dialog: add support for more dialog actions
    
    Add support for Hibernate, Suspend and Hybrid Sleep actions. This
    requires additional work in gnome-panel module.
    
    https://mail.gnome.org/archives/gnome-flashback-list/2014-October/msg00096.html

 .../flashback-end-session-dialog.c                 |    6 ++++
 .../flashback-inhibit-dialog.c                     |   27 ++++++++++++++++++++
 .../flashback-inhibit-dialog.h                     |    5 +++-
 .../org.gnome.SessionManager.EndSessionDialog.xml  |    6 +++-
 4 files changed, 42 insertions(+), 2 deletions(-)
---
diff --git a/gnome-flashback/libend-session-dialog/flashback-end-session-dialog.c 
b/gnome-flashback/libend-session-dialog/flashback-end-session-dialog.c
index db07c99..dc79b57 100644
--- a/gnome-flashback/libend-session-dialog/flashback-end-session-dialog.c
+++ b/gnome-flashback/libend-session-dialog/flashback-end-session-dialog.c
@@ -51,6 +51,12 @@ inhibit_dialog_response (FlashbackInhibitDialog *dialog,
                        dbus_end_session_dialog_emit_confirmed_shutdown (object);
                } else if (action == FLASHBACK_LOGOUT_ACTION_REBOOT) {
                        dbus_end_session_dialog_emit_confirmed_reboot (object);
+               } else if (action == FLASHBACK_LOGOUT_ACTION_HIBERNATE) {
+                       dbus_end_session_dialog_emit_confirmed_hibernate (object);
+               } else if (action == FLASHBACK_LOGOUT_ACTION_SUSPEND) {
+                       dbus_end_session_dialog_emit_confirmed_suspend (object);
+               } else if (action == FLASHBACK_LOGOUT_ACTION_HYBRID_SLEEP) {
+                       dbus_end_session_dialog_emit_confirmed_hybrid_sleep (object);
                } else {
                        g_assert_not_reached ();
                }
diff --git a/gnome-flashback/libend-session-dialog/flashback-inhibit-dialog.c 
b/gnome-flashback/libend-session-dialog/flashback-inhibit-dialog.c
index 9f6e2ab..05f59d4 100644
--- a/gnome-flashback/libend-session-dialog/flashback-inhibit-dialog.c
+++ b/gnome-flashback/libend-session-dialog/flashback-inhibit-dialog.c
@@ -434,6 +434,24 @@ update_dialog_text (FlashbackInhibitDialog *dialog)
                                        seconds);
                        description = g_strdup_printf (tmp, seconds);
                }
+       } else if (dialog->priv->action == FLASHBACK_LOGOUT_ACTION_HIBERNATE) {
+               title = _("Hibernate");
+               tmp = ngettext ("The system will hibernate automatically in %d second.",
+                               "The system will hibernate automatically in %d seconds.",
+                               seconds);
+               description = g_strdup_printf (tmp, seconds);
+       } else if (dialog->priv->action == FLASHBACK_LOGOUT_ACTION_SUSPEND) {
+               title = _("Suspend");
+               tmp = ngettext ("The system will suspend automatically in %d second.",
+                               "The system will suspend automatically in %d seconds.",
+                               seconds);
+               description = g_strdup_printf (tmp, seconds);
+       } else if (dialog->priv->action == FLASHBACK_LOGOUT_ACTION_HYBRID_SLEEP) {
+               title = _("Hybrid Sleep");
+               tmp = ngettext ("The system will hybrid sleep automatically in %d second.",
+                               "The system will hybrid sleep automatically in %d seconds.",
+                               seconds);
+               description = g_strdup_printf (tmp, seconds);
        } else {
                g_assert_not_reached ();
        }
@@ -584,6 +602,15 @@ setup_dialog (FlashbackInhibitDialog *dialog)
        case FLASHBACK_LOGOUT_ACTION_REBOOT:
                button_text = _("Restart");
                break;
+       case FLASHBACK_LOGOUT_ACTION_HIBERNATE:
+               button_text = _("Hibernate");
+               break;
+       case FLASHBACK_LOGOUT_ACTION_SUSPEND:
+               button_text = _("Suspend");
+               break;
+       case FLASHBACK_LOGOUT_ACTION_HYBRID_SLEEP:
+               button_text = _("Hybrid Sleep");
+               break;
        default:
                g_assert_not_reached ();
                break;
diff --git a/gnome-flashback/libend-session-dialog/flashback-inhibit-dialog.h 
b/gnome-flashback/libend-session-dialog/flashback-inhibit-dialog.h
index 140e637..64831a3 100644
--- a/gnome-flashback/libend-session-dialog/flashback-inhibit-dialog.h
+++ b/gnome-flashback/libend-session-dialog/flashback-inhibit-dialog.h
@@ -26,7 +26,10 @@ G_BEGIN_DECLS
 typedef enum {
        FLASHBACK_LOGOUT_ACTION_LOGOUT,
        FLASHBACK_LOGOUT_ACTION_SHUTDOWN,
-       FLASHBACK_LOGOUT_ACTION_REBOOT
+       FLASHBACK_LOGOUT_ACTION_REBOOT,
+       FLASHBACK_LOGOUT_ACTION_HIBERNATE,
+       FLASHBACK_LOGOUT_ACTION_SUSPEND,
+       FLASHBACK_LOGOUT_ACTION_HYBRID_SLEEP
 } FlashbackLogoutAction;
 
 typedef enum {
diff --git a/gnome-flashback/libend-session-dialog/org.gnome.SessionManager.EndSessionDialog.xml 
b/gnome-flashback/libend-session-dialog/org.gnome.SessionManager.EndSessionDialog.xml
index 5392de0..38f2757 100644
--- a/gnome-flashback/libend-session-dialog/org.gnome.SessionManager.EndSessionDialog.xml
+++ b/gnome-flashback/libend-session-dialog/org.gnome.SessionManager.EndSessionDialog.xml
@@ -7,7 +7,8 @@
         <doc:doc>
           <doc:summary>
             The type of dialog to show.
-            0 for logout, 1 for shutdown, 2 for restart.
+            0 for logout, 1 for shutdown, 2 for restart, 3 for hibernate,
+            4 for suspend and 5 hybrid sleep.
           </doc:summary>
         </doc:doc>
       </arg>
@@ -47,6 +48,9 @@
     <signal name="ConfirmedLogout" />
     <signal name="ConfirmedReboot" />
     <signal name="ConfirmedShutdown" />
+    <signal name="ConfirmedHibernate" />
+    <signal name="ConfirmedSuspend" />
+    <signal name="ConfirmedHybridSleep" />
     <signal name="Canceled" />
     <signal name="Closed" />
   </interface>


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