[gtk+/wip/matthiasc/icon-size: 5/15] button: Get rid of icon size
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/matthiasc/icon-size: 5/15] button: Get rid of icon size
- Date: Wed, 15 Nov 2017 04:34:18 +0000 (UTC)
commit 382ff81bb9de5617f0d5f04297a3cceb15ae2961
Author: Benjamin Otte <otte redhat com>
Date: Fri Jan 20 08:02:48 2017 +0100
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.
docs/tools/widgets.c | 4 ++--
gtk/gtkbutton.c | 11 ++++-------
gtk/gtkbutton.h | 3 +--
gtk/gtkspinbutton.c | 4 ++--
gtk/inspector/strv-editor.c | 4 ++--
gtk/inspector/window.c | 3 +--
tests/testbuttons.c | 2 +-
tests/testnotebookdnd.c | 4 ++--
tests/testtoolbar2.c | 6 +++---
9 files changed, 18 insertions(+), 23 deletions(-)
---
diff --git a/docs/tools/widgets.c b/docs/tools/widgets.c
index ba062e7..b8fc1f7 100644
--- a/docs/tools/widgets.c
+++ b/docs/tools/widgets.c
@@ -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);
diff --git a/gtk/gtkbutton.c b/gtk/gtkbutton.c
index eb2958c..b66e897 100644
--- a/gtk/gtkbutton.c
+++ b/gtk/gtkbutton.c
@@ -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;
}
diff --git a/gtk/gtkbutton.h b/gtk/gtkbutton.h
index d62c49c..2bd236c 100644
--- a/gtk/gtkbutton.h
+++ b/gtk/gtkbutton.h
@@ -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
diff --git a/gtk/gtkspinbutton.c b/gtk/gtkspinbutton.c
index 2cd6c28..7210916 100644
--- a/gtk/gtkspinbutton.c
+++ b/gtk/gtkspinbutton.c
@@ -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);
diff --git a/gtk/inspector/strv-editor.c b/gtk/inspector/strv-editor.c
index 0ea973b..cc5fad6 100644
--- a/gtk/inspector/strv-editor.c
+++ b/gtk/inspector/strv-editor.c
@@ -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);
diff --git a/gtk/inspector/window.c b/gtk/inspector/window.c
index e771184..655b360 100644
--- a/gtk/inspector/window.c
+++ b/gtk/inspector/window.c
@@ -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);
diff --git a/tests/testbuttons.c b/tests/testbuttons.c
index d597e4b..038dfad 100644
--- a/tests/testbuttons.c
+++ b/tests/testbuttons.c
@@ -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,
diff --git a/tests/testnotebookdnd.c b/tests/testnotebookdnd.c
index bf050e4..cf398a8 100644
--- a/tests/testnotebookdnd.c
+++ b/tests/testnotebookdnd.c
@@ -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);
diff --git a/tests/testtoolbar2.c b/tests/testtoolbar2.c
index 499edb8..4b1b24e 100644
--- a/tests/testtoolbar2.c
+++ b/tests/testtoolbar2.c
@@ -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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]