gnome-session r4796 - in branches/dbus_based: . gnome-session



Author: mccann
Date: Mon Jul  7 16:55:13 2008
New Revision: 4796
URL: http://svn.gnome.org/viewvc/gnome-session?rev=4796&view=rev

Log:
2008-07-07  William Jon McCann  <jmccann redhat com>

	* gnome-session/gsm-logout-inhibit-dialog.c (lock_screen),
	(on_response), (setup_dialog):
	* gnome-session/gsm-logout-inhibit-dialog.glade:
	Add ability to lock screen while waiting for processes to finish.



Modified:
   branches/dbus_based/ChangeLog
   branches/dbus_based/gnome-session/gsm-logout-inhibit-dialog.c
   branches/dbus_based/gnome-session/gsm-logout-inhibit-dialog.glade

Modified: branches/dbus_based/gnome-session/gsm-logout-inhibit-dialog.c
==============================================================================
--- branches/dbus_based/gnome-session/gsm-logout-inhibit-dialog.c	(original)
+++ branches/dbus_based/gnome-session/gsm-logout-inhibit-dialog.c	Mon Jul  7 16:55:13 2008
@@ -45,6 +45,8 @@
 #define DEFAULT_ICON_SIZE 64
 #endif
 
+#define DIALOG_RESPONSE_LOCK_SCREEN 1
+
 struct GsmLogoutInhibitDialogPrivate
 {
         GladeXML          *xml;
@@ -74,6 +76,32 @@
 G_DEFINE_TYPE (GsmLogoutInhibitDialog, gsm_logout_inhibit_dialog, GTK_TYPE_DIALOG)
 
 static void
+lock_screen (GsmLogoutInhibitDialog *dialog)
+{
+        GError *error;
+        error = NULL;
+        g_spawn_command_line_async ("gnome-screensaver-command --lock", &error);
+        if (error != NULL) {
+                g_warning ("Couldn't lock screen: %s", error->message);
+                g_error_free (error);
+        }
+}
+
+static void
+on_response (GsmLogoutInhibitDialog *dialog,
+             gint                    response_id)
+{
+        switch (response_id) {
+        case DIALOG_RESPONSE_LOCK_SCREEN:
+                g_signal_stop_emission_by_name (dialog, "response");
+                lock_screen (dialog);
+                break;
+        default:
+                break;
+        }
+}
+
+static void
 gsm_logout_inhibit_dialog_set_action (GsmLogoutInhibitDialog *dialog,
                                       int                     action)
 {
@@ -520,11 +548,18 @@
         }
 
         gtk_dialog_add_button (GTK_DIALOG (dialog),
+                               _("Lock Screen"),
+                               DIALOG_RESPONSE_LOCK_SCREEN);
+        gtk_dialog_add_button (GTK_DIALOG (dialog),
                                _("Cancel"),
                                GTK_RESPONSE_CANCEL);
         gtk_dialog_add_button (GTK_DIALOG (dialog),
                                button_text,
                                GTK_RESPONSE_ACCEPT);
+        g_signal_connect (dialog,
+                          "response",
+                          G_CALLBACK (on_response),
+                          dialog);
 
         dialog->priv->list_store = gtk_list_store_new (NUMBER_OF_COLUMNS,
                                                        GDK_TYPE_PIXBUF,

Modified: branches/dbus_based/gnome-session/gsm-logout-inhibit-dialog.glade
==============================================================================
--- branches/dbus_based/gnome-session/gsm-logout-inhibit-dialog.glade	(original)
+++ branches/dbus_based/gnome-session/gsm-logout-inhibit-dialog.glade	Mon Jul  7 16:55:13 2008
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
 <!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
-<!--Generated with glade3 3.4.4 on Mon Jul  7 09:44:00 2008 -->
+<!--Generated with glade3 3.4.4 on Mon Jul  7 10:16:11 2008 -->
 <glade-interface>
   <widget class="GtkDialog" id="dialog1">
     <property name="border_width">5</property>
@@ -28,9 +28,10 @@
             </child>
             <child>
               <widget class="GtkLabel" id="description-label">
+                <property name="width_request">300</property>
                 <property name="visible">True</property>
                 <property name="xalign">0</property>
-                <property name="label" translatable="yes">Interrupting these programs may cause you to lose work.  </property>
+                <property name="label" translatable="yes">Waiting for program to finish.  Interrupting program may cause you to lose work.</property>
                 <property name="wrap">True</property>
               </widget>
               <packing>



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