mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-26 05:31:07 +00:00
button: Get rid of icon size
In fact, make gtk_button_new_from_icon_name() just set the icon-name property instead of creating a GtkImage.
This commit is contained in:
parent
3da65ff233
commit
f53b72e5ff
@ -425,10 +425,10 @@ create_action_bar (void)
|
||||
|
||||
widget = gtk_action_bar_new ();
|
||||
|
||||
button = gtk_button_new_from_icon_name ("object-select-symbolic", GTK_ICON_SIZE_MENU);
|
||||
button = gtk_button_new_from_icon_name ("object-select-symbolic");
|
||||
gtk_widget_show (button);
|
||||
gtk_container_add (GTK_CONTAINER (widget), button);
|
||||
button = gtk_button_new_from_icon_name ("call-start-symbolic", GTK_ICON_SIZE_MENU);
|
||||
button = gtk_button_new_from_icon_name ("call-start-symbolic");
|
||||
gtk_widget_show (button);
|
||||
gtk_container_add (GTK_CONTAINER (widget), button);
|
||||
g_object_set (gtk_widget_get_parent (button), "margin", 6, "spacing", 6, NULL);
|
||||
|
@ -614,7 +614,6 @@ gtk_button_new_with_label (const gchar *label)
|
||||
/**
|
||||
* gtk_button_new_from_icon_name:
|
||||
* @icon_name: (nullable): an icon name or %NULL
|
||||
* @size: (type int): an icon size (#GtkIconSize)
|
||||
*
|
||||
* Creates a new button containing an icon from the current icon theme.
|
||||
*
|
||||
@ -627,15 +626,13 @@ gtk_button_new_with_label (const gchar *label)
|
||||
* Since: 3.10
|
||||
*/
|
||||
GtkWidget*
|
||||
gtk_button_new_from_icon_name (const gchar *icon_name,
|
||||
GtkIconSize size)
|
||||
gtk_button_new_from_icon_name (const gchar *icon_name)
|
||||
{
|
||||
GtkWidget *button;
|
||||
GtkWidget *image;
|
||||
|
||||
image = gtk_image_new_from_icon_name (icon_name, size);
|
||||
button = g_object_new (GTK_TYPE_BUTTON, NULL);
|
||||
gtk_container_add (GTK_CONTAINER (button), image);
|
||||
button = g_object_new (GTK_TYPE_BUTTON,
|
||||
"icon-name", icon_name,
|
||||
NULL);
|
||||
|
||||
return button;
|
||||
}
|
||||
|
@ -89,8 +89,7 @@ GtkWidget* gtk_button_new (void);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GtkWidget* gtk_button_new_with_label (const gchar *label);
|
||||
GDK_AVAILABLE_IN_3_10
|
||||
GtkWidget* gtk_button_new_from_icon_name (const gchar *icon_name,
|
||||
GtkIconSize size);
|
||||
GtkWidget* gtk_button_new_from_icon_name (const gchar *icon_name);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GtkWidget* gtk_button_new_with_mnemonic (const gchar *label);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
|
@ -884,7 +884,7 @@ gtk_spin_button_init (GtkSpinButton *spin_button)
|
||||
g_signal_connect (priv->entry, "activate", G_CALLBACK (gtk_spin_button_activate), spin_button);
|
||||
gtk_container_add (GTK_CONTAINER (priv->box), priv->entry);
|
||||
|
||||
priv->down_button = gtk_button_new_from_icon_name ("list-remove-symbolic", GTK_ICON_SIZE_BUTTON);
|
||||
priv->down_button = gtk_button_new_from_icon_name ("list-remove-symbolic");
|
||||
gtk_widget_set_can_focus (priv->down_button, FALSE);
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (priv->down_button), "down");
|
||||
gtk_container_add (GTK_CONTAINER (priv->box), priv->down_button);
|
||||
@ -897,7 +897,7 @@ gtk_spin_button_init (GtkSpinButton *spin_button)
|
||||
g_signal_connect (priv->down_click_gesture, "pressed", G_CALLBACK (button_pressed_cb), spin_button);
|
||||
g_signal_connect (priv->down_click_gesture, "released", G_CALLBACK (button_released_cb), spin_button);
|
||||
|
||||
priv->up_button = gtk_button_new_from_icon_name ("list-add-symbolic", GTK_ICON_SIZE_BUTTON);
|
||||
priv->up_button = gtk_button_new_from_icon_name ("list-add-symbolic");
|
||||
gtk_widget_set_can_focus (priv->up_button, FALSE);
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (priv->up_button), "up");
|
||||
gtk_container_add (GTK_CONTAINER (priv->box), priv->up_button);
|
||||
|
@ -72,7 +72,7 @@ add_string (GtkInspectorStrvEditor *editor,
|
||||
g_object_set_data (G_OBJECT (box), "entry", entry);
|
||||
g_signal_connect_swapped (entry, "notify::text", G_CALLBACK (emit_changed), editor);
|
||||
|
||||
button = gtk_button_new_from_icon_name ("user-trash-symbolic", GTK_ICON_SIZE_MENU);
|
||||
button = gtk_button_new_from_icon_name ("user-trash-symbolic");
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (button), "image-button");
|
||||
gtk_widget_show (button);
|
||||
gtk_box_pack_start (GTK_BOX (box), button);
|
||||
@ -100,7 +100,7 @@ gtk_inspector_strv_editor_init (GtkInspectorStrvEditor *editor)
|
||||
editor->box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
|
||||
gtk_widget_show (editor->box);
|
||||
|
||||
editor->button = gtk_button_new_from_icon_name ("list-add-symbolic", GTK_ICON_SIZE_MENU);
|
||||
editor->button = gtk_button_new_from_icon_name ("list-add-symbolic");
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (editor->button), "image-button");
|
||||
gtk_widget_set_focus_on_click (editor->button, FALSE);
|
||||
gtk_widget_set_halign (editor->button, GTK_ALIGN_END);
|
||||
|
@ -202,8 +202,7 @@ gtk_inspector_window_init (GtkInspectorWindow *iw)
|
||||
|
||||
if (use_picker)
|
||||
{
|
||||
button = gtk_button_new_from_icon_name ("find-location-symbolic",
|
||||
GTK_ICON_SIZE_MENU);
|
||||
button = gtk_button_new_from_icon_name ("find-location-symbolic");
|
||||
gtk_widget_set_focus_on_click (button, FALSE);
|
||||
gtk_widget_set_halign (button, GTK_ALIGN_START);
|
||||
gtk_widget_set_valign (button, GTK_ALIGN_CENTER);
|
||||
|
@ -84,7 +84,7 @@ int main (int argc, char *argv[])
|
||||
|
||||
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
||||
gtk_container_add (GTK_CONTAINER (box), hbox);
|
||||
button = gtk_button_new_from_icon_name ("help-about", GTK_ICON_SIZE_BUTTON);
|
||||
button = gtk_button_new_from_icon_name ("help-about");
|
||||
gtk_container_add (GTK_CONTAINER (hbox), button);
|
||||
|
||||
g_object_get (button,
|
||||
|
@ -179,7 +179,7 @@ create_notebook (gchar **labels,
|
||||
gtk_widget_set_vexpand (notebook, TRUE);
|
||||
gtk_widget_set_hexpand (notebook, TRUE);
|
||||
|
||||
action_widget = gtk_button_new_from_icon_name ("list-add-symbolic", GTK_ICON_SIZE_BUTTON);
|
||||
action_widget = gtk_button_new_from_icon_name ("list-add-symbolic");
|
||||
g_signal_connect (action_widget, "clicked", G_CALLBACK (action_clicked_cb), notebook);
|
||||
gtk_widget_show (action_widget);
|
||||
gtk_notebook_set_action_widget (GTK_NOTEBOOK (notebook), action_widget, GTK_PACK_END);
|
||||
@ -223,7 +223,7 @@ create_notebook_non_dragable_content (gchar **labels,
|
||||
gtk_widget_set_vexpand (notebook, TRUE);
|
||||
gtk_widget_set_hexpand (notebook, TRUE);
|
||||
|
||||
action_widget = gtk_button_new_from_icon_name ("list-add-symbolic", GTK_ICON_SIZE_BUTTON);
|
||||
action_widget = gtk_button_new_from_icon_name ("list-add-symbolic");
|
||||
g_signal_connect (action_widget, "clicked", G_CALLBACK (action_clicked_cb), notebook);
|
||||
gtk_widget_show (action_widget);
|
||||
gtk_notebook_set_action_widget (GTK_NOTEBOOK (notebook), action_widget, GTK_PACK_END);
|
||||
|
@ -23,11 +23,11 @@ int main (int argc, char *argv[])
|
||||
box3 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
||||
g_object_set (box3, "margin", 10, NULL);
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (box3), GTK_STYLE_CLASS_LINKED);
|
||||
button = gtk_button_new_from_icon_name ("document-new-symbolic", GTK_ICON_SIZE_BUTTON);
|
||||
button = gtk_button_new_from_icon_name ("document-new-symbolic");
|
||||
gtk_container_add (GTK_CONTAINER (box3), button);
|
||||
button = gtk_button_new_from_icon_name ("document-open-symbolic", GTK_ICON_SIZE_BUTTON);
|
||||
button = gtk_button_new_from_icon_name ("document-open-symbolic");
|
||||
gtk_container_add (GTK_CONTAINER (box3), button);
|
||||
button = gtk_button_new_from_icon_name ("document-save-symbolic", GTK_ICON_SIZE_BUTTON);
|
||||
button = gtk_button_new_from_icon_name ("document-save-symbolic");
|
||||
gtk_container_add (GTK_CONTAINER (box3), button);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (frame), box3);
|
||||
|
Loading…
Reference in New Issue
Block a user