[nautilus/wip/gbsneto/other-locations] files-view: remove ::get_nautilus_window_slot method



commit 755bc997d30d64f86003b7e119b0e569429c5e68
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Thu Jul 16 13:22:31 2015 -0300

    files-view: remove ::get_nautilus_window_slot method
    
    NautilusFilesView manages its parent NautilusWindowSlot instance,
    but this is unecessary since Gtk+ already has parent management
    code.
    
    Clean up ::get_nautilus_window_slot code, and replace it by the
    Gtk+ equivalents.

 src/nautilus-files-view-dnd.c |    2 +-
 src/nautilus-files-view.c     |   13 ++-----------
 src/nautilus-files-view.h     |    4 ----
 src/nautilus-window.c         |    3 +--
 4 files changed, 4 insertions(+), 18 deletions(-)
---
diff --git a/src/nautilus-files-view-dnd.c b/src/nautilus-files-view-dnd.c
index 2f9cfa1..86b91d6 100644
--- a/src/nautilus-files-view-dnd.c
+++ b/src/nautilus-files-view-dnd.c
@@ -532,7 +532,7 @@ nautilus_files_view_handle_hover (NautilusFilesView *view,
        NautilusFile *target_file;
        gboolean target_is_dir;
 
-       slot = nautilus_files_view_get_nautilus_window_slot (view);
+       slot = NAUTILUS_WINDOW_SLOT (gtk_widget_get_ancestor (GTK_WIDGET (view), NAUTILUS_TYPE_WINDOW_SLOT));
 
        location = g_file_new_for_uri (target_uri);
        target_file = nautilus_file_get_existing (location);
diff --git a/src/nautilus-files-view.c b/src/nautilus-files-view.c
index 916e451..fc9c478 100644
--- a/src/nautilus-files-view.c
+++ b/src/nautilus-files-view.c
@@ -717,18 +717,10 @@ create_templates_parameters_free (CreateTemplateParameters *parameters)
        g_free (parameters);
 }
 
-NautilusWindow *
+static NautilusWindow*
 nautilus_files_view_get_window (NautilusFilesView  *view)
 {
-       return nautilus_window_slot_get_window (view->details->slot);
-}
-
-NautilusWindowSlot *
-nautilus_files_view_get_nautilus_window_slot (NautilusFilesView  *view)
-{
-       g_assert (view->details->slot != NULL);
-
-       return view->details->slot;
+       return NAUTILUS_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (view)));
 }
 
 /* Returns the GtkWindow that this directory view occupies, or NULL
@@ -7629,7 +7621,6 @@ nautilus_files_view_class_init (NautilusFilesViewClass *klass)
        klass->can_rename_file = can_rename_file;
        klass->get_backing_uri = real_get_backing_uri;
        klass->using_manual_layout = real_using_manual_layout;
-       klass->get_window = nautilus_files_view_get_window;
        klass->update_context_menus = real_update_context_menus;
        klass->update_actions_state = real_update_actions_state;
 
diff --git a/src/nautilus-files-view.h b/src/nautilus-files-view.h
index c03463b..22a996a 100644
--- a/src/nautilus-files-view.h
+++ b/src/nautilus-files-view.h
@@ -274,8 +274,6 @@ struct NautilusFilesViewClass {
           of the view */
        void           (* scroll_to_file)         (NautilusFilesView     *view,
                                                   const char            *uri);
-
-       NautilusWindow * (*get_window)            (NautilusFilesView     *view);
 };
 
 /* GObject support */
@@ -285,7 +283,6 @@ NautilusFilesView*  nautilus_files_view_new                              (const
                                                                           NautilusWindowSlot *slot);
 
 /* Functions callable from the user interface and elsewhere. */
-NautilusWindowSlot *nautilus_files_view_get_nautilus_window_slot         (NautilusFilesView  *view);
 char *              nautilus_files_view_get_uri                          (NautilusFilesView  *view);
 
 void                nautilus_files_view_display_selection_info           (NautilusFilesView  *view);
@@ -332,7 +329,6 @@ void                nautilus_files_view_remove_subdirectory             (Nautilu
                                                                          NautilusDirectory *directory);
 
 gboolean            nautilus_files_view_is_editable                     (NautilusFilesView *view);
-NautilusWindow *    nautilus_files_view_get_window                      (NautilusFilesView *view);
 
 /* NautilusFilesView methods */
 const char *      nautilus_files_view_get_view_id                       (NautilusFilesView  *view);
diff --git a/src/nautilus-window.c b/src/nautilus-window.c
index ce3bd9e..28fde51 100644
--- a/src/nautilus-window.c
+++ b/src/nautilus-window.c
@@ -41,7 +41,6 @@
 #include "nautilus-toolbar.h"
 #include "nautilus-window-slot.h"
 #include "nautilus-list-view.h"
-#include "nautilus-files-view.h"
 
 #include <eel/eel-debug.h>
 #include <eel/eel-gtk-extensions.h>
@@ -2118,7 +2117,7 @@ nautilus_window_view_visible (NautilusWindow *window,
         *
         * Needs more investigation...
         */
-       slot = nautilus_files_view_get_nautilus_window_slot (view);
+       slot = NAUTILUS_WINDOW_SLOT (gtk_widget_get_ancestor (GTK_WIDGET (view), NAUTILUS_TYPE_WINDOW_SLOT));
        if (g_object_get_data (G_OBJECT (slot), "nautilus-window-view-visible") != NULL) {
                return;
        }


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