Unverified Commit e74b4336 authored by step's avatar step Committed by GitHub

fix form switch changed callback

Here this example showed garbage when the switch widget was changed ```sh yad --form --field=switch:SW TRUE --field=check:CHK TRUE --changed-action='echo 3:' --field=changes ``` To fix this issue I changed the callback according to the gobject signature https://docs.gtk.org/gobject/signal.Object.notify.html.
parent a2008874
...@@ -472,6 +472,12 @@ field_changed_cb (GtkWidget *w, guint fn) ...@@ -472,6 +472,12 @@ field_changed_cb (GtkWidget *w, guint fn)
} }
static void static void
switch_changed_cb (GObject *obj, GParamSpec *spec, gpointer data)
{
field_changed_cb (obj, data);
}
static void
form_activate_cb (GtkEntry * entry, gpointer data) form_activate_cb (GtkEntry * entry, gpointer data)
{ {
if (options.plug == -1) if (options.plug == -1)
...@@ -988,7 +994,7 @@ form_create_widget (GtkWidget * dlg) ...@@ -988,7 +994,7 @@ form_create_widget (GtkWidget * dlg)
gtk_widget_set_halign (e, GTK_ALIGN_START); /* prevent expanding widget (make it always compact) */ gtk_widget_set_halign (e, GTK_ALIGN_START); /* prevent expanding widget (make it always compact) */
gtk_label_set_mnemonic_widget (GTK_LABEL (l), e); gtk_label_set_mnemonic_widget (GTK_LABEL (l), e);
fields = g_slist_append (fields, e); fields = g_slist_append (fields, e);
g_signal_connect_after (G_OBJECT (e), "notify::active", G_CALLBACK (field_changed_cb), GINT_TO_POINTER (i)); g_signal_connect_after (G_OBJECT (e), "notify::active", G_CALLBACK (switch_changed_cb), GINT_TO_POINTER (i));
} }
break; break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment