[Xfce4-commits] <xfce4-panel:nick/gtk3> Clock: Improve tooltips, plug leaks and fix glade layout.
Nick Schermer
noreply at xfce.org
Mon Apr 8 00:52:01 CEST 2013
Updating branch refs/heads/nick/gtk3
to df13f26e5442134ab3c4c2a9ed8e9e41bdf3148e (commit)
from b513b93b7b047a9f46074b79fd1d85f743178751 (commit)
commit df13f26e5442134ab3c4c2a9ed8e9e41bdf3148e
Author: Nick Schermer <nick at xfce.org>
Date: Sun Mar 17 14:22:53 2013 +0100
Clock: Improve tooltips, plug leaks and fix glade layout.
plugins/clock/clock-dialog.glade | 103 ++++++++++++++++++++------------------
plugins/clock/clock.c | 23 +++++----
2 files changed, 67 insertions(+), 59 deletions(-)
diff --git a/plugins/clock/clock-dialog.glade b/plugins/clock/clock-dialog.glade
index ac35769..1b48528 100644
--- a/plugins/clock/clock-dialog.glade
+++ b/plugins/clock/clock-dialog.glade
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
- <requires lib="gtk+" version="2.14"/>
+ <requires lib="gtk+" version="2.24"/>
<!-- interface-requires libxfce4ui 0.0 -->
<!-- interface-naming-policy toplevel-contextual -->
<object class="XfceTitledDialog" id="dialog">
@@ -21,10 +21,10 @@
<child>
<object class="GtkButton" id="close-button">
<property name="label">gtk-close</property>
+ <property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
- <property name="use_action_appearance">False</property>
<property name="use_stock">True</property>
</object>
<packing>
@@ -36,10 +36,10 @@
<child>
<object class="GtkButton" id="help-button">
<property name="label">gtk-help</property>
+ <property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
- <property name="use_action_appearance">False</property>
<property name="use_stock">True</property>
</object>
<packing>
@@ -84,24 +84,11 @@
<property name="column_spacing">12</property>
<property name="row_spacing">6</property>
<child>
- <object class="GtkLabel" id="label9">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">Time_zone:</property>
- <property name="use_underline">True</property>
- <property name="mnemonic_widget">timezone-name</property>
- </object>
- <packing>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- </packing>
- </child>
- <child>
<object class="GtkEntry" id="timezone-name">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="tooltip_text" translatable="yes">Name of the timezone matching the system's timezone database. Leave empty to revert to the local time.</property>
+ <property name="tooltip_text" translatable="yes">Name of a timezone corresponding a file in the zoneinfo database, for example "America/New_York". Leave empty to use the localtime.</property>
+ <property name="invisible_char">●</property>
<property name="primary_icon_activatable">False</property>
<property name="secondary_icon_activatable">False</property>
<property name="primary_icon_sensitive">True</property>
@@ -110,31 +97,44 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
</packing>
</child>
<child>
- <object class="GtkLabel" id="label7">
+ <object class="GtkLabel" id="label9">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
- <property name="label" translatable="yes">Time:</property>
+ <property name="label" translatable="yes">Time_zone:</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">timezone-name</property>
</object>
+ <packing>
+ <property name="x_options">GTK_FILL</property>
+ </packing>
</child>
<child>
- <object class="GtkButton" id="run-time-config-tool">
- <property name="label" translatable="yes">_Set</property>
+ <object class="GtkAlignment" id="alignment4">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="tooltip_text" translatable="yes">Start a tool for setting the system time and date. If the button is grayed out, check the "Help" page to see how to configure it correctly.</property>
- <property name="use_action_appearance">False</property>
- <property name="use_underline">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="xscale">0</property>
+ <child>
+ <object class="GtkButton" id="run-time-config-tool">
+ <property name="label" translatable="yes">Time and Date _Settings...</property>
+ <property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="image">image1</property>
+ <property name="use_underline">True</property>
+ </object>
+ </child>
</object>
<packing>
- <property name="left_attach">1</property>
<property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">GTK_FILL</property>
</packing>
</child>
</object>
@@ -179,6 +179,15 @@
<property name="column_spacing">12</property>
<property name="row_spacing">6</property>
<child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
<object class="GtkLabel" id="label2">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -257,15 +266,6 @@
<property name="bottom_attach">3</property>
</packing>
</child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
</object>
</child>
</object>
@@ -307,10 +307,10 @@
<child>
<object class="GtkCheckButton" id="show-seconds">
<property name="label" translatable="yes">Display _seconds</property>
+ <property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
- <property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<property name="draw_indicator">True</property>
</object>
@@ -323,10 +323,10 @@
<child>
<object class="GtkCheckButton" id="true-binary">
<property name="label" translatable="yes">True _binary clock</property>
+ <property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
- <property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<property name="draw_indicator">True</property>
</object>
@@ -339,10 +339,10 @@
<child>
<object class="GtkCheckButton" id="show-military">
<property name="label" translatable="yes">24-_hour clock</property>
+ <property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
- <property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<property name="draw_indicator">True</property>
</object>
@@ -355,10 +355,10 @@
<child>
<object class="GtkCheckButton" id="flash-separators">
<property name="label" translatable="yes">Fl_ash time separators</property>
+ <property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
- <property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<property name="draw_indicator">True</property>
</object>
@@ -371,10 +371,10 @@
<child>
<object class="GtkCheckButton" id="show-meridiem">
<property name="label" translatable="yes">Sho_w AM/PM</property>
+ <property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
- <property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<property name="draw_indicator">True</property>
</object>
@@ -393,6 +393,9 @@
<property name="column_spacing">12</property>
<property name="row_spacing">6</property>
<child>
+ <placeholder/>
+ </child>
+ <child>
<object class="GtkLabel" id="label8">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -437,9 +440,6 @@
<property name="bottom_attach">2</property>
</packing>
</child>
- <child>
- <placeholder/>
- </child>
</object>
<packing>
<property name="expand">True</property>
@@ -491,10 +491,10 @@
<child>
<object class="GtkCheckButton" id="show-inactive">
<property name="label" translatable="yes">Show _inactive dots</property>
+ <property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
- <property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<property name="draw_indicator">True</property>
</object>
@@ -507,10 +507,10 @@
<child>
<object class="GtkCheckButton" id="show-grid">
<property name="label" translatable="yes">Show gri_d</property>
+ <property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
- <property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<property name="draw_indicator">True</property>
</object>
@@ -561,6 +561,11 @@
<property name="page_increment">1</property>
<property name="page_size">1</property>
</object>
+ <object class="GtkImage" id="image1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="icon_name">time-admin</property>
+ </object>
<object class="GtkListStore" id="mode-model">
<columns>
<!-- column-name title -->
diff --git a/plugins/clock/clock.c b/plugins/clock/clock.c
index 61e6c66..992d7bb 100644
--- a/plugins/clock/clock.c
+++ b/plugins/clock/clock.c
@@ -44,9 +44,11 @@
#include "clock-dialog_ui.h"
#define DEFAULT_TOOLTIP_FORMAT "%A %d %B %Y"
+
/* Please adjust the following command to match your distribution */
/* e.g. "time-admin" */
-#define DEFAULT_TIME_CONFIG_TOOL ""
+#define DEFAULT_TIME_CONFIG_TOOL "time-admin"
+
static void clock_plugin_get_property (GObject *object,
@@ -512,7 +514,10 @@ clock_plugin_free_data (XfcePanelPlugin *panel_plugin)
if (plugin->calendar_window != NULL)
gtk_widget_destroy (plugin->calendar_window);
+ g_object_unref (G_OBJECT (plugin->time));
+
g_free (plugin->tooltip_format);
+ g_free (plugin->time_config_tool);
g_free (plugin->command);
}
@@ -820,18 +825,17 @@ clock_plugin_configure_plugin_free (gpointer user_data)
static void
clock_plugin_configure_config_tool_changed (ClockPluginDialog *dialog)
{
- GObject *object;
+ GObject *object;
+ gchar *path;
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);
+ path = g_find_program_in_path (dialog->plugin->time_config_tool);
+ gtk_widget_set_visible (GTK_WIDGET (object), path != NULL);
+ g_free (path);
}
@@ -840,7 +844,7 @@ static void
clock_plugin_configure_run_config_tool (GtkWidget *button,
ClockPlugin *plugin)
{
- GError *error = NULL;
+ GError *error = NULL;
panel_return_if_fail (XFCE_IS_CLOCK_PLUGIN (plugin));
@@ -848,8 +852,7 @@ clock_plugin_configure_run_config_tool (GtkWidget *button,
plugin->time_config_tool,
FALSE, FALSE, &error))
{
- xfce_dialog_show_error
- (NULL, error, _("Failed to execute command \"%s\"."), plugin->time_config_tool);
+ xfce_dialog_show_error (NULL, error, _("Failed to execute command \"%s\"."), plugin->time_config_tool);
g_error_free (error);
}
}
More information about the Xfce4-commits
mailing list