Re: totally awesome gnome-settings-daemon patch!
- From: jacob berkman <jacob ximian com>
- To: Bradford Hovinen <hovinen ximian com>
- Cc: desktop-devel-list <desktop-devel-list gnome org>
- Subject: Re: totally awesome gnome-settings-daemon patch!
- Date: 25 Mar 2002 17:08:24 -0500
On Fri, 2002-03-22 at 22:26, Bradford Hovinen wrote:
> On Fri, 2002-03-22 at 19:19, jacob berkman wrote:
> > this patch does 2 things:
> >
> > * run xscreensaver when we start up. i think this is the most
> > appropriate place for this. if you're unconvinced of this, i can
> > explain it better but i want to go home.
> >
> Modulo the g_spawn issue that jrb mentioned, it looks good. Once that's
> changed, please commit. Thanks.
here's the finished patch.
i also noticed gnome-settings-daemon wasn't set up for i18n - is anyone
fixing this?
jacob
--
"don't get me wrong, i think that radiohead are amazing. i love their
music and i love their ethos, but that thom yorke guy always seems to
be complaining." -- moby
? control-center-1.99.4
? foo
? control-center/foo
? po/cs.old.po
? po/po2tbl.sed
? po/po2tbl.sed.in
Index: acconfig.h
===================================================================
RCS file: /cvs/gnome/gnome-control-center/acconfig.h,v
retrieving revision 1.32
diff -u -r1.32 acconfig.h
--- acconfig.h 27 Feb 2002 22:23:36 -0000 1.32
+++ acconfig.h 25 Mar 2002 22:05:33 -0000
@@ -9,6 +9,9 @@
#undef HAVE_PROGRAM_INVOCATION_NAME
#undef GNOMECC_DATA_DIR
+#undef GNOMECC_DESKTOP_DIR
+#undef GNOMECC_GLADE_DIR
+#undef GNOMECC_PIXMAPS_DIR
#undef GETTEXT_PACKAGE
#undef VERSION
Index: gnome-settings-daemon/Makefile.am
===================================================================
RCS file: /cvs/gnome/gnome-control-center/gnome-settings-daemon/Makefile.am,v
retrieving revision 1.14
diff -u -r1.14 Makefile.am
--- gnome-settings-daemon/Makefile.am 23 Mar 2002 04:39:23 -0000 1.14
+++ gnome-settings-daemon/Makefile.am 25 Mar 2002 22:05:34 -0000
@@ -22,6 +22,8 @@
gnome-settings-sound.h \
gnome-settings-accessibility-keyboard.h \
gnome-settings-accessibility-keyboard.c \
+ gnome-settings-screensaver.h \
+ gnome-settings-screensaver.c \
xsettings-common.c \
xsettings-manager.c \
xsettings-common.h \
Index: gnome-settings-daemon/gnome-settings-daemon.c
===================================================================
RCS file: /cvs/gnome/gnome-control-center/gnome-settings-daemon/gnome-settings-daemon.c,v
retrieving revision 1.18
diff -u -r1.18 gnome-settings-daemon.c
--- gnome-settings-daemon/gnome-settings-daemon.c 23 Mar 2002 04:39:23 -0000 1.18
+++ gnome-settings-daemon/gnome-settings-daemon.c 25 Mar 2002 22:05:34 -0000
@@ -41,6 +41,7 @@
#include "gnome-settings-sound.h"
#include "gnome-settings-wm.h"
#include "gnome-settings-accessibility-keyboard.h"
+#include "gnome-settings-screensaver.h"
#include "GNOME_SettingsDaemon.h"
@@ -228,7 +229,8 @@
gnome_settings_sound_init (client);
gnome_settings_wm_init (client);
gnome_settings_accessibility_keyboard_init (client);
-
+ gnome_settings_screensaver_init (client);
+
for (list = directories; list; list = list->next)
{
GError *error = NULL;
@@ -261,6 +263,7 @@
gnome_settings_background_load (client);
gnome_settings_wm_load (client);
gnome_settings_accessibility_keyboard_load (client);
+ gnome_settings_screensaver_load (client);
return G_OBJECT (daemon);
}
Index: gnome-settings-daemon/gnome-settings-screensaver.c
===================================================================
RCS file: gnome-settings-daemon/gnome-settings-screensaver.c
diff -N gnome-settings-daemon/gnome-settings-screensaver.c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnome-settings-daemon/gnome-settings-screensaver.c 25 Mar 2002 22:05:34 -0000
@@ -0,0 +1,119 @@
+/* -*- mode: c; style: linux -*- */
+
+/* gnome-settings-screensaver.c
+ *
+ * Copyright (C) 2002 Sun Microsystems, Inc.
+ *
+ * Written by Jacob Berkman <jacob ximian com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ */
+
+#include <config.h>
+
+#include "gnome-settings-screensaver.h"
+
+#include <gtk/gtkcheckbutton.h>
+#include <gtk/gtkbox.h>
+#include <gtk/gtkmessagedialog.h>
+
+#define START_SCREENSAVER_KEY "/desktop/gnome/screensaver/start_screensaver"
+#define SHOW_STARTUP_ERRORS_KEY "/desktop/gnome/screensaver/show_startup_errors"
+#define XSCREENSAVER_COMMAND "xscreensaver -nosplash"
+
+void
+gnome_settings_screensaver_init (GConfClient *client)
+{
+ /*
+ * do nothing.
+ *
+ * our settings only apply to startup, and the screensaver
+ * settings are all in xscreensaver and not gconf.
+ *
+ * we could have xscreensaver-demo run gconftool-2 directly,
+ * and start / stop xscreensaver here
+ *
+ */
+}
+
+static void
+key_toggled_cb (GtkWidget *toggle, gpointer data)
+{
+ GConfClient *client;
+
+ client = gconf_client_get_default ();
+ gconf_client_set_bool (client,
+ SHOW_STARTUP_ERRORS_KEY,
+ gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (toggle))
+ ? 0 : 1,
+ NULL);
+}
+
+void
+gnome_settings_screensaver_load (GConfClient *client)
+{
+ GError *gerr = NULL;
+ gboolean start_screensaver;
+ gboolean show_error;
+ GtkWidget *dialog, *toggle;
+
+ start_screensaver = gconf_client_get_bool (client, START_SCREENSAVER_KEY, NULL);
+
+ if (!start_screensaver)
+ return;
+
+ if (g_spawn_command_line_async (XSCREENSAVER_COMMAND, &gerr))
+ return;
+
+ show_error = gconf_client_get_bool (client, SHOW_STARTUP_ERRORS_KEY, NULL);
+ if (!show_error) {
+ g_error_free (gerr);
+ return;
+ }
+
+ dialog = gtk_message_dialog_new (NULL,
+ 0,
+ GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_OK,
+ "There was an error starting up the screensaver:\n\n"
+ "%s\n\n"
+ "Screensaver functionality will not work in this session.",
+ gerr->message);
+
+ g_signal_connect (dialog, "response",
+ G_CALLBACK (gtk_widget_destroy),
+ NULL);
+
+ toggle = gtk_check_button_new_with_mnemonic (
+ "_Do not show this message again");
+ gtk_widget_show (toggle);
+
+ if (gconf_client_key_is_writable (client, SHOW_STARTUP_ERRORS_KEY, NULL))
+ g_signal_connect (toggle, "toggled",
+ G_CALLBACK (key_toggled_cb),
+ NULL);
+ else
+ gtk_widget_set_sensitive (toggle, FALSE);
+
+ gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox),
+ toggle,
+ FALSE, FALSE, 0);
+
+ gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
+
+ gtk_widget_show (dialog);
+}
+
Index: gnome-settings-daemon/gnome-settings-screensaver.h
===================================================================
RCS file: gnome-settings-daemon/gnome-settings-screensaver.h
diff -N gnome-settings-daemon/gnome-settings-screensaver.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnome-settings-daemon/gnome-settings-screensaver.h 25 Mar 2002 22:05:34 -0000
@@ -0,0 +1,33 @@
+/* -*- mode: c; style: linux -*- */
+
+/* gnome-settings-screensaver.h
+ *
+ * Copyright (C) 2002 Sun Microsystems, Inc.
+ *
+ * Written by Jacob Berkman <jacob ximian com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ */
+
+#ifndef GNOME_SETTINGS_SCREENSAVER_H
+#define GNOME_SETTINGS_SCREENSAVER_H
+
+#include <gconf/gconf-client.h>
+
+void gnome_settings_screensaver_init (GConfClient *client);
+void gnome_settings_screensaver_load (GConfClient *client);
+
+#endif
Index: schemas/Makefile.am
===================================================================
RCS file: /cvs/gnome/gnome-control-center/schemas/Makefile.am,v
retrieving revision 1.6
diff -u -r1.6 Makefile.am
--- schemas/Makefile.am 17 Mar 2002 21:27:08 -0000 1.6
+++ schemas/Makefile.am 25 Mar 2002 22:05:34 -0000
@@ -1,6 +1,7 @@
schemadir = @GCONF_SCHEMA_FILE_DIR@
schema_DATA = \
- apps_gnome_keybinding_properties.schemas
+ apps_gnome_keybinding_properties.schemas \
+ desktop_gnome_screensaver.schemas
schema_source_data = $(foreach file, $(schema_DATA), $(srcdir)/$(file))
Index: schemas/desktop_gnome_screensaver.schemas
===================================================================
RCS file: schemas/desktop_gnome_screensaver.schemas
diff -N schemas/desktop_gnome_screensaver.schemas
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ schemas/desktop_gnome_screensaver.schemas 25 Mar 2002 22:05:34 -0000
@@ -0,0 +1,27 @@
+<?xml version="1.0"?>
+<gconfschemafile>
+ <schemalist>
+ <schema>
+ <key>/schemas/desktop/gnome/screensaver/start_screensaver</key>
+ <applyto>/desktop/gnome/screensaver/start_screensaver</applyto>
+ <owner>gnome</owner>
+ <type>bool</type>
+ <default>true</default>
+ <locale name="C">
+ <short>Start XScreenSaver</short>
+ <long>Run XScreenSaver at login</long>
+ </locale>
+ </schema>
+ <schema>
+ <key>/schemas/desktop/gnome/screensaver/show_startup_errors</key>
+ <applyto>/desktop/gnome/screensaver/show_startup_errors</applyto>
+ <owner>gnome</owner>
+ <type>bool</type>
+ <default>true</default>
+ <locale name="C">
+ <short>Show Startup Errors</short>
+ <long>Display a dialog when there are errors running XScreenSaver</long>
+ </locale>
+ </schema>
+ </schemalist>
+</gconfschemafile>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]