[gnome-panel] clock: Always show actions to set time



commit 221450b851b7d30c9e3d5389bdb04ff442632a29
Author: Vincent Untz <vuntz gnome org>
Date:   Thu Feb 2 16:42:50 2012 +0100

    clock: Always show actions to set time
    
    As we open the control center now and the datetime panel works in a
    different way than the old "set time" dialog, just always show the
    actions instead of trying to detect when the time cannot be set.

 applets/clock/clock.c        |   25 ++++++++++---------------
 applets/clock/set-timezone.c |    7 -------
 applets/clock/set-timezone.h |    2 --
 3 files changed, 10 insertions(+), 24 deletions(-)
---
diff --git a/applets/clock/clock.c b/applets/clock/clock.c
index 7a92345..ead349b 100644
--- a/applets/clock/clock.c
+++ b/applets/clock/clock.c
@@ -1646,26 +1646,22 @@ copy_date (GtkAction *action,
 }
 
 static void
-update_set_time_button (ClockData *cd)
+ensure_datetime_appinfo (ClockData *cd)
 {
-	gint can_set;
-
-	if (!cd->time_settings_button)
-		return;
-
 	if (!cd->datetime_appinfo)
 		cd->datetime_appinfo = (GAppInfo *) g_desktop_app_info_new ("gnome-datetime-panel.desktop");
+}
 
-	if (!cd->datetime_appinfo) {
-		gtk_widget_set_sensitive (cd->time_settings_button, FALSE);
+static void
+update_set_time_button (ClockData *cd)
+{
+	if (!cd->time_settings_button)
 		return;
-	}
 
-	/* this returns more than just a boolean; check the documentation of
-	 * the dbus method for more information */
-	can_set = can_set_system_time ();
+	ensure_datetime_appinfo (cd);
 
-	gtk_widget_set_sensitive (cd->time_settings_button, can_set);
+	gtk_widget_set_sensitive (cd->time_settings_button,
+				  cd->datetime_appinfo != NULL);
 }
 
 static void
@@ -1677,6 +1673,7 @@ run_time_settings (GtkWidget *unused, ClockData *cd)
 	GError              *error;
 
 	update_set_time_button (cd);
+	ensure_datetime_appinfo (cd);
 
 	if (!cd->datetime_appinfo)
 		return;
@@ -2497,8 +2494,6 @@ fill_clock_applet (PanelApplet *applet)
 	g_signal_connect (cd->systz, "changed",
 			  G_CALLBACK (clock_timezone_changed), cd);
 
-        action = gtk_action_group_get_action (action_group, "ClockConfig");
-        gtk_action_set_visible (action, can_set_system_time ());
         g_object_unref (action_group);
 
 	return TRUE;
diff --git a/applets/clock/set-timezone.c b/applets/clock/set-timezone.c
index f4064bf..f979c5d 100644
--- a/applets/clock/set-timezone.c
+++ b/applets/clock/set-timezone.c
@@ -44,7 +44,6 @@ typedef struct {
   guint64  stamp;
 } Cache;
 
-static Cache can_set_time_cache;
 static Cache can_set_timezone_cache;
 
 static GDBusConnection *
@@ -122,12 +121,6 @@ can_set_system_timezone (void)
   return can_set (&can_set_timezone_cache, "CanSetTimezone");
 }
 
-gint
-can_set_system_time (void)
-{
-  return can_set (&can_set_time_cache, "CanSetTime");
-}
-
 gboolean
 set_system_timezone_finish (GAsyncResult  *result,
                             GError       **error)
diff --git a/applets/clock/set-timezone.h b/applets/clock/set-timezone.h
index fcb7a24..5497381 100644
--- a/applets/clock/set-timezone.h
+++ b/applets/clock/set-timezone.h
@@ -25,8 +25,6 @@
 
 gint     can_set_system_timezone (void);
 
-gint     can_set_system_time     (void);
-
 void     set_system_timezone_async   (const gchar          *tz,
                                       GAsyncReadyCallback   callback,
                                       gpointer              user_data);



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