colorbutton, fontbutton: Propagate focus-on-click to inner buttons
authorSergey Bugaev <bugaevc@gmail.com>
Fri, 25 Aug 2023 16:13:43 +0000 (19:13 +0300)
committerMatthias Clasen <mclasen@redhat.com>
Tue, 19 Sep 2023 20:32:27 +0000 (16:32 -0400)
These widgets wrap a GtkButton internally. Make it possible to prevent
the inner button from grabbing focus on click by propagating the value
of the focus-on-click property from the widget to the inner button.

Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
gtk/deprecated/gtkcolorbutton.c
gtk/deprecated/gtkfontbutton.c

index 6cd40101aaf6d70a7eb293f329111f2dd1d5615e..83c777e857b94022496985ef5fc3d013bd4d8622 100644 (file)
@@ -290,6 +290,9 @@ gtk_color_button_init (GtkColorButton *button)
 
   button->button = gtk_button_new ();
   g_signal_connect (button->button, "clicked", G_CALLBACK (gtk_color_button_clicked), button);
+  g_object_bind_property (button, "focus-on-click",
+                          button->button, "focus-on-click",
+                          0);
   gtk_widget_set_parent (button->button, GTK_WIDGET (button));
 
   button->swatch = g_object_new (GTK_TYPE_COLOR_SWATCH,
index 2a6f037e3c4f37170ffaa0a50387eee9611e82df..21d59a247eab38c19df8ea3effc1ca561a3350d0 100644 (file)
@@ -594,6 +594,9 @@ gtk_font_button_init (GtkFontButton *font_button)
 
   font_button->button = gtk_button_new ();
   g_signal_connect (font_button->button, "clicked", G_CALLBACK (gtk_font_button_clicked), font_button);
+  g_object_bind_property (font_button, "focus-on-click",
+                          font_button->button, "focus-on-click",
+                          0);
   font_button->font_label = gtk_label_new (_("Font"));
   gtk_widget_set_hexpand (font_button->font_label, TRUE);
   font_button->size_label = gtk_label_new ("14");