Commit fc71cbe5 authored by William Jon McCann's avatar William Jon McCann

Remove most of the stock API usage from the tests

With the exception of GtkActions and the tests for stock items.
parent c79a21e1
......@@ -74,7 +74,6 @@ noinst_PROGRAMS = $(TEST_PROGS) \
testkineticscrolling \
testlist \
testlockbutton \
testmenubars \
testmenubutton \
testmountoperation \
testmultidisplay \
......@@ -203,7 +202,6 @@ testimage_DEPENDENCIES = $(TEST_DEPS)
testkineticscrolling_DEPENDENCIES = $(TEST_DEPS)
testlist_DEPENDENCIES = $(TEST_DEPS)
testlockbutton_DEPENDENCIES = $(TEST_DEPS)
testmenubars_DEPENDENCIES = $(TEST_DEPS)
testmenubutton_DEPENDENCIES = $(TEST_DEPS)
testmountoperation_DEPENDENCIES = $(TEST_DEPS)
testmultidisplay_DEPENDENCIES = $(TEST_DEPS)
......
......@@ -154,8 +154,8 @@ do_open (GtkAction *action)
dialog = gtk_file_chooser_dialog_new ("Select file",
GTK_WINDOW (main_window),
GTK_FILE_CHOOSER_ACTION_OPEN,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OPEN, GTK_RESPONSE_OK,
"_Cancel", GTK_RESPONSE_CANCEL,
"_Open", GTK_RESPONSE_OK,
NULL);
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
response = gtk_dialog_run (GTK_DIALOG (dialog));
......@@ -216,8 +216,8 @@ do_save_as (GtkAction *action)
dialog = gtk_file_chooser_dialog_new ("Select file",
GTK_WINDOW (main_window),
GTK_FILE_CHOOSER_ACTION_SAVE,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_SAVE, GTK_RESPONSE_OK,
"_Cancel", GTK_RESPONSE_CANCEL,
"_Save", GTK_RESPONSE_OK,
NULL);
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
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);
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);
da = gtk_drawing_area_new ();
......
......@@ -37,8 +37,8 @@ static GtkWidget *test_widgets[TEST_WIDGET_LAST];
static GtkWidget*
create_image (void)
{
return gtk_image_new_from_stock (GTK_STOCK_OPEN,
GTK_ICON_SIZE_BUTTON);
return gtk_image_new_from_icon_name ("document-open",
GTK_ICON_SIZE_BUTTON);
}
static GtkWidget*
......
......@@ -135,8 +135,8 @@ button_clicked (GtkButton *b,
w = gtk_file_chooser_dialog_new ("Select file",
GTK_WINDOW (toplevel),
GTK_FILE_CHOOSER_ACTION_OPEN,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
"_Cancel", GTK_RESPONSE_CANCEL,
"_Open", GTK_RESPONSE_ACCEPT,
NULL);
gtk_dialog_run (GTK_DIALOG (w));
......
......@@ -542,7 +542,7 @@ create_full_featured_assistant (GtkWidget *widget)
assistant = gtk_assistant_new ();
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_assistant_add_action_widget (GTK_ASSISTANT (assistant), button);
g_signal_connect (button, "clicked",
......
......@@ -104,7 +104,7 @@ add_button (GtkBox *box)
char *text;
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);
gtk_style_context_add_class (gtk_widget_get_style_context (button), "play");
g_signal_connect_swapped (button,
......
......@@ -104,7 +104,7 @@ int main (int argc, char *argv[])
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_container_add (GTK_CONTAINER (box), hbox);
button = gtk_button_new_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);
g_object_get (button,
......@@ -121,7 +121,7 @@ int main (int argc, char *argv[])
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_container_add (GTK_CONTAINER (box), hbox);
button = gtk_button_new_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);
g_object_get (button,
"label", &text,
......
......@@ -25,7 +25,7 @@ simple_list_model (void)
gtk_list_store_append (store, &iter);
gtk_list_store_set (store, &iter,
SIMPLE_COLUMN_NAME, "Alice in wonderland",
SIMPLE_COLUMN_ICON, "gtk-execute",
SIMPLE_COLUMN_ICON, "system-run",
SIMPLE_COLUMN_DESCRIPTION,
"Twas brillig, and the slithy toves "
"did gyre and gimble in the wabe; "
......@@ -36,14 +36,14 @@ simple_list_model (void)
gtk_list_store_append (store, &iter);
gtk_list_store_set (store, &iter,
SIMPLE_COLUMN_NAME, "Marry Poppins",
SIMPLE_COLUMN_ICON, "gtk-yes",
SIMPLE_COLUMN_ICON, "dialog-information",
SIMPLE_COLUMN_DESCRIPTION, "Supercalifragilisticexpialidocious",
-1);
gtk_list_store_append (store, &iter);
gtk_list_store_set (store, &iter,
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, "
"and I'm not going to answer it",
-1);
......@@ -51,7 +51,7 @@ simple_list_model (void)
gtk_list_store_append (store, &iter);
gtk_list_store_set (store, &iter,
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, "
"is tiggers are wonderful things",
-1);
......@@ -59,7 +59,7 @@ simple_list_model (void)
gtk_list_store_append (store, &iter);
gtk_list_store_set (store, &iter,
SIMPLE_COLUMN_NAME, "Aleister Crowley",
SIMPLE_COLUMN_ICON, "gtk-about",
SIMPLE_COLUMN_ICON, "help-about",
SIMPLE_COLUMN_DESCRIPTION,
"Thou shalt do what thou wilt shall be the whole of the law",
-1);
......@@ -67,7 +67,7 @@ simple_list_model (void)
gtk_list_store_append (store, &iter);
gtk_list_store_set (store, &iter,
SIMPLE_COLUMN_NAME, "Mark Twain",
SIMPLE_COLUMN_ICON, "gtk-quit",
SIMPLE_COLUMN_ICON, "application-exit",
SIMPLE_COLUMN_DESCRIPTION,
"Giving up smoking is the easiest thing in the world. "
"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 ();
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_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 ();
g_object_set (G_OBJECT (renderer),
......
......@@ -114,7 +114,7 @@ main (int argc, char **argv)
0,
"Copy Large", 0,
"Copy Small", 1,
GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE,
"_Close", GTK_RESPONSE_CLOSE,
NULL);
image = gtk_image_new ();
......
This diff is collapsed.
......@@ -254,7 +254,7 @@ main (int argc, char **argv)
dialog = gtk_dialog_new_with_buttons ("GtkComboBox model changes",
NULL, 0,
GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE,
"_Close", GTK_RESPONSE_CLOSE,
NULL);
content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
......
......@@ -49,7 +49,7 @@ drag_begin_cb (GtkWidget *widget,
pos = gtk_entry_get_current_icon_drag_source (GTK_ENTRY (widget));
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);
}
......@@ -121,8 +121,8 @@ main (int argc, char **argv)
gtk_widget_set_hexpand (entry, TRUE);
gtk_grid_attach (GTK_GRID (grid), entry, 1, 0, 1, 1);
icon = g_themed_icon_new ("folder");
g_themed_icon_append_name (G_THEMED_ICON (icon), "folder");
icon = g_themed_icon_new ("folder-symbolic");
g_themed_icon_append_name (G_THEMED_ICON (icon), "folder-symbolic");
gtk_entry_set_icon_from_gicon (GTK_ENTRY (entry),
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:");
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_widget_set_direction (entry, GTK_TEXT_DIR_RTL);
gtk_entry_set_icon_from_stock (GTK_ENTRY (entry),
GTK_ENTRY_ICON_PRIMARY,
GTK_STOCK_SAVE);
gtk_entry_set_icon_from_icon_name (GTK_ENTRY (entry),
GTK_ENTRY_ICON_PRIMARY,
"document-save-symbolic");
gtk_entry_set_icon_tooltip_text (GTK_ENTRY (entry),
GTK_ENTRY_ICON_PRIMARY,
"Save a file");
......@@ -187,13 +187,13 @@ main (int argc, char **argv)
gtk_widget_set_hexpand (entry, TRUE);
gtk_grid_attach (GTK_GRID (grid), entry, 1, 2, 1, 1);
gtk_entry_set_icon_from_stock (GTK_ENTRY (entry),
GTK_ENTRY_ICON_PRIMARY,
GTK_STOCK_FIND);
gtk_entry_set_icon_from_icon_name (GTK_ENTRY (entry),
GTK_ENTRY_ICON_PRIMARY,
"edit-find-symbolic");
gtk_entry_set_icon_from_stock (GTK_ENTRY (entry),
GTK_ENTRY_ICON_SECONDARY,
GTK_STOCK_CLEAR);
gtk_entry_set_icon_from_icon_name (GTK_ENTRY (entry),
GTK_ENTRY_ICON_SECONDARY,
"edit-clear-symbolic");
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);
/*
* Password - Sets the icon using a stock id
* Password - Sets the icon using an icon name
*/
label = gtk_label_new ("Password:");
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_entry_set_visibility (GTK_ENTRY (entry), FALSE);
gtk_entry_set_icon_from_stock (GTK_ENTRY (entry),
GTK_ENTRY_ICON_PRIMARY,
GTK_STOCK_DIALOG_AUTHENTICATION);
gtk_entry_set_icon_from_icon_name (GTK_ENTRY (entry),
GTK_ENTRY_ICON_PRIMARY,
"dialog-password-symbolic");
gtk_entry_set_icon_activatable (GTK_ENTRY (entry),
GTK_ENTRY_ICON_PRIMARY,
......
......@@ -586,16 +586,16 @@ main (int argc, char **argv)
case GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER:
gtk_window_set_title (GTK_WINDOW (dialog), "Select a file");
gtk_dialog_add_buttons (GTK_DIALOG (dialog),
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OPEN, GTK_RESPONSE_OK,
_("_Cancel"), GTK_RESPONSE_CANCEL,
_("_Open"), GTK_RESPONSE_OK,
NULL);
break;
case GTK_FILE_CHOOSER_ACTION_SAVE:
case GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER:
gtk_window_set_title (GTK_WINDOW (dialog), "Save a file");
gtk_dialog_add_buttons (GTK_DIALOG (dialog),
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_SAVE, GTK_RESPONSE_OK,
_("_Cancel"), GTK_RESPONSE_CANCEL,
_("_Open"), GTK_RESPONSE_OK,
NULL);
break;
}
......
......@@ -285,7 +285,7 @@ main (int argc,
g_free (cwd);
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, "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);
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);
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);
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);
gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
......
......@@ -258,7 +258,7 @@ create_alpha_window (GtkWidget *widget)
window = gtk_dialog_new_with_buttons ("Alpha Window",
GTK_WINDOW (gtk_widget_get_toplevel (widget)), 0,
GTK_STOCK_CLOSE, 0,
"_Close", 0,
NULL);
gtk_widget_set_app_paintable (window, TRUE);
......@@ -553,7 +553,7 @@ create_big_windows (GtkWidget *widget)
window = gtk_dialog_new_with_buttons ("Big Windows",
NULL, 0,
GTK_STOCK_CLOSE,
"_Close",
GTK_RESPONSE_NONE,
NULL);
......@@ -845,7 +845,7 @@ create_check_buttons (GtkWidget *widget)
{
window = gtk_dialog_new_with_buttons ("Check Buttons",
NULL, 0,
GTK_STOCK_CLOSE,
"_Close",
GTK_RESPONSE_NONE,
NULL);
......@@ -910,7 +910,7 @@ create_radio_buttons (GtkWidget *widget)
{
window = gtk_dialog_new_with_buttons ("Radio Buttons",
NULL, 0,
GTK_STOCK_CLOSE,
"_Close",
GTK_RESPONSE_NONE,
NULL);
......@@ -1923,7 +1923,7 @@ create_rotated_label (GtkWidget *widget)
{
window = gtk_dialog_new_with_buttons ("Rotated Label",
GTK_WINDOW (gtk_widget_get_toplevel (widget)), 0,
GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE,
"_Close", GTK_RESPONSE_CLOSE,
NULL);
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",
GTK_WINDOW (gtk_widget_get_toplevel (widget)), 0,
GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE,
"_Close", GTK_RESPONSE_CLOSE,
NULL);
gtk_window_set_resizable (GTK_WINDOW (window), TRUE);
......@@ -2785,8 +2785,8 @@ create_image (GtkWidget *widget)
gtk_container_add (GTK_CONTAINER (window), vbox);
pack_image (vbox, "Stock Warning Dialog",
gtk_image_new_from_stock (GTK_STOCK_DIALOG_WARNING,
GTK_ICON_SIZE_DIALOG));
gtk_image_new_from_icon_name ("dialog-warning",
GTK_ICON_SIZE_DIALOG));
pixbuf = gdk_pixbuf_new_from_xpm_data ((const char **) openfile);
......@@ -2993,8 +2993,8 @@ create_menu (GdkScreen *screen, gint depth, gint length)
group = NULL;
image = gtk_image_new_from_stock (GTK_STOCK_OPEN,
GTK_ICON_SIZE_MENU);
image = gtk_image_new_from_icon_name ("document-open",
GTK_ICON_SIZE_MENU);
gtk_widget_show (image);
menuitem = gtk_image_menu_item_new_with_label ("Image item");
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++;
/* now fill the items submenu */
image = gtk_image_new_from_stock (GTK_STOCK_HELP,
GTK_ICON_SIZE_MENU);
image = gtk_image_new_from_icon_name ("help-broswer",
GTK_ICON_SIZE_MENU);
gtk_widget_show (image);
menuitem = gtk_image_menu_item_new_with_label ("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_widget_show (menuitem);
image = gtk_image_new_from_stock (GTK_STOCK_HELP,
GTK_ICON_SIZE_MENU);
image = gtk_image_new_from_icon_name ("help-browser",
GTK_ICON_SIZE_MENU);
gtk_widget_show (image);
menuitem = gtk_image_menu_item_new_with_label ("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_widget_show (menuitem);
image = gtk_image_new_from_stock (GTK_STOCK_HELP,
GTK_ICON_SIZE_MENU);
image = gtk_image_new_from_icon_name ("help-browser",
GTK_ICON_SIZE_MENU);
gtk_widget_show (image);
menuitem = gtk_image_menu_item_new_with_label ("Help");
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menuitem), image);
......@@ -3506,7 +3506,7 @@ create_key_lookup (GtkWidget *widget)
GtkWidget *content_area;
window = gtk_dialog_new_with_buttons ("Key Lookup", NULL, 0,
GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE,
"_Close", GTK_RESPONSE_CLOSE,
NULL);
gtk_window_set_screen (GTK_WINDOW (window),
......@@ -3599,10 +3599,11 @@ cmw_file (GtkWidget *widget, GtkWidget *parent)
GtkWidget *fs;
fs = gtk_file_chooser_dialog_new ("This is a modal file selection dialog",
GTK_WINDOW (parent), GTK_FILE_CHOOSER_ACTION_OPEN,
GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
NULL);
GTK_WINDOW (parent),
GTK_FILE_CHOOSER_ACTION_OPEN,
"_Open", GTK_RESPONSE_ACCEPT,
"_Cancel", GTK_RESPONSE_CANCEL,
NULL);
gtk_window_set_screen (GTK_WINDOW (fs), gtk_widget_get_screen (parent));
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",
NULL, 0,
GTK_STOCK_CLOSE,
"_Close",
GTK_RESPONSE_NONE,
NULL);
......@@ -5188,8 +5189,8 @@ create_forward_back (const char *title,
{
GtkWidget *frame = gtk_frame_new (title);
GtkWidget *bbox = gtk_button_box_new (GTK_ORIENTATION_HORIZONTAL);
GtkWidget *back_button = gtk_button_new_from_stock (GTK_STOCK_GO_BACK);
GtkWidget *forward_button = gtk_button_new_from_stock (GTK_STOCK_GO_FORWARD);
GtkWidget *back_button = gtk_button_new_with_label ("Back");
GtkWidget *forward_button = gtk_button_new_with_label ("Forward");
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",
NULL, 0,
GTK_STOCK_CLOSE,
"_Close",
GTK_RESPONSE_NONE,
NULL);
......@@ -5599,8 +5600,8 @@ create_display_screen (GtkWidget *widget)
gtk_grid_attach (GTK_GRID (grid), combo_dpy, 0, 1, 1, 1);
bbox = gtk_button_box_new (GTK_ORIENTATION_HORIZONTAL);
applyb = gtk_button_new_from_stock (GTK_STOCK_APPLY);
cancelb = gtk_button_new_from_stock (GTK_STOCK_CANCEL);
applyb = gtk_button_new_with_label ("_Apply");
cancelb = gtk_button_new_with_label ("_Cancel");
gtk_container_add (GTK_CONTAINER (vbox), bbox);
......
......@@ -28,7 +28,7 @@ on_bookmark_clicked (GtkButton *button, gpointer data)
chooser = gtk_file_chooser_dialog_new ("File Chooser Test",
window,
GTK_FILE_CHOOSER_ACTION_OPEN,
GTK_STOCK_CLOSE,
"_Close",
GTK_RESPONSE_CLOSE,
NULL);
......@@ -120,7 +120,7 @@ change_header (GtkButton *button, gpointer data)
gtk_style_context_add_class (gtk_widget_get_style_context (header), "titlebar");
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");
g_signal_connect (widget, "clicked", G_CALLBACK (gtk_main_quit), NULL);
......
......@@ -719,7 +719,7 @@ TestInterface interfaces[] = {
" <child>"
" <object class=\"GtkCellRendererPixbuf\" id=\"cellrenderertext1\"/>"
" <attributes>"
" <attribute name=\"stock-id\">1</attribute>"
" <attribute name=\"icon-name\">1</attribute>"
" </attributes>"
" </child>"
" <child>"
......@@ -820,7 +820,7 @@ TestInterface interfaces[] = {
" <child>"
" <object class=\"GtkCellRendererPixbuf\" id=\"cellrenderertext3\"/>"
" <attributes>"
" <attribute name=\"stock-id\">1</attribute>"
" <attribute name=\"icon-name\">1</attribute>"
" </attributes>"
" </child>"
" <child>"
......@@ -883,27 +883,27 @@ TestInterface interfaces[] = {
" <data>"
" <row>"
" <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>"
" <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>"
" <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>"
" <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>"
" <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>"
" <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>"
" </data>"
" </object>"
......
#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;
}
......@@ -41,7 +41,7 @@ int main (int argc, char **argv)
GtkWidget *item;
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 {
char *label;
......
......@@ -85,8 +85,8 @@ make_selection_dialog (GdkScreen * screen,
gtk_widget_grab_focus (entry);
gtk_dialog_add_buttons (GTK_DIALOG (window),
GTK_STOCK_APPLY, GTK_RESPONSE_APPLY,
GTK_STOCK_QUIT, GTK_RESPONSE_DELETE_EVENT,
"_Apply", GTK_RESPONSE_APPLY,
"_Quit", GTK_RESPONSE_DELETE_EVENT,
NULL);
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",
NULL,
GTK_DIALOG_MODAL,
GTK_STOCK_OK,
"_OK",
GTK_RESPONSE_OK, NULL);
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
......
......@@ -103,9 +103,16 @@ on_notebook_drag_begin (GtkWidget *widget,
if (page_num > 2)
{
pixbuf = gtk_widget_render_icon_pixbuf (widget,
(page_num % 2) ? GTK_STOCK_HELP : GTK_STOCK_STOP,
GTK_ICON_SIZE_DND);
GtkIconTheme *icon_theme;
int width;
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);
g_object_unref (pixbuf);
......@@ -219,7 +226,7 @@ create_trash_button (void)
{
GtkWidget *button;
button = gtk_button_new_from_stock (GTK_STOCK_DELETE);
button = gtk_button_new_with_label ("_Delete");
gtk_drag_dest_set (button,
GTK_DEST_DEFAULT_MOTION | GTK_DEST_DEFAULT_DROP,
......
......@@ -3,6 +3,7 @@
*/
#include <math.h>
#include <string.h>
#include <gtk/gtk.h>
#include "gtkoffscreenbox.h"
......@@ -143,8 +144,9 @@ create_treeview (GtkWidget *vbox)
GtkWidget *scrolledwindow;
GtkListStore *store;
GtkWidget *tree_view;
GSList *stock_ids;
GSList *list;
GtkIconTheme *icon_theme;
GList *icon_names;
GList *list;
scrolledwindow = gtk_scrolled_window_new (NULL, NULL);
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,
"Icon",
gtk_cell_renderer_pixbuf_new (),
"stock-id", 0,
"icon-name", 0,
NULL);
gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (tree_view), -1,
"Label",
......@@ -169,24 +171,21 @@ create_treeview (GtkWidget *vbox)
"text", 1,
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;
GtkStockItem item;
if (gtk_stock_lookup (stock_id, &item))
{
gtk_list_store_insert_with_values (store, NULL, -1,
0, item.stock_id,
1, item.label,
-1);
}
const gchar *name = list->data;
gtk_list_store_insert_with_values (store, NULL, -1,
0, name,
1, name,
-1);
}
g_slist_foreach (stock_ids, (GFunc) g_free, NULL);
g_slist_free (stock_ids);
g_list_free_full (icon_names, g_free);
}