Merge branch 'wip/exalm/image-button' into 'master'

Ensure consistent header bar buttons in the demo and tests

See merge request GNOME/gtk!3537
This commit is contained in:
Matthias Clasen 2021-05-09 23:06:25 +00:00
commit 1601e204f4
8 changed files with 14 additions and 29 deletions

View File

@ -13,13 +13,13 @@
</style> </style>
<child> <child>
<object class="GtkButton"> <object class="GtkButton">
<property name="icon-name">pan-start-symbolic</property> <property name="icon-name">go-previous-symbolic</property>
<signal name="clicked" handler="fishbowl_prev_button_clicked_cb" object="bowl" swapped="no"/> <signal name="clicked" handler="fishbowl_prev_button_clicked_cb" object="bowl" swapped="no"/>
</object> </object>
</child> </child>
<child> <child>
<object class="GtkButton"> <object class="GtkButton">
<property name="icon-name">pan-end-symbolic</property> <property name="icon-name">go-next-symbolic</property>
<signal name="clicked" handler="fishbowl_next_button_clicked_cb" object="bowl" swapped="no"/> <signal name="clicked" handler="fishbowl_next_button_clicked_cb" object="bowl" swapped="no"/>
</object> </object>
</child> </child>

View File

@ -10,12 +10,8 @@
<object class="GtkButton" id="reset"> <object class="GtkButton" id="reset">
<property name="receives-default">1</property> <property name="receives-default">1</property>
<property name="tooltip-text">Reset</property> <property name="tooltip-text">Reset</property>
<property name="icon-name">view-refresh-symbolic</property>
<signal name="clicked" handler="font_features_reset_features" swapped="no"/> <signal name="clicked" handler="font_features_reset_features" swapped="no"/>
<child>
<object class="GtkImage">
<property name="icon-name">view-refresh-symbolic</property>
</object>
</child>
</object> </object>
</child> </child>
</object> </object>

View File

@ -18,8 +18,6 @@ do_headerbar (GtkWidget *do_widget)
GtkWidget *header; GtkWidget *header;
GtkWidget *button; GtkWidget *button;
GtkWidget *box; GtkWidget *box;
GtkWidget *image;
GIcon *icon;
if (!window) if (!window)
{ {
@ -32,20 +30,14 @@ do_headerbar (GtkWidget *do_widget)
header = gtk_header_bar_new (); header = gtk_header_bar_new ();
button = gtk_button_new (); button = gtk_button_new_from_icon_name ("mail-send-receive-symbolic");
icon = g_themed_icon_new ("mail-send-receive-symbolic");
image = gtk_image_new_from_gicon (icon);
g_object_unref (icon);
gtk_button_set_child (GTK_BUTTON (button), image);
gtk_header_bar_pack_end (GTK_HEADER_BAR (header), button); gtk_header_bar_pack_end (GTK_HEADER_BAR (header), button);
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_widget_add_css_class (box, "linked"); gtk_widget_add_css_class (box, "linked");
button = gtk_button_new (); button = gtk_button_new_from_icon_name ("go-previous-symbolic");
gtk_button_set_child (GTK_BUTTON (button), gtk_image_new_from_icon_name ("pan-start-symbolic"));
gtk_box_append (GTK_BOX (box), button); gtk_box_append (GTK_BOX (box), button);
button = gtk_button_new (); button = gtk_button_new_from_icon_name ("go-next-symbolic");
gtk_button_set_child (GTK_BUTTON (button), gtk_image_new_from_icon_name ("pan-end-symbolic"));
gtk_box_append (GTK_BOX (box), button); gtk_box_append (GTK_BOX (box), button);
gtk_header_bar_pack_start (GTK_HEADER_BAR (header), box); gtk_header_bar_pack_start (GTK_HEADER_BAR (header), box);

View File

@ -13,13 +13,13 @@
</style> </style>
<child> <child>
<object class="GtkButton"> <object class="GtkButton">
<property name="icon-name">pan-start-symbolic</property> <property name="icon-name">go-previous-symbolic</property>
<signal name="clicked" handler="iconscroll_prev_clicked_cb"/> <signal name="clicked" handler="iconscroll_prev_clicked_cb"/>
</object> </object>
</child> </child>
<child> <child>
<object class="GtkButton"> <object class="GtkButton">
<property name="icon-name">pan-end-symbolic</property> <property name="icon-name">go-next-symbolic</property>
<signal name="clicked" handler="iconscroll_next_clicked_cb"/> <signal name="clicked" handler="iconscroll_next_clicked_cb"/>
</object> </object>
</child> </child>

View File

@ -2606,12 +2606,12 @@ microphone-sensitivity-medium-symbolic</property>
</style> </style>
<child> <child>
<object class="GtkButton"> <object class="GtkButton">
<property name="icon-name">pan-start-symbolic</property> <property name="icon-name">go-previous-symbolic</property>
</object> </object>
</child> </child>
<child> <child>
<object class="GtkButton"> <object class="GtkButton">
<property name="icon-name">pan-end-symbolic</property> <property name="icon-name">go-next-symbolic</property>
</object> </object>
</child> </child>
</object> </object>

View File

@ -439,7 +439,6 @@ change_header (GtkButton *button, gpointer data)
GtkWidget *window = GTK_WIDGET (data); GtkWidget *window = GTK_WIDGET (data);
GtkWidget *label; GtkWidget *label;
GtkWidget *widget; GtkWidget *widget;
GtkWidget *image;
GtkWidget *header; GtkWidget *header;
if (button && gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button))) if (button && gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button)))
@ -470,10 +469,8 @@ change_header (GtkButton *button, gpointer data)
gtk_header_bar_pack_end (GTK_HEADER_BAR (header), widget); gtk_header_bar_pack_end (GTK_HEADER_BAR (header), widget);
widget= gtk_button_new (); widget= gtk_button_new_from_icon_name ("bookmark-new-symbolic");
image = gtk_image_new_from_icon_name ("bookmark-new-symbolic");
g_signal_connect (widget, "clicked", G_CALLBACK (on_bookmark_clicked), window); g_signal_connect (widget, "clicked", G_CALLBACK (on_bookmark_clicked), window);
gtk_button_set_child (GTK_BUTTON (widget), image);
gtk_header_bar_pack_start (GTK_HEADER_BAR (header), widget); gtk_header_bar_pack_start (GTK_HEADER_BAR (header), widget);
} }

View File

@ -30,13 +30,13 @@
</style> </style>
<child> <child>
<object class="GtkButton"> <object class="GtkButton">
<property name="label">&lt;</property> <property name="icon-name">go-previous-symbolic</property>
<property name="valign">center</property> <property name="valign">center</property>
</object> </object>
</child> </child>
<child> <child>
<object class="GtkButton"> <object class="GtkButton">
<property name="label">&gt;</property> <property name="icon-name">go-next-symbolic</property>
<property name="valign">center</property> <property name="valign">center</property>
</object> </object>
</child> </child>

View File

@ -32,7 +32,7 @@
<object class="GtkHeaderBar"> <object class="GtkHeaderBar">
<child type="start"> <child type="start">
<object class="GtkButton" id="back_btn"> <object class="GtkButton" id="back_btn">
<property name="label">&lt;</property> <property name="icon-name">go-previous-symbolic</property>
<property name="valign">center</property> <property name="valign">center</property>
</object> </object>
</child> </child>