[Xfce4-commits] [xfce/xfce4-panel] 01/01: clock: Fix format validation (Bug #11527)

noreply at xfce.org noreply at xfce.org
Sun Nov 26 01:16:05 CET 2017


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

o   c   h   o   s   i       p   u   s   h   e   d       a       c   o   m   m   i   t       t   o       b   r   a   n   c   h       m   a   s   t   e   r   
   in repository xfce/xfce4-panel.

commit 989d654b5d6b33e1c4127c740c806420a30b45a4
Author: Simon Steinbeiss <simon.steinbeiss at elfenbeinturm.at>
Date:   Sun Nov 26 01:15:17 2017 +0100

    clock: Fix format validation (Bug #11527)
    
    The insert-text signal is ok for validating before the user input.
    As we want to validate the complete string we use the changed signal
    instead, because it is emitted after the user input.
---
 plugins/clock/clock.c | 18 +++++++-----------
 1 file changed, 7 insertions(+), 11 deletions(-)

diff --git a/plugins/clock/clock.c b/plugins/clock/clock.c
index 0fd3867..fc2396c 100644
--- a/plugins/clock/clock.c
+++ b/plugins/clock/clock.c
@@ -787,18 +787,14 @@ clock_plugin_validate_format_specifier (GtkEntry *entry, gchar *format, ClockPlu
 
 
 static void
-clock_plugin_validate_entry_text (GtkEntry *entry,
-                                  const gchar *text,
-                                  gint length,
-                                  gint *position,
-                                  ClockPlugin *plugin)
+clock_plugin_validate_entry_text (GtkEditable *entry,
+                                  gpointer user_data)
 {
-  gchar *format;
-
-  format = g_strdup_printf ("%s%s",gtk_entry_get_text(entry), text);
-  clock_plugin_validate_format_specifier (entry, format, plugin);
+  ClockPlugin *plugin = user_data;
 
-  g_free (format);
+  clock_plugin_validate_format_specifier (entry,
+                                          gtk_entry_get_text(GTK_ENTRY (entry)),
+                                          plugin);
 }
 
 
@@ -1062,7 +1058,7 @@ clock_plugin_configure_plugin (XfcePanelPlugin *panel_plugin)
                                               tooltip_formats);
 
   object = gtk_builder_get_object (builder, "digital-format");
-  g_signal_connect (G_OBJECT (object), "insert_text",
+  g_signal_connect (G_OBJECT (object), "changed",
                     G_CALLBACK (clock_plugin_validate_entry_text), plugin);
   combo = gtk_builder_get_object (builder, "digital-chooser");
   clock_plugin_configure_plugin_chooser_fill (plugin,

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list