[gnome-panel] [clock] Remove dead config tool dead code



commit 33cfffff2d56a19706eba82d404411d42316d669
Author: Vincent Untz <vuntz gnome org>
Date:   Thu Jun 4 20:12:54 2009 +0200

    [clock] Remove dead config tool dead code
    
    Remove the old code that was used to choose/start the config tool to set
    the time and date, since we now use a PolicyKit helper.
    
    Also remove --with-clock-time-utility configure option.
---
 applets/clock/Makefile.am      |    1 -
 applets/clock/clock.c          |  181 ----------------------------------------
 applets/clock/clock.schemas.in |    5 +-
 configure.in                   |   10 --
 4 files changed, 3 insertions(+), 194 deletions(-)

diff --git a/applets/clock/Makefile.am b/applets/clock/Makefile.am
index d8c965e..4007a4a 100644
--- a/applets/clock/Makefile.am
+++ b/applets/clock/Makefile.am
@@ -19,7 +19,6 @@ INCLUDES =							\
 	-DPREFIX=\""$(prefix)"\"				\
 	-DGNOMELOCALEDIR=\""$(prefix)/$(DATADIRNAME)/locale"\"	\
 	-DCLOCK_EDS_ICONDIR="\"$(CLOCK_EDS_ICONDIR)\""		\
-	-DCLOCK_TIME_UTILITY="\"$(CLOCK_TIME_UTILITY)\""	\
 	-DGWEATHER_I_KNOW_THIS_IS_UNSTABLE
 
 if HAVE_LIBECAL
diff --git a/applets/clock/clock.c b/applets/clock/clock.c
index a2d569e..31ad70e 100644
--- a/applets/clock/clock.c
+++ b/applets/clock/clock.c
@@ -83,20 +83,12 @@
 #define KEY_SHOW_WEATHER	"show_weather"
 #define KEY_SHOW_TEMPERATURE	"show_temperature"
 #define KEY_GMT_TIME		"gmt_time"
-#define KEY_CONFIG_TOOL		"config_tool"
 #define KEY_CUSTOM_FORMAT	"custom_format"
 #define KEY_SHOW_WEEK		"show_week_numbers"
 #define KEY_CITIES		"cities"
 #define KEY_TEMPERATURE_UNIT	"temperature_unit"
 #define KEY_SPEED_UNIT		"speed_unit"
 
-#define FALLBACK_CONFIG_TOOL "time-admin"
-
-static const char *clock_config_tools [] = {
-	CLOCK_TIME_UTILITY,
-	FALLBACK_CONFIG_TOOL
-};
-
 static GConfEnumStringPair format_type_enum_map [] = {
 	{ CLOCK_FORMAT_12,       "12-hour"  },
 	{ CLOCK_FORMAT_24,       "24-hour"  },
@@ -180,8 +172,6 @@ struct _ClockData {
         TempUnit     temperature_unit;
         SpeedUnit    speed_unit;
 
-        char *config_tool;
-
         /* Locations */
         GList *locations;
         GList *location_tiles;
@@ -779,7 +769,6 @@ destroy_clock (GtkWidget * widget, ClockData *cd)
 
 	g_free (cd->timeformat);
 	g_free (cd->fallback_timeformat);
-	g_free (cd->config_tool);
 	g_free (cd->custom_format);
 
         free_locations (cd);
@@ -1623,85 +1612,6 @@ copy_date (BonoboUIComponent *uic,
 	g_free (utf8);
 }
 
-/* FIXME old clock applet */
-#if 0
-static void
-on_config_tool_exited (GPid     pid,
-                       gint     status,
-                       gpointer data)
-{
-  ClockData *clock;
-
-  clock = (ClockData *) data;
-
-  refresh_clock (clock);
-
-  g_spawn_close_pid (pid);
-}
-
-static gboolean
-try_config_tool (GdkScreen  *screen,
-		 const char *tool,
-		 ClockData  *cd)
-{
-	GtkWidget *dialog;
-	GError    *err;
-	char     **argv;
-	char      *path;
-	GPid       pid;
-
-        if (!tool || tool[0] == '\0')
-                return FALSE;
-
-        if (!g_shell_parse_argv (tool, NULL, &argv, NULL))
-                return FALSE;
-
-        if (!(path = g_find_program_in_path (argv [0]))) {
-                g_strfreev (argv);
-                return FALSE;
-        }
-
-        g_free (path);
-
-	err = NULL;
-	if (gdk_spawn_on_screen (screen,
-                                 NULL,
-                                 argv,
-                                 NULL,
-                                 G_SPAWN_SEARCH_PATH|G_SPAWN_DO_NOT_REAP_CHILD,
-                                 NULL,
-                                 NULL,
-                                 &pid,
-                                 &err)) {
-
-		g_child_watch_add (pid, on_config_tool_exited, cd);
-		g_strfreev (argv);
-		return TRUE;
-	}
-
-        g_strfreev (argv);
-
-	dialog = gtk_message_dialog_new (NULL,
-					 GTK_DIALOG_DESTROY_WITH_PARENT,
-					 GTK_MESSAGE_ERROR,
-					 GTK_BUTTONS_CLOSE,
-					 _("Failed to launch time configuration tool: %s"),
-					 err->message);
-	g_error_free (err);
-
-	g_signal_connect (dialog, "response",
-			  G_CALLBACK (gtk_widget_destroy), NULL);
-
-	gtk_window_set_icon_name (GTK_WINDOW (dialog), CLOCK_ICON);
-	gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
-	gtk_window_set_screen (GTK_WINDOW (dialog), screen);
-
-	gtk_widget_show_all (dialog);
-
-	return TRUE;
-}
-#endif
-
 static void
 update_set_time_button (ClockData *cd)
 {
@@ -1927,37 +1837,6 @@ config_date (BonoboUIComponent *uic,
              const char        *verbname)
 {
 	run_time_settings (NULL, cd);
-#if 0
-        /* FMQ: this was from the old clock; it's replaced with our PolicyKit stuff */
-	GtkWidget *dialog;
-	GdkScreen *screen;
-	int i;
-
-	screen = gtk_widget_get_screen (cd->applet);
-
-	if (try_config_tool (screen, cd->config_tool, cd))
-		return;
-
-	for (i = 0; i < G_N_ELEMENTS (clock_config_tools); i++)
-		if (try_config_tool (screen, clock_config_tools [i], cd))
-			return;
-
-	dialog = gtk_message_dialog_new (NULL,
-					 GTK_DIALOG_DESTROY_WITH_PARENT,
-					 GTK_MESSAGE_ERROR,
-					 GTK_BUTTONS_CLOSE,
-					 _("Failed to locate a program for configuring "
-					   "the date and time. Perhaps none is installed?"));
-
-	g_signal_connect (dialog, "response",
-			  G_CALLBACK (gtk_widget_destroy), NULL);
-
-	gtk_window_set_icon_name (GTK_WINDOW (dialog), CLOCK_ICON);
-	gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
-	gtk_window_set_screen (GTK_WINDOW (dialog), screen);
-
-	gtk_widget_show_all (dialog);
-#endif
 }
 
 /* current timestamp */
@@ -2501,49 +2380,6 @@ gmt_time_changed (GConfClient  *client,
 	}
 }
 
-static gboolean
-check_config_tool_command (const char *config_tool)
-{
-        char **argv;
-        char  *path;
-
-        if (!config_tool || config_tool[0] == '\0')
-                return FALSE;
-
-        argv = NULL;
-        if (!g_shell_parse_argv (config_tool, NULL, &argv, NULL))
-                return FALSE;
-
-        if (!(path = g_find_program_in_path (argv [0]))) {
-                g_strfreev (argv);
-                return FALSE;
-        }
-
-        g_free (path);
-        g_strfreev (argv);
-
-        return TRUE;
-}
-
-static void
-config_tool_changed (GConfClient  *client,
-                     guint         cnxn_id,
-                     GConfEntry   *entry,
-                     ClockData    *clock)
-{
-	const char *value;
-
-	if (!entry->value || entry->value->type != GCONF_VALUE_STRING)
-		return;
-
-	value = gconf_value_get_string (entry->value);
-
-        if (check_config_tool_command (value)) {
-                g_free (clock->config_tool);
-                clock->config_tool = g_strdup (value);
-        }
-}
-
 static void
 custom_format_changed (GConfClient  *client,
                        guint         cnxn_id,
@@ -2617,7 +2453,6 @@ setup_gconf (ClockData *cd)
                 { KEY_SHOW_WEATHER,	(GConfClientNotifyFunc) show_weather_changed },
                 { KEY_SHOW_TEMPERATURE,	(GConfClientNotifyFunc) show_temperature_changed },
                 { KEY_GMT_TIME,		(GConfClientNotifyFunc) gmt_time_changed },
-                { KEY_CONFIG_TOOL,	(GConfClientNotifyFunc) config_tool_changed },
                 { KEY_CUSTOM_FORMAT,	(GConfClientNotifyFunc) custom_format_changed },
                 { KEY_SHOW_WEEK,	(GConfClientNotifyFunc) show_week_changed },
                 { KEY_CITIES,		(GConfClientNotifyFunc) cities_changed },
@@ -2706,7 +2541,6 @@ load_gconf_settings (ClockData *cd)
         cd->show_temperature = panel_applet_gconf_get_bool (applet, KEY_SHOW_TEMPERATURE, NULL);
 	cd->gmt_time = panel_applet_gconf_get_bool (applet, KEY_GMT_TIME, NULL);
 	cd->showweek = panel_applet_gconf_get_bool (applet, KEY_SHOW_WEEK, NULL);
-        cd->config_tool = panel_applet_gconf_get_string (applet, KEY_CONFIG_TOOL, NULL);
         cd->timeformat = NULL;
         cd->fallback_timeformat = NULL;
 
@@ -2804,21 +2638,6 @@ fill_clock_applet (PanelApplet *applet)
 					      NULL);
 	}
 
-        if (!check_config_tool_command (cd->config_tool)) {
-                g_free (cd->config_tool);
-                cd->config_tool = NULL;
-        }
-
-        if (!cd->config_tool) {
-                int i;
-
-                for (i = 0; i < G_N_ELEMENTS (clock_config_tools); i++)
-                        if (check_config_tool_command (clock_config_tools [i])) {
-                                cd->config_tool = g_strdup (clock_config_tools [i]);
-                                break;
-                        }
-        }
-
 	cd->systz = system_timezone_new ();
 	g_signal_connect (cd->systz, "changed",
 			  G_CALLBACK (clock_timezone_changed), cd);
diff --git a/applets/clock/clock.schemas.in b/applets/clock/clock.schemas.in
index 91d1d0a..2641e93 100644
--- a/applets/clock/clock.schemas.in
+++ b/applets/clock/clock.schemas.in
@@ -134,8 +134,9 @@
         <locale name="C">
           <short>Time configuration tool</short>
           <long>
-            This key specifies the program to run in order to configure the
-            time.
+            The use of this key was deprecated in GNOME 2.22 with the use
+            of an internal time configuration tool. The schema is retained for
+            compatibility with older versions.
           </long>
         </locale>
       </schema>
diff --git a/configure.in b/configure.in
index b78965b..a5d9c4c 100644
--- a/configure.in
+++ b/configure.in
@@ -175,16 +175,6 @@ if test "x$HAVE_NETWORK_MANAGER" = "xyes" ; then
     AC_DEFINE(HAVE_NETWORK_MANAGER, 1, [Defined if NetworkManager support is enabled])
 fi
 
-# Let distributor specify which utility to use when changing the time
-AC_ARG_WITH(clock-time-utility,
-              [AC_HELP_STRING([--with-clock-time-utility],
-                              [Specify the utility to use when changing the time from the clock applet @<:@default=@:>@])],,
-                              [with_clock_time_utility=""])
-
-CLOCK_TIME_UTILITY=$with_clock_time_utility
-AC_SUBST(CLOCK_TIME_UTILITY)
-
-
 # Make it possible to compile the applets in-process
 PANEL_INPROCESS_NONE=
 PANEL_INPROCESS_ALL=



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