PATCH for using gnome-screensaver if available in gnome-control-center



Hi

This patch makes gnome-control-center use gnome-screensaver when
available.

Ok to commit?
-- 
Rodrigo Moya <rodrigo gnome-db org>
? capplets/scheduled-jobs
? capplets/about-me/gnome-about-me
? gnome-settings-daemon/org.gnome.SettingsDaemon.desktop-service
? gnome-settings-daemon/org.gnome.SettingsDaemon.service
? gnome-settings-daemon/org.gnome.SettingsDaemon.service.in
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gnome-control-center/ChangeLog,v
retrieving revision 1.710
diff -u -p -r1.710 ChangeLog
--- ChangeLog	19 Jul 2005 12:35:24 -0000	1.710
+++ ChangeLog	20 Jul 2005 13:25:36 -0000
@@ -1,3 +1,10 @@
+2005-07-20  Rodrigo Moya <rodrigo novell com>
+
+	* control-center.spec.in: require either xscreensaver or gnome-screensaver.
+
+	* schemas/apps_gnome_settings_daemon_screensaver.schemas.in: don't
+	mention explicitly xscreensaver, but "generic screen saver".
+	
 2005-07-19  Mark McLoughlin  <mark skynet ie>
 
 	See http://mail.gnome.org/archives/desktop-devel-list/2005-July/msg00341.html
Index: control-center.spec.in
===================================================================
RCS file: /cvs/gnome/gnome-control-center/control-center.spec.in,v
retrieving revision 1.8
diff -u -p -r1.8 control-center.spec.in
--- control-center.spec.in	19 Aug 1999 17:03:02 -0000	1.8
+++ control-center.spec.in	20 Jul 2005 13:25:36 -0000
@@ -19,7 +19,7 @@ URL: http://www.gnome.org
 Docdir: %{prefix}/doc
 
 
-Requires: xscreensaver >= 3.00
+Requires: xscreensaver >= 3.00 | gnome-screensaver >= 0.0.7
 Requires: gnome-libs >= 1.0.0
 Requires: ORBit >= 0.4.0
 
Index: capplets/display/ChangeLog
===================================================================
RCS file: /cvs/gnome/gnome-control-center/capplets/display/ChangeLog,v
retrieving revision 1.14
diff -u -p -r1.14 ChangeLog
--- capplets/display/ChangeLog	8 Feb 2005 22:42:09 -0000	1.14
+++ capplets/display/ChangeLog	20 Jul 2005 13:25:36 -0000
@@ -1,3 +1,9 @@
+2005-07-20  Rodrigo Moya <rodrigo novell com>
+
+	* main.c (get_screensaver_command): new function to get the correct
+	screensaver command to run.
+	(apply_config, revert_config): use gnome-screensaver if available.
+
 2005-02-08  Sebastien Bacher  <seb128 debian org>
 
 	* main.c: (wrap_in_label):
Index: capplets/display/main.c
===================================================================
RCS file: /cvs/gnome/gnome-control-center/capplets/display/main.c,v
retrieving revision 1.17
diff -u -p -r1.17 main.c
--- capplets/display/main.c	8 Feb 2005 22:42:09 -0000	1.17
+++ capplets/display/main.c	20 Jul 2005 13:25:36 -0000
@@ -44,6 +44,22 @@ struct DisplayInfo {
 static void generate_rate_menu (struct ScreenInfo *screen_info);
 static void generate_resolution_menu(struct ScreenInfo* screen_info);
 
+const char *
+get_screensaver_command (void)
+{
+  char *ss_command;
+  const char *ret;
+
+  if ((ss_command = g_find_program_in_path ("gnome-screensaver-command")))
+    ret = "gnome-screensaver-command";
+  else
+    ret = "xscreensaver-command";
+
+  g_free (ss_command);
+
+  return ret;
+}
+
 struct DisplayInfo *
 read_display_info (GdkDisplay *display)
 {
@@ -193,8 +209,13 @@ apply_config (struct DisplayInfo *info)
   
   /* xscreensaver should handle this itself, but does not currently so we hack
    * it.  Ignore failures in case xscreensaver is not installed */
-  if (changed)
-   g_spawn_command_line_async ("xscreensaver-command -restart", NULL);
+  if (changed) {
+    char *cmd;
+
+    cmd = g_strdup_printf ("%s -restart", get_screensaver_command ());
+    g_spawn_command_line_async (cmd, NULL);
+    g_free (cmd);
+  }
 
   return changed;
 }
@@ -206,6 +227,7 @@ revert_config (struct DisplayInfo *info)
   GdkDisplay *display;
   Display *xdisplay;
   GdkScreen *screen;
+  char *cmd;
 
   display = gdk_display_get_default ();
   xdisplay = gdk_x11_display_get_xdisplay (display);
@@ -242,7 +264,9 @@ revert_config (struct DisplayInfo *info)
 
   /* xscreensaver should handle this itself, but does not currently so we hack
    * it.  Ignore failures in case xscreensaver is not installed */
-  g_spawn_command_line_async ("xscreensaver-command -restart", NULL);
+  cmd = g_strdup_printf ("%s -restart", get_screensaver_command ());
+  g_spawn_command_line_async (cmd, NULL);
+  g_free (cmd);
   
   return 0;
 }
Index: gnome-settings-daemon/ChangeLog
===================================================================
RCS file: /cvs/gnome/gnome-control-center/gnome-settings-daemon/ChangeLog,v
retrieving revision 1.185
diff -u -p -r1.185 ChangeLog
--- gnome-settings-daemon/ChangeLog	12 Jul 2005 10:23:17 -0000	1.185
+++ gnome-settings-daemon/ChangeLog	20 Jul 2005 13:25:37 -0000
@@ -1,3 +1,9 @@
+2005-07-20  Rodrigo Moya <rodrigo novell com>
+
+	* gnome-settings-screensaver.c (gnome_settings_screensaver_load):
+	* gnome-settings-multimedia-keys.c (do_action): try to run
+	gnome-screensaver, and if that fails, run xscreensaver.
+
 2005-07-12  Sebastien Bacher  <seb128 debian org>
 
 	* modmap-dialog.glade: fix a label form (Closes: #167739).
Index: gnome-settings-daemon/gnome-settings-multimedia-keys.c
===================================================================
RCS file: /cvs/gnome/gnome-control-center/gnome-settings-daemon/gnome-settings-multimedia-keys.c,v
retrieving revision 1.13
diff -u -p -r1.13 gnome-settings-multimedia-keys.c
--- gnome-settings-daemon/gnome-settings-multimedia-keys.c	22 May 2005 15:46:43 -0000	1.13
+++ gnome-settings-daemon/gnome-settings-multimedia-keys.c	20 Jul 2005 13:25:37 -0000
@@ -804,6 +804,8 @@ do_sound_action (Acme *acme, int type)
 static void
 do_action (Acme *acme, int type)
 {
+	gchar *cmd;
+
 	switch (type) {
 	case MUTE_KEY:
 	case VOLUME_DOWN_KEY:
@@ -829,7 +831,12 @@ do_action (Acme *acme, int type)
 		do_sleep_action ("apm", "xset dpms force off");
 		break;
 	case SCREENSAVER_KEY:
-		execute ("xscreensaver-command -lock", FALSE);
+		if ((cmd = g_find_program_in_path ("gnome-screensaver-command")))
+			execute ("gnome-screensaver-command --lock", FALSE);
+		else
+			execute ("xscreensaver-command -lock", FALSE);
+
+		g_free (cmd);
 		break;
 	case HELP_KEY:
 		do_help_action (acme);
Index: gnome-settings-daemon/gnome-settings-screensaver.c
===================================================================
RCS file: /cvs/gnome/gnome-control-center/gnome-settings-daemon/gnome-settings-screensaver.c,v
retrieving revision 1.3
diff -u -p -r1.3 gnome-settings-screensaver.c
--- gnome-settings-daemon/gnome-settings-screensaver.c	22 May 2005 15:46:43 -0000	1.3
+++ gnome-settings-daemon/gnome-settings-screensaver.c	20 Jul 2005 13:25:37 -0000
@@ -35,6 +35,7 @@
 #define START_SCREENSAVER_KEY   "/apps/gnome_settings_daemon/screensaver/start_screensaver"
 #define SHOW_STARTUP_ERRORS_KEY "/apps/gnome_settings_daemon/screensaver/show_startup_errors"
 #define XSCREENSAVER_COMMAND    "xscreensaver -nosplash"
+#define GSCREENSAVER_COMMAND    "gnome-screensaver"
 
 void
 gnome_settings_screensaver_init (GConfClient *client)
@@ -69,16 +70,30 @@ void
 gnome_settings_screensaver_load (GConfClient *client)
 {
 	GError *gerr = NULL;
-	gboolean start_screensaver;
+	gboolean start_screensaver, use_gscreensaver = FALSE;
 	gboolean show_error;
 	GtkWidget *dialog, *toggle;
+	gchar *ss_command;
  
 	start_screensaver = gconf_client_get_bool (client, START_SCREENSAVER_KEY, NULL);
 
 	if (!start_screensaver)
 		return;
 
-	if (g_spawn_command_line_async (XSCREENSAVER_COMMAND, &gerr))
+	if ((ss_command = g_find_program_in_path ("gnome-screensaver")))
+		use_gscreensaver = TRUE;
+	else {
+		if (!(ss_command = g_find_program_in_path ("xscreensaver")))
+			return;
+	}
+
+	g_free (ss_command);
+	if (use_gscreensaver)
+		ss_command = GSCREENSAVER_COMMAND;
+	else
+		ss_command = XSCREENSAVER_COMMAND;
+
+	if (g_spawn_command_line_async (ss_command, &gerr))
 		return;
 	
 	show_error = gconf_client_get_bool (client, SHOW_STARTUP_ERRORS_KEY, NULL);
Index: help/ChangeLog
===================================================================
RCS file: /cvs/gnome/gnome-control-center/help/ChangeLog,v
retrieving revision 1.49
diff -u -p -r1.49 ChangeLog
--- help/ChangeLog	14 Oct 2004 19:05:38 -0000	1.49
+++ help/ChangeLog	20 Jul 2005 13:25:37 -0000
@@ -1,3 +1,8 @@
+2005-07-20  Rodrigo Moya <rodrigo novell com>
+
+	* C/config-screensaver.xml: specify the fact that it works with both
+	xscreensaver and gnome-screensaver.
+
 2004-10-14  Jody Goldberg <jody gnome org>
 
 	* Release 2.8.1
Index: help/C/config-screensaver.xml
===================================================================
RCS file: /cvs/gnome/gnome-control-center/help/C/config-screensaver.xml,v
retrieving revision 1.2
diff -u -p -r1.2 config-screensaver.xml
--- help/C/config-screensaver.xml	12 Feb 2002 00:31:26 -0000	1.2
+++ help/C/config-screensaver.xml	20 Jul 2005 13:25:37 -0000
@@ -9,8 +9,9 @@
     entertain visitors.
   </para>
   <para>
-    <application>Gnome</application> uses the
-    <application>xscreensaver</application> program to display
+    <application>Gnome</application> uses either the
+    <application>xscreensaver</application> or the <application>gnome-screensaver</application>
+    programs to display
     screensavers.  By default, <application>Gnome</application> comes
     with dozens of screensavers.  These can all be configured in the
     <application>Settings Capplet</application> in <application>Gnome
@@ -85,7 +86,7 @@
 		<term>Random Screen Saver</term>
 		<listitem>
 		  <para>
-		    <application>xscreensaver</application> can
+		    The screensaver program can
 		    display screensavers in a random fashion.
 		    This option displays screensavers randomly.
 		    It also puts checkboxes next to the
Index: schemas/apps_gnome_settings_daemon_screensaver.schemas.in
===================================================================
RCS file: /cvs/gnome/gnome-control-center/schemas/apps_gnome_settings_daemon_screensaver.schemas.in,v
retrieving revision 1.1
diff -u -p -r1.1 apps_gnome_settings_daemon_screensaver.schemas.in
--- schemas/apps_gnome_settings_daemon_screensaver.schemas.in	2 Dec 2002 19:47:25 -0000	1.1
+++ schemas/apps_gnome_settings_daemon_screensaver.schemas.in	20 Jul 2005 13:25:37 -0000
@@ -8,8 +8,8 @@
 	    <type>bool</type>
             <default>true</default>
             <locale name="C">
-	        <short>Start XScreenSaver</short>
-                <long>Run XScreenSaver at login</long>
+	        <short>Start ScreenSaver</short>
+                <long>Run screen saver at login</long>
             </locale>
         </schema>
 	<schema>
@@ -20,7 +20,7 @@
 	    <default>true</default>
             <locale name="C">
                 <short>Show Startup Errors</short>
-	        <long>Display a dialog when there are errors running XScreenSaver</long>
+	        <long>Display a dialog when there are errors running the screen saver</long>
 	    </locale>
 	</schema>
     </schemalist>


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