Remove most of the stock API usage from the tests

With the exception of GtkActions and the tests for stock items.
This commit is contained in:
William Jon McCann 2013-06-24 17:31:22 -04:00
parent c79a21e1dd
commit fc71cbe5a6
35 changed files with 254 additions and 332 deletions

View File

@ -74,7 +74,6 @@ noinst_PROGRAMS = $(TEST_PROGS) \
testkineticscrolling \ testkineticscrolling \
testlist \ testlist \
testlockbutton \ testlockbutton \
testmenubars \
testmenubutton \ testmenubutton \
testmountoperation \ testmountoperation \
testmultidisplay \ testmultidisplay \
@ -203,7 +202,6 @@ testimage_DEPENDENCIES = $(TEST_DEPS)
testkineticscrolling_DEPENDENCIES = $(TEST_DEPS) testkineticscrolling_DEPENDENCIES = $(TEST_DEPS)
testlist_DEPENDENCIES = $(TEST_DEPS) testlist_DEPENDENCIES = $(TEST_DEPS)
testlockbutton_DEPENDENCIES = $(TEST_DEPS) testlockbutton_DEPENDENCIES = $(TEST_DEPS)
testmenubars_DEPENDENCIES = $(TEST_DEPS)
testmenubutton_DEPENDENCIES = $(TEST_DEPS) testmenubutton_DEPENDENCIES = $(TEST_DEPS)
testmountoperation_DEPENDENCIES = $(TEST_DEPS) testmountoperation_DEPENDENCIES = $(TEST_DEPS)
testmultidisplay_DEPENDENCIES = $(TEST_DEPS) testmultidisplay_DEPENDENCIES = $(TEST_DEPS)

View File

@ -154,8 +154,8 @@ do_open (GtkAction *action)
dialog = gtk_file_chooser_dialog_new ("Select file", dialog = gtk_file_chooser_dialog_new ("Select file",
GTK_WINDOW (main_window), GTK_WINDOW (main_window),
GTK_FILE_CHOOSER_ACTION_OPEN, GTK_FILE_CHOOSER_ACTION_OPEN,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, "_Cancel", GTK_RESPONSE_CANCEL,
GTK_STOCK_OPEN, GTK_RESPONSE_OK, "_Open", GTK_RESPONSE_OK,
NULL); NULL);
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK); gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
response = gtk_dialog_run (GTK_DIALOG (dialog)); response = gtk_dialog_run (GTK_DIALOG (dialog));
@ -216,8 +216,8 @@ do_save_as (GtkAction *action)
dialog = gtk_file_chooser_dialog_new ("Select file", dialog = gtk_file_chooser_dialog_new ("Select file",
GTK_WINDOW (main_window), GTK_WINDOW (main_window),
GTK_FILE_CHOOSER_ACTION_SAVE, GTK_FILE_CHOOSER_ACTION_SAVE,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, "_Cancel", GTK_RESPONSE_CANCEL,
GTK_STOCK_SAVE, GTK_RESPONSE_OK, "_Save", GTK_RESPONSE_OK,
NULL); NULL);
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK); gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
response = gtk_dialog_run (GTK_DIALOG (dialog)); response = gtk_dialog_run (GTK_DIALOG (dialog));
@ -572,7 +572,7 @@ preview_cb (GtkPrintOperation *op,
page = gtk_spin_button_new_with_range (1, 100, 1); page = gtk_spin_button_new_with_range (1, 100, 1);
gtk_box_pack_start (GTK_BOX (hbox), page, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (hbox), page, FALSE, FALSE, 0);
close = gtk_button_new_from_stock (GTK_STOCK_CLOSE); close = gtk_button_new_with_label ("Close");
gtk_box_pack_start (GTK_BOX (hbox), close, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (hbox), close, FALSE, FALSE, 0);
da = gtk_drawing_area_new (); da = gtk_drawing_area_new ();

View File

@ -37,8 +37,8 @@ static GtkWidget *test_widgets[TEST_WIDGET_LAST];
static GtkWidget* static GtkWidget*
create_image (void) create_image (void)
{ {
return gtk_image_new_from_stock (GTK_STOCK_OPEN, return gtk_image_new_from_icon_name ("document-open",
GTK_ICON_SIZE_BUTTON); GTK_ICON_SIZE_BUTTON);
} }
static GtkWidget* static GtkWidget*

View File

@ -135,8 +135,8 @@ button_clicked (GtkButton *b,
w = gtk_file_chooser_dialog_new ("Select file", w = gtk_file_chooser_dialog_new ("Select file",
GTK_WINDOW (toplevel), GTK_WINDOW (toplevel),
GTK_FILE_CHOOSER_ACTION_OPEN, GTK_FILE_CHOOSER_ACTION_OPEN,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, "_Cancel", GTK_RESPONSE_CANCEL,
GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, "_Open", GTK_RESPONSE_ACCEPT,
NULL); NULL);
gtk_dialog_run (GTK_DIALOG (w)); gtk_dialog_run (GTK_DIALOG (w));

View File

@ -542,7 +542,7 @@ create_full_featured_assistant (GtkWidget *widget)
assistant = gtk_assistant_new (); assistant = gtk_assistant_new ();
gtk_window_set_default_size (GTK_WINDOW (assistant), 400, 300); gtk_window_set_default_size (GTK_WINDOW (assistant), 400, 300);
button = gtk_button_new_from_stock (GTK_STOCK_STOP); button = gtk_button_new_with_label ("_Stop");
gtk_widget_show (button); gtk_widget_show (button);
gtk_assistant_add_action_widget (GTK_ASSISTANT (assistant), button); gtk_assistant_add_action_widget (GTK_ASSISTANT (assistant), button);
g_signal_connect (button, "clicked", g_signal_connect (button, "clicked",

View File

@ -104,7 +104,7 @@ add_button (GtkBox *box)
char *text; char *text;
text = g_strdup_printf ("Remove %d", ++count); text = g_strdup_printf ("Remove %d", ++count);
button = (GtkWidget *)gtk_button_new_from_stock (text); button = (GtkWidget *)gtk_button_new_with_label (text);
g_free (text); g_free (text);
gtk_style_context_add_class (gtk_widget_get_style_context (button), "play"); gtk_style_context_add_class (gtk_widget_get_style_context (button), "play");
g_signal_connect_swapped (button, g_signal_connect_swapped (button,

View File

@ -104,7 +104,7 @@ int main (int argc, char *argv[])
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_container_add (GTK_CONTAINER (box), hbox); gtk_container_add (GTK_CONTAINER (box), hbox);
button = gtk_button_new_with_label ("_Save"); button = gtk_button_new_with_label ("_Save");
gtk_button_set_image (GTK_BUTTON (button), gtk_image_new_from_stock (GTK_STOCK_ABOUT, GTK_ICON_SIZE_BUTTON)); gtk_button_set_image (GTK_BUTTON (button), gtk_image_new_from_icon_name ("help-about", GTK_ICON_SIZE_BUTTON));
gtk_container_add (GTK_CONTAINER (hbox), button); gtk_container_add (GTK_CONTAINER (hbox), button);
g_object_get (button, g_object_get (button,
@ -121,7 +121,7 @@ int main (int argc, char *argv[])
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_container_add (GTK_CONTAINER (box), hbox); gtk_container_add (GTK_CONTAINER (box), hbox);
button = gtk_button_new_with_mnemonic ("_Save"); button = gtk_button_new_with_mnemonic ("_Save");
gtk_button_set_image (GTK_BUTTON (button), gtk_image_new_from_stock (GTK_STOCK_ABOUT, GTK_ICON_SIZE_BUTTON)); gtk_button_set_image (GTK_BUTTON (button), gtk_image_new_from_icon_name ("help-about", GTK_ICON_SIZE_BUTTON));
gtk_container_add (GTK_CONTAINER (hbox), button); gtk_container_add (GTK_CONTAINER (hbox), button);
g_object_get (button, g_object_get (button,
"label", &text, "label", &text,

View File

@ -25,7 +25,7 @@ simple_list_model (void)
gtk_list_store_append (store, &iter); gtk_list_store_append (store, &iter);
gtk_list_store_set (store, &iter, gtk_list_store_set (store, &iter,
SIMPLE_COLUMN_NAME, "Alice in wonderland", SIMPLE_COLUMN_NAME, "Alice in wonderland",
SIMPLE_COLUMN_ICON, "gtk-execute", SIMPLE_COLUMN_ICON, "system-run",
SIMPLE_COLUMN_DESCRIPTION, SIMPLE_COLUMN_DESCRIPTION,
"Twas brillig, and the slithy toves " "Twas brillig, and the slithy toves "
"did gyre and gimble in the wabe; " "did gyre and gimble in the wabe; "
@ -36,14 +36,14 @@ simple_list_model (void)
gtk_list_store_append (store, &iter); gtk_list_store_append (store, &iter);
gtk_list_store_set (store, &iter, gtk_list_store_set (store, &iter,
SIMPLE_COLUMN_NAME, "Marry Poppins", SIMPLE_COLUMN_NAME, "Marry Poppins",
SIMPLE_COLUMN_ICON, "gtk-yes", SIMPLE_COLUMN_ICON, "dialog-information",
SIMPLE_COLUMN_DESCRIPTION, "Supercalifragilisticexpialidocious", SIMPLE_COLUMN_DESCRIPTION, "Supercalifragilisticexpialidocious",
-1); -1);
gtk_list_store_append (store, &iter); gtk_list_store_append (store, &iter);
gtk_list_store_set (store, &iter, gtk_list_store_set (store, &iter,
SIMPLE_COLUMN_NAME, "George Bush", SIMPLE_COLUMN_NAME, "George Bush",
SIMPLE_COLUMN_ICON, "gtk-dialog-warning", SIMPLE_COLUMN_ICON, "dialog-warning",
SIMPLE_COLUMN_DESCRIPTION, "It's a very good question, very direct, " SIMPLE_COLUMN_DESCRIPTION, "It's a very good question, very direct, "
"and I'm not going to answer it", "and I'm not going to answer it",
-1); -1);
@ -51,7 +51,7 @@ simple_list_model (void)
gtk_list_store_append (store, &iter); gtk_list_store_append (store, &iter);
gtk_list_store_set (store, &iter, gtk_list_store_set (store, &iter,
SIMPLE_COLUMN_NAME, "Whinnie the pooh", SIMPLE_COLUMN_NAME, "Whinnie the pooh",
SIMPLE_COLUMN_ICON, "gtk-stop", SIMPLE_COLUMN_ICON, "process-stop",
SIMPLE_COLUMN_DESCRIPTION, "The most wonderful thing about tiggers, " SIMPLE_COLUMN_DESCRIPTION, "The most wonderful thing about tiggers, "
"is tiggers are wonderful things", "is tiggers are wonderful things",
-1); -1);
@ -59,7 +59,7 @@ simple_list_model (void)
gtk_list_store_append (store, &iter); gtk_list_store_append (store, &iter);
gtk_list_store_set (store, &iter, gtk_list_store_set (store, &iter,
SIMPLE_COLUMN_NAME, "Aleister Crowley", SIMPLE_COLUMN_NAME, "Aleister Crowley",
SIMPLE_COLUMN_ICON, "gtk-about", SIMPLE_COLUMN_ICON, "help-about",
SIMPLE_COLUMN_DESCRIPTION, SIMPLE_COLUMN_DESCRIPTION,
"Thou shalt do what thou wilt shall be the whole of the law", "Thou shalt do what thou wilt shall be the whole of the law",
-1); -1);
@ -67,7 +67,7 @@ simple_list_model (void)
gtk_list_store_append (store, &iter); gtk_list_store_append (store, &iter);
gtk_list_store_set (store, &iter, gtk_list_store_set (store, &iter,
SIMPLE_COLUMN_NAME, "Mark Twain", SIMPLE_COLUMN_NAME, "Mark Twain",
SIMPLE_COLUMN_ICON, "gtk-quit", SIMPLE_COLUMN_ICON, "application-exit",
SIMPLE_COLUMN_DESCRIPTION, SIMPLE_COLUMN_DESCRIPTION,
"Giving up smoking is the easiest thing in the world. " "Giving up smoking is the easiest thing in the world. "
"I know because I've done it thousands of times.", "I know because I've done it thousands of times.",
@ -102,7 +102,7 @@ simple_iconview (void)
cell_2 = renderer = gtk_cell_renderer_pixbuf_new (); cell_2 = renderer = gtk_cell_renderer_pixbuf_new ();
g_object_set (G_OBJECT (renderer), "xalign", 0.0F, NULL); g_object_set (G_OBJECT (renderer), "xalign", 0.0F, NULL);
gtk_cell_area_box_pack_start (GTK_CELL_AREA_BOX (area), renderer, TRUE, FALSE, FALSE); gtk_cell_area_box_pack_start (GTK_CELL_AREA_BOX (area), renderer, TRUE, FALSE, FALSE);
gtk_cell_area_attribute_connect (area, renderer, "stock-id", SIMPLE_COLUMN_ICON); gtk_cell_area_attribute_connect (area, renderer, "icon-name", SIMPLE_COLUMN_ICON);
cell_3 = renderer = gtk_cell_renderer_text_new (); cell_3 = renderer = gtk_cell_renderer_text_new ();
g_object_set (G_OBJECT (renderer), g_object_set (G_OBJECT (renderer),

View File

@ -114,7 +114,7 @@ main (int argc, char **argv)
0, 0,
"Copy Large", 0, "Copy Large", 0,
"Copy Small", 1, "Copy Small", 1,
GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, "_Close", GTK_RESPONSE_CLOSE,
NULL); NULL);
image = gtk_image_new (); image = gtk_image_new ();

View File

@ -153,48 +153,39 @@ create_combo_box_grid_demo (void)
static GtkTreeModel * static GtkTreeModel *
create_tree_blaat (void) create_tree_blaat (void)
{ {
GdkPixbuf *pixbuf;
GtkWidget *cellview; GtkWidget *cellview;
GtkTreeIter iter, iter2; GtkTreeIter iter, iter2;
GtkTreeStore *store; GtkTreeStore *store;
cellview = gtk_cell_view_new (); cellview = gtk_cell_view_new ();
store = gtk_tree_store_new (3, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_BOOLEAN); store = gtk_tree_store_new (3, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_BOOLEAN);
pixbuf = gtk_widget_render_icon_pixbuf (cellview, GTK_STOCK_DIALOG_WARNING,
GTK_ICON_SIZE_BUTTON);
gtk_tree_store_append (store, &iter, NULL); gtk_tree_store_append (store, &iter, NULL);
gtk_tree_store_set (store, &iter, gtk_tree_store_set (store, &iter,
0, pixbuf, 0, "dialog-warning",
1, "gtk-stock-dialog-warning", 1, "dialog-warning",
2, FALSE, 2, FALSE,
-1); -1);
pixbuf = gtk_widget_render_icon_pixbuf (cellview, GTK_STOCK_STOP,
GTK_ICON_SIZE_BUTTON);
gtk_tree_store_append (store, &iter2, &iter); gtk_tree_store_append (store, &iter2, &iter);
gtk_tree_store_set (store, &iter2, gtk_tree_store_set (store, &iter2,
0, pixbuf, 0, "process-stop",
1, "gtk-stock-stop", 1, "process-stop",
2, FALSE, 2, FALSE,
-1); -1);
pixbuf = gtk_widget_render_icon_pixbuf (cellview, GTK_STOCK_NEW,
GTK_ICON_SIZE_BUTTON);
gtk_tree_store_append (store, &iter2, &iter); gtk_tree_store_append (store, &iter2, &iter);
gtk_tree_store_set (store, &iter2, gtk_tree_store_set (store, &iter2,
0, pixbuf, 0, "document-new",
1, "gtk-stock-new", 1, "document-new",
2, FALSE, 2, FALSE,
-1); -1);
pixbuf = gtk_widget_render_icon_pixbuf (cellview, GTK_STOCK_CLEAR,
GTK_ICON_SIZE_BUTTON);
gtk_tree_store_append (store, &iter, NULL); gtk_tree_store_append (store, &iter, NULL);
gtk_tree_store_set (store, &iter, gtk_tree_store_set (store, &iter,
0, pixbuf, 0, "edit-clear",
1, "gtk-stock-clear", 1, "edit-clear",
2, FALSE, 2, FALSE,
-1); -1);
@ -207,12 +198,10 @@ create_tree_blaat (void)
-1); -1);
#endif #endif
pixbuf = gtk_widget_render_icon_pixbuf (cellview, GTK_STOCK_OPEN,
GTK_ICON_SIZE_BUTTON);
gtk_tree_store_append (store, &iter, NULL); gtk_tree_store_append (store, &iter, NULL);
gtk_tree_store_set (store, &iter, gtk_tree_store_set (store, &iter,
0, pixbuf, 0, "document-open",
1, "gtk-stock-open", 1, "document-open",
2, FALSE, 2, FALSE,
-1); -1);
@ -224,21 +213,18 @@ create_tree_blaat (void)
static GtkTreeModel * static GtkTreeModel *
create_empty_list_blaat (void) create_empty_list_blaat (void)
{ {
GdkPixbuf *pixbuf;
GtkWidget *cellview; GtkWidget *cellview;
GtkTreeIter iter; GtkTreeIter iter;
GtkListStore *store; GtkListStore *store;
cellview = gtk_cell_view_new (); 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);
pixbuf = gtk_widget_render_icon_pixbuf (cellview, GTK_STOCK_DIALOG_WARNING,
GTK_ICON_SIZE_BUTTON);
gtk_list_store_append (store, &iter); gtk_list_store_append (store, &iter);
gtk_list_store_set (store, &iter, gtk_list_store_set (store, &iter,
0, pixbuf, 0, "dialog-warning",
1, "gtk-stock-dialog-warning", 1, "dialog-warning",
-1); -1);
gtk_widget_destroy (cellview); gtk_widget_destroy (cellview);
@ -251,7 +237,6 @@ populate_list_blaat (gpointer data)
{ {
GtkComboBox *combo_box = GTK_COMBO_BOX (data); GtkComboBox *combo_box = GTK_COMBO_BOX (data);
GtkListStore *store; GtkListStore *store;
GdkPixbuf *pixbuf;
GtkWidget *cellview; GtkWidget *cellview;
GtkTreeIter iter; GtkTreeIter iter;
@ -264,28 +249,22 @@ populate_list_blaat (gpointer data)
cellview = gtk_cell_view_new (); cellview = gtk_cell_view_new ();
pixbuf = gtk_widget_render_icon_pixbuf (cellview, GTK_STOCK_STOP,
GTK_ICON_SIZE_BUTTON);
gtk_list_store_append (store, &iter); gtk_list_store_append (store, &iter);
gtk_list_store_set (store, &iter, gtk_list_store_set (store, &iter,
0, pixbuf, 0, "process-stop",
1, "gtk-stock-stop", 1, "process-stop",
-1); -1);
pixbuf = gtk_widget_render_icon_pixbuf (cellview, GTK_STOCK_NEW,
GTK_ICON_SIZE_BUTTON);
gtk_list_store_append (store, &iter); gtk_list_store_append (store, &iter);
gtk_list_store_set (store, &iter, gtk_list_store_set (store, &iter,
0, pixbuf, 0, "document-new",
1, "gtk-stock-new", 1, "document-new",
-1); -1);
pixbuf = gtk_widget_render_icon_pixbuf (cellview, GTK_STOCK_CLEAR,
GTK_ICON_SIZE_BUTTON);
gtk_list_store_append (store, &iter); gtk_list_store_append (store, &iter);
gtk_list_store_set (store, &iter, gtk_list_store_set (store, &iter,
0, pixbuf, 0, "edit-clear",
1, "gtk-stock-clear", 1, "edit-clear",
-1); -1);
gtk_list_store_append (store, &iter); gtk_list_store_append (store, &iter);
@ -294,12 +273,10 @@ populate_list_blaat (gpointer data)
1, "separator", 1, "separator",
-1); -1);
pixbuf = gtk_widget_render_icon_pixbuf (cellview, GTK_STOCK_OPEN,
GTK_ICON_SIZE_BUTTON);
gtk_list_store_append (store, &iter); gtk_list_store_append (store, &iter);
gtk_list_store_set (store, &iter, gtk_list_store_set (store, &iter,
0, pixbuf, 0, "document-open",
1, "gtk-stock-open", 1, "document-open",
-1); -1);
gtk_widget_destroy (cellview); gtk_widget_destroy (cellview);
@ -308,45 +285,36 @@ populate_list_blaat (gpointer data)
static GtkTreeModel * static GtkTreeModel *
create_list_blaat (void) create_list_blaat (void)
{ {
GdkPixbuf *pixbuf;
GtkWidget *cellview; GtkWidget *cellview;
GtkTreeIter iter; GtkTreeIter iter;
GtkListStore *store; GtkListStore *store;
cellview = gtk_cell_view_new (); 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);
pixbuf = gtk_widget_render_icon_pixbuf (cellview, GTK_STOCK_DIALOG_WARNING,
GTK_ICON_SIZE_BUTTON);
gtk_list_store_append (store, &iter); gtk_list_store_append (store, &iter);
gtk_list_store_set (store, &iter, gtk_list_store_set (store, &iter,
0, pixbuf, 0, "dialog-warning",
1, "gtk-stock-dialog-warning", 1, "dialog-warning",
-1); -1);
pixbuf = gtk_widget_render_icon_pixbuf (cellview, GTK_STOCK_STOP,
GTK_ICON_SIZE_BUTTON);
gtk_list_store_append (store, &iter); gtk_list_store_append (store, &iter);
gtk_list_store_set (store, &iter, gtk_list_store_set (store, &iter,
0, pixbuf, 0, "process-stop",
1, "gtk-stock-stop", 1, "process-stop",
-1); -1);
pixbuf = gtk_widget_render_icon_pixbuf (cellview, GTK_STOCK_NEW,
GTK_ICON_SIZE_BUTTON);
gtk_list_store_append (store, &iter); gtk_list_store_append (store, &iter);
gtk_list_store_set (store, &iter, gtk_list_store_set (store, &iter,
0, pixbuf, 0, "document-new",
1, "gtk-stock-new", 1, "document-new",
-1); -1);
pixbuf = gtk_widget_render_icon_pixbuf (cellview, GTK_STOCK_CLEAR,
GTK_ICON_SIZE_BUTTON);
gtk_list_store_append (store, &iter); gtk_list_store_append (store, &iter);
gtk_list_store_set (store, &iter, gtk_list_store_set (store, &iter,
0, pixbuf, 0, "edit-clear",
1, "gtk-stock-clear", 1, "edit-clear",
-1); -1);
gtk_list_store_append (store, &iter); gtk_list_store_append (store, &iter);
@ -355,12 +323,10 @@ create_list_blaat (void)
1, "separator", 1, "separator",
-1); -1);
pixbuf = gtk_widget_render_icon_pixbuf (cellview, GTK_STOCK_OPEN,
GTK_ICON_SIZE_BUTTON);
gtk_list_store_append (store, &iter); gtk_list_store_append (store, &iter);
gtk_list_store_set (store, &iter, gtk_list_store_set (store, &iter,
0, pixbuf, 0, "document-open",
1, "gtk-stock-open", 1, "document-open",
-1); -1);
gtk_widget_destroy (cellview); gtk_widget_destroy (cellview);
@ -1086,7 +1052,6 @@ main (int argc, char **argv)
GtkWidget *combobox, *comboboxtext, *comboboxgrid; GtkWidget *combobox, *comboboxtext, *comboboxgrid;
GtkWidget *tmp, *boom; GtkWidget *tmp, *boom;
GtkCellRenderer *renderer; GtkCellRenderer *renderer;
GdkPixbuf *pixbuf;
GtkTreeModel *model; GtkTreeModel *model;
GtkTreePath *path; GtkTreePath *path;
GtkTreeIter iter; GtkTreeIter iter;
@ -1129,13 +1094,10 @@ main (int argc, char **argv)
cellview = gtk_cell_view_new (); cellview = gtk_cell_view_new ();
renderer = gtk_cell_renderer_pixbuf_new (); renderer = gtk_cell_renderer_pixbuf_new ();
pixbuf = gtk_widget_render_icon_pixbuf (cellview, GTK_STOCK_DIALOG_WARNING,
GTK_ICON_SIZE_BUTTON);
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (cellview), gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (cellview),
renderer, renderer,
FALSE); FALSE);
g_object_set (renderer, "pixbuf", pixbuf, NULL); g_object_set (renderer, "icon-name", "dialog-warning", NULL);
renderer = gtk_cell_renderer_text_new (); renderer = gtk_cell_renderer_text_new ();
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (cellview), gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (cellview),
@ -1163,7 +1125,7 @@ main (int argc, char **argv)
renderer, renderer,
FALSE); FALSE);
gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combobox), renderer, gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combobox), renderer,
"pixbuf", 0, "icon-name", 0,
NULL); NULL);
gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT (combobox), gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT (combobox),
renderer, renderer,
@ -1208,7 +1170,7 @@ main (int argc, char **argv)
renderer, renderer,
FALSE); FALSE);
gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combobox), renderer, gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combobox), renderer,
"pixbuf", 0, "icon-name", 0,
NULL); NULL);
gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT (combobox), gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT (combobox),
renderer, renderer,
@ -1251,7 +1213,7 @@ main (int argc, char **argv)
renderer, renderer,
FALSE); FALSE);
gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combobox), renderer, gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combobox), renderer,
"pixbuf", 0, "icon-name", 0,
NULL); NULL);
gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT (combobox), gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT (combobox),
renderer, renderer,
@ -1312,7 +1274,7 @@ main (int argc, char **argv)
renderer, renderer,
FALSE); FALSE);
gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combobox), renderer, gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combobox), renderer,
"pixbuf", 0, "icon-name", 0,
NULL); NULL);
gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT (combobox), gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT (combobox),
renderer, renderer,

View File

@ -254,7 +254,7 @@ main (int argc, char **argv)
dialog = gtk_dialog_new_with_buttons ("GtkComboBox model changes", dialog = gtk_dialog_new_with_buttons ("GtkComboBox model changes",
NULL, 0, NULL, 0,
GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, "_Close", GTK_RESPONSE_CLOSE,
NULL); NULL);
content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog)); content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));

View File

@ -49,7 +49,7 @@ drag_begin_cb (GtkWidget *widget,
pos = gtk_entry_get_current_icon_drag_source (GTK_ENTRY (widget)); pos = gtk_entry_get_current_icon_drag_source (GTK_ENTRY (widget));
if (pos != -1) if (pos != -1)
gtk_drag_set_icon_stock (context, GTK_STOCK_INFO, 2, 2); gtk_drag_set_icon_name (context, "dialog-info", 2, 2);
g_print ("drag begin %d\n", pos); g_print ("drag begin %d\n", pos);
} }
@ -121,8 +121,8 @@ main (int argc, char **argv)
gtk_widget_set_hexpand (entry, TRUE); gtk_widget_set_hexpand (entry, TRUE);
gtk_grid_attach (GTK_GRID (grid), entry, 1, 0, 1, 1); gtk_grid_attach (GTK_GRID (grid), entry, 1, 0, 1, 1);
icon = g_themed_icon_new ("folder"); icon = g_themed_icon_new ("folder-symbolic");
g_themed_icon_append_name (G_THEMED_ICON (icon), "folder"); g_themed_icon_append_name (G_THEMED_ICON (icon), "folder-symbolic");
gtk_entry_set_icon_from_gicon (GTK_ENTRY (entry), gtk_entry_set_icon_from_gicon (GTK_ENTRY (entry),
GTK_ENTRY_ICON_PRIMARY, GTK_ENTRY_ICON_PRIMARY,
@ -142,7 +142,7 @@ main (int argc, char **argv)
/* /*
* Save File - sets the icon using a stock id. * Save File - sets the icon using an icon name.
*/ */
label = gtk_label_new ("Save File:"); label = gtk_label_new ("Save File:");
gtk_grid_attach (GTK_GRID (grid), label, 0, 1, 1, 1); gtk_grid_attach (GTK_GRID (grid), label, 0, 1, 1, 1);
@ -154,9 +154,9 @@ main (int argc, char **argv)
gtk_entry_set_text (GTK_ENTRY (entry), "Right-to-left"); gtk_entry_set_text (GTK_ENTRY (entry), "Right-to-left");
gtk_widget_set_direction (entry, GTK_TEXT_DIR_RTL); gtk_widget_set_direction (entry, GTK_TEXT_DIR_RTL);
gtk_entry_set_icon_from_stock (GTK_ENTRY (entry), gtk_entry_set_icon_from_icon_name (GTK_ENTRY (entry),
GTK_ENTRY_ICON_PRIMARY, GTK_ENTRY_ICON_PRIMARY,
GTK_STOCK_SAVE); "document-save-symbolic");
gtk_entry_set_icon_tooltip_text (GTK_ENTRY (entry), gtk_entry_set_icon_tooltip_text (GTK_ENTRY (entry),
GTK_ENTRY_ICON_PRIMARY, GTK_ENTRY_ICON_PRIMARY,
"Save a file"); "Save a file");
@ -187,13 +187,13 @@ main (int argc, char **argv)
gtk_widget_set_hexpand (entry, TRUE); gtk_widget_set_hexpand (entry, TRUE);
gtk_grid_attach (GTK_GRID (grid), entry, 1, 2, 1, 1); gtk_grid_attach (GTK_GRID (grid), entry, 1, 2, 1, 1);
gtk_entry_set_icon_from_stock (GTK_ENTRY (entry), gtk_entry_set_icon_from_icon_name (GTK_ENTRY (entry),
GTK_ENTRY_ICON_PRIMARY, GTK_ENTRY_ICON_PRIMARY,
GTK_STOCK_FIND); "edit-find-symbolic");
gtk_entry_set_icon_from_stock (GTK_ENTRY (entry), gtk_entry_set_icon_from_icon_name (GTK_ENTRY (entry),
GTK_ENTRY_ICON_SECONDARY, GTK_ENTRY_ICON_SECONDARY,
GTK_STOCK_CLEAR); "edit-clear-symbolic");
g_signal_connect (entry, "icon-press", G_CALLBACK (clear_pressed), NULL); g_signal_connect (entry, "icon-press", G_CALLBACK (clear_pressed), NULL);
@ -203,7 +203,7 @@ main (int argc, char **argv)
G_CALLBACK (properties_cb), entry); G_CALLBACK (properties_cb), entry);
/* /*
* Password - Sets the icon using a stock id * Password - Sets the icon using an icon name
*/ */
label = gtk_label_new ("Password:"); label = gtk_label_new ("Password:");
gtk_grid_attach (GTK_GRID (grid), label, 0, 3, 1, 1); gtk_grid_attach (GTK_GRID (grid), label, 0, 3, 1, 1);
@ -214,9 +214,9 @@ main (int argc, char **argv)
gtk_grid_attach (GTK_GRID (grid), entry, 1, 3, 1, 1); gtk_grid_attach (GTK_GRID (grid), entry, 1, 3, 1, 1);
gtk_entry_set_visibility (GTK_ENTRY (entry), FALSE); gtk_entry_set_visibility (GTK_ENTRY (entry), FALSE);
gtk_entry_set_icon_from_stock (GTK_ENTRY (entry), gtk_entry_set_icon_from_icon_name (GTK_ENTRY (entry),
GTK_ENTRY_ICON_PRIMARY, GTK_ENTRY_ICON_PRIMARY,
GTK_STOCK_DIALOG_AUTHENTICATION); "dialog-password-symbolic");
gtk_entry_set_icon_activatable (GTK_ENTRY (entry), gtk_entry_set_icon_activatable (GTK_ENTRY (entry),
GTK_ENTRY_ICON_PRIMARY, GTK_ENTRY_ICON_PRIMARY,

View File

@ -586,16 +586,16 @@ main (int argc, char **argv)
case GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER: case GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER:
gtk_window_set_title (GTK_WINDOW (dialog), "Select a file"); gtk_window_set_title (GTK_WINDOW (dialog), "Select a file");
gtk_dialog_add_buttons (GTK_DIALOG (dialog), gtk_dialog_add_buttons (GTK_DIALOG (dialog),
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, _("_Cancel"), GTK_RESPONSE_CANCEL,
GTK_STOCK_OPEN, GTK_RESPONSE_OK, _("_Open"), GTK_RESPONSE_OK,
NULL); NULL);
break; break;
case GTK_FILE_CHOOSER_ACTION_SAVE: case GTK_FILE_CHOOSER_ACTION_SAVE:
case GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER: case GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER:
gtk_window_set_title (GTK_WINDOW (dialog), "Save a file"); gtk_window_set_title (GTK_WINDOW (dialog), "Save a file");
gtk_dialog_add_buttons (GTK_DIALOG (dialog), gtk_dialog_add_buttons (GTK_DIALOG (dialog),
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, _("_Cancel"), GTK_RESPONSE_CANCEL,
GTK_STOCK_SAVE, GTK_RESPONSE_OK, _("_Open"), GTK_RESPONSE_OK,
NULL); NULL);
break; break;
} }

View File

@ -285,7 +285,7 @@ main (int argc,
g_free (cwd); g_free (cwd);
win = gtk_dialog_new_with_buttons ("TestFileChooserButton", NULL, 0, win = gtk_dialog_new_with_buttons ("TestFileChooserButton", NULL, 0,
GTK_STOCK_QUIT, GTK_RESPONSE_CLOSE, NULL); "_Quit", GTK_RESPONSE_CLOSE, NULL);
g_signal_connect (win, "style-set", G_CALLBACK (win_style_set_cb), NULL); g_signal_connect (win, "style-set", G_CALLBACK (win_style_set_cb), NULL);
g_signal_connect (win, "response", G_CALLBACK (gtk_main_quit), NULL); g_signal_connect (win, "response", G_CALLBACK (gtk_main_quit), NULL);
@ -327,7 +327,7 @@ main (int argc,
g_signal_connect (chooser, "update-preview", G_CALLBACK (chooser_update_preview_cb), NULL); g_signal_connect (chooser, "update-preview", G_CALLBACK (chooser_update_preview_cb), NULL);
gtk_box_pack_start (GTK_BOX (hbox), chooser, TRUE, TRUE, 0); gtk_box_pack_start (GTK_BOX (hbox), chooser, TRUE, TRUE, 0);
button = gtk_button_new_from_stock (GTK_STOCK_PROPERTIES); button = gtk_button_new_with_label ("_Properties");
g_signal_connect (button, "clicked", G_CALLBACK (properties_button_clicked_cb), chooser); g_signal_connect (button, "clicked", G_CALLBACK (properties_button_clicked_cb), chooser);
gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
@ -357,7 +357,7 @@ main (int argc,
g_signal_connect (chooser, "update-preview", G_CALLBACK (chooser_update_preview_cb), NULL); g_signal_connect (chooser, "update-preview", G_CALLBACK (chooser_update_preview_cb), NULL);
gtk_box_pack_start (GTK_BOX (hbox), chooser, TRUE, TRUE, 0); gtk_box_pack_start (GTK_BOX (hbox), chooser, TRUE, TRUE, 0);
button = gtk_button_new_from_stock (GTK_STOCK_PROPERTIES); button = gtk_button_new_with_label ("_Properties");
g_signal_connect (button, "clicked", G_CALLBACK (properties_button_clicked_cb), chooser); g_signal_connect (button, "clicked", G_CALLBACK (properties_button_clicked_cb), chooser);
gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);

View File

@ -258,7 +258,7 @@ create_alpha_window (GtkWidget *widget)
window = gtk_dialog_new_with_buttons ("Alpha Window", window = gtk_dialog_new_with_buttons ("Alpha Window",
GTK_WINDOW (gtk_widget_get_toplevel (widget)), 0, GTK_WINDOW (gtk_widget_get_toplevel (widget)), 0,
GTK_STOCK_CLOSE, 0, "_Close", 0,
NULL); NULL);
gtk_widget_set_app_paintable (window, TRUE); gtk_widget_set_app_paintable (window, TRUE);
@ -553,7 +553,7 @@ create_big_windows (GtkWidget *widget)
window = gtk_dialog_new_with_buttons ("Big Windows", window = gtk_dialog_new_with_buttons ("Big Windows",
NULL, 0, NULL, 0,
GTK_STOCK_CLOSE, "_Close",
GTK_RESPONSE_NONE, GTK_RESPONSE_NONE,
NULL); NULL);
@ -845,7 +845,7 @@ create_check_buttons (GtkWidget *widget)
{ {
window = gtk_dialog_new_with_buttons ("Check Buttons", window = gtk_dialog_new_with_buttons ("Check Buttons",
NULL, 0, NULL, 0,
GTK_STOCK_CLOSE, "_Close",
GTK_RESPONSE_NONE, GTK_RESPONSE_NONE,
NULL); NULL);
@ -910,7 +910,7 @@ create_radio_buttons (GtkWidget *widget)
{ {
window = gtk_dialog_new_with_buttons ("Radio Buttons", window = gtk_dialog_new_with_buttons ("Radio Buttons",
NULL, 0, NULL, 0,
GTK_STOCK_CLOSE, "_Close",
GTK_RESPONSE_NONE, GTK_RESPONSE_NONE,
NULL); NULL);
@ -1923,7 +1923,7 @@ create_rotated_label (GtkWidget *widget)
{ {
window = gtk_dialog_new_with_buttons ("Rotated Label", window = gtk_dialog_new_with_buttons ("Rotated Label",
GTK_WINDOW (gtk_widget_get_toplevel (widget)), 0, GTK_WINDOW (gtk_widget_get_toplevel (widget)), 0,
GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, "_Close", GTK_RESPONSE_CLOSE,
NULL); NULL);
gtk_window_set_resizable (GTK_WINDOW (window), TRUE); gtk_window_set_resizable (GTK_WINDOW (window), TRUE);
@ -2054,7 +2054,7 @@ create_rotated_text (GtkWidget *widget)
window = gtk_dialog_new_with_buttons ("Rotated Text", window = gtk_dialog_new_with_buttons ("Rotated Text",
GTK_WINDOW (gtk_widget_get_toplevel (widget)), 0, GTK_WINDOW (gtk_widget_get_toplevel (widget)), 0,
GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, "_Close", GTK_RESPONSE_CLOSE,
NULL); NULL);
gtk_window_set_resizable (GTK_WINDOW (window), TRUE); gtk_window_set_resizable (GTK_WINDOW (window), TRUE);
@ -2785,8 +2785,8 @@ create_image (GtkWidget *widget)
gtk_container_add (GTK_CONTAINER (window), vbox); gtk_container_add (GTK_CONTAINER (window), vbox);
pack_image (vbox, "Stock Warning Dialog", pack_image (vbox, "Stock Warning Dialog",
gtk_image_new_from_stock (GTK_STOCK_DIALOG_WARNING, gtk_image_new_from_icon_name ("dialog-warning",
GTK_ICON_SIZE_DIALOG)); GTK_ICON_SIZE_DIALOG));
pixbuf = gdk_pixbuf_new_from_xpm_data ((const char **) openfile); pixbuf = gdk_pixbuf_new_from_xpm_data ((const char **) openfile);
@ -2993,8 +2993,8 @@ create_menu (GdkScreen *screen, gint depth, gint length)
group = NULL; group = NULL;
image = gtk_image_new_from_stock (GTK_STOCK_OPEN, image = gtk_image_new_from_icon_name ("document-open",
GTK_ICON_SIZE_MENU); GTK_ICON_SIZE_MENU);
gtk_widget_show (image); gtk_widget_show (image);
menuitem = gtk_image_menu_item_new_with_label ("Image item"); menuitem = gtk_image_menu_item_new_with_label ("Image item");
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menuitem), image); gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menuitem), image);
@ -3050,8 +3050,8 @@ create_table_menu (GdkScreen *screen, gint cols, gint rows)
j++; j++;
/* now fill the items submenu */ /* now fill the items submenu */
image = gtk_image_new_from_stock (GTK_STOCK_HELP, image = gtk_image_new_from_icon_name ("help-broswer",
GTK_ICON_SIZE_MENU); GTK_ICON_SIZE_MENU);
gtk_widget_show (image); gtk_widget_show (image);
menuitem = gtk_image_menu_item_new_with_label ("Image"); menuitem = gtk_image_menu_item_new_with_label ("Image");
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menuitem), image); gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menuitem), image);
@ -3066,8 +3066,8 @@ create_table_menu (GdkScreen *screen, gint cols, gint rows)
gtk_menu_attach (GTK_MENU (submenu), menuitem, 0, 1, 1, 2); gtk_menu_attach (GTK_MENU (submenu), menuitem, 0, 1, 1, 2);
gtk_widget_show (menuitem); gtk_widget_show (menuitem);
image = gtk_image_new_from_stock (GTK_STOCK_HELP, image = gtk_image_new_from_icon_name ("help-browser",
GTK_ICON_SIZE_MENU); GTK_ICON_SIZE_MENU);
gtk_widget_show (image); gtk_widget_show (image);
menuitem = gtk_image_menu_item_new_with_label ("Image"); menuitem = gtk_image_menu_item_new_with_label ("Image");
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menuitem), image); gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menuitem), image);
@ -3271,8 +3271,8 @@ create_menus (GtkWidget *widget)
gtk_menu_shell_append (GTK_MENU_SHELL (menubar), menuitem); gtk_menu_shell_append (GTK_MENU_SHELL (menubar), menuitem);
gtk_widget_show (menuitem); gtk_widget_show (menuitem);
image = gtk_image_new_from_stock (GTK_STOCK_HELP, image = gtk_image_new_from_icon_name ("help-browser",
GTK_ICON_SIZE_MENU); GTK_ICON_SIZE_MENU);
gtk_widget_show (image); gtk_widget_show (image);
menuitem = gtk_image_menu_item_new_with_label ("Help"); menuitem = gtk_image_menu_item_new_with_label ("Help");
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menuitem), image); gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menuitem), image);
@ -3506,7 +3506,7 @@ create_key_lookup (GtkWidget *widget)
GtkWidget *content_area; GtkWidget *content_area;
window = gtk_dialog_new_with_buttons ("Key Lookup", NULL, 0, window = gtk_dialog_new_with_buttons ("Key Lookup", NULL, 0,
GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, "_Close", GTK_RESPONSE_CLOSE,
NULL); NULL);
gtk_window_set_screen (GTK_WINDOW (window), gtk_window_set_screen (GTK_WINDOW (window),
@ -3599,10 +3599,11 @@ cmw_file (GtkWidget *widget, GtkWidget *parent)
GtkWidget *fs; GtkWidget *fs;
fs = gtk_file_chooser_dialog_new ("This is a modal file selection dialog", fs = gtk_file_chooser_dialog_new ("This is a modal file selection dialog",
GTK_WINDOW (parent), GTK_FILE_CHOOSER_ACTION_OPEN, GTK_WINDOW (parent),
GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, GTK_FILE_CHOOSER_ACTION_OPEN,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, "_Open", GTK_RESPONSE_ACCEPT,
NULL); "_Cancel", GTK_RESPONSE_CANCEL,
NULL);
gtk_window_set_screen (GTK_WINDOW (fs), gtk_widget_get_screen (parent)); gtk_window_set_screen (GTK_WINDOW (fs), gtk_widget_get_screen (parent));
gtk_window_set_modal (GTK_WINDOW (fs), TRUE); gtk_window_set_modal (GTK_WINDOW (fs), TRUE);
@ -4291,7 +4292,7 @@ create_size_group_window (GdkScreen *screen,
window = gtk_dialog_new_with_buttons ("GtkSizeGroup", window = gtk_dialog_new_with_buttons ("GtkSizeGroup",
NULL, 0, NULL, 0,
GTK_STOCK_CLOSE, "_Close",
GTK_RESPONSE_NONE, GTK_RESPONSE_NONE,
NULL); NULL);
@ -5188,8 +5189,8 @@ create_forward_back (const char *title,
{ {
GtkWidget *frame = gtk_frame_new (title); GtkWidget *frame = gtk_frame_new (title);
GtkWidget *bbox = gtk_button_box_new (GTK_ORIENTATION_HORIZONTAL); GtkWidget *bbox = gtk_button_box_new (GTK_ORIENTATION_HORIZONTAL);
GtkWidget *back_button = gtk_button_new_from_stock (GTK_STOCK_GO_BACK); GtkWidget *back_button = gtk_button_new_with_label ("Back");
GtkWidget *forward_button = gtk_button_new_from_stock (GTK_STOCK_GO_FORWARD); GtkWidget *forward_button = gtk_button_new_with_label ("Forward");
gtk_container_set_border_width (GTK_CONTAINER (bbox), 5); gtk_container_set_border_width (GTK_CONTAINER (bbox), 5);
@ -5320,7 +5321,7 @@ create_focus (GtkWidget *widget)
window = gtk_dialog_new_with_buttons ("Keyboard focus navigation", window = gtk_dialog_new_with_buttons ("Keyboard focus navigation",
NULL, 0, NULL, 0,
GTK_STOCK_CLOSE, "_Close",
GTK_RESPONSE_NONE, GTK_RESPONSE_NONE,
NULL); NULL);
@ -5599,8 +5600,8 @@ create_display_screen (GtkWidget *widget)
gtk_grid_attach (GTK_GRID (grid), combo_dpy, 0, 1, 1, 1); gtk_grid_attach (GTK_GRID (grid), combo_dpy, 0, 1, 1, 1);
bbox = gtk_button_box_new (GTK_ORIENTATION_HORIZONTAL); bbox = gtk_button_box_new (GTK_ORIENTATION_HORIZONTAL);
applyb = gtk_button_new_from_stock (GTK_STOCK_APPLY); applyb = gtk_button_new_with_label ("_Apply");
cancelb = gtk_button_new_from_stock (GTK_STOCK_CANCEL); cancelb = gtk_button_new_with_label ("_Cancel");
gtk_container_add (GTK_CONTAINER (vbox), bbox); gtk_container_add (GTK_CONTAINER (vbox), bbox);

View File

@ -28,7 +28,7 @@ on_bookmark_clicked (GtkButton *button, gpointer data)
chooser = gtk_file_chooser_dialog_new ("File Chooser Test", chooser = gtk_file_chooser_dialog_new ("File Chooser Test",
window, window,
GTK_FILE_CHOOSER_ACTION_OPEN, GTK_FILE_CHOOSER_ACTION_OPEN,
GTK_STOCK_CLOSE, "_Close",
GTK_RESPONSE_CLOSE, GTK_RESPONSE_CLOSE,
NULL); NULL);
@ -120,7 +120,7 @@ change_header (GtkButton *button, gpointer data)
gtk_style_context_add_class (gtk_widget_get_style_context (header), "titlebar"); gtk_style_context_add_class (gtk_widget_get_style_context (header), "titlebar");
gtk_header_bar_set_title (GTK_HEADER_BAR (header), "Example header"); gtk_header_bar_set_title (GTK_HEADER_BAR (header), "Example header");
widget = gtk_button_new_from_stock (GTK_STOCK_CLOSE); widget = gtk_button_new_with_label ("_Close");
gtk_style_context_add_class (gtk_widget_get_style_context (widget), "suggested-action"); gtk_style_context_add_class (gtk_widget_get_style_context (widget), "suggested-action");
g_signal_connect (widget, "clicked", G_CALLBACK (gtk_main_quit), NULL); g_signal_connect (widget, "clicked", G_CALLBACK (gtk_main_quit), NULL);

View File

@ -719,7 +719,7 @@ TestInterface interfaces[] = {
" <child>" " <child>"
" <object class=\"GtkCellRendererPixbuf\" id=\"cellrenderertext1\"/>" " <object class=\"GtkCellRendererPixbuf\" id=\"cellrenderertext1\"/>"
" <attributes>" " <attributes>"
" <attribute name=\"stock-id\">1</attribute>" " <attribute name=\"icon-name\">1</attribute>"
" </attributes>" " </attributes>"
" </child>" " </child>"
" <child>" " <child>"
@ -820,7 +820,7 @@ TestInterface interfaces[] = {
" <child>" " <child>"
" <object class=\"GtkCellRendererPixbuf\" id=\"cellrenderertext3\"/>" " <object class=\"GtkCellRendererPixbuf\" id=\"cellrenderertext3\"/>"
" <attributes>" " <attributes>"
" <attribute name=\"stock-id\">1</attribute>" " <attribute name=\"icon-name\">1</attribute>"
" </attributes>" " </attributes>"
" </child>" " </child>"
" <child>" " <child>"
@ -883,27 +883,27 @@ TestInterface interfaces[] = {
" <data>" " <data>"
" <row>" " <row>"
" <col id=\"0\" translatable=\"yes\">Montreal, Quebec Canada</col>" " <col id=\"0\" translatable=\"yes\">Montreal, Quebec Canada</col>"
" <col id=\"1\" translatable=\"yes\">gtk-yes</col>" " <col id=\"1\" translatable=\"yes\">edit-undo</col>"
" </row>" " </row>"
" <row>" " <row>"
" <col id=\"0\" translatable=\"yes\">Sao Paulo, SP Brazil</col>" " <col id=\"0\" translatable=\"yes\">Sao Paulo, SP Brazil</col>"
" <col id=\"1\" translatable=\"yes\">gtk-no</col>" " <col id=\"1\" translatable=\"yes\">edit-redo</col>"
" </row>" " </row>"
" <row>" " <row>"
" <col id=\"0\" translatable=\"yes\">Buenos Aires, Argentina</col>" " <col id=\"0\" translatable=\"yes\">Buenos Aires, Argentina</col>"
" <col id=\"1\" translatable=\"yes\">gtk-stop</col>" " <col id=\"1\" translatable=\"yes\">process-stop</col>"
" </row>" " </row>"
" <row>" " <row>"
" <col id=\"0\" translatable=\"yes\">Los Angelos, California USA</col>" " <col id=\"0\" translatable=\"yes\">Los Angelos, California USA</col>"
" <col id=\"1\" translatable=\"yes\">gtk-media-record</col>" " <col id=\"1\" translatable=\"yes\">media-record</col>"
" </row>" " </row>"
" <row>" " <row>"
" <col id=\"0\" translatable=\"yes\">Rio de Janeiro, RJ Brazil</col>" " <col id=\"0\" translatable=\"yes\">Rio de Janeiro, RJ Brazil</col>"
" <col id=\"1\" translatable=\"yes\">gtk-dialog-error</col>" " <col id=\"1\" translatable=\"yes\">dialog-error</col>"
" </row>" " </row>"
" <row>" " <row>"
" <col id=\"0\" translatable=\"yes\">Seoul, South Korea</col>" " <col id=\"0\" translatable=\"yes\">Seoul, South Korea</col>"
" <col id=\"1\" translatable=\"yes\">gtk-info</col>" " <col id=\"1\" translatable=\"yes\">dialog-information</col>"
" </row>" " </row>"
" </data>" " </data>"
" </object>" " </object>"

View File

@ -1,50 +0,0 @@
#include <gtk/gtk.h>
static void scale_moved(GtkWidget *widget, gpointer data)
{
g_print("%.1f\n", gtk_adjustment_get_value(GTK_ADJUSTMENT(data)));
}
int main(int argc, char **argv)
{
GtkWidget *window, *vbox, *toolbar, *scale;
GtkAdjustment *adjustment;
GtkStyleContext *context;
GtkToolItem *boxitem, *button;
gtk_init(&argc, &argv);
vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_default_size(GTK_WINDOW(window), 300, 200);
toolbar = gtk_toolbar_new();
context = gtk_widget_get_style_context(toolbar);
gtk_style_context_add_class(context, GTK_STYLE_CLASS_PRIMARY_TOOLBAR);
adjustment = gtk_adjustment_new(0, 0, 10, 1, 2, 0);
scale = gtk_scale_new(GTK_ORIENTATION_HORIZONTAL, adjustment);
gtk_scale_set_value_pos(GTK_SCALE(scale), GTK_POS_RIGHT);
gtk_widget_set_size_request(scale, 255, -1);
button = gtk_tool_button_new_from_stock(GTK_STOCK_QUIT);
boxitem = gtk_tool_item_new();
gtk_toolbar_insert(GTK_TOOLBAR(toolbar), button, 0);
gtk_toolbar_insert(GTK_TOOLBAR(toolbar), boxitem, 1);
gtk_container_add(GTK_CONTAINER(vbox), toolbar);
gtk_container_add(GTK_CONTAINER(boxitem), scale);
gtk_container_add(GTK_CONTAINER(window), vbox);
g_signal_connect(window, "destroy", G_CALLBACK(gtk_main_quit), NULL);
g_signal_connect(button, "clicked", G_CALLBACK(gtk_main_quit), NULL);
g_signal_connect(scale, "value-changed", G_CALLBACK(scale_moved), adjustment);
gtk_widget_show_all(window);
gtk_main();
return 0;
}

View File

@ -41,7 +41,7 @@ int main (int argc, char **argv)
GtkWidget *item; GtkWidget *item;
if (i == 3) { if (i == 3) {
item = gtk_image_menu_item_new_from_stock (GTK_STOCK_COPY, accel_group); item = gtk_menu_item_new_with_mnemonic ("_Copy");
} else { } else {
char *label; char *label;

View File

@ -85,8 +85,8 @@ make_selection_dialog (GdkScreen * screen,
gtk_widget_grab_focus (entry); gtk_widget_grab_focus (entry);
gtk_dialog_add_buttons (GTK_DIALOG (window), gtk_dialog_add_buttons (GTK_DIALOG (window),
GTK_STOCK_APPLY, GTK_RESPONSE_APPLY, "_Apply", GTK_RESPONSE_APPLY,
GTK_STOCK_QUIT, GTK_RESPONSE_DELETE_EVENT, "_Quit", GTK_RESPONSE_DELETE_EVENT,
NULL); NULL);
gtk_dialog_set_default_response (GTK_DIALOG (window), GTK_RESPONSE_APPLY); gtk_dialog_set_default_response (GTK_DIALOG (window), GTK_RESPONSE_APPLY);
@ -116,7 +116,7 @@ main (int argc, char *argv[])
dialog = gtk_dialog_new_with_buttons ("Second Display Selection", dialog = gtk_dialog_new_with_buttons ("Second Display Selection",
NULL, NULL,
GTK_DIALOG_MODAL, GTK_DIALOG_MODAL,
GTK_STOCK_OK, "_OK",
GTK_RESPONSE_OK, NULL); GTK_RESPONSE_OK, NULL);
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK); gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);

View File

@ -103,9 +103,16 @@ on_notebook_drag_begin (GtkWidget *widget,
if (page_num > 2) if (page_num > 2)
{ {
pixbuf = gtk_widget_render_icon_pixbuf (widget, GtkIconTheme *icon_theme;
(page_num % 2) ? GTK_STOCK_HELP : GTK_STOCK_STOP, int width;
GTK_ICON_SIZE_DND);
icon_theme = gtk_icon_theme_get_for_screen (gtk_widget_get_screen (widget));
gtk_icon_size_lookup (GTK_ICON_SIZE_DND, &width, NULL);
pixbuf = gtk_icon_theme_load_icon (icon_theme,
(page_num % 2) ? "help-browser" : "process-stop",
width,
GTK_ICON_LOOKUP_GENERIC_FALLBACK,
NULL);
gtk_drag_set_icon_pixbuf (context, pixbuf, 0, 0); gtk_drag_set_icon_pixbuf (context, pixbuf, 0, 0);
g_object_unref (pixbuf); g_object_unref (pixbuf);
@ -219,7 +226,7 @@ create_trash_button (void)
{ {
GtkWidget *button; GtkWidget *button;
button = gtk_button_new_from_stock (GTK_STOCK_DELETE); button = gtk_button_new_with_label ("_Delete");
gtk_drag_dest_set (button, gtk_drag_dest_set (button,
GTK_DEST_DEFAULT_MOTION | GTK_DEST_DEFAULT_DROP, GTK_DEST_DEFAULT_MOTION | GTK_DEST_DEFAULT_DROP,

View File

@ -3,6 +3,7 @@
*/ */
#include <math.h> #include <math.h>
#include <string.h>
#include <gtk/gtk.h> #include <gtk/gtk.h>
#include "gtkoffscreenbox.h" #include "gtkoffscreenbox.h"
@ -143,8 +144,9 @@ create_treeview (GtkWidget *vbox)
GtkWidget *scrolledwindow; GtkWidget *scrolledwindow;
GtkListStore *store; GtkListStore *store;
GtkWidget *tree_view; GtkWidget *tree_view;
GSList *stock_ids; GtkIconTheme *icon_theme;
GSList *list; GList *icon_names;
GList *list;
scrolledwindow = gtk_scrolled_window_new (NULL, NULL); scrolledwindow = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolledwindow), gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolledwindow),
@ -161,7 +163,7 @@ create_treeview (GtkWidget *vbox)
gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (tree_view), -1, gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (tree_view), -1,
"Icon", "Icon",
gtk_cell_renderer_pixbuf_new (), gtk_cell_renderer_pixbuf_new (),
"stock-id", 0, "icon-name", 0,
NULL); NULL);
gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (tree_view), -1, gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (tree_view), -1,
"Label", "Label",
@ -169,24 +171,21 @@ create_treeview (GtkWidget *vbox)
"text", 1, "text", 1,
NULL); NULL);
stock_ids = gtk_stock_list_ids (); icon_theme = gtk_icon_theme_get_for_screen (gtk_widget_get_screen (vbox));
icon_names = gtk_icon_theme_list_icons (icon_theme, NULL);
icon_names = g_list_sort (icon_names, (GCompareFunc) strcmp);
for (list = stock_ids; list; list = g_slist_next (list)) for (list = icon_names; list; list = g_list_next (list))
{ {
const gchar *stock_id = list->data; const gchar *name = list->data;
GtkStockItem item;
if (gtk_stock_lookup (stock_id, &item)) gtk_list_store_insert_with_values (store, NULL, -1,
{ 0, name,
gtk_list_store_insert_with_values (store, NULL, -1, 1, name,
0, item.stock_id, -1);
1, item.label,
-1);
}
} }
g_slist_foreach (stock_ids, (GFunc) g_free, NULL); g_list_free_full (icon_names, g_free);
g_slist_free (stock_ids);
} }
static GtkWidget * static GtkWidget *

View File

@ -132,8 +132,8 @@ main (int argc,
NULL); NULL);
gtk_window_set_title (GTK_WINDOW (dialog), "Select a file"); gtk_window_set_title (GTK_WINDOW (dialog), "Select a file");
gtk_dialog_add_buttons (GTK_DIALOG (dialog), gtk_dialog_add_buttons (GTK_DIALOG (dialog),
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, "_Cancel", GTK_RESPONSE_CANCEL,
GTK_STOCK_OPEN, GTK_RESPONSE_OK, "_Open", GTK_RESPONSE_OK,
NULL); NULL);
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK); gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);

View File

@ -95,7 +95,7 @@ create_recent_chooser_menu (gint limit)
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem); gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
gtk_widget_show (menuitem); gtk_widget_show (menuitem);
menuitem = gtk_image_menu_item_new_from_stock (GTK_STOCK_CLEAR, NULL); menuitem = gtk_menu_item_new_with_mnemonic ("Clear");
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem); gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
gtk_widget_show (menuitem); gtk_widget_show (menuitem);
@ -113,11 +113,11 @@ create_file_menu (GtkAccelGroup *accelgroup)
menu = gtk_menu_new (); menu = gtk_menu_new ();
menuitem = gtk_image_menu_item_new_from_stock (GTK_STOCK_NEW, accelgroup); menuitem = gtk_menu_item_new_with_mnemonic ("_New");
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem); gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
gtk_widget_show (menuitem); gtk_widget_show (menuitem);
menuitem = gtk_image_menu_item_new_from_stock (GTK_STOCK_OPEN, accelgroup); menuitem = gtk_image_menu_item_new_with_mnemonic ("_Open");
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem); gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
gtk_widget_show (menuitem); gtk_widget_show (menuitem);
@ -131,7 +131,7 @@ create_file_menu (GtkAccelGroup *accelgroup)
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem); gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
gtk_widget_show (menuitem); gtk_widget_show (menuitem);
menuitem = gtk_image_menu_item_new_from_stock (GTK_STOCK_QUIT, accelgroup); menuitem = gtk_menu_item_new_with_mnemonic ("_Quit");
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem); gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
gtk_widget_show (menuitem); gtk_widget_show (menuitem);

View File

@ -170,12 +170,12 @@ create_menubar (GtkWindow *window)
gtk_menu_shell_append (GTK_MENU_SHELL (menubar), menuitem); gtk_menu_shell_append (GTK_MENU_SHELL (menubar), menuitem);
menu = gtk_menu_new (); menu = gtk_menu_new ();
gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), menu); gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), menu);
menuitem = gtk_image_menu_item_new_from_stock (GTK_STOCK_NEW, NULL); menuitem = gtk_menu_item_new_with_mnemonic ("_New");
g_signal_connect (menuitem, "activate", G_CALLBACK (print_hello), window); g_signal_connect (menuitem, "activate", G_CALLBACK (print_hello), window);
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem); gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
menuitem = gtk_separator_menu_item_new (); menuitem = gtk_separator_menu_item_new ();
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem); gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
menuitem = gtk_image_menu_item_new_from_stock (GTK_STOCK_QUIT, NULL); menuitem = gtk_menu_item_new_with_mnemonic ("_Quit");
g_signal_connect (menuitem, "activate", G_CALLBACK (gtk_main_quit), window); g_signal_connect (menuitem, "activate", G_CALLBACK (gtk_main_quit), window);
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem); gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
@ -186,7 +186,7 @@ create_menubar (GtkWindow *window)
gtk_menu_shell_append (GTK_MENU_SHELL (menubar), menuitem); gtk_menu_shell_append (GTK_MENU_SHELL (menubar), menuitem);
menu = gtk_menu_new (); menu = gtk_menu_new ();
gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), menu); gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), menu);
menuitem = gtk_image_menu_item_new_from_stock (GTK_STOCK_ABOUT, NULL); menuitem = gtk_menu_item_new_with_mnemonic ("_About");
g_signal_connect (menuitem, "activate", G_CALLBACK (print_hello), window); g_signal_connect (menuitem, "activate", G_CALLBACK (print_hello), window);
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem); gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);

View File

@ -229,7 +229,7 @@ popup_menu (GtkStatusIcon *icon,
gtk_menu_set_screen (GTK_MENU (menu), gtk_menu_set_screen (GTK_MENU (menu),
gtk_status_icon_get_screen (icon)); gtk_status_icon_get_screen (icon));
menuitem = gtk_image_menu_item_new_from_stock (GTK_STOCK_PROPERTIES, NULL); menuitem = gtk_menu_item_new_with_mnemonic ("_Properties");
g_signal_connect (menuitem, "activate", G_CALLBACK (do_properties), icon); g_signal_connect (menuitem, "activate", G_CALLBACK (do_properties), icon);
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem); gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);

View File

@ -573,9 +573,9 @@ main (gint argc, gchar **argv)
store = create_items_list (&treeview); store = create_items_list (&treeview);
gtk_container_add (GTK_CONTAINER (scrolled_window), treeview); gtk_container_add (GTK_CONTAINER (scrolled_window), treeview);
item = gtk_tool_button_new_from_stock (GTK_STOCK_NEW); item = gtk_tool_button_new (NULL, NULL);
gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (item), "document-new");
gtk_tool_button_set_label (GTK_TOOL_BUTTON (item), "Custom label"); gtk_tool_button_set_label (GTK_TOOL_BUTTON (item), "Custom label");
gtk_tool_button_set_label (GTK_TOOL_BUTTON (item), NULL);
add_item_to_list (store, item, "New"); add_item_to_list (store, item, "New");
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1); gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
gdk_threads_add_timeout (3000, (GSourceFunc) timeout_cb, item); gdk_threads_add_timeout (3000, (GSourceFunc) timeout_cb, item);
@ -592,7 +592,9 @@ main (gint argc, gchar **argv)
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem); gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
} }
item = gtk_menu_tool_button_new_from_stock (GTK_STOCK_OPEN); item = gtk_menu_tool_button_new (NULL, NULL);
gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (item), "document-open");
gtk_tool_button_set_label (GTK_TOOL_BUTTON (item), "Open");
gtk_menu_tool_button_set_menu (GTK_MENU_TOOL_BUTTON (item), menu); gtk_menu_tool_button_set_menu (GTK_MENU_TOOL_BUTTON (item), menu);
add_item_to_list (store, item, "Open"); add_item_to_list (store, item, "Open");
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1); gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
@ -609,7 +611,9 @@ main (gint argc, gchar **argv)
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem); gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
} }
item = gtk_menu_tool_button_new_from_stock (GTK_STOCK_GO_BACK); item = gtk_menu_tool_button_new (NULL, NULL);
gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (item), "go-previous");
gtk_tool_button_set_label (GTK_TOOL_BUTTON (item), "Back");
gtk_menu_tool_button_set_menu (GTK_MENU_TOOL_BUTTON (item), menu); gtk_menu_tool_button_set_menu (GTK_MENU_TOOL_BUTTON (item), menu);
add_item_to_list (store, item, "BackWithHistory"); add_item_to_list (store, item, "BackWithHistory");
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1); gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
@ -618,14 +622,16 @@ main (gint argc, gchar **argv)
add_item_to_list (store, item, "-----"); add_item_to_list (store, item, "-----");
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1); gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
image = gtk_image_new_from_stock (GTK_STOCK_DIALOG_WARNING, GTK_ICON_SIZE_DIALOG); image = gtk_image_new_from_icon_name ("dialog-warning", GTK_ICON_SIZE_DIALOG);
item = gtk_tool_item_new (); item = gtk_tool_item_new ();
gtk_widget_show (image); gtk_widget_show (image);
gtk_container_add (GTK_CONTAINER (item), image); gtk_container_add (GTK_CONTAINER (item), image);
add_item_to_list (store, item, "(Custom Item)"); add_item_to_list (store, item, "(Custom Item)");
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1); 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_tool_button_set_label (GTK_TOOL_BUTTON (item), "Back");
add_item_to_list (store, item, "Back"); add_item_to_list (store, item, "Back");
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1); gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
@ -633,11 +639,14 @@ main (gint argc, gchar **argv)
add_item_to_list (store, item, "-----"); add_item_to_list (store, item, "-----");
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1); gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
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_tool_button_set_label (GTK_TOOL_BUTTON (item), "Forward");
add_item_to_list (store, item, "Forward"); add_item_to_list (store, item, "Forward");
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1); gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
item = gtk_toggle_tool_button_new_from_stock (GTK_STOCK_BOLD); item = gtk_toggle_tool_button_new ();
gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (item), "format-text-bold");
g_signal_connect (item, "toggled", G_CALLBACK (bold_toggled), NULL); g_signal_connect (item, "toggled", G_CALLBACK (bold_toggled), NULL);
add_item_to_list (store, item, "Bold"); add_item_to_list (store, item, "Bold");
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1); gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
@ -650,20 +659,23 @@ main (gint argc, gchar **argv)
gtk_separator_tool_item_set_draw (GTK_SEPARATOR_TOOL_ITEM (item), FALSE); gtk_separator_tool_item_set_draw (GTK_SEPARATOR_TOOL_ITEM (item), FALSE);
g_assert (gtk_toolbar_get_nth_item (GTK_TOOLBAR (toolbar), 0) != 0); g_assert (gtk_toolbar_get_nth_item (GTK_TOOLBAR (toolbar), 0) != 0);
item = gtk_radio_tool_button_new_from_stock (NULL, GTK_STOCK_JUSTIFY_LEFT); item = gtk_radio_tool_button_new (NULL);
gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (item), "format-justify-left");
group = gtk_radio_tool_button_get_group (GTK_RADIO_TOOL_BUTTON (item)); group = gtk_radio_tool_button_get_group (GTK_RADIO_TOOL_BUTTON (item));
add_item_to_list (store, item, "Left"); add_item_to_list (store, item, "Left");
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1); gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
item = gtk_radio_tool_button_new_from_stock (group, GTK_STOCK_JUSTIFY_CENTER); item = gtk_radio_tool_button_new (group);
gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (item), "format-justify-center");
make_prop_editor (G_OBJECT (item)); make_prop_editor (G_OBJECT (item));
group = gtk_radio_tool_button_get_group (GTK_RADIO_TOOL_BUTTON (item)); group = gtk_radio_tool_button_get_group (GTK_RADIO_TOOL_BUTTON (item));
add_item_to_list (store, item, "Center"); add_item_to_list (store, item, "Center");
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1); gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
item = gtk_radio_tool_button_new_from_stock (group, GTK_STOCK_JUSTIFY_RIGHT); item = gtk_radio_tool_button_new (group);
gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (item), "format-justify-right");
add_item_to_list (store, item, "Right"); add_item_to_list (store, item, "Right");
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1); gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);

View File

@ -32,8 +32,8 @@ query_tooltip_cb (GtkWidget *widget,
gpointer data) gpointer data)
{ {
gtk_tooltip_set_markup (tooltip, gtk_button_get_label (GTK_BUTTON (widget))); gtk_tooltip_set_markup (tooltip, gtk_button_get_label (GTK_BUTTON (widget)));
gtk_tooltip_set_icon_from_stock (tooltip, GTK_STOCK_DELETE, gtk_tooltip_set_icon_from_icon_name (tooltip, "edit-delete",
GTK_ICON_SIZE_MENU); GTK_ICON_SIZE_MENU);
return TRUE; return TRUE;
} }

View File

@ -18,7 +18,7 @@ create_tab_label (GtkWidget *toplevel)
GtkWidget *box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2); GtkWidget *box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2);
GtkWidget *label = gtk_label_new (G_OBJECT_TYPE_NAME (toplevel)); GtkWidget *label = gtk_label_new (G_OBJECT_TYPE_NAME (toplevel));
GtkWidget *button = gtk_button_new (); GtkWidget *button = gtk_button_new ();
GtkWidget *image = gtk_image_new_from_stock (GTK_STOCK_CLOSE, GTK_ICON_SIZE_MENU); GtkWidget *image = gtk_image_new_from_icon_name ("window-close", GTK_ICON_SIZE_MENU);
gtk_container_add (GTK_CONTAINER (button), image); gtk_container_add (GTK_CONTAINER (button), image);
gtk_box_pack_start (GTK_BOX (box), label, TRUE, TRUE, 0); gtk_box_pack_start (GTK_BOX (box), label, TRUE, TRUE, 0);
@ -86,8 +86,8 @@ main (gint argc, gchar **argv)
g_signal_connect (widget, "delete-event", G_CALLBACK (toplevel_delete_event), NULL); g_signal_connect (widget, "delete-event", G_CALLBACK (toplevel_delete_event), NULL);
widget = gtk_recent_chooser_dialog_new ("the recent chooser", NULL, widget = gtk_recent_chooser_dialog_new ("the recent chooser", NULL,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, "_Cancel", GTK_RESPONSE_CANCEL,
GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, "_Open", GTK_RESPONSE_ACCEPT,
NULL); NULL);
toplevel_delete_event (widget, NULL, NULL); toplevel_delete_event (widget, NULL, NULL);
g_signal_connect (widget, "delete-event", G_CALLBACK (toplevel_delete_event), NULL); g_signal_connect (widget, "delete-event", G_CALLBACK (toplevel_delete_event), NULL);

View File

@ -30,8 +30,8 @@ enum {
STRING_COLUMN, STRING_COLUMN,
IS_EDITABLE_COLUMN, IS_EDITABLE_COLUMN,
IS_SENSITIVE_COLUMN, IS_SENSITIVE_COLUMN,
PIXBUF_COLUMN, ICON_NAME_COLUMN,
LAST_PIXBUF_COLUMN, LAST_ICON_NAME_COLUMN,
PROGRESS_COLUMN, PROGRESS_COLUMN,
NUM_COLUMNS NUM_COLUMNS
}; };
@ -53,20 +53,13 @@ create_model (void)
GtkTreeStore *model; GtkTreeStore *model;
GtkTreeIter iter; GtkTreeIter iter;
gint i; gint i;
GdkPixbuf *foo, *bar;
GtkWidget *blah;
blah = gtk_window_new (GTK_WINDOW_TOPLEVEL);
foo = gtk_widget_render_icon_pixbuf (blah, GTK_STOCK_NEW, GTK_ICON_SIZE_MENU);
bar = gtk_widget_render_icon_pixbuf (blah, GTK_STOCK_DELETE, GTK_ICON_SIZE_MENU);
gtk_widget_destroy (blah);
model = gtk_tree_store_new (NUM_COLUMNS, model = gtk_tree_store_new (NUM_COLUMNS,
G_TYPE_STRING, G_TYPE_STRING,
G_TYPE_BOOLEAN, G_TYPE_BOOLEAN,
G_TYPE_BOOLEAN, G_TYPE_BOOLEAN,
GDK_TYPE_PIXBUF, G_TYPE_STRING,
GDK_TYPE_PIXBUF, G_TYPE_STRING,
G_TYPE_INT); G_TYPE_INT);
for (i = 0; model_strings[i].string != NULL; i++) for (i = 0; model_strings[i].string != NULL; i++)
@ -77,8 +70,8 @@ create_model (void)
STRING_COLUMN, model_strings[i].string, STRING_COLUMN, model_strings[i].string,
IS_EDITABLE_COLUMN, model_strings[i].is_editable, IS_EDITABLE_COLUMN, model_strings[i].is_editable,
IS_SENSITIVE_COLUMN, model_strings[i].is_sensitive, IS_SENSITIVE_COLUMN, model_strings[i].is_sensitive,
PIXBUF_COLUMN, foo, ICON_NAME_COLUMN, "document-new",
LAST_PIXBUF_COLUMN, bar, LAST_ICON_NAME_COLUMN, "edit-delete",
PROGRESS_COLUMN, model_strings[i].progress, PROGRESS_COLUMN, model_strings[i].progress,
-1); -1);
} }
@ -269,7 +262,7 @@ main (gint argc, gchar **argv)
renderer = gtk_cell_renderer_pixbuf_new (); renderer = gtk_cell_renderer_pixbuf_new ();
gtk_tree_view_column_pack_start (column, renderer, FALSE); gtk_tree_view_column_pack_start (column, renderer, FALSE);
gtk_tree_view_column_set_attributes (column, renderer, gtk_tree_view_column_set_attributes (column, renderer,
"pixbuf", PIXBUF_COLUMN, "icon-name", ICON_NAME_COLUMN,
"sensitive", IS_SENSITIVE_COLUMN, "sensitive", IS_SENSITIVE_COLUMN,
NULL); NULL);
callback[0].area = area; callback[0].area = area;
@ -311,7 +304,7 @@ main (gint argc, gchar **argv)
NULL); NULL);
gtk_tree_view_column_pack_start (column, renderer, FALSE); gtk_tree_view_column_pack_start (column, renderer, FALSE);
gtk_tree_view_column_set_attributes (column, renderer, gtk_tree_view_column_set_attributes (column, renderer,
"pixbuf", LAST_PIXBUF_COLUMN, "icon-name", LAST_ICON_NAME_COLUMN,
"sensitive", IS_SENSITIVE_COLUMN, "sensitive", IS_SENSITIVE_COLUMN,
NULL); NULL);
callback[3].area = area; callback[3].area = area;

View File

@ -155,7 +155,7 @@ simple_tree_model (void)
gtk_tree_store_append (store, &parent, NULL); gtk_tree_store_append (store, &parent, NULL);
gtk_tree_store_set (store, &parent, gtk_tree_store_set (store, &parent,
SIMPLE_COLUMN_NAME, "Alice in wonderland", SIMPLE_COLUMN_NAME, "Alice in wonderland",
SIMPLE_COLUMN_ICON, "gtk-execute", SIMPLE_COLUMN_ICON, "system-run",
SIMPLE_COLUMN_DESCRIPTION, SIMPLE_COLUMN_DESCRIPTION,
"Twas brillig, and the slithy toves " "Twas brillig, and the slithy toves "
"did gyre and gimble in the wabe", "did gyre and gimble in the wabe",
@ -164,35 +164,35 @@ simple_tree_model (void)
gtk_tree_store_append (store, &iter, &parent); gtk_tree_store_append (store, &iter, &parent);
gtk_tree_store_set (store, &iter, gtk_tree_store_set (store, &iter,
SIMPLE_COLUMN_NAME, "Go ask", SIMPLE_COLUMN_NAME, "Go ask",
SIMPLE_COLUMN_ICON, "gtk-zoom-out", SIMPLE_COLUMN_ICON, "zoom-out",
SIMPLE_COLUMN_DESCRIPTION, "One pill makes you shorter", SIMPLE_COLUMN_DESCRIPTION, "One pill makes you shorter",
-1); -1);
gtk_tree_store_append (store, &iter, &parent); gtk_tree_store_append (store, &iter, &parent);
gtk_tree_store_set (store, &iter, gtk_tree_store_set (store, &iter,
SIMPLE_COLUMN_NAME, "Alice", SIMPLE_COLUMN_NAME, "Alice",
SIMPLE_COLUMN_ICON, "gtk-zoom-in", SIMPLE_COLUMN_ICON, "zoom-in",
SIMPLE_COLUMN_DESCRIPTION, "Another one makes you tall", SIMPLE_COLUMN_DESCRIPTION, "Another one makes you tall",
-1); -1);
gtk_tree_store_append (store, &iter, &parent); gtk_tree_store_append (store, &iter, &parent);
gtk_tree_store_set (store, &iter, gtk_tree_store_set (store, &iter,
SIMPLE_COLUMN_NAME, "Jefferson Airplane", SIMPLE_COLUMN_NAME, "Jefferson Airplane",
SIMPLE_COLUMN_ICON, "gtk-zoom-fit", SIMPLE_COLUMN_ICON, "zoom-fit-best",
SIMPLE_COLUMN_DESCRIPTION, "The one's that mother gives you dont do anything at all", SIMPLE_COLUMN_DESCRIPTION, "The one's that mother gives you dont do anything at all",
-1); -1);
gtk_tree_store_append (store, &iter, NULL); gtk_tree_store_append (store, &iter, NULL);
gtk_tree_store_set (store, &iter, gtk_tree_store_set (store, &iter,
SIMPLE_COLUMN_NAME, "Marry Poppins", SIMPLE_COLUMN_NAME, "Marry Poppins",
SIMPLE_COLUMN_ICON, "gtk-yes", SIMPLE_COLUMN_ICON, "dialog-information",
SIMPLE_COLUMN_DESCRIPTION, "Supercalifragilisticexpialidocious", SIMPLE_COLUMN_DESCRIPTION, "Supercalifragilisticexpialidocious",
-1); -1);
gtk_tree_store_append (store, &iter, NULL); gtk_tree_store_append (store, &iter, NULL);
gtk_tree_store_set (store, &iter, gtk_tree_store_set (store, &iter,
SIMPLE_COLUMN_NAME, "George Bush", SIMPLE_COLUMN_NAME, "George Bush",
SIMPLE_COLUMN_ICON, "gtk-dialog-question", SIMPLE_COLUMN_ICON, "dialog-question",
SIMPLE_COLUMN_DESCRIPTION, "It's a very good question, very direct, " SIMPLE_COLUMN_DESCRIPTION, "It's a very good question, very direct, "
"and I'm not going to answer it", "and I'm not going to answer it",
-1); -1);
@ -200,7 +200,7 @@ simple_tree_model (void)
gtk_tree_store_append (store, &parent, NULL); gtk_tree_store_append (store, &parent, NULL);
gtk_tree_store_set (store, &parent, gtk_tree_store_set (store, &parent,
SIMPLE_COLUMN_NAME, "Whinnie the pooh", SIMPLE_COLUMN_NAME, "Whinnie the pooh",
SIMPLE_COLUMN_ICON, "gtk-stop", SIMPLE_COLUMN_ICON, "process-stop",
SIMPLE_COLUMN_DESCRIPTION, "The most wonderful thing about tiggers, " SIMPLE_COLUMN_DESCRIPTION, "The most wonderful thing about tiggers, "
"is tiggers are wonderful things", "is tiggers are wonderful things",
-1); -1);
@ -208,56 +208,56 @@ simple_tree_model (void)
gtk_tree_store_append (store, &iter, &parent); gtk_tree_store_append (store, &iter, &parent);
gtk_tree_store_set (store, &iter, gtk_tree_store_set (store, &iter,
SIMPLE_COLUMN_NAME, "Tigger", SIMPLE_COLUMN_NAME, "Tigger",
SIMPLE_COLUMN_ICON, "gtk-yes", SIMPLE_COLUMN_ICON, "dialog-information",
SIMPLE_COLUMN_DESCRIPTION, "Eager", SIMPLE_COLUMN_DESCRIPTION, "Eager",
-1); -1);
gtk_tree_store_append (store, &child, &iter); gtk_tree_store_append (store, &child, &iter);
gtk_tree_store_set (store, &child, gtk_tree_store_set (store, &child,
SIMPLE_COLUMN_NAME, "Jump", SIMPLE_COLUMN_NAME, "Jump",
SIMPLE_COLUMN_ICON, "gtk-yes", SIMPLE_COLUMN_ICON, "dialog-information",
SIMPLE_COLUMN_DESCRIPTION, "Very High", SIMPLE_COLUMN_DESCRIPTION, "Very High",
-1); -1);
gtk_tree_store_append (store, &child, &iter); gtk_tree_store_append (store, &child, &iter);
gtk_tree_store_set (store, &child, gtk_tree_store_set (store, &child,
SIMPLE_COLUMN_NAME, "Pounce", SIMPLE_COLUMN_NAME, "Pounce",
SIMPLE_COLUMN_ICON, "gtk-no", SIMPLE_COLUMN_ICON, "dialog-question",
SIMPLE_COLUMN_DESCRIPTION, "On Pooh", SIMPLE_COLUMN_DESCRIPTION, "On Pooh",
-1); -1);
gtk_tree_store_append (store, &child, &iter); gtk_tree_store_append (store, &child, &iter);
gtk_tree_store_set (store, &child, gtk_tree_store_set (store, &child,
SIMPLE_COLUMN_NAME, "Bounce", SIMPLE_COLUMN_NAME, "Bounce",
SIMPLE_COLUMN_ICON, "gtk-cancel", SIMPLE_COLUMN_ICON, "dialog-error",
SIMPLE_COLUMN_DESCRIPTION, "Around", SIMPLE_COLUMN_DESCRIPTION, "Around",
-1); -1);
gtk_tree_store_append (store, &iter, &parent); gtk_tree_store_append (store, &iter, &parent);
gtk_tree_store_set (store, &iter, gtk_tree_store_set (store, &iter,
SIMPLE_COLUMN_NAME, "Owl", SIMPLE_COLUMN_NAME, "Owl",
SIMPLE_COLUMN_ICON, "gtk-stop", SIMPLE_COLUMN_ICON, "process-stop",
SIMPLE_COLUMN_DESCRIPTION, "Wise", SIMPLE_COLUMN_DESCRIPTION, "Wise",
-1); -1);
gtk_tree_store_append (store, &iter, &parent); gtk_tree_store_append (store, &iter, &parent);
gtk_tree_store_set (store, &iter, gtk_tree_store_set (store, &iter,
SIMPLE_COLUMN_NAME, "Eor", SIMPLE_COLUMN_NAME, "Eor",
SIMPLE_COLUMN_ICON, "gtk-no", SIMPLE_COLUMN_ICON, "dialog-question",
SIMPLE_COLUMN_DESCRIPTION, "Depressed", SIMPLE_COLUMN_DESCRIPTION, "Depressed",
-1); -1);
gtk_tree_store_append (store, &iter, &parent); gtk_tree_store_append (store, &iter, &parent);
gtk_tree_store_set (store, &iter, gtk_tree_store_set (store, &iter,
SIMPLE_COLUMN_NAME, "Piglet", SIMPLE_COLUMN_NAME, "Piglet",
SIMPLE_COLUMN_ICON, "gtk-media-play", SIMPLE_COLUMN_ICON, "media-playback-start",
SIMPLE_COLUMN_DESCRIPTION, "Insecure", SIMPLE_COLUMN_DESCRIPTION, "Insecure",
-1); -1);
gtk_tree_store_append (store, &iter, NULL); gtk_tree_store_append (store, &iter, NULL);
gtk_tree_store_set (store, &iter, gtk_tree_store_set (store, &iter,
SIMPLE_COLUMN_NAME, "Aleister Crowley", SIMPLE_COLUMN_NAME, "Aleister Crowley",
SIMPLE_COLUMN_ICON, "gtk-about", SIMPLE_COLUMN_ICON, "help-about",
SIMPLE_COLUMN_DESCRIPTION, SIMPLE_COLUMN_DESCRIPTION,
"Thou shalt do what thou wilt shall be the whole of the law", "Thou shalt do what thou wilt shall be the whole of the law",
-1); -1);
@ -265,7 +265,7 @@ simple_tree_model (void)
gtk_tree_store_append (store, &iter, NULL); gtk_tree_store_append (store, &iter, NULL);
gtk_tree_store_set (store, &iter, gtk_tree_store_set (store, &iter,
SIMPLE_COLUMN_NAME, "Mark Twain", SIMPLE_COLUMN_NAME, "Mark Twain",
SIMPLE_COLUMN_ICON, "gtk-quit", SIMPLE_COLUMN_ICON, "application-exit",
SIMPLE_COLUMN_DESCRIPTION, SIMPLE_COLUMN_DESCRIPTION,
"Giving up smoking is the easiest thing in the world. " "Giving up smoking is the easiest thing in the world. "
"I know because I've done it thousands of times.", "I know because I've done it thousands of times.",
@ -290,7 +290,7 @@ create_cell_area (void)
cell_2 = renderer = gtk_cell_renderer_pixbuf_new (); cell_2 = renderer = gtk_cell_renderer_pixbuf_new ();
g_object_set (G_OBJECT (renderer), "xalign", 0.0F, NULL); g_object_set (G_OBJECT (renderer), "xalign", 0.0F, NULL);
gtk_cell_area_box_pack_start (GTK_CELL_AREA_BOX (area), renderer, TRUE, FALSE, FALSE); gtk_cell_area_box_pack_start (GTK_CELL_AREA_BOX (area), renderer, TRUE, FALSE, FALSE);
gtk_cell_area_attribute_connect (area, renderer, "stock-id", SIMPLE_COLUMN_ICON); gtk_cell_area_attribute_connect (area, renderer, "icon-name", SIMPLE_COLUMN_ICON);
cell_3 = renderer = gtk_cell_renderer_text_new (); cell_3 = renderer = gtk_cell_renderer_text_new ();
g_object_set (G_OBJECT (renderer), g_object_set (G_OBJECT (renderer),

View File

@ -114,7 +114,7 @@ int main (int argc, char *argv[])
cell = gtk_cell_renderer_pixbuf_new (); cell = gtk_cell_renderer_pixbuf_new ();
gtk_tree_view_column_pack_start (col, cell, FALSE); gtk_tree_view_column_pack_start (col, cell, FALSE);
gtk_tree_view_column_add_attribute (col, cell, "stock-id", 2); gtk_tree_view_column_add_attribute (col, cell, "icon-name", 2);
cell = gtk_cell_renderer_toggle_new (); cell = gtk_cell_renderer_toggle_new ();
gtk_tree_view_column_pack_start (col, cell, FALSE); gtk_tree_view_column_pack_start (col, cell, FALSE);
@ -123,9 +123,9 @@ int main (int argc, char *argv[])
gtk_tree_view_append_column (GTK_TREE_VIEW (tv), col); gtk_tree_view_append_column (GTK_TREE_VIEW (tv), col);
store = gtk_tree_store_new (3, G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_STRING); store = gtk_tree_store_new (3, G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_STRING);
gtk_tree_store_insert_with_values (store, NULL, NULL, 0, 0, "One row", 1, FALSE, 2, "gtk-open", -1); gtk_tree_store_insert_with_values (store, NULL, NULL, 0, 0, "One row", 1, FALSE, 2, "document-open", -1);
gtk_tree_store_insert_with_values (store, &iter, NULL, 1, 0, "Two row", 1, FALSE, 2, "gtk-file", -1); gtk_tree_store_insert_with_values (store, &iter, NULL, 1, 0, "Two row", 1, FALSE, 2, "dialog-warning", -1);
gtk_tree_store_insert_with_values (store, NULL, &iter, 0, 0, "Three row", 1, FALSE, 2, "gtk-file", -1); gtk_tree_store_insert_with_values (store, NULL, &iter, 0, 0, "Three row", 1, FALSE, 2, "dialog-error", -1);
gtk_tree_view_set_model (GTK_TREE_VIEW (tv), GTK_TREE_MODEL (store)); gtk_tree_view_set_model (GTK_TREE_VIEW (tv), GTK_TREE_MODEL (store));

View File

@ -48,7 +48,7 @@ enum {
static TreeEntry info_entries[] = static TreeEntry info_entries[] =
{ {
{ {
"gtk-execute", "system-run",
"Will you\n" "Will you\n"
"run this ?", "run this ?",
"Currently executing that thing... you might want to abort", "Currently executing that thing... you might want to abort",
@ -58,7 +58,7 @@ static TreeEntry info_entries[] =
NULL NULL
}, },
{ {
"gtk-dialog-authentication", "dialog-password",
"This is the\n" "This is the\n"
"realest of the real", "realest of the real",
"We are about to authenticate the actual realness, this could take some time", "We are about to authenticate the actual realness, this could take some time",
@ -73,7 +73,7 @@ static TreeEntry info_entries[] =
static TreeEntry directory_entries[] = static TreeEntry directory_entries[] =
{ {
{ {
"gtk-edit", "document-open",
"We can edit\n" "We can edit\n"
"things in here", "things in here",
"Time to edit your directory, almost finished now", "Time to edit your directory, almost finished now",
@ -83,7 +83,7 @@ static TreeEntry directory_entries[] =
NULL NULL
}, },
{ {
"gtk-file", "text-x-generic",
"You have a\n" "You have a\n"
"file here", "file here",
"Who would of thought there would be a file in the directory ?", "Who would of thought there would be a file in the directory ?",
@ -93,7 +93,7 @@ static TreeEntry directory_entries[] =
NULL NULL
}, },
{ {
"gtk-dialog-question", "dialog-question",
"Any questions ?", "Any questions ?",
"This file would like to ask you a question", "This file would like to ask you a question",
"so he decided that the fine print underneath the progress bar probably made no sense at all", "so he decided that the fine print underneath the progress bar probably made no sense at all",
@ -107,7 +107,7 @@ static TreeEntry directory_entries[] =
static TreeEntry other_entries[] = static TreeEntry other_entries[] =
{ {
{ {
"gtk-zoom-fit", "zoom-fit-best",
"Thats the\n" "Thats the\n"
"perfect fit", "perfect fit",
"Now fitting foo into bar using frobnicator", "Now fitting foo into bar using frobnicator",
@ -118,7 +118,7 @@ static TreeEntry other_entries[] =
NULL NULL
}, },
{ {
"gtk-underline", "format-text-underline",
"Under the\n" "Under the\n"
"line", "line",
"Now underlining that this demo would look alot niftier with some real content", "Now underlining that this demo would look alot niftier with some real content",
@ -133,18 +133,18 @@ static TreeEntry other_entries[] =
static TreeEntry add_entries[] = static TreeEntry add_entries[] =
{ {
{ {
"gtk-about", "help-about",
"its about\n" "its about\n"
"to start", "to start",
"This is what it's all about", "This is what it's all about",
"so he went ahead and added the 'gtk-about' icon to his story, thinking 'mint cream' would be the " "so he went ahead and added the 'help-about' icon to his story, thinking 'mint cream' would be the "
"right color for something like that", "right color for something like that",
"dark violet", "dark violet",
1, 1,
NULL NULL
}, },
{ {
"gtk-zoom-in", "zoom-in",
"Watch it\n" "Watch it\n"
"Zoom !", "Zoom !",
"Now zooming into something", "Now zooming into something",
@ -154,7 +154,7 @@ static TreeEntry add_entries[] =
NULL NULL
}, },
{ {
"gtk-zoom-out", "zoom-out",
"Zoom Zoom\n" "Zoom Zoom\n"
"Zoom !", "Zoom !",
"Now zooming out of something else", "Now zooming out of something else",
@ -171,7 +171,7 @@ static TreeEntry add_entries[] =
static TreeEntry main_entries[] = static TreeEntry main_entries[] =
{ {
{ {
"gtk-info", "dialog-information",
"This is all\n" "This is all\n"
"the info", "the info",
"We are currently informing you", "We are currently informing you",
@ -181,7 +181,7 @@ static TreeEntry main_entries[] =
info_entries info_entries
}, },
{ {
"gtk-dialog-warning", "dialog-warning",
"This is a\n" "This is a\n"
"warning", "warning",
"We would like to warn you that your laptop might explode after we're done", "We would like to warn you that your laptop might explode after we're done",
@ -191,7 +191,7 @@ static TreeEntry main_entries[] =
NULL NULL
}, },
{ {
"gtk-dialog-error", "dialog-error",
"An error will\n" "An error will\n"
"occur", "occur",
"Once we're done here, dont worry... an error will surely occur.", "Once we're done here, dont worry... an error will surely occur.",
@ -201,7 +201,7 @@ static TreeEntry main_entries[] =
NULL NULL
}, },
{ {
"gtk-directory", "folder",
"The directory", "The directory",
"Currently scanning your directories.", "Currently scanning your directories.",
"jill didnt know what to make of the barking pigs either so she fed him sleeping pills", "jill didnt know what to make of the barking pigs either so she fed him sleeping pills",
@ -210,7 +210,7 @@ static TreeEntry main_entries[] =
directory_entries directory_entries
}, },
{ {
"gtk-delete", "edit-delete",
"Now deleting\n" "Now deleting\n"
"the whole thing", "the whole thing",
"Time to delete the sucker", "Time to delete the sucker",
@ -220,7 +220,7 @@ static TreeEntry main_entries[] =
NULL NULL
}, },
{ {
"gtk-add", "list-add",
"Anything\n" "Anything\n"
"to add ?", "to add ?",
"Now adding stuff... please be patient", "Now adding stuff... please be patient",
@ -230,7 +230,7 @@ static TreeEntry main_entries[] =
add_entries add_entries
}, },
{ {
"gtk-redo", "edit-redo",
"Time to\n" "Time to\n"
"do it again", "do it again",
"For the hell of it, lets add the content to the treeview over and over again !", "For the hell of it, lets add the content to the treeview over and over again !",
@ -325,7 +325,7 @@ main (gint argc, gchar **argv)
g_object_set (renderer, "stock-size", GTK_ICON_SIZE_DIALOG, NULL); g_object_set (renderer, "stock-size", GTK_ICON_SIZE_DIALOG, NULL);
gtk_tree_view_column_pack_start (column, renderer, TRUE); gtk_tree_view_column_pack_start (column, renderer, TRUE);
gtk_tree_view_column_set_attributes (column, renderer, gtk_tree_view_column_set_attributes (column, renderer,
"stock-id", ICON_COLUMN, NULL); "icon-name", ICON_COLUMN, NULL);
renderer = gtk_cell_renderer_text_new (); renderer = gtk_cell_renderer_text_new ();
g_object_set (renderer, "scale", 1.2F, "weight", PANGO_WEIGHT_BOLD, NULL); g_object_set (renderer, "scale", 1.2F, "weight", PANGO_WEIGHT_BOLD, NULL);

View File

@ -296,8 +296,8 @@ save_clicked (GtkWidget *button,
dialog = gtk_file_chooser_dialog_new ("Filename for window data", dialog = gtk_file_chooser_dialog_new ("Filename for window data",
NULL, NULL,
GTK_FILE_CHOOSER_ACTION_SAVE, GTK_FILE_CHOOSER_ACTION_SAVE,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, "_Cancel", GTK_RESPONSE_CANCEL,
GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT, "_Save", GTK_RESPONSE_ACCEPT,
NULL); NULL);
gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (dialog), TRUE); gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (dialog), TRUE);
@ -455,7 +455,7 @@ manual_clicked (GtkWidget *button,
dialog = gtk_dialog_new_with_buttons ("Select new position and size", dialog = gtk_dialog_new_with_buttons ("Select new position and size",
GTK_WINDOW (main_window), GTK_WINDOW (main_window),
GTK_DIALOG_MODAL, GTK_DIALOG_MODAL,
GTK_STOCK_OK, GTK_RESPONSE_OK, "_OK", GTK_RESPONSE_OK,
NULL); NULL);
@ -896,8 +896,8 @@ main (int argc, char **argv)
button = gtk_button_new (); button = gtk_button_new ();
gtk_button_set_image (GTK_BUTTON (button), gtk_button_set_image (GTK_BUTTON (button),
gtk_image_new_from_stock (GTK_STOCK_GO_BACK, gtk_image_new_from_icon_name ("go-previous-symbolic",
GTK_ICON_SIZE_BUTTON)); GTK_ICON_SIZE_BUTTON));
g_signal_connect (button, "clicked", g_signal_connect (button, "clicked",
G_CALLBACK (move_window_clicked), G_CALLBACK (move_window_clicked),
GINT_TO_POINTER (GTK_DIR_LEFT)); GINT_TO_POINTER (GTK_DIR_LEFT));
@ -906,8 +906,8 @@ main (int argc, char **argv)
button = gtk_button_new (); button = gtk_button_new ();
gtk_button_set_image (GTK_BUTTON (button), gtk_button_set_image (GTK_BUTTON (button),
gtk_image_new_from_stock (GTK_STOCK_GO_UP, gtk_image_new_from_icon_name ("go-up-symbolic",
GTK_ICON_SIZE_BUTTON)); GTK_ICON_SIZE_BUTTON));
g_signal_connect (button, "clicked", g_signal_connect (button, "clicked",
G_CALLBACK (move_window_clicked), G_CALLBACK (move_window_clicked),
GINT_TO_POINTER (GTK_DIR_UP)); GINT_TO_POINTER (GTK_DIR_UP));
@ -916,8 +916,8 @@ main (int argc, char **argv)
button = gtk_button_new (); button = gtk_button_new ();
gtk_button_set_image (GTK_BUTTON (button), gtk_button_set_image (GTK_BUTTON (button),
gtk_image_new_from_stock (GTK_STOCK_GO_FORWARD, gtk_image_new_from_icon_name ("go-next-symbolic",
GTK_ICON_SIZE_BUTTON)); GTK_ICON_SIZE_BUTTON));
g_signal_connect (button, "clicked", g_signal_connect (button, "clicked",
G_CALLBACK (move_window_clicked), G_CALLBACK (move_window_clicked),
GINT_TO_POINTER (GTK_DIR_RIGHT)); GINT_TO_POINTER (GTK_DIR_RIGHT));
@ -926,8 +926,8 @@ main (int argc, char **argv)
button = gtk_button_new (); button = gtk_button_new ();
gtk_button_set_image (GTK_BUTTON (button), gtk_button_set_image (GTK_BUTTON (button),
gtk_image_new_from_stock (GTK_STOCK_GO_DOWN, gtk_image_new_from_icon_name ("go-down-symbolic",
GTK_ICON_SIZE_BUTTON)); GTK_ICON_SIZE_BUTTON));
g_signal_connect (button, "clicked", g_signal_connect (button, "clicked",
G_CALLBACK (move_window_clicked), G_CALLBACK (move_window_clicked),
GINT_TO_POINTER (GTK_DIR_DOWN)); GINT_TO_POINTER (GTK_DIR_DOWN));
@ -974,8 +974,8 @@ main (int argc, char **argv)
button = gtk_button_new_with_label ("scroll"); button = gtk_button_new_with_label ("scroll");
gtk_button_set_image (GTK_BUTTON (button), gtk_button_set_image (GTK_BUTTON (button),
gtk_image_new_from_stock (GTK_STOCK_GO_UP, gtk_image_new_from_icon_name ("go-up-symbolic",
GTK_ICON_SIZE_BUTTON)); GTK_ICON_SIZE_BUTTON));
g_signal_connect (button, "clicked", g_signal_connect (button, "clicked",
G_CALLBACK (scroll_window_clicked), G_CALLBACK (scroll_window_clicked),
GINT_TO_POINTER (GTK_DIR_UP)); GINT_TO_POINTER (GTK_DIR_UP));
@ -984,8 +984,8 @@ main (int argc, char **argv)
button = gtk_button_new_with_label ("scroll"); button = gtk_button_new_with_label ("scroll");
gtk_button_set_image (GTK_BUTTON (button), gtk_button_set_image (GTK_BUTTON (button),
gtk_image_new_from_stock (GTK_STOCK_GO_DOWN, gtk_image_new_from_icon_name ("go-down-symbolic",
GTK_ICON_SIZE_BUTTON)); GTK_ICON_SIZE_BUTTON));
g_signal_connect (button, "clicked", g_signal_connect (button, "clicked",
G_CALLBACK (scroll_window_clicked), G_CALLBACK (scroll_window_clicked),
GINT_TO_POINTER (GTK_DIR_DOWN)); GINT_TO_POINTER (GTK_DIR_DOWN));

View File

@ -36,7 +36,7 @@ show_dialog (void)
dialog = gtk_dialog_new_with_buttons ("Test", GTK_WINDOW (window), dialog = gtk_dialog_new_with_buttons ("Test", GTK_WINDOW (window),
GTK_DIALOG_MODAL, GTK_DIALOG_MODAL,
GTK_STOCK_CLOSE, GTK_RESPONSE_CANCEL, "_Close", GTK_RESPONSE_CANCEL,
NULL); NULL);
label = gtk_label_new ("Lorem ipsum dolor sit amet, consectetur adipiscing elit. " label = gtk_label_new ("Lorem ipsum dolor sit amet, consectetur adipiscing elit. "