[gimp] More gimp_display_get_shell() instead of display->shell



commit d1ded0617fc6eb98ed0ffb91db3978661ba19334
Author: Michael Natterer <mitch gimp org>
Date:   Mon Oct 5 19:58:03 2009 +0200

    More gimp_display_get_shell() instead of display->shell

 app/actions/actions.c                    |    2 +-
 app/actions/file-commands.c              |    5 ++-
 app/actions/image-commands.c             |    8 ++--
 app/actions/select-commands.c            |    8 ++--
 app/actions/text-tool-actions.c          |   23 +++++++------
 app/actions/text-tool-commands.c         |    8 ++++-
 app/actions/view-commands.c              |    8 +++--
 app/display/gimpdisplay-foreach.c        |    7 ++--
 app/display/gimpdisplayshell-callbacks.c |   12 +++----
 app/display/gimpdisplayshell.c           |    2 +-
 app/display/gimpimagewindow.c            |    2 +-
 app/gui/gui-vtable.c                     |   13 ++++---
 app/gui/gui.c                            |    6 +++-
 app/tools/gimpcolortool.c                |    7 ++--
 app/tools/gimpimagemaptool.c             |    2 +-
 app/tools/gimprectangletool.c            |    6 ++--
 app/tools/gimptexttool.c                 |   52 +++++++++++++++++++----------
 app/tools/gimptool.c                     |    9 +++--
 18 files changed, 108 insertions(+), 72 deletions(-)
---
diff --git a/app/actions/actions.c b/app/actions/actions.c
index 5d8effd..2323aa2 100644
--- a/app/actions/actions.c
+++ b/app/actions/actions.c
@@ -401,7 +401,7 @@ action_data_get_widget (gpointer data)
     return data;
 
   if (display)
-    return display->shell;
+    return GTK_WIDGET (gimp_display_get_shell (display));
 
   return dialogs_get_toolbox ();
 }
diff --git a/app/actions/file-commands.c b/app/actions/file-commands.c
index aa24378..56aaf91 100644
--- a/app/actions/file-commands.c
+++ b/app/actions/file-commands.c
@@ -332,7 +332,7 @@ file_create_template_cmd_callback (GtkAction *action,
   return_if_no_display (display, data);
 
   dialog = gimp_query_string_box (_("Create New Template"),
-                                  display->shell,
+                                  GTK_WIDGET (gimp_display_get_shell (display)),
                                   gimp_standard_help_func,
                                   GIMP_HELP_FILE_CREATE_TEMPLATE,
                                   _("Enter a name for this template"),
@@ -384,7 +384,8 @@ file_revert_cmd_callback (GtkAction *action,
 
       dialog =
         gimp_message_dialog_new (_("Revert Image"), GTK_STOCK_REVERT_TO_SAVED,
-                                 display->shell, 0,
+                                 GTK_WIDGET (gimp_display_get_shell (display)),
+                                 0,
                                  gimp_standard_help_func, GIMP_HELP_FILE_REVERT,
 
                                  GTK_STOCK_CANCEL,          GTK_RESPONSE_CANCEL,
diff --git a/app/actions/image-commands.c b/app/actions/image-commands.c
index 996e26e..3643eba 100644
--- a/app/actions/image-commands.c
+++ b/app/actions/image-commands.c
@@ -487,10 +487,10 @@ image_configure_grid_cmd_callback (GtkAction *action,
     {
       shell->grid_dialog = grid_dialog_new (display->image,
                                             action_data_get_context (data),
-                                            display->shell);
+                                            GTK_WIDGET (shell));
 
       gtk_window_set_transient_for (GTK_WINDOW (shell->grid_dialog),
-                                    GTK_WINDOW (display->shell));
+                                    GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (shell))));
       gtk_window_set_destroy_with_parent (GTK_WINDOW (shell->grid_dialog),
                                           TRUE);
 
@@ -516,10 +516,10 @@ image_properties_cmd_callback (GtkAction *action,
 
   dialog = image_properties_dialog_new (display->image,
                                         action_data_get_context (data),
-                                        display->shell);
+                                        GTK_WIDGET (shell));
 
   gtk_window_set_transient_for (GTK_WINDOW (dialog),
-                                GTK_WINDOW (display->shell));
+                                GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (shell))));
   gtk_window_set_destroy_with_parent (GTK_WINDOW (dialog),
                                       TRUE);
 
diff --git a/app/actions/select-commands.c b/app/actions/select-commands.c
index b74720f..c293a00 100644
--- a/app/actions/select-commands.c
+++ b/app/actions/select-commands.c
@@ -152,7 +152,7 @@ select_feather_cmd_callback (GtkAction *action,
   gimp_image_get_resolution (display->image, &xres, &yres);
 
   dialog = gimp_query_size_box (_("Feather Selection"),
-                                display->shell,
+                                GTK_WIDGET (gimp_display_get_shell (display)),
                                 gimp_standard_help_func,
                                 GIMP_HELP_SELECTION_FEATHER,
                                 _("Feather selection by"),
@@ -190,7 +190,7 @@ select_shrink_cmd_callback (GtkAction *action,
   gimp_image_get_resolution (display->image, &xres, &yres);
 
   dialog = gimp_query_size_box (_("Shrink Selection"),
-                                display->shell,
+                                GTK_WIDGET (gimp_display_get_shell (display)),
                                 gimp_standard_help_func,
                                 GIMP_HELP_SELECTION_SHRINK,
                                 _("Shrink selection by"),
@@ -227,7 +227,7 @@ select_grow_cmd_callback (GtkAction *action,
   gimp_image_get_resolution (display->image, &xres, &yres);
 
   dialog = gimp_query_size_box (_("Grow Selection"),
-                                display->shell,
+                                GTK_WIDGET (gimp_display_get_shell (display)),
                                 gimp_standard_help_func,
                                 GIMP_HELP_SELECTION_GROW,
                                 _("Grow selection by"),
@@ -254,7 +254,7 @@ select_border_cmd_callback (GtkAction *action,
   gimp_image_get_resolution (display->image, &xres, &yres);
 
   dialog = gimp_query_size_box (_("Border Selection"),
-                                display->shell,
+                                GTK_WIDGET (gimp_display_get_shell (display)),
                                 gimp_standard_help_func,
                                 GIMP_HELP_SELECTION_BORDER,
                                 _("Border selection by"),
diff --git a/app/actions/text-tool-actions.c b/app/actions/text-tool-actions.c
index 41fcb2b..3f610f1 100644
--- a/app/actions/text-tool-actions.c
+++ b/app/actions/text-tool-actions.c
@@ -128,8 +128,7 @@ text_tool_actions_setup (GimpActionGroup *group)
                                        G_CALLBACK (text_tool_direction_cmd_callback));
 }
 
-/*
- * The following code is written on the assumption that this is for a
+/* The following code is written on the assumption that this is for a
  * context menu, activated by right-clicking in a text layer.
  * Therefore, the tool must have a display.  If for any reason the
  * code is adapted to a different situation, some existence testing
@@ -139,14 +138,15 @@ void
 text_tool_actions_update (GimpActionGroup *group,
                           gpointer         data)
 {
-  GimpTextTool  *text_tool  = GIMP_TEXT_TOOL (data);
-  GimpImage     *image      = GIMP_TOOL (text_tool)->display->image;
-  GimpLayer     *layer;
-  GimpVectors   *vectors;
-  GtkClipboard  *clipboard;
-  gboolean       text_layer = FALSE;
-  gboolean       text_sel   = FALSE;   /* some text is selected        */
-  gboolean       clip       = FALSE;   /* clipboard has text available */
+  GimpTextTool     *text_tool  = GIMP_TEXT_TOOL (data);
+  GimpImage        *image      = GIMP_TOOL (text_tool)->display->image;
+  GimpLayer        *layer;
+  GimpVectors      *vectors;
+  GimpDisplayShell *shell;
+  GtkClipboard     *clipboard;
+  gboolean          text_layer = FALSE;
+  gboolean          text_sel   = FALSE;   /* some text is selected        */
+  gboolean          clip       = FALSE;   /* clipboard has text available */
 
   layer = gimp_image_get_active_layer (image);
 
@@ -160,7 +160,8 @@ text_tool_actions_update (GimpActionGroup *group,
   /*
    * see whether there is text available for pasting
    */
-  clipboard = gtk_widget_get_clipboard (GIMP_TOOL (text_tool)->display->shell,
+  shell = gimp_display_get_shell (GIMP_TOOL (text_tool)->display);
+  clipboard = gtk_widget_get_clipboard (GTK_WIDGET (shell),
                                         GDK_SELECTION_CLIPBOARD);
   clip = gtk_clipboard_wait_is_text_available (clipboard);
 
diff --git a/app/actions/text-tool-commands.c b/app/actions/text-tool-commands.c
index 2b6b616..6637bf0 100644
--- a/app/actions/text-tool-commands.c
+++ b/app/actions/text-tool-commands.c
@@ -105,7 +105,13 @@ text_tool_load_cmd_callback (GtkAction *action,
     }
 
   if (GIMP_TOOL (text_tool)->display)
-    parent = GIMP_TOOL (text_tool)->display->shell;
+    {
+      GimpDisplayShell *shell;
+
+      shell = gimp_display_get_shell (GIMP_TOOL (text_tool)->display);
+
+      parent = gtk_widget_get_toplevel (GTK_WIDGET (shell));
+    }
 
   dialog = gtk_file_chooser_dialog_new (_("Open Text File (UTF-8)"),
 					parent ? GTK_WINDOW (parent) : NULL,
diff --git a/app/actions/view-commands.c b/app/actions/view-commands.c
index 76b368b..3778177 100644
--- a/app/actions/view-commands.c
+++ b/app/actions/view-commands.c
@@ -337,7 +337,7 @@ view_navigation_window_cmd_callback (GtkAction *action,
   shell = gimp_display_get_shell (display);
 
   gimp_dialog_factory_dialog_raise (global_dock_factory,
-                                    gtk_widget_get_screen (display->shell),
+                                    gtk_widget_get_screen (GTK_WIDGET (shell)),
                                     "gimp-navigation-view", -1);
 }
 
@@ -618,20 +618,22 @@ view_padding_color_cmd_callback (GtkAction *action,
 
         if (! color_dialog)
           {
+            GimpDisplayShell *shell = gimp_display_get_shell (display);
+
             color_dialog =
               gimp_color_dialog_new (GIMP_VIEWABLE (display->image),
                                      action_data_get_context (data),
                                      _("Set Canvas Padding Color"),
                                      GTK_STOCK_SELECT_COLOR,
                                      _("Set Custom Canvas Padding Color"),
-                                     display->shell,
+                                     GTK_WIDGET (shell),
                                      NULL, NULL,
                                      &options->padding_color,
                                      FALSE, FALSE);
 
             g_signal_connect (color_dialog, "update",
                               G_CALLBACK (view_padding_color_dialog_update),
-                              display->shell);
+                              shell);
 
             g_object_set_data_full (G_OBJECT (shell), "padding-color-dialog",
                                     color_dialog,
diff --git a/app/display/gimpdisplay-foreach.c b/app/display/gimpdisplay-foreach.c
index 8ce8a12..97241b1 100644
--- a/app/display/gimpdisplay-foreach.c
+++ b/app/display/gimpdisplay-foreach.c
@@ -242,11 +242,12 @@ gimp_displays_get_num_visible (Gimp *gimp)
        list;
        list = g_list_next (list))
     {
-      GimpDisplay *display = list->data;
+      GimpDisplay      *display = list->data;
+      GimpDisplayShell *shell   = gimp_display_get_shell (display);
 
-      if (GTK_WIDGET_DRAWABLE (display->shell))
+      if (GTK_WIDGET_DRAWABLE (shell))
         {
-          GtkWidget *toplevel = gtk_widget_get_toplevel (display->shell);
+          GtkWidget *toplevel = gtk_widget_get_toplevel (GTK_WIDGET (shell));
 
           if (GTK_IS_WINDOW (toplevel))
             {
diff --git a/app/display/gimpdisplayshell-callbacks.c b/app/display/gimpdisplayshell-callbacks.c
index 6bda4cd..e944b0c 100644
--- a/app/display/gimpdisplayshell-callbacks.c
+++ b/app/display/gimpdisplayshell-callbacks.c
@@ -119,7 +119,7 @@ gimp_display_shell_events (GtkWidget        *widget,
   gboolean  set_display = FALSE;
 
   /*  are we in destruction?  */
-  if (! shell->display || ! shell->display->shell)
+  if (! shell->display || ! gimp_display_get_shell (shell->display))
     return TRUE;
 
   gimp = shell->display->gimp;
@@ -270,7 +270,7 @@ gimp_display_shell_canvas_size_allocate (GtkWidget        *widget,
                                          GimpDisplayShell *shell)
 {
   /*  are we in destruction?  */
-  if (! shell->display || ! shell->display->shell)
+  if (! shell->display || ! gimp_display_get_shell (shell->display))
     return;
 
   if ((shell->disp_width  != allocation->width) ||
@@ -367,10 +367,8 @@ gimp_display_shell_canvas_expose (GtkWidget        *widget,
                                   GimpDisplayShell *shell)
 {
   /*  are we in destruction?  */
-  if (! shell->display || ! shell->display->shell)
-    {
-      return TRUE;
-    }
+  if (! shell->display || ! gimp_display_get_shell (shell->display))
+    return TRUE;
 
   if (shell->display->image)
     {
@@ -605,7 +603,7 @@ gimp_display_shell_canvas_tool_events (GtkWidget        *canvas,
   g_return_val_if_fail (GTK_WIDGET_REALIZED (canvas), FALSE);
 
   /*  are we in destruction?  */
-  if (! shell->display || ! shell->display->shell)
+  if (! shell->display || ! gimp_display_get_shell (shell->display))
     return TRUE;
 
   /*  set the active display before doing any other canvas event processing  */
diff --git a/app/display/gimpdisplayshell.c b/app/display/gimpdisplayshell.c
index 06d5ee7..7863691 100644
--- a/app/display/gimpdisplayshell.c
+++ b/app/display/gimpdisplayshell.c
@@ -731,7 +731,7 @@ gimp_display_shell_sync_config (GimpDisplayShell  *shell,
   gimp_config_sync (G_OBJECT (config->default_fullscreen_view),
                     G_OBJECT (shell->fullscreen_options), 0);
 
-  if (shell->display && shell->display->shell)
+  if (shell->display && gimp_display_get_shell (shell->display))
     {
       /*  if the shell is already fully constructed, use proper API
        *  so the actions are updated accordingly.
diff --git a/app/display/gimpimagewindow.c b/app/display/gimpimagewindow.c
index 9bc6df2..b655ea3 100644
--- a/app/display/gimpimagewindow.c
+++ b/app/display/gimpimagewindow.c
@@ -1077,7 +1077,7 @@ gimp_image_window_image_notify (GimpDisplay      *display,
     }
 
   view = gtk_notebook_get_tab_label (GTK_NOTEBOOK (private->notebook),
-                                     display->shell);
+                                     GTK_WIDGET (gimp_display_get_shell (display)));
 
   gimp_view_set_viewable (GIMP_VIEW (view),
                           GIMP_VIEWABLE (display->image));
diff --git a/app/gui/gui-vtable.c b/app/gui/gui-vtable.c
index 8917e6d..40a36d5 100644
--- a/app/gui/gui-vtable.c
+++ b/app/gui/gui-vtable.c
@@ -242,9 +242,11 @@ gui_get_display_name (Gimp *gimp,
 
   if (display)
     {
-      screen  = gtk_widget_get_screen (display->shell);
+      GimpDisplayShell *shell = gimp_display_get_shell (display);
+
+      screen  = gtk_widget_get_screen (GTK_WIDGET (shell));
       monitor = gdk_screen_get_monitor_at_window (screen,
-                                                  display->shell->window);
+                                                  GTK_WIDGET (shell)->window);
     }
   else
     {
@@ -313,11 +315,12 @@ gui_display_get_ID (GimpObject *display)
 static guint32
 gui_display_get_window (GimpObject *display)
 {
-  GimpDisplay *disp = GIMP_DISPLAY (display);
+  GimpDisplay      *disp  = GIMP_DISPLAY (display);
+  GimpDisplayShell *shell = gimp_display_get_shell (disp);
 
-  if (disp->shell)
+  if (shell)
     {
-      GtkWidget *toplevel = gtk_widget_get_toplevel (disp->shell);
+      GtkWidget *toplevel = gtk_widget_get_toplevel (GTK_WIDGET (shell));
 
       if (GTK_IS_WINDOW (toplevel))
         return (guint32) gimp_window_get_native (GTK_WINDOW (toplevel));
diff --git a/app/gui/gui.c b/app/gui/gui.c
index b92e45c..167fe08 100644
--- a/app/gui/gui.c
+++ b/app/gui/gui.c
@@ -530,19 +530,23 @@ gui_restore_after_callback (Gimp               *gimp,
 
   if (gimp_get_show_gui (gimp))
     {
+      GimpDisplayShell *shell;
+
       /*  create the empty display  */
       display = GIMP_DISPLAY (gimp_create_display (gimp,
                                                    NULL,
                                                    GIMP_UNIT_PIXEL,
                                                    1.0));
 
+      shell = gimp_display_get_shell (display);
+
       if (gui_config->restore_session)
         session_restore (gimp);
 
       windows_show_toolbox ();
 
       /*  move keyboard focus to the display  */
-      gtk_window_present (GTK_WINDOW (gtk_widget_get_toplevel (display->shell)));
+      gtk_window_present (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (shell))));
     }
 
   /*  indicate that the application has finished loading  */
diff --git a/app/tools/gimpcolortool.c b/app/tools/gimpcolortool.c
index 7bc5a8c..feae801 100644
--- a/app/tools/gimpcolortool.c
+++ b/app/tools/gimpcolortool.c
@@ -688,10 +688,11 @@ gimp_color_tool_real_picked (GimpColorTool      *color_tool,
 
     case GIMP_COLOR_PICK_MODE_PALETTE:
       {
-        GdkScreen *screen;
-        GtkWidget *dockable;
+        GimpDisplayShell *shell = gimp_display_get_shell (tool->display);
+        GdkScreen        *screen;
+        GtkWidget        *dockable;
 
-        screen = gtk_widget_get_screen (tool->display->shell);
+        screen = gtk_widget_get_screen (GTK_WIDGET (shell));
         dockable = gimp_dialog_factory_dialog_raise (dialog_factory, screen,
                                                      "gimp-palette-editor",
                                                      -1);
diff --git a/app/tools/gimpimagemaptool.c b/app/tools/gimpimagemaptool.c
index 552618b..0216f69 100644
--- a/app/tools/gimpimagemaptool.c
+++ b/app/tools/gimpimagemaptool.c
@@ -300,7 +300,7 @@ gimp_image_map_tool_initialize (GimpTool     *tool,
 
       image_map_tool->shell = shell =
         gimp_tool_dialog_new (tool_info,
-                              display->shell,
+                              GTK_WIDGET (gimp_display_get_shell (display)),
                               klass->shell_desc,
 
                               GIMP_STOCK_RESET, RESPONSE_RESET,
diff --git a/app/tools/gimprectangletool.c b/app/tools/gimprectangletool.c
index d212c90..1271fe9 100644
--- a/app/tools/gimprectangletool.c
+++ b/app/tools/gimprectangletool.c
@@ -914,9 +914,9 @@ gimp_rectangle_tool_button_press (GimpTool         *tool,
     {
       if (gimp_draw_tool_is_active (draw_tool))
         {
-          GtkWidget *shell = draw_tool->display->shell;
+          GimpDisplayShell *shell = gimp_display_get_shell (draw_tool->display);
 
-          gimp_display_shell_set_highlight (GIMP_DISPLAY_SHELL (shell), NULL);
+          gimp_display_shell_set_highlight (shell, NULL);
           gimp_draw_tool_stop (draw_tool);
         }
 
@@ -2078,7 +2078,7 @@ gimp_rectangle_tool_start (GimpRectangleTool *rect_tool,
 
   tool->display = display;
 
-  g_signal_connect_object (tool->display->shell, "scrolled",
+  g_signal_connect_object (gimp_display_get_shell (tool->display), "scrolled",
                            G_CALLBACK (gimp_rectangle_tool_shell_scrolled),
                            rect_tool, 0);
 
diff --git a/app/tools/gimptexttool.c b/app/tools/gimptexttool.c
index e5f386c..a885aa9 100644
--- a/app/tools/gimptexttool.c
+++ b/app/tools/gimptexttool.c
@@ -636,9 +636,10 @@ gimp_text_tool_button_release (GimpTool              *tool,
     {
       if (gtk_text_buffer_get_has_selection (text_tool->text_buffer))
         {
-          GtkClipboard *clipboard;
+          GimpDisplayShell *shell = gimp_display_get_shell (tool->display);
+          GtkClipboard     *clipboard;
 
-          clipboard = gtk_widget_get_clipboard (tool->display->shell,
+          clipboard = gtk_widget_get_clipboard (GTK_WIDGET (shell),
                                                 GDK_SELECTION_PRIMARY);
 
           gtk_text_buffer_copy_clipboard (text_tool->text_buffer, clipboard);
@@ -1351,21 +1352,22 @@ gimp_text_tool_rectangle_change_complete (GimpRectangleTool *rect_tool)
 static void
 gimp_text_tool_ensure_proxy (GimpTextTool *text_tool)
 {
-  GimpTool *tool = GIMP_TOOL (text_tool);
+  GimpTool         *tool  = GIMP_TOOL (text_tool);
+  GimpDisplayShell *shell = gimp_display_get_shell (tool->display);
 
   if (text_tool->offscreen_window &&
       gtk_widget_get_screen (text_tool->offscreen_window) !=
-      gtk_widget_get_screen (tool->display->shell))
+      gtk_widget_get_screen (GTK_WIDGET (shell)))
     {
       gtk_window_set_screen (GTK_WINDOW (text_tool->offscreen_window),
-                             gtk_widget_get_screen (tool->display->shell));
+                             gtk_widget_get_screen (GTK_WIDGET (shell)));
       gtk_window_move (GTK_WINDOW (text_tool->offscreen_window), -200, -200);
     }
   else if (! text_tool->offscreen_window)
     {
       text_tool->offscreen_window = gtk_window_new (GTK_WINDOW_POPUP);
       gtk_window_set_screen (GTK_WINDOW (text_tool->offscreen_window),
-                             gtk_widget_get_screen (tool->display->shell));
+                             gtk_widget_get_screen (GTK_WIDGET (shell)));
       gtk_window_move (GTK_WINDOW (text_tool->offscreen_window), -200, -200);
       gtk_widget_show (text_tool->offscreen_window);
 
@@ -2224,7 +2226,11 @@ gimp_text_tool_editor (GimpTextTool *text_tool)
   dialog_factory = gimp_dialog_factory_from_name ("toplevel");
 
   if (tool->display)
-    parent = GTK_WINDOW (tool->display->shell);
+    {
+      GimpDisplayShell *shell = gimp_display_get_shell (tool->display);
+
+      parent = GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (shell)));
+    }
 
   text_tool->editor = gimp_text_options_editor_new (parent, options,
                                                     dialog_factory->menu_factory,
@@ -2335,10 +2341,11 @@ gimp_text_tool_confirm_response (GtkWidget    *widget,
 static void
 gimp_text_tool_confirm_dialog (GimpTextTool *text_tool)
 {
-  GimpTool  *tool = GIMP_TOOL (text_tool);
-  GtkWidget *dialog;
-  GtkWidget *vbox;
-  GtkWidget *label;
+  GimpTool         *tool  = GIMP_TOOL (text_tool);
+  GimpDisplayShell *shell = gimp_display_get_shell (tool->display);
+  GtkWidget        *dialog;
+  GtkWidget        *vbox;
+  GtkWidget        *label;
 
   g_return_if_fail (text_tool->layer != NULL);
 
@@ -2354,7 +2361,7 @@ gimp_text_tool_confirm_dialog (GimpTextTool *text_tool)
                                      "gimp-text-tool-confirm",
                                      GIMP_STOCK_TEXT_LAYER,
                                      _("Confirm Text Editing"),
-                                     tool->display->shell,
+                                     GTK_WIDGET (shell),
                                      gimp_standard_help_func, NULL,
 
                                      _("Create _New Layer"), RESPONSE_NEW,
@@ -2736,11 +2743,14 @@ gimp_text_tool_delete_selection (GimpTextTool *text_tool)
 void
 gimp_text_tool_cut_clipboard (GimpTextTool *text_tool)
 {
-  GtkClipboard *clipboard;
+  GimpDisplayShell *shell;
+  GtkClipboard     *clipboard;
 
   g_return_if_fail (GIMP_IS_TEXT_TOOL (text_tool));
 
-  clipboard = gtk_widget_get_clipboard (GIMP_TOOL (text_tool)->display->shell,
+  shell = gimp_display_get_shell (GIMP_TOOL (text_tool)->display);
+
+  clipboard = gtk_widget_get_clipboard (GTK_WIDGET (shell),
                                         GDK_SELECTION_CLIPBOARD);
   gtk_text_buffer_cut_clipboard (text_tool->text_buffer, clipboard, TRUE);
 }
@@ -2748,11 +2758,14 @@ gimp_text_tool_cut_clipboard (GimpTextTool *text_tool)
 void
 gimp_text_tool_copy_clipboard (GimpTextTool *text_tool)
 {
-  GtkClipboard *clipboard;
+  GimpDisplayShell *shell;
+  GtkClipboard     *clipboard;
 
   g_return_if_fail (GIMP_IS_TEXT_TOOL (text_tool));
 
-  clipboard = gtk_widget_get_clipboard (GIMP_TOOL (text_tool)->display->shell,
+  shell = gimp_display_get_shell (GIMP_TOOL (text_tool)->display);
+
+  clipboard = gtk_widget_get_clipboard (GTK_WIDGET (shell),
                                         GDK_SELECTION_CLIPBOARD);
 
   gtk_text_buffer_copy_clipboard (text_tool->text_buffer, clipboard);
@@ -2761,11 +2774,14 @@ gimp_text_tool_copy_clipboard (GimpTextTool *text_tool)
 void
 gimp_text_tool_paste_clipboard (GimpTextTool *text_tool)
 {
-  GtkClipboard *clipboard;
+  GimpDisplayShell *shell;
+  GtkClipboard     *clipboard;
 
   g_return_if_fail (GIMP_IS_TEXT_TOOL (text_tool));
 
-  clipboard = gtk_widget_get_clipboard (GIMP_TOOL (text_tool)->display->shell,
+  shell = gimp_display_get_shell (GIMP_TOOL (text_tool)->display);
+
+  clipboard = gtk_widget_get_clipboard (GTK_WIDGET (shell),
                                         GDK_SELECTION_CLIPBOARD);
 
   gtk_text_buffer_paste_clipboard (text_tool->text_buffer, clipboard, NULL, TRUE);
diff --git a/app/tools/gimptool.c b/app/tools/gimptool.c
index 3a4443f..ca521bb 100644
--- a/app/tools/gimptool.c
+++ b/app/tools/gimptool.c
@@ -546,13 +546,16 @@ gimp_tool_check_click_distance (GimpTool         *tool,
                                 guint32           time,
                                 GimpDisplay      *display)
 {
-  gint double_click_time;
-  gint double_click_distance;
+  GimpDisplayShell *shell;
+  gint              double_click_time;
+  gint              double_click_distance;
 
   if (! tool->in_click_distance)
     return FALSE;
 
-  g_object_get (gtk_widget_get_settings (display->shell),
+  shell = gimp_display_get_shell (display);
+
+  g_object_get (gtk_widget_get_settings (GTK_WIDGET (shell)),
                 "gtk-double-click-time",     &double_click_time,
                 "gtk-double-click-distance", &double_click_distance,
                 NULL);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]