Commit 708dd8cc authored by William Jon McCann's avatar William Jon McCann

Remove usage of stock APIs in demo

With the exception of GtkAction.
parent 75a9b911
......@@ -47,7 +47,6 @@ demos = \
sizegroup.c \
spinner.c \
stack.c \
stock_browser.c \
textview.c \
textscroll.c \
theming_style_classes.c \
......
......@@ -155,40 +155,6 @@ activate_quit (GSimpleAction *action,
}
}
static void
register_stock_icons (void)
{
static gboolean registered = FALSE;
if (!registered)
{
GdkPixbuf *pixbuf;
GtkIconFactory *factory;
GtkIconSet *icon_set;
static GtkStockItem items[] = {
{ "demo-gtk-logo", "_GTK!", 0, 0, NULL }
};
registered = TRUE;
gtk_stock_add (items, G_N_ELEMENTS (items));
factory = gtk_icon_factory_new ();
gtk_icon_factory_add_default (factory);
pixbuf = gdk_pixbuf_new_from_resource ("/application/gtk-logo-24.png", NULL);
icon_set = gtk_icon_set_new_from_pixbuf (pixbuf);
gtk_icon_factory_add (factory, "demo-gtk-logo", icon_set);
gtk_icon_set_unref (icon_set);
g_object_unref (pixbuf);
/* Drop our reference to the factory, GTK will hold a reference. */
g_object_unref (factory);
}
}
static void
update_statusbar (GtkTextBuffer *buffer,
GtkStatusbar *statusbar)
......@@ -376,8 +342,6 @@ main (int argc, char *argv[])
gtk_init (NULL, NULL);
register_stock_icons ();
app = gtk_application_new ("org.gtk.Demo", 0);
settings = g_settings_new ("org.gtk.Demo");
......
......@@ -8,12 +8,12 @@
<property name="hexpand">True</property>
<child>
<object class="GtkMenuToolButton" id="menutool">
<property name="stock-id">gtk-open</property>
<property name="icon-name">document-open</property>
</object>
</child>
<child>
<object class="GtkToolButton" id="quit">
<property name="stock-id">gtk-quit</property>
<property name="icon-name">application-exit</property>
<property name="action-name">app.quit</property>
</object>
</child>
......@@ -22,7 +22,7 @@
</child>
<child>
<object class="GtkToolButton" id="logo">
<property name="stock-id">demo-gtk-logo</property>
<property name="icon-name">applications-other</property>
<property name="action-name">win.logo</property>
</object>
</child>
......@@ -54,8 +54,8 @@
<object class="GtkButton" id="button">
<property name="visible">True</property>
<property name="valign">center</property>
<property name="label">gtk-ok</property>
<property name="use-stock">True</property>
<property name="label" translatable="yes">_OK</property>
<property name="use_underline">True</property>
</object>
</child>
</object>
......
......@@ -7,6 +7,7 @@
#include "config.h"
#include <glib/gi18n.h>
#include <gtk/gtk.h>
static GtkWidget *window = NULL;
......@@ -177,10 +178,6 @@ static GtkActionEntry entries[] = {
"_About", "<control>A", /* label, accelerator */
"About", /* tooltip */
G_CALLBACK (about_cb) },
{ "Logo", "demo-gtk-logo", /* name, stock id */
NULL, NULL, /* label, accelerator */
"GTK+", /* tooltip */
G_CALLBACK (activate_action) },
};
static guint n_entries = G_N_ELEMENTS (entries);
......@@ -279,59 +276,9 @@ static const gchar *ui_info =
" </menu>"
" </toolitem>"
" <toolitem action='Quit'/>"
" <separator action='Sep1'/>"
" <toolitem action='Logo'/>"
" </toolbar>"
"</ui>";
/* This function registers our custom toolbar icons, so they can be themed.
*
* It's totally optional to do this, you could just manually insert icons
* and have them not be themeable, especially if you never expect people
* to theme your app.
*/
static void
register_stock_icons (void)
{
static gboolean registered = FALSE;
if (!registered)
{
GdkPixbuf *pixbuf;
GtkIconFactory *factory;
GtkIconSet *icon_set;
static GtkStockItem items[] = {
{ "demo-gtk-logo",
"_GTK!",
0, 0, NULL }
};
registered = TRUE;
/* Register our stock items */
gtk_stock_add (items, G_N_ELEMENTS (items));
/* Add our custom icon factory to the list of defaults */
factory = gtk_icon_factory_new ();
gtk_icon_factory_add_default (factory);
pixbuf = gdk_pixbuf_new_from_resource ("/appwindow/gtk-logo-old.png", NULL);
/* We assert the existence of the pixbuf as we load it from a custom resource. */
g_assert (pixbuf);
icon_set = gtk_icon_set_new_from_pixbuf (pixbuf);
gtk_icon_factory_add (factory, "demo-gtk-logo", icon_set);
gtk_icon_set_unref (icon_set);
g_object_unref (pixbuf);
/* Drop our reference to the factory, GTK will hold a reference. */
g_object_unref (factory);
}
}
static void
update_statusbar (GtkTextBuffer *buffer,
GtkStatusbar *statusbar)
......@@ -387,8 +334,6 @@ do_appwindow (GtkWidget *do_widget)
GtkUIManager *merge;
GError *error = NULL;
register_stock_icons ();
/* Create the toplevel window
*/
......@@ -470,7 +415,7 @@ do_appwindow (GtkWidget *do_widget)
messagelabel,
TRUE, TRUE, 0);
gtk_info_bar_add_button (GTK_INFO_BAR (infobar),
GTK_STOCK_OK, GTK_RESPONSE_OK);
_("OK"), GTK_RESPONSE_OK);
g_signal_connect (infobar, "response",
G_CALLBACK (gtk_widget_hide), NULL);
......
......@@ -3,6 +3,7 @@
* The Button Box widgets are used to arrange buttons with padding.
*/
#include <glib/gi18n.h>
#include <gtk/gtk.h>
static GtkWidget *
......@@ -28,13 +29,13 @@ create_bbox (gint horizontal,
gtk_button_box_set_layout (GTK_BUTTON_BOX (bbox), layout);
gtk_box_set_spacing (GTK_BOX (bbox), spacing);
button = gtk_button_new_from_stock (GTK_STOCK_OK);
button = gtk_button_new_with_label (_("OK"));
gtk_container_add (GTK_CONTAINER (bbox), button);
button = gtk_button_new_from_stock (GTK_STOCK_CANCEL);
button = gtk_button_new_with_label (_("Cancel"));
gtk_container_add (GTK_CONTAINER (bbox), button);
button = gtk_button_new_from_stock (GTK_STOCK_HELP);
button = gtk_button_new_with_label (_("Help"));
gtk_container_add (GTK_CONTAINER (bbox), button);
return frame;
......
......@@ -29,6 +29,7 @@
#undef GDK_DISABLE_DEPRECATED
#include <glib/gi18n.h>
#include <gtk/gtk.h>
/* The ChangeDisplayInfo structure corresponds to a toplevel window and
......@@ -211,8 +212,8 @@ open_display_cb (GtkWidget *button,
dialog = gtk_dialog_new_with_buttons ("Open Display",
GTK_WINDOW (info->window),
GTK_DIALOG_MODAL,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OK, GTK_RESPONSE_OK,
_("_Cancel"), GTK_RESPONSE_CANCEL,
_("_OK"), GTK_RESPONSE_OK,
NULL);
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
......@@ -528,7 +529,7 @@ do_changedisplay (GtkWidget *do_widget)
info->window = gtk_dialog_new_with_buttons ("Change Screen or display",
GTK_WINDOW (do_widget),
0,
GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE,
_("_Close"), GTK_RESPONSE_CLOSE,
"Change", GTK_RESPONSE_OK,
NULL);
......
......@@ -9,6 +9,7 @@
* manager to run.
*/
#include <glib/gi18n.h>
#include <gtk/gtk.h>
#include <string.h>
......@@ -68,17 +69,24 @@ paste_button_clicked (GtkWidget *button,
static GdkPixbuf *
get_image_pixbuf (GtkImage *image)
{
gchar *stock_id;
gchar *icon_name;
GtkIconSize size;
GtkIconTheme *icon_theme;
int width;
switch (gtk_image_get_storage_type (image))
{
case GTK_IMAGE_PIXBUF:
return g_object_ref (gtk_image_get_pixbuf (image));
case GTK_IMAGE_STOCK:
gtk_image_get_stock (image, &stock_id, &size);
return gtk_widget_render_icon_pixbuf (GTK_WIDGET (image),
stock_id, size);
case GTK_IMAGE_ICON_NAME:
gtk_image_get_icon_name (image, &icon_name, &size);
icon_theme = gtk_icon_theme_get_for_screen (gtk_widget_get_screen (image));
gtk_icon_size_lookup (size, &width, NULL);
return gtk_icon_theme_load_icon (icon_theme,
icon_name,
width,
GTK_ICON_LOOKUP_GENERIC_FALLBACK,
NULL);
default:
g_warning ("Image storage type %d not handled",
gtk_image_get_storage_type (image));
......@@ -177,12 +185,12 @@ button_press (GtkWidget *widget,
menu = gtk_menu_new ();
item = gtk_image_menu_item_new_from_stock (GTK_STOCK_COPY, NULL);
item = gtk_menu_item_new_with_mnemonic (_("_Copy"));
g_signal_connect (item, "activate", G_CALLBACK (copy_image), data);
gtk_widget_show (item);
gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
item = gtk_image_menu_item_new_from_stock (GTK_STOCK_PASTE, NULL);
item = gtk_menu_item_new_with_mnemonic (_("_Paste"));
g_signal_connect (item, "activate", G_CALLBACK (paste_image), data);
gtk_widget_show (item);
gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
......@@ -228,7 +236,7 @@ do_clipboard (GtkWidget *do_widget)
gtk_box_pack_start (GTK_BOX (hbox), entry, TRUE, TRUE, 0);
/* Create the button */
button = gtk_button_new_from_stock (GTK_STOCK_COPY);
button = gtk_button_new_with_mnemonic (_("_Copy"));
gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
g_signal_connect (button, "clicked",
G_CALLBACK (copy_button_clicked), entry);
......@@ -245,7 +253,7 @@ do_clipboard (GtkWidget *do_widget)
gtk_box_pack_start (GTK_BOX (hbox), entry, TRUE, TRUE, 0);
/* Create the button */
button = gtk_button_new_from_stock (GTK_STOCK_PASTE);
button = gtk_button_new_with_mnemonic (_("_Paste"));
gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
g_signal_connect (button, "clicked",
G_CALLBACK (paste_button_clicked), entry);
......@@ -258,8 +266,8 @@ do_clipboard (GtkWidget *do_widget)
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
/* Create the first image */
image = gtk_image_new_from_stock (GTK_STOCK_DIALOG_WARNING,
GTK_ICON_SIZE_BUTTON);
image = gtk_image_new_from_icon_name ("dialog-warning",
GTK_ICON_SIZE_BUTTON);
ebox = gtk_event_box_new ();
gtk_container_add (GTK_CONTAINER (ebox), image);
gtk_container_add (GTK_CONTAINER (hbox), ebox);
......@@ -284,8 +292,8 @@ do_clipboard (GtkWidget *do_widget)
G_CALLBACK (button_press), image);
/* Create the second image */
image = gtk_image_new_from_stock (GTK_STOCK_STOP,
GTK_ICON_SIZE_BUTTON);
image = gtk_image_new_from_icon_name ("process-stop",
GTK_ICON_SIZE_BUTTON);
ebox = gtk_event_box_new ();
gtk_container_add (GTK_CONTAINER (ebox), image);
gtk_container_add (GTK_CONTAINER (hbox), ebox);
......
......@@ -7,81 +7,59 @@
* How the options are displayed is controlled by cell renderers.
*/
#include <glib/gi18n.h>
#include <gtk/gtk.h>
enum
{
PIXBUF_COL,
ICON_NAME_COL,
TEXT_COL
};
static gchar *
strip_underscore (const gchar *text)
{
gchar *p, *q;
gchar *result;
result = g_strdup (text);
p = q = result;
while (*p)
{
if (*p != '_')
{
*q = *p;
q++;
}
p++;
}
*q = '\0';
return result;
}
static GtkTreeModel *
create_stock_icon_store (void)
create_icon_store (void)
{
gchar *stock_id[6] = {
GTK_STOCK_DIALOG_WARNING,
GTK_STOCK_STOP,
GTK_STOCK_NEW,
GTK_STOCK_CLEAR,
const gchar *icon_names[6] = {
"dialog-warning",
"process-stop",
"document-new",
"edit-clear",
NULL,
"document-open"
};
const gchar *labels[6] = {
N_("Warning"),
N_("Stop"),
N_("New"),
N_("Clear"),
NULL,
GTK_STOCK_OPEN
N_("Open")
};
GtkStockItem item;
GdkPixbuf *pixbuf;
GtkWidget *cellview;
GtkTreeIter iter;
GtkListStore *store;
gchar *label;
gint i;
cellview = gtk_cell_view_new ();
store = gtk_list_store_new (2, GDK_TYPE_PIXBUF, G_TYPE_STRING);
store = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_STRING);
for (i = 0; i < G_N_ELEMENTS (stock_id); i++)
for (i = 0; i < G_N_ELEMENTS (icon_names); i++)
{
if (stock_id[i])
if (icon_names[i])
{
pixbuf = gtk_widget_render_icon_pixbuf (cellview, stock_id[i],
GTK_ICON_SIZE_BUTTON);
gtk_stock_lookup (stock_id[i], &item);
label = strip_underscore (item.label);
gtk_list_store_append (store, &iter);
gtk_list_store_set (store, &iter,
PIXBUF_COL, pixbuf,
TEXT_COL, label,
ICON_NAME_COL, icon_names[i],
TEXT_COL, _(labels[i]),
-1);
g_object_unref (pixbuf);
g_free (label);
}
else
{
gtk_list_store_append (store, &iter);
gtk_list_store_set (store, &iter,
PIXBUF_COL, NULL,
ICON_NAME_COL, NULL,
TEXT_COL, "separator",
-1);
}
......@@ -351,14 +329,14 @@ do_combobox (GtkWidget *do_widget)
/* A combobox demonstrating cell renderers, separators and
* insensitive rows
*/
frame = gtk_frame_new ("Some stock icons");
frame = gtk_frame_new ("Items with icons");
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_container_set_border_width (GTK_CONTAINER (box), 5);
gtk_container_add (GTK_CONTAINER (frame), box);
model = create_stock_icon_store ();
model = create_icon_store ();
combo = gtk_combo_box_new_with_model (model);
g_object_unref (model);
gtk_container_add (GTK_CONTAINER (box), combo);
......@@ -366,7 +344,7 @@ do_combobox (GtkWidget *do_widget)
renderer = gtk_cell_renderer_pixbuf_new ();
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), renderer, FALSE);
gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo), renderer,
"pixbuf", PIXBUF_COL,
"icon-name", ICON_NAME_COL,
NULL);
gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT (combo),
......
......@@ -68,10 +68,12 @@ create_toolbar (void)
toolbar = gtk_toolbar_new ();
gtk_widget_set_valign (toolbar, GTK_ALIGN_CENTER);
item = gtk_tool_button_new_from_stock (GTK_STOCK_GO_FORWARD);
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_tool_button_new_from_stock (GTK_STOCK_GO_BACK);
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_tool_button_new (NULL, "Hello World");
......
......@@ -121,7 +121,6 @@
<file>sizegroup.c</file>
<file>stack.c</file>
<file>spinner.c</file>
<file>stock_browser.c</file>
<file>textview.c</file>
<file>textscroll.c</file>
<file>theming_style_classes.c</file>
......
......@@ -3,6 +3,7 @@
* Dialog widgets are used to pop up a transient window for user feedback.
*/
#include <glib/gi18n.h>
#include <gtk/gtk.h>
static GtkWidget *window = NULL;
......@@ -36,7 +37,7 @@ interactive_dialog_clicked (GtkButton *button,
GtkWidget *content_area;
GtkWidget *dialog;
GtkWidget *hbox;
GtkWidget *stock;
GtkWidget *image;
GtkWidget *table;
GtkWidget *local_entry1;
GtkWidget *local_entry2;
......@@ -46,9 +47,9 @@ interactive_dialog_clicked (GtkButton *button,
dialog = gtk_dialog_new_with_buttons ("Interactive Dialog",
GTK_WINDOW (window),
GTK_DIALOG_MODAL| GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_STOCK_OK,
_("_OK"),
GTK_RESPONSE_OK,
"_Non-stock Button",
"_Cancel",
GTK_RESPONSE_CANCEL,
NULL);
......@@ -58,8 +59,8 @@ interactive_dialog_clicked (GtkButton *button,
gtk_container_set_border_width (GTK_CONTAINER (hbox), 8);
gtk_box_pack_start (GTK_BOX (content_area), hbox, FALSE, FALSE, 0);
stock = gtk_image_new_from_stock (GTK_STOCK_DIALOG_QUESTION, GTK_ICON_SIZE_DIALOG);
gtk_box_pack_start (GTK_BOX (hbox), stock, FALSE, FALSE, 0);
image = gtk_image_new_from_icon_name ("dialog-question", GTK_ICON_SIZE_DIALOG);
gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0);
table = gtk_grid_new ();
gtk_grid_set_row_spacing (GTK_GRID (table), 4);
......
......@@ -4,6 +4,7 @@
*
*/
#include <glib/gi18n.h>
#include <gtk/gtk.h>
static GtkWidget *window = NULL;
......@@ -22,7 +23,7 @@ do_entry_buffer (GtkWidget *do_widget)
window = gtk_dialog_new_with_buttons ("GtkEntryBuffer",
GTK_WINDOW (do_widget),
0,
GTK_STOCK_CLOSE,
_("_Close"),
GTK_RESPONSE_NONE,
NULL);
gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
......
......@@ -5,6 +5,7 @@
*
*/
#include <glib/gi18n.h>
#include <gtk/gtk.h>
static GtkWidget *window = NULL;
......@@ -49,7 +50,7 @@ do_entry_completion (GtkWidget *do_widget)
window = gtk_dialog_new_with_buttons ("GtkEntryCompletion",
GTK_WINDOW (do_widget),
0,
GTK_STOCK_CLOSE,
_("_Close"),
GTK_RESPONSE_NONE,
NULL);
gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
......
......@@ -5,6 +5,7 @@
*
*/
#include <glib/gi18n.h>
#include <gtk/gtk.h>
static GtkWidget *window = NULL;
......@@ -23,7 +24,7 @@ do_expander (GtkWidget *do_widget)
window = gtk_dialog_new_with_buttons ("GtkExpander",
GTK_WINDOW (do_widget),
0,
GTK_STOCK_CLOSE,
_("_Close"),
GTK_RESPONSE_NONE,
NULL);
gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
......
......@@ -5,6 +5,7 @@
* example might be helpful.
*/
#include <glib/gi18n.h>
#include <gtk/gtk.h>
#include <string.h>
......@@ -267,12 +268,16 @@ do_iconview (GtkWidget *do_widget)
tool_bar = gtk_toolbar_new ();
gtk_box_pack_start (GTK_BOX (vbox), tool_bar, FALSE, FALSE, 0);
up_button = gtk_tool_button_new_from_stock (GTK_STOCK_GO_UP);
up_button = gtk_tool_button_new (NULL, NULL);
gtk_tool_button_set_label (GTK_TOOL_BUTTON (up_button), _("_Up"));
gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (up_button), "go-up");
gtk_tool_item_set_is_important (up_button, TRUE);
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_from_stock (GTK_STOCK_HOME);
home_button = gtk_tool_button_new (NULL, NULL);
gtk_tool_button_set_label (GTK_TOOL_BUTTON (home_button), _("_Home"));
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);
......
......@@ -3,6 +3,7 @@
* Info bar widgets are used to report important messages to the user.
*/
#include <glib/gi18n.h>
#include <gtk/gtk.h>
static GtkWidget *window = NULL;
......@@ -64,7 +65,7 @@ do_infobar (GtkWidget *do_widget)
label = gtk_label_new ("This is an info bar with message type GTK_MESSAGE_WARNING");
gtk_box_pack_start (GTK_BOX (gtk_info_bar_get_content_area (GTK_INFO_BAR (bar))), label, FALSE, FALSE, 0);
bar = gtk_info_bar_new_with_buttons (GTK_STOCK_OK, GTK_RESPONSE_OK, NULL);
bar = gtk_info_bar_new_with_buttons (_("_OK"), GTK_RESPONSE_OK, NULL);
g_signal_connect (bar, "response", G_CALLBACK (on_bar_response), window);
gtk_box_pack_start (GTK_BOX (vbox), bar, FALSE, FALSE, 0);
gtk_info_bar_set_message_type (GTK_INFO_BAR (bar), GTK_MESSAGE_QUESTION);
......
......@@ -2,8 +2,7 @@
*
* The GtkListStore is used to store data in list form, to be used
* later on by a GtkTreeView to display it. This demo builds a
* simple GtkListStore and displays it. See the Stock Browser
* demo for a more advanced example.
* simple GtkListStore and displays it.
*
*/
......
......@@ -40,7 +40,7 @@
<property name="margin_bottom">8</property>
<property name="margin_left">8</property>
<property name="margin_right">8</property>
<property name="stock">gtk-missing-image</property>
<property name="icon-name">image-missing</property>
</object>
<packing>
<property name="left_attach">0</property>
......
......@@ -122,7 +122,6 @@ static gchar *types[] =
"GtkActionEntry ",
"GtkRadioActionEntry ",
"GtkIconFactory ",
"GtkStockItem ",
"GtkIconSet ",
"GtkTextBuffer ",
"GtkStatusbar ",
......
......@@ -54,7 +54,6 @@ DEMOS = \
pixbufs.c \
rotated_text.c \
sizegroup.c \
stock_browser.c \
textview.c \
tree_store.c \
ui_manager.c \
......@@ -83,7 +82,6 @@ OBJECTS = \
pixbufs.obj \
rotated_text.obj \
sizegroup.obj \
stock_browser.obj \
textview.obj \
tree_store.obj \
ui_manager.obj \
......
......@@ -3,6 +3,7 @@
* Offscreen windows can be used to render elements multiple times to achieve
* various effects.
*/
#include <glib/gi18n.h>
#include <gtk/gtk.h>
#define GTK_TYPE_MIRROR_BIN (gtk_mirror_bin_get_type ())
......@@ -497,14 +498,12 @@ do_offscreen_window2 (GtkWidget *do_widget)
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
backbutton = gtk_button_new ();
gtk_container_add (GTK_CONTAINER (backbutton),
gtk_image_new_from_stock (GTK_STOCK_GO_BACK, 4));
gtk_image_new_from_icon_name ("go-previous", 4));
gtk_size_group_add_widget (group, backbutton);
entry = gtk_entry_new ();
gtk_size_group_add_widget (group, entry);
applybutton = gtk_button_new ();
applybutton = gtk_button_new_with_label (_("Apply"));
gtk_size_group_add_widget (group, applybutton);
gtk_container_add (GTK_CONTAINER (applybutton),
gtk_image_new_from_stock (GTK_STOCK_APPLY, 4));
gtk_container_add (GTK_CONTAINER (window), vbox);
gtk_box_pack_start (GTK_BOX (vbox), bin, TRUE, TRUE, 0);
......
......@@ -19,11 +19,11 @@
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="button1">
<property name="label">gtk-close</property>
<property name="label" translatable="yes">_Close</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
<property name="use_underline">True</property>
</object>
<packing>
<property name="expand">False</property>
......
......@@ -4,6 +4,7 @@
* This demo shows how to use these features in a search entry.
*/
#include <glib/gi18n.h>
#include <gtk/gtk.h>
static GtkWidget *window = NULL;
......@@ -85,9 +86,6 @@ static void
search_by_name (GtkWidget *item,
GtkEntry *entry)
{
gtk_entry_set_icon_from_stock (entry,
GTK_ENTRY_ICON_PRIMARY,
GTK_STOCK_FIND);
gtk_entry_set_icon_tooltip_text (entry,
GTK_ENTRY_ICON_PRIMARY,
"Search by name\n"
......@@ -99,9 +97,7 @@ static void
search_by_description (GtkWidget *item,
GtkEntry *entry)
{
gtk_entry_set_icon_from_stock (entry,
GTK_ENTRY_ICON_PRIMARY,
GTK_STOCK_EDIT);
gtk_entry_set_icon_tooltip_text (entry,
GTK_ENTRY_ICON_PRIMARY,
"Search by description\n"
......@@ -113,9 +109,6 @@ static void
search_by_file (GtkWidget *item,
GtkEntry *entry)