Commit 4033415a authored by Michael Natterer's avatar Michael Natterer 😴

app, libgimpwidgets, plug-ins: kill gtk_scrolled_window_add_with_viewport()

It's deprecated in GTK+ 3.x, so we get rid of some deprecation
warnings. Also, it has always only been a utility function that hides
what is really going on in the widget hierarchy.
parent 19239c24
......@@ -194,16 +194,17 @@ gimp_container_grid_view_init (GimpContainerGridView *grid_view)
gimp_editor_set_show_name (GIMP_EDITOR (grid_view), TRUE);
grid_view->wrap_box = gtk_hwrap_box_new (FALSE);
viewport = gtk_viewport_new (NULL, NULL);
gtk_viewport_set_shadow_type (GTK_VIEWPORT (viewport), GTK_SHADOW_NONE);
gtk_container_add (GTK_CONTAINER (box->scrolled_win), viewport);
gtk_widget_show (viewport);
grid_view->wrap_box = gtk_hwrap_box_new (FALSE);
/* set a silly small and random size request so it doesn't initially
* request too much and breaks dock geometry deserialization
*/
gtk_widget_set_size_request (grid_view->wrap_box, 16, 16);
gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (box->scrolled_win),
grid_view->wrap_box);
viewport = gtk_widget_get_parent (grid_view->wrap_box);
gtk_viewport_set_shadow_type (GTK_VIEWPORT (viewport), GTK_SHADOW_NONE);
gtk_container_add (GTK_CONTAINER (viewport), grid_view->wrap_box);
gtk_widget_show (grid_view->wrap_box);
g_signal_connect (viewport, "size-allocate",
......
......@@ -166,6 +166,7 @@ static void
gimp_palette_editor_init (GimpPaletteEditor *editor)
{
GimpDataEditor *data_editor = GIMP_DATA_EDITOR (editor);
GtkWidget *viewport;
GtkWidget *hbox;
GtkWidget *label;
GtkWidget *spinbutton;
......@@ -183,6 +184,10 @@ gimp_palette_editor_init (GimpPaletteEditor *editor)
gtk_box_pack_start (GTK_BOX (editor), data_editor->view, TRUE, TRUE, 0);
gtk_widget_show (data_editor->view);
viewport = gtk_viewport_new (NULL, NULL);
gtk_container_add (GTK_CONTAINER (data_editor->view), viewport);
gtk_widget_show (viewport);
editor->view = gimp_view_new_full_by_types (NULL,
GIMP_TYPE_PALETTE_VIEW,
GIMP_TYPE_PALETTE,
......@@ -192,9 +197,7 @@ gimp_palette_editor_init (GimpPaletteEditor *editor)
(GIMP_VIEW_RENDERER_PALETTE (GIMP_VIEW (editor->view)->renderer), -1);
gimp_view_renderer_palette_set_draw_grid
(GIMP_VIEW_RENDERER_PALETTE (GIMP_VIEW (editor->view)->renderer), TRUE);
gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (data_editor->view),
editor->view);
gtk_container_add (GTK_CONTAINER (viewport), editor->view);
gtk_widget_show (editor->view);
g_signal_connect (gtk_widget_get_parent (editor->view), "size-allocate",
......
......@@ -317,8 +317,8 @@ gimp_prefs_box_add_page (GimpPrefsBox *box,
{
GimpPrefsBoxPrivate *private;
GtkWidget *scrolled_win;
GtkWidget *vbox;
GtkWidget *viewport;
GtkWidget *vbox;
g_return_val_if_fail (GIMP_IS_PREFS_BOX (box), NULL);
......@@ -332,14 +332,15 @@ gimp_prefs_box_add_page (GimpPrefsBox *box,
gimp_help_set_help_data (scrolled_win, NULL, help_id);
viewport = gtk_viewport_new (NULL, NULL);
gtk_viewport_set_shadow_type (GTK_VIEWPORT (viewport), GTK_SHADOW_NONE);
gtk_container_add (GTK_CONTAINER (scrolled_win), viewport);
gtk_widget_show (viewport);
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scrolled_win),
vbox);
gtk_container_add (GTK_CONTAINER (viewport), vbox);
gtk_widget_show (vbox);
viewport = gtk_bin_get_child (GTK_BIN (scrolled_win));
gtk_viewport_set_shadow_type (GTK_VIEWPORT (viewport), GTK_SHADOW_NONE);
gtk_tree_store_append (private->store, iter, parent);
gtk_tree_store_set (private->store, iter,
COLUMN_TREE_ICON_NAME, icon_name,
......
......@@ -85,6 +85,7 @@ static void
gimp_symmetry_editor_init (GimpSymmetryEditor *editor)
{
GtkWidget *scrolled_window;
GtkWidget *viewport;
editor->p = G_TYPE_INSTANCE_GET_PRIVATE (editor,
GIMP_TYPE_SYMMETRY_EDITOR,
......@@ -92,7 +93,6 @@ gimp_symmetry_editor_init (GimpSymmetryEditor *editor)
gtk_widget_set_size_request (GTK_WIDGET (editor), -1, 200);
/* Scrolled window to keep the dock size reasonable. */
scrolled_window = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
GTK_POLICY_AUTOMATIC,
......@@ -100,11 +100,13 @@ gimp_symmetry_editor_init (GimpSymmetryEditor *editor)
gtk_box_pack_start (GTK_BOX (editor), scrolled_window, TRUE, TRUE, 0);
gtk_widget_show (scrolled_window);
/* A vbox to hold the symmetry options. */
viewport = gtk_viewport_new (NULL, NULL);
gtk_container_add (GTK_CONTAINER (scrolled_window), viewport);
gtk_widget_show (viewport);
editor->p->options_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2);
gtk_container_set_border_width (GTK_CONTAINER (editor->p->options_vbox), 2);
gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scrolled_window),
editor->p->options_vbox);
gtk_container_add (GTK_CONTAINER (viewport), editor->p->options_vbox);
gtk_widget_show (editor->p->options_vbox);
}
......
......@@ -97,6 +97,7 @@ gimp_browser_init (GimpBrowser *browser)
GtkWidget *hbox;
GtkWidget *label;
GtkWidget *scrolled_window;
GtkWidget *viewport;
browser->search_type = -1;
......@@ -155,10 +156,13 @@ gimp_browser_init (GimpBrowser *browser)
gtk_paned_pack2 (GTK_PANED (browser), scrolled_window, TRUE, TRUE);
gtk_widget_show (scrolled_window);
viewport = gtk_viewport_new (NULL, NULL);
gtk_container_add (GTK_CONTAINER (scrolled_window), viewport);
gtk_widget_show (viewport);
browser->right_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_container_set_border_width (GTK_CONTAINER (browser->right_vbox), 12);
gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scrolled_window),
browser->right_vbox);
gtk_container_add (GTK_CONTAINER (viewport), browser->right_vbox);
gtk_widget_show (browser->right_vbox);
gtk_widget_grab_focus (browser->search_entry);
......
......@@ -764,6 +764,7 @@ build_dialog (gchar *imagename)
{
GtkWidget *toolbar;
GtkWidget *frame;
GtkWidget *viewport;
GtkWidget *main_vbox;
GtkWidget *vbox;
GtkWidget *hbox;
......@@ -816,12 +817,17 @@ build_dialog (gchar *imagename)
frame = gtk_scrolled_window_new (NULL, NULL);
gtk_container_add (GTK_CONTAINER (abox), frame);
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW (frame), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (frame),
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
gtk_widget_show (frame);
viewport = gtk_viewport_new (NULL, NULL);
gtk_container_add (GTK_CONTAINER (frame), viewport);
gtk_widget_show (viewport);
/* I add the drawing area inside an alignment box to prevent it from being resized. */
abox = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (frame), abox);
gtk_container_add (GTK_CONTAINER (viewport), abox);
gtk_widget_show (abox);
/* Build a drawing area, with a default size same as the image */
......
......@@ -1355,6 +1355,7 @@ load_dialog (const gchar *filename)
GtkWidget *main_vbox;
GtkWidget *preview;
GtkWidget *sw;
GtkWidget *viewport;
GtkWidget *frame;
GtkWidget *table;
GtkWidget *combo;
......@@ -1395,10 +1396,14 @@ load_dialog (const gchar *filename)
gtk_widget_set_size_request (sw, PREVIEW_SIZE, PREVIEW_SIZE);
gtk_widget_show (sw);
viewport = gtk_viewport_new (NULL, NULL);
gtk_container_add (GTK_CONTAINER (sw), viewport);
gtk_widget_show (viewport);
preview = gimp_preview_area_new ();
gtk_widget_set_size_request (preview,
runtime->image_width, runtime->image_height);
gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (sw), preview);
gtk_container_add (GTK_CONTAINER (viewport), preview);
gtk_widget_show (preview);
g_signal_connect_after (preview, "size-allocate",
......
......@@ -47,7 +47,8 @@ ico_dialog_new (IcoSaveInfo *info)
GtkWidget *main_vbox;
GtkWidget *vbox;
GtkWidget *frame;
GtkWidget *scrolledwindow;
GtkWidget *scrolled_window;
GtkWidget *viewport;
GtkWidget *warning;
dialog = gimp_export_dialog_new (_("Windows Icon"),
......@@ -74,17 +75,20 @@ ico_dialog_new (IcoSaveInfo *info)
gtk_box_pack_start (GTK_BOX (main_vbox), frame, TRUE, TRUE, 0);
gtk_widget_show (frame);
scrolledwindow = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow),
scrolled_window = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
gtk_container_add (GTK_CONTAINER (frame), scrolledwindow);
gtk_widget_show (scrolledwindow);
gtk_container_add (GTK_CONTAINER (frame), scrolled_window);
gtk_widget_show (scrolled_window);
viewport = gtk_viewport_new (NULL, NULL);
gtk_container_add (GTK_CONTAINER (scrolled_window), viewport);
gtk_widget_show (viewport);
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 6);
g_object_set_data (G_OBJECT (dialog), "icons_vbox", vbox);
gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scrolledwindow),
vbox);
gtk_container_add (GTK_CONTAINER (viewport), vbox);
gtk_widget_show (vbox);
warning = g_object_new (GIMP_TYPE_HINT_BOX,
......
......@@ -421,6 +421,7 @@ make_preview (GimpDrawable *drawable)
GtkAdjustment *vadj;
GtkWidget *preview;
GtkWidget *window;
GtkWidget *viewport;
GtkWidget *button, *arrow;
GtkWidget *ruler;
GtkWidget *table;
......@@ -431,73 +432,84 @@ make_preview (GimpDrawable *drawable)
data->preview = preview = gimp_preview_area_new ();
g_object_set_data (G_OBJECT (preview), "preview", data);
gtk_widget_set_events(GTK_WIDGET(preview), PREVIEW_MASK);
g_signal_connect_after(preview, "expose-event",
G_CALLBACK(preview_expose), data);
gtk_widget_set_events (GTK_WIDGET (preview), PREVIEW_MASK);
g_signal_connect_after (preview, "expose-event",
G_CALLBACK (preview_expose),
data);
g_signal_connect (preview, "size-allocate",
G_CALLBACK (preview_size_allocate), (gpointer)data);
G_CALLBACK (preview_size_allocate),
data);
/* Handle drop of links in preview widget */
gtk_drag_dest_set(preview, GTK_DEST_DEFAULT_ALL, target_table,
2, GDK_ACTION_COPY);
g_signal_connect(preview, "drag-data-received",
G_CALLBACK(handle_drop), NULL);
gtk_drag_dest_set (preview, GTK_DEST_DEFAULT_ALL, target_table,
2, GDK_ACTION_COPY);
g_signal_connect (preview, "drag-data-received",
G_CALLBACK (handle_drop),
NULL);
data->widget_width = data->width =
gimp_drawable_width(drawable->drawable_id);
gimp_drawable_width (drawable->drawable_id);
data->widget_height = data->height =
gimp_drawable_height(drawable->drawable_id);
gimp_drawable_height (drawable->drawable_id);
gtk_widget_set_size_request (preview, data->widget_width,
data->widget_height);
/* The main table */
data->window = table = gtk_table_new(3, 3, FALSE);
data->window = table = gtk_table_new (3, 3, FALSE);
gtk_table_set_col_spacings (GTK_TABLE (table), 1);
gtk_table_set_row_spacings (GTK_TABLE (table), 1);
/* Create button with arrow */
button = gtk_button_new();
button = gtk_button_new ();
gtk_widget_set_can_focus (button, FALSE);
gtk_table_attach(GTK_TABLE(table), button, 0, 1, 0, 1, GTK_FILL, GTK_FILL,
0, 0);
gtk_widget_set_events(button,
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK);
g_signal_connect(button, "button-press-event",
G_CALLBACK(arrow_cb), NULL);
gtk_widget_show(button);
arrow = gtk_arrow_new(GTK_ARROW_RIGHT, GTK_SHADOW_OUT);
gtk_container_add(GTK_CONTAINER(button), arrow);
gtk_widget_show(arrow);
gtk_table_attach (GTK_TABLE (table), button, 0, 1, 0, 1,
GTK_FILL, GTK_FILL, 0, 0);
gtk_widget_set_events (button,
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK);
gtk_widget_show (button);
g_signal_connect (button, "button-press-event",
G_CALLBACK (arrow_cb),
NULL);
arrow = gtk_arrow_new (GTK_ARROW_RIGHT, GTK_SHADOW_OUT);
gtk_container_add (GTK_CONTAINER (button), arrow);
gtk_widget_show (arrow);
/* Create horizontal ruler */
data->hruler = ruler = gimp_ruler_new (GTK_ORIENTATION_HORIZONTAL);
g_signal_connect_swapped(preview, "motion-notify-event",
G_CALLBACK(GTK_WIDGET_GET_CLASS(ruler)->motion_notify_event),
ruler);
g_signal_connect_swapped (preview, "motion-notify-event",
G_CALLBACK (GTK_WIDGET_GET_CLASS (ruler)->motion_notify_event),
ruler);
gtk_table_attach(GTK_TABLE(table), ruler, 1, 2, 0, 1,
GTK_EXPAND | GTK_SHRINK | GTK_FILL, GTK_FILL, 0, 0);
gtk_widget_show(ruler);
gtk_table_attach (GTK_TABLE (table), ruler, 1, 2, 0, 1,
GTK_EXPAND | GTK_SHRINK | GTK_FILL, GTK_FILL, 0, 0);
gtk_widget_show (ruler);
/* Create vertical ruler */
data->vruler = ruler = gimp_ruler_new (GTK_ORIENTATION_VERTICAL);
g_signal_connect_swapped(preview, "motion-notify-event",
G_CALLBACK(GTK_WIDGET_GET_CLASS(ruler)->motion_notify_event),
g_signal_connect_swapped (preview, "motion-notify-event",
G_CALLBACK (GTK_WIDGET_GET_CLASS (ruler)->motion_notify_event),
ruler);
gtk_table_attach(GTK_TABLE(table), ruler, 0, 1, 1, 2,
GTK_FILL, GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0, 0);
gtk_widget_show(ruler);
gtk_table_attach (GTK_TABLE (table), ruler, 0, 1, 1, 2,
GTK_FILL, GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0, 0);
gtk_widget_show (ruler);
window = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(window),
GTK_POLICY_NEVER, GTK_POLICY_NEVER);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (window),
GTK_POLICY_NEVER, GTK_POLICY_NEVER);
width = (data->width > 600) ? 600 : data->width;
height = (data->height > 400) ? 400 : data->height;
gtk_widget_set_size_request(window, width, height);
gtk_table_attach(GTK_TABLE(table), window, 1, 2, 1, 2, GTK_FILL, GTK_FILL,
0, 0);
gtk_widget_show(window);
gtk_widget_set_size_request (window, width, height);
gtk_table_attach (GTK_TABLE (table), window, 1, 2, 1, 2,
GTK_FILL, GTK_FILL, 0, 0);
gtk_widget_show (window);
viewport = gtk_viewport_new (NULL, NULL);
gtk_container_add (GTK_CONTAINER (window), viewport);
gtk_widget_show (viewport);
hadj = gtk_scrolled_window_get_hadjustment (GTK_SCROLLED_WINDOW (window));
......@@ -517,7 +529,7 @@ make_preview (GimpDrawable *drawable)
G_CALLBACK (scroll_adj_changed),
data->vruler);
gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW(window), preview);
gtk_container_add (GTK_CONTAINER (viewport), preview);
scrollbar = gtk_scrollbar_new (GTK_ORIENTATION_HORIZONTAL, hadj);
gtk_table_attach(GTK_TABLE(table), scrollbar, 1, 2, 2, 3,
......@@ -525,17 +537,17 @@ make_preview (GimpDrawable *drawable)
gtk_widget_show (scrollbar);
scrollbar = gtk_scrollbar_new (GTK_ORIENTATION_VERTICAL, vadj);
gtk_table_attach(GTK_TABLE(table), scrollbar, 2, 3, 1, 2,
GTK_FILL | GTK_SHRINK, GTK_FILL | GTK_SHRINK, 0, 0);
gtk_table_attach (GTK_TABLE (table), scrollbar, 2, 3, 1, 2,
GTK_FILL | GTK_SHRINK, GTK_FILL | GTK_SHRINK, 0, 0);
gtk_widget_show (scrollbar);
gtk_widget_show (preview);
gimp_pixel_rgn_init(&data->src_rgn, drawable, 0, 0, data->width,
data->height, FALSE, FALSE);
render_preview(data, &data->src_rgn);
gimp_pixel_rgn_init (&data->src_rgn, drawable, 0, 0, data->width,
data->height, FALSE, FALSE);
render_preview (data, &data->src_rgn);
gtk_widget_show(table);
gtk_widget_show (table);
return data;
}
......@@ -400,7 +400,7 @@ make_selection(ObjectList_t *object_list)
gtk_container_add (GTK_CONTAINER(frame), swin);
gtk_widget_show (swin);
gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW(swin), list);
gtk_container_add (GTK_CONTAINER (swin), list);
gtk_widget_show (list);
/* Drop support */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment