[gtk/wip/otte/toolbar: 3/8] gtk-demo: Get rid of toolbars
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/otte/toolbar: 3/8] gtk-demo: Get rid of toolbars
- Date: Mon, 3 Feb 2020 04:46:48 +0000 (UTC)
commit 7502eea82a5352700a56255163d3ae5702c6d781
Author: Benjamin Otte <otte redhat com>
Date: Mon Feb 3 04:52:15 2020 +0100
gtk-demo: Get rid of toolbars
demos/gtk-demo/css_shadows.c | 19 ++++++++-----------
demos/gtk-demo/demo.ui | 17 ++++++++---------
demos/gtk-demo/iconview.c | 24 ++++++++----------------
3 files changed, 24 insertions(+), 36 deletions(-)
---
diff --git a/demos/gtk-demo/css_shadows.c b/demos/gtk-demo/css_shadows.c
index 318141c896..a61bd3bd03 100644
--- a/demos/gtk-demo/css_shadows.c
+++ b/demos/gtk-demo/css_shadows.c
@@ -62,22 +62,19 @@ GtkWidget *
create_toolbar (void)
{
GtkWidget *toolbar;
- GtkToolItem *item;
+ GtkWidget *item;
- toolbar = gtk_toolbar_new ();
+ toolbar = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
gtk_widget_set_valign (toolbar, GTK_ALIGN_CENTER);
- item = gtk_tool_button_new (NULL, NULL);
- gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (item), "go-next");
- gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
+ item = gtk_button_new_from_icon_name ("go-next");
+ gtk_container_add (GTK_CONTAINER (toolbar), item);
- item = gtk_tool_button_new (NULL, NULL);
- gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (item), "go-previous");
- gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
+ item = gtk_button_new_from_icon_name ("go-previous");
+ gtk_container_add (GTK_CONTAINER (toolbar), item);
- item = gtk_tool_button_new (NULL, "Hello World");
- gtk_tool_item_set_is_important (item, TRUE);
- gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
+ item = gtk_button_new_with_label ("Hello World");
+ gtk_container_add (GTK_CONTAINER (toolbar), item);
return toolbar;
}
diff --git a/demos/gtk-demo/demo.ui b/demos/gtk-demo/demo.ui
index 7520467155..b020232523 100644
--- a/demos/gtk-demo/demo.ui
+++ b/demos/gtk-demo/demo.ui
@@ -111,53 +111,52 @@
</object>
</child>
<child>
- <object class="GtkToolbar" id="toolbar1">
+ <object class="GtkBox" id="toolbar1">
<child internal-child="accessible">
<object class="AtkObject" id="a11y-toolbar">
<property name="AtkObject::accessible-name">The toolbar</property>
</object>
</child>
<child>
- <object class="GtkToolButton">
+ <object class="GtkButton">
<property name="label" translatable="yes">New</property>
<property name="tooltip-text" translatable="yes">Create a new file</property>
<property name="icon-name">document-new</property>
</object>
</child>
<child>
- <object class="GtkToolButton">
+ <object class="GtkButton">
<property name="label" translatable="yes">Open</property>
<property name="tooltip-text" translatable="yes">Open a file</property>
<property name="icon-name">document-open</property>
</object>
</child>
<child>
- <object class="GtkToolButton">
+ <object class="GtkButton">
<property name="label" translatable="yes">Save</property>
<property name="tooltip-text" translatable="yes">Save a file</property>
<property name="icon-name">document-save</property>
- <property name="is-important">1</property>
</object>
</child>
<child>
- <object class="GtkSeparatorToolItem"/>
+ <object class="GtkSeparator"/>
</child>
<child>
- <object class="GtkToolButton">
+ <object class="GtkButton">
<property name="label" translatable="yes">Copy</property>
<property name="tooltip-text" translatable="yes">Copy selected object into the
clipboard</property>
<property name="icon-name">edit-copy</property>
</object>
</child>
<child>
- <object class="GtkToolButton">
+ <object class="GtkButton">
<property name="label" translatable="yes">Cut</property>
<property name="tooltip-text" translatable="yes">Cut selected object into the
clipboard</property>
<property name="icon-name">edit-cut</property>
</object>
</child>
<child>
- <object class="GtkToolButton">
+ <object class="GtkButton">
<property name="label" translatable="yes">Paste</property>
<property name="tooltip-text" translatable="yes">Paste object from the clipboard</property>
<property name="icon-name">edit-paste</property>
diff --git a/demos/gtk-demo/iconview.c b/demos/gtk-demo/iconview.c
index d252ef36ec..7e0e15d4e2 100644
--- a/demos/gtk-demo/iconview.c
+++ b/demos/gtk-demo/iconview.c
@@ -26,7 +26,7 @@ enum
static GdkPixbuf *file_pixbuf, *folder_pixbuf;
gchar *parent;
-GtkToolItem *up_button;
+GtkWidget *up_button;
/* Loads the images for the demo and returns whether the operation succeeded */
static void
@@ -248,7 +248,7 @@ do_iconview (GtkWidget *do_widget)
GtkListStore *store;
GtkWidget *vbox;
GtkWidget *tool_bar;
- GtkToolItem *home_button;
+ GtkWidget *home_button;
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_default_size (GTK_WINDOW (window), 650, 400);
@@ -265,23 +265,15 @@ do_iconview (GtkWidget *do_widget)
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_container_add (GTK_CONTAINER (window), vbox);
- tool_bar = gtk_toolbar_new ();
+ tool_bar = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_container_add (GTK_CONTAINER (vbox), tool_bar);
- up_button = gtk_tool_button_new (NULL, NULL);
- gtk_tool_button_set_label (GTK_TOOL_BUTTON (up_button), _("_Up"));
- gtk_tool_button_set_use_underline (GTK_TOOL_BUTTON (up_button), TRUE);
- gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (up_button), "go-up");
- gtk_tool_item_set_is_important (up_button, TRUE);
+ up_button = gtk_button_new_with_mnemonic ("_Up");
gtk_widget_set_sensitive (GTK_WIDGET (up_button), FALSE);
- gtk_toolbar_insert (GTK_TOOLBAR (tool_bar), up_button, -1);
-
- home_button = gtk_tool_button_new (NULL, NULL);
- gtk_tool_button_set_label (GTK_TOOL_BUTTON (home_button), _("_Home"));
- gtk_tool_button_set_use_underline (GTK_TOOL_BUTTON (home_button), TRUE);
- gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (home_button), "go-home");
- gtk_tool_item_set_is_important (home_button, TRUE);
- gtk_toolbar_insert (GTK_TOOLBAR (tool_bar), home_button, -1);
+ gtk_container_add (GTK_CONTAINER (tool_bar), up_button);
+
+ home_button = gtk_button_new_with_mnemonic ("_Home");
+ gtk_container_add (GTK_CONTAINER (tool_bar), home_button);
sw = gtk_scrolled_window_new (NULL, NULL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]