[Xfce4-commits] <xfce4-panel:master> Clock plugin: adjusted defaults.

Andrzej noreply at xfce.org
Sun Mar 3 12:02:07 CET 2013


Updating branch refs/heads/master
         to 769e1a41581c5e8bf99d8da34c20565b719d4892 (commit)
       from 592668fb4cdfb57ab92a3aa68b42ece502c0c4fe (commit)

commit 769e1a41581c5e8bf99d8da34c20565b719d4892
Author: Andrzej <ndrwrdck at gmail.com>
Date:   Mon Feb 25 23:38:04 2013 +0000

    Clock plugin: adjusted defaults.
    
    - A simpler label for the configuration button.
    - An empty string for the time configuration command
      - the button is grayed out when the config command is empty

 plugins/clock/clock-dialog.glade |    2 +-
 plugins/clock/clock.c            |   26 +++++++++++++++++++++++++-
 2 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/plugins/clock/clock-dialog.glade b/plugins/clock/clock-dialog.glade
index 301cb56..37e0398 100644
--- a/plugins/clock/clock-dialog.glade
+++ b/plugins/clock/clock-dialog.glade
@@ -124,7 +124,7 @@
                         </child>
                         <child>
                           <object class="GtkButton" id="run-time-config-tool">
-                            <property name="label" translatable="yes">_Run configuration tool</property>
+                            <property name="label" translatable="yes">_Set</property>
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
                             <property name="receives_default">True</property>
diff --git a/plugins/clock/clock.c b/plugins/clock/clock.c
index 43f5dc3..a09d562 100644
--- a/plugins/clock/clock.c
+++ b/plugins/clock/clock.c
@@ -45,7 +45,8 @@
 
 #define DEFAULT_TOOLTIP_FORMAT "%A %d %B %Y"
 /* Please adjust the following command to match your distribution */
-#define DEFAULT_TIME_CONFIG_TOOL "time-admin"
+/* e.g. "time-admin" */
+#define DEFAULT_TIME_CONFIG_TOOL ""
 
 
 static void     clock_plugin_get_property              (GObject               *object,
@@ -799,6 +800,25 @@ clock_plugin_configure_plugin_free (gpointer user_data)
 
 
 static void
+clock_plugin_configure_config_tool_changed (ClockPluginDialog *dialog)
+{
+  GObject           *object;
+
+  panel_return_if_fail (GTK_IS_BUILDER (dialog->builder));
+  panel_return_if_fail (XFCE_IS_CLOCK_PLUGIN (dialog->plugin));
+
+  object = gtk_builder_get_object (dialog->builder, "run-time-config-tool");
+  panel_return_if_fail (GTK_IS_BUTTON (object));
+
+  gtk_widget_set_sensitive
+    (GTK_WIDGET (object),
+     dialog->plugin->time_config_tool != NULL &&
+     g_strcmp0 (dialog->plugin->time_config_tool, "") != 0);
+}
+
+
+
+static void
 clock_plugin_configure_run_config_tool (GtkWidget   *button,
                                         ClockPlugin *plugin)
 {
@@ -843,6 +863,10 @@ clock_plugin_configure_plugin (XfcePanelPlugin *panel_plugin)
 
   object = gtk_builder_get_object (builder, "run-time-config-tool");
   panel_return_if_fail (GTK_IS_BUTTON (object));
+  g_signal_connect_swapped (G_OBJECT (plugin), "notify::time-config-tool",
+                            G_CALLBACK (clock_plugin_configure_config_tool_changed),
+                            dialog);
+  clock_plugin_configure_config_tool_changed (dialog);
   g_signal_connect (G_OBJECT (object), "clicked",
       G_CALLBACK (clock_plugin_configure_run_config_tool), plugin);
 


More information about the Xfce4-commits mailing list