This is an automated email from the git hooks/post-receive script.

ochosi pushed a 
commit to branch 
master
in repository xfce/xfce4-panel.

commit 285ee742f98707516c79a4d22f08285f448d28cd
Author: Simon Steinbeiss <[email protected]>
Date:   Sun Oct 13 01:07:59 2019 +0200

    clock: Validate timezone entry (Bug #16036)
---
 plugins/clock/clock.c | 42 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)

diff --git a/plugins/clock/clock.c b/plugins/clock/clock.c
index 64a1073..ff7a599 100644
--- a/plugins/clock/clock.c
+++ b/plugins/clock/clock.c
@@ -794,6 +794,46 @@ clock_plugin_validate_entry_text (GtkEditable *entry,
 
 
 static void
+clock_plugin_validate_timezone (GtkEntry    *entry,
+                                const gchar *format,
+                                ClockPlugin *plugin)
+{
+  GtkStyleContext *context;
+  gchar           *filename;
+
+  context = gtk_widget_get_style_context (GTK_WIDGET (entry));
+
+  if (strcmp (format, "") != 0)
+    {
+      filename = g_build_filename (ZONEINFO_DIR, format, NULL);
+
+      if (!g_file_test (filename, G_FILE_TEST_IS_REGULAR))
+        gtk_style_context_add_class (context, "error");
+      else
+        gtk_style_context_remove_class (context, "error");
+    }
+  else
+    {
+      gtk_style_context_remove_class (context, "error");
+    }
+}
+
+
+
+static void
+clock_plugin_validate_entry_tz (GtkEditable *entry,
+                                gpointer     user_data)
+{
+  ClockPlugin *plugin = user_data;
+
+  clock_plugin_validate_timezone (GTK_ENTRY (entry),
+                                  gtk_entry_get_text (GTK_ENTRY (entry)),
+                                  plugin);
+}
+
+
+
+static void
 clock_plugin_configure_plugin_chooser_fill (ClockPlugin *plugin,
                                             GtkComboBox *combo,
                                             GtkEntry    *entry,
@@ -1026,6 +1066,8 @@ clock_plugin_configure_plugin (XfcePanelPlugin 
*panel_plugin)
 
   object = gtk_builder_get_object (builder, "timezone-name");
   panel_return_if_fail (GTK_IS_ENTRY (object));
+  g_signal_connect (G_OBJECT (object), "changed",
+                    G_CALLBACK (clock_plugin_validate_entry_tz), plugin);
   g_object_bind_property (G_OBJECT (plugin->time), "timezone",
                           G_OBJECT (object), "text",
                           G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.
_______________________________________________
Xfce4-commits mailing list
[email protected]
https://mail.xfce.org/mailman/listinfo/xfce4-commits

Reply via email to