[nautilus/wip/gbsneto/other-locations: 4/4] window-slot: prepare for places view



commit 261875c8231b2521459ba78ef10e074e3b5ebbc8
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Tue Jun 16 17:16:00 2015 -0300

    window-slot: prepare for places view

 src/nautilus-toolbar.c     |   81 +++++++++++++-----------
 src/nautilus-window-slot.c |  144 ++++++++++++++++++++++++++------------------
 src/nautilus-window-slot.h |    4 +-
 src/nautilus-window.c      |   45 ++++++--------
 4 files changed, 151 insertions(+), 123 deletions(-)
---
diff --git a/src/nautilus-toolbar.c b/src/nautilus-toolbar.c
index 68bb86d..abc4a35 100644
--- a/src/nautilus-toolbar.c
+++ b/src/nautilus-toolbar.c
@@ -393,16 +393,18 @@ zoom_level_changed (GtkRange *range,
                    NautilusToolbar *self)
 {
        NautilusWindowSlot *slot;
-       NautilusView *view;
+       GtkWidget *view;
        gdouble zoom_level;
 
        zoom_level = gtk_range_get_value (range);
        slot = nautilus_window_get_active_slot (self->priv->window);
        view = nautilus_window_slot_get_current_view (slot);
 
-       g_action_group_change_action_state (nautilus_view_get_action_group (view),
-                                           "zoom-to-level",
-                                           g_variant_new_int32 ((gint) zoom_level));
+       if (NAUTILUS_IS_VIEW (view)) {
+               g_action_group_change_action_state (nautilus_view_get_action_group (NAUTILUS_VIEW (view)),
+                                                    "zoom-to-level",
+                                                    g_variant_new_int32 ((gint) zoom_level));
+        }
 }
 
 static void
@@ -410,12 +412,14 @@ view_menu_popover_closed (GtkPopover *popover,
                          NautilusToolbar *self)
 {
        NautilusWindowSlot *slot;
-       NautilusView *view;
+       GtkWidget *view;
 
        slot = nautilus_window_get_active_slot (self->priv->window);
        view = nautilus_window_slot_get_current_view (slot);
 
-       nautilus_view_grab_focus (view);
+       if (NAUTILUS_IS_VIEW (view)) {
+               nautilus_view_grab_focus (NAUTILUS_VIEW (view));
+        }
 }
 
 static void
@@ -571,7 +575,7 @@ void
 nautilus_toolbar_reset_menus (NautilusToolbar *self)
 {
        NautilusWindowSlot *slot;
-       NautilusView *view;
+       GtkWidget *view;
        GActionGroup *view_action_group;
        GVariant *variant;
        GVariantIter iter;
@@ -582,39 +586,42 @@ nautilus_toolbar_reset_menus (NautilusToolbar *self)
         * the view menu and action menu of the toolbar */
        slot = nautilus_window_get_active_slot (self->priv->window);
        view = nautilus_window_slot_get_current_view (slot);
-       view_action_group = nautilus_view_get_action_group (view);
-       gtk_widget_insert_action_group (GTK_WIDGET (self),
-                                       "view",
-                                       G_ACTION_GROUP (view_action_group));
-
-       gtk_widget_set_visible (self->priv->visible_columns,
-                               g_action_group_has_action (view_action_group, "visible-columns"));
-
-       has_sort = g_action_group_has_action (view_action_group, "sort");
-       sort_trash = sort_search = FALSE;
-       gtk_widget_set_visible (self->priv->sort_menu, has_sort);
-
-       if (has_sort) {
-               variant = g_action_group_get_action_state_hint (view_action_group, "sort");
-               g_variant_iter_init (&iter, variant);
-
-               while (g_variant_iter_next (&iter, "&s", &hint)) {
-                       if (g_strcmp0 (hint, "trash-time") == 0)
-                               sort_trash = TRUE;
-                       if (g_strcmp0 (hint, "search-relevance") == 0)
-                               sort_search = TRUE;
-               }
 
-               g_variant_unref (variant);
-       }
+       if (NAUTILUS_IS_VIEW (view)) {
+               view_action_group = nautilus_view_get_action_group (NAUTILUS_VIEW (view));
+               gtk_widget_insert_action_group (GTK_WIDGET (self),
+                                                "view",
+                                                G_ACTION_GROUP (view_action_group));
+
+               gtk_widget_set_visible (self->priv->visible_columns,
+                                        g_action_group_has_action (view_action_group, "visible-columns"));
+
+               has_sort = g_action_group_has_action (view_action_group, "sort");
+               sort_trash = sort_search = FALSE;
+               gtk_widget_set_visible (self->priv->sort_menu, has_sort);
 
-       gtk_widget_set_visible (self->priv->sort_trash_time, sort_trash);
-       gtk_widget_set_visible (self->priv->sort_search_relevance, sort_search);
+               if (has_sort) {
+                       variant = g_action_group_get_action_state_hint (view_action_group, "sort");
+                       g_variant_iter_init (&iter, variant);
 
-       variant = g_action_group_get_action_state (view_action_group, "zoom-to-level");
-       gtk_adjustment_set_value (self->priv->zoom_adjustment,
-                                 g_variant_get_int32 (variant));
-       g_variant_unref (variant);
+                       while (g_variant_iter_next (&iter, "&s", &hint)) {
+                               if (g_strcmp0 (hint, "trash-time") == 0)
+                                       sort_trash = TRUE;
+                               if (g_strcmp0 (hint, "search-relevance") == 0)
+                                       sort_search = TRUE;
+                       }
+
+                       g_variant_unref (variant);
+               }
+
+               gtk_widget_set_visible (self->priv->sort_trash_time, sort_trash);
+               gtk_widget_set_visible (self->priv->sort_search_relevance, sort_search);
+
+               variant = g_action_group_get_action_state (view_action_group, "zoom-to-level");
+               gtk_adjustment_set_value (self->priv->zoom_adjustment,
+                                          g_variant_get_int32 (variant));
+               g_variant_unref (variant);
+        }
 }
 
 GtkWidget *
diff --git a/src/nautilus-window-slot.c b/src/nautilus-window-slot.c
index 61b6548..acf571e 100644
--- a/src/nautilus-window-slot.c
+++ b/src/nautilus-window-slot.c
@@ -79,8 +79,8 @@ struct NautilusWindowSlotDetails {
        gchar *title;
 
        /* Viewed file */
-       NautilusView *content_view;
-       NautilusView *new_content_view;
+       GtkWidget *content_view;
+       GtkWidget *new_content_view;
        NautilusFile *viewed_file;
        gboolean viewed_file_seen;
        gboolean viewed_file_in_trash;
@@ -146,8 +146,9 @@ nautilus_window_slot_sync_search_widgets (NautilusWindowSlot *slot)
 
        toggle = slot->details->search_visible;
 
-       if (slot->details->content_view != NULL) {
-               directory = nautilus_view_get_model (slot->details->content_view);
+       if (slot->details->content_view != NULL &&
+            NAUTILUS_IS_VIEW (slot->details->content_view)) {
+               directory = nautilus_view_get_model (NAUTILUS_VIEW (slot->details->content_view));
                if (NAUTILUS_IS_SEARCH_DIRECTORY (directory)) {
                        toggle = TRUE;
                }
@@ -160,10 +161,11 @@ static gboolean
 nautilus_window_slot_content_view_matches_iid (NautilusWindowSlot *slot,
                                               const char *iid)
 {
-       if (slot->details->content_view == NULL) {
+       if (slot->details->content_view == NULL ||
+            !NAUTILUS_IS_VIEW (slot->details->content_view)) {
                return FALSE;
        }
-       return g_strcmp0 (nautilus_view_get_view_id (slot->details->content_view), iid) == 0;
+       return g_strcmp0 (nautilus_view_get_view_id (NAUTILUS_VIEW (slot->details->content_view)), iid) == 0;
 }
 
 void
@@ -259,8 +261,9 @@ static void
 query_editor_activated_callback (NautilusQueryEditor *editor,
                                 NautilusWindowSlot *slot)
 {
-       if (slot->details->content_view != NULL) {
-               nautilus_view_activate_selection (slot->details->content_view);
+       if (slot->details->content_view != NULL &&
+            NAUTILUS_IS_VIEW (slot->details->content_view)) {
+               nautilus_view_activate_selection (NAUTILUS_VIEW (slot->details->content_view));
        }
 }
 
@@ -788,8 +791,9 @@ nautilus_window_slot_open_location_full (NautilusWindowSlot *slot,
        }
 
        old_selection = NULL;
-       if (slot->details->content_view != NULL) {
-               old_selection = nautilus_view_get_selection (slot->details->content_view);
+       if (slot->details->content_view != NULL &&
+            NAUTILUS_IS_VIEW (slot->details->content_view)) {
+               old_selection = nautilus_view_get_selection (NAUTILUS_VIEW (slot->details->content_view));
        }
 
        if (target_window == window && target_slot == slot && !is_desktop &&
@@ -944,8 +948,9 @@ begin_location_change (NautilusWindowSlot *slot,
 
         /* Set current_bookmark scroll pos */
         if (slot->details->current_location_bookmark != NULL &&
-            slot->details->content_view != NULL) {
-                current_pos = nautilus_view_get_first_visible_file (slot->details->content_view);
+            slot->details->content_view != NULL &&
+            NAUTILUS_IS_VIEW (slot->details->content_view)) {
+                current_pos = nautilus_view_get_first_visible_file (NAUTILUS_VIEW 
(slot->details->content_view));
                 nautilus_bookmark_set_scroll_pos (slot->details->current_location_bookmark, current_pos);
                 g_free (current_pos);
         }
@@ -1249,8 +1254,9 @@ got_file_info_for_view_selection_callback (NautilusFile *file,
                mimetype = nautilus_file_get_mime_type (file);
 
                /* Otherwise, use default */
-               if (slot->details->content_view != NULL) {
-                       view_id = g_strdup (nautilus_view_get_view_id (slot->details->content_view));
+               if (slot->details->content_view != NULL &&
+                    NAUTILUS_IS_VIEW (slot->details->content_view)) {
+                       view_id = g_strdup (nautilus_view_get_view_id (NAUTILUS_VIEW 
(slot->details->content_view)));
                }
 
                if (view_id == NULL) {
@@ -1358,7 +1364,7 @@ create_content_view (NautilusWindowSlot *slot,
                     GError **error_out)
 {
        NautilusWindow *window;
-        NautilusView *view;
+        GtkWidget *view;
        GList *selection;
        gboolean ret = TRUE;
        GError *error = NULL;
@@ -1388,7 +1394,7 @@ create_content_view (NautilusWindowSlot *slot,
                g_object_ref (view);
         } else {
                 /* create a new content view */
-               view = nautilus_view_new (view_id, slot);
+               view = GTK_WIDGET (nautilus_view_new (view_id, slot));
 
                 slot->details->new_content_view = view;
                nautilus_window_slot_connect_new_content_view (slot);
@@ -1416,8 +1422,9 @@ create_content_view (NautilusWindowSlot *slot,
 
                slot->details->load_with_search = FALSE;
 
-               if (slot->details->pending_selection == NULL) {
-                       slot->details->pending_selection = nautilus_view_get_selection 
(slot->details->content_view);
+               if (slot->details->pending_selection == NULL &&
+                    NAUTILUS_IS_VIEW (slot->details->content_view)) {
+                       slot->details->pending_selection = nautilus_view_get_selection (NAUTILUS_VIEW 
(slot->details->content_view));
                }
        }
 
@@ -1432,8 +1439,8 @@ create_content_view (NautilusWindowSlot *slot,
 
                g_list_free_full (slot->details->pending_selection, g_object_unref);
                slot->details->pending_selection = NULL;
-       } else if (old_location != NULL) {
-               selection = nautilus_view_get_selection (slot->details->content_view);
+       } else if (old_location != NULL && NAUTILUS_IS_VIEW (slot->details->content_view)) {
+               selection = nautilus_view_get_selection (NAUTILUS_VIEW (slot->details->content_view));
                load_new_location (slot,
                                   old_location,
                                   selection,
@@ -1465,7 +1472,7 @@ load_new_location (NautilusWindowSlot *slot,
                   gboolean tell_new_content_view)
 {
        GList *selection_copy;
-       NautilusView *view;
+       GtkWidget *view;
 
        g_assert (slot != NULL);
        g_assert (location != NULL);
@@ -1475,21 +1482,25 @@ load_new_location (NautilusWindowSlot *slot,
 
        nautilus_profile_start (NULL);
        /* Note, these may recurse into report_load_underway */
-        if (slot->details->content_view != NULL && tell_current_content_view) {
+        if (slot->details->content_view != NULL &&
+            NAUTILUS_IS_VIEW (slot->details->content_view) &&
+            tell_current_content_view) {
                view = slot->details->content_view;
-               nautilus_view_load_location (slot->details->content_view, location);
+               nautilus_view_load_location (NAUTILUS_VIEW (slot->details->content_view), location);
         }
 
-        if (slot->details->new_content_view != NULL && tell_new_content_view &&
+        if (slot->details->new_content_view != NULL &&
+            NAUTILUS_IS_VIEW (slot->details->new_content_view) &&
+            tell_new_content_view &&
            (!tell_current_content_view ||
-            slot->details->new_content_view != slot->details->content_view) ) {
+            slot->details->new_content_view != slot->details->content_view)) {
                view = slot->details->new_content_view;
-               nautilus_view_load_location (slot->details->new_content_view, location);
+               nautilus_view_load_location (NAUTILUS_VIEW (slot->details->new_content_view), location);
         }
-       if (view != NULL) {
+       if (view != NULL && NAUTILUS_IS_VIEW (view)) {
                /* new_content_view might have changed here if
                   report_load_underway was called from load_location */
-               nautilus_view_set_selection (view, selection_copy);
+               nautilus_view_set_selection (NAUTILUS_VIEW (view), selection_copy);
        }
 
        g_list_free_full (selection_copy, g_object_unref);
@@ -1542,9 +1553,10 @@ free_location_change (NautilusWindowSlot *slot)
                 slot->details->determine_view_file = NULL;
         }
 
-        if (slot->details->new_content_view != NULL) {
+        if (slot->details->new_content_view != NULL &&
+            NAUTILUS_IS_VIEW (slot->details->new_content_view)) {
                slot->details->temporarily_ignore_view_signals = TRUE;
-               nautilus_view_stop_loading (slot->details->new_content_view);
+               nautilus_view_stop_loading (NAUTILUS_VIEW (slot->details->new_content_view));
                slot->details->temporarily_ignore_view_signals = FALSE;
 
                g_object_unref (slot->details->new_content_view);
@@ -1562,14 +1574,15 @@ cancel_location_change (NautilusWindowSlot *slot)
 
         if (slot->details->pending_location != NULL
             && location != NULL
-            && slot->details->content_view != NULL) {
+            && slot->details->content_view != NULL
+            && NAUTILUS_IS_VIEW (slot->details->content_view)) {
 
                 /* No need to tell the new view - either it is the
                  * same as the old view, in which case it will already
                  * be told, or it is the very pending change we wish
                  * to cancel.
                  */
-               selection = nautilus_view_get_selection (slot->details->content_view);
+               selection = nautilus_view_get_selection (NAUTILUS_VIEW (slot->details->content_view));
                 load_new_location (slot,
                                   location,
                                   selection,
@@ -1669,16 +1682,18 @@ nautilus_window_slot_set_content_view (NautilusWindowSlot *slot,
 
         nautilus_window_slot_set_allow_stop (slot, TRUE);
 
-        if (nautilus_view_get_selection_count (slot->details->content_view) == 0) {
-                /* If there is no selection, queue a scroll to the same icon that
-                 * is currently visible */
-                slot->details->pending_scroll_to = nautilus_view_get_first_visible_file 
(slot->details->content_view);
-        }
-       slot->details->location_change_type = NAUTILUS_LOCATION_CHANGE_RELOAD;
+       if (NAUTILUS_IS_VIEW (slot->details->content_view)) {
+               if (nautilus_view_get_selection_count (NAUTILUS_VIEW (slot->details->content_view)) == 0) {
+                       /* If there is no selection, queue a scroll to the same icon that
+                        * is currently visible */
+                       slot->details->pending_scroll_to = nautilus_view_get_first_visible_file 
(NAUTILUS_VIEW (slot->details->content_view));
+               }
+               slot->details->location_change_type = NAUTILUS_LOCATION_CHANGE_RELOAD;
 
-        if (!create_content_view (slot, id, NULL)) {
-               /* Just load the homedir. */
-               nautilus_window_slot_go_home (slot, FALSE);
+               if (!create_content_view (slot, id, NULL)) {
+                       /* Just load the homedir. */
+                       nautilus_window_slot_go_home (slot, FALSE);
+               }
        }
 }
 
@@ -1754,9 +1769,10 @@ nautilus_window_slot_force_reload (NautilusWindowSlot *slot)
        g_object_ref (location);
        current_pos = NULL;
        selection = NULL;
-       if (slot->details->content_view != NULL) {
-               current_pos = nautilus_view_get_first_visible_file (slot->details->content_view);
-               selection = nautilus_view_get_selection (slot->details->content_view);
+       if (slot->details->content_view != NULL &&
+            NAUTILUS_IS_VIEW (slot->details->content_view)) {
+               current_pos = nautilus_view_get_first_visible_file (NAUTILUS_VIEW 
(slot->details->content_view));
+               selection = nautilus_view_get_selection (NAUTILUS_VIEW (slot->details->content_view));
        }
        begin_location_change
                (slot, location, location, selection,
@@ -1778,7 +1794,8 @@ nautilus_window_slot_queue_reload (NautilusWindowSlot *slot)
 
        if (slot->details->pending_location != NULL
            || slot->details->content_view == NULL
-           || nautilus_view_get_loading (slot->details->content_view)) {
+           || (NAUTILUS_IS_VIEW (slot->details->content_view) &&
+                nautilus_view_get_loading (NAUTILUS_VIEW (slot->details->content_view)))) {
                /* there is a reload in flight */
                slot->details->needs_reload = TRUE;
                return;
@@ -2052,14 +2069,18 @@ nautilus_window_slot_emit_location_change (NautilusWindowSlot *slot,
 static void
 nautilus_window_slot_show_trash_bar (NautilusWindowSlot *slot)
 {
-       GtkWidget *bar;
-       NautilusView *view;
+       GtkWidget *view;
 
        view = nautilus_window_slot_get_current_view (slot);
-       bar = nautilus_trash_bar_new (view);
-       gtk_widget_show (bar);
 
-       nautilus_window_slot_add_extra_location_widget (slot, bar);
+       if (NAUTILUS_IS_VIEW (view)) {
+               GtkWidget *bar;
+
+               bar = nautilus_trash_bar_new (NAUTILUS_VIEW (view));
+               gtk_widget_show (bar);
+
+               nautilus_window_slot_add_extra_location_widget (slot, bar);
+        }
 }
 
 static void
@@ -2154,9 +2175,9 @@ view_end_loading_cb (NautilusView       *view,
 
        /* Only handle this if we're expecting it.
         * Don't handle it if its from an old view we've switched from */
-       if (view == slot->details->content_view && all_files_seen) {
+       if (view == NAUTILUS_VIEW (slot->details->content_view) && all_files_seen) {
                if (slot->details->pending_scroll_to != NULL) {
-                       nautilus_view_scroll_to_file (slot->details->content_view,
+                       nautilus_view_scroll_to_file (NAUTILUS_VIEW (slot->details->content_view),
                                                      slot->details->pending_scroll_to);
                }
                end_location_change (slot);
@@ -2186,7 +2207,7 @@ real_setup_loading_floating_bar (NautilusWindowSlot *slot)
 
        nautilus_floating_bar_cleanup_actions (NAUTILUS_FLOATING_BAR (slot->details->floating_bar));
        nautilus_floating_bar_set_primary_label (NAUTILUS_FLOATING_BAR (slot->details->floating_bar),
-                                                NAUTILUS_IS_SEARCH_DIRECTORY (nautilus_view_get_model 
(slot->details->content_view)) ?
+                                                NAUTILUS_IS_SEARCH_DIRECTORY (nautilus_view_get_model 
(NAUTILUS_VIEW (slot->details->content_view))) ?
                                                 _("Searching…") : _("Loading…"));
        nautilus_floating_bar_set_details_label (NAUTILUS_FLOATING_BAR (slot->details->floating_bar), NULL);
        nautilus_floating_bar_set_show_spinner (NAUTILUS_FLOATING_BAR (slot->details->floating_bar),
@@ -2238,7 +2259,7 @@ view_begin_loading_cb (NautilusView       *view,
 
        nautilus_profile_start (NULL);
 
-       if (view == slot->details->new_content_view) {
+       if (view == NAUTILUS_VIEW (slot->details->new_content_view)) {
                location_has_really_changed (slot);
        } else {
                nautilus_window_slot_set_allow_stop (slot, TRUE);
@@ -2563,7 +2584,7 @@ nautilus_window_slot_set_window (NautilusWindowSlot *slot,
        }
 }
 
-NautilusView *
+GtkWidget *
 nautilus_window_slot_get_view (NautilusWindowSlot *slot)
 {
        return slot->details->content_view;
@@ -2630,11 +2651,16 @@ nautilus_window_slot_set_allow_stop (NautilusWindowSlot *slot,
 void
 nautilus_window_slot_stop_loading (NautilusWindowSlot *slot)
 {
-       nautilus_view_stop_loading (slot->details->content_view);
+       if (!NAUTILUS_IS_VIEW (slot->details->content_view)) {
+               return;
+       }
 
-       if (slot->details->new_content_view != NULL) {
+       nautilus_view_stop_loading (NAUTILUS_VIEW (slot->details->content_view));
+
+       if (slot->details->new_content_view != NULL &&
+            NAUTILUS_IS_VIEW (slot->details->new_content_view)) {
                slot->details->temporarily_ignore_view_signals = TRUE;
-               nautilus_view_stop_loading (slot->details->new_content_view);
+               nautilus_view_stop_loading (NAUTILUS_VIEW (slot->details->new_content_view));
                slot->details->temporarily_ignore_view_signals = FALSE;
        }
 
@@ -2758,7 +2784,7 @@ nautilus_window_slot_get_current_uri (NautilusWindowSlot *slot)
        return NULL;
 }
 
-NautilusView *
+GtkWidget *
 nautilus_window_slot_get_current_view (NautilusWindowSlot *slot)
 {
        if (slot->details->content_view != NULL) {
diff --git a/src/nautilus-window-slot.h b/src/nautilus-window-slot.h
index ed7e780..afc349c 100644
--- a/src/nautilus-window-slot.h
+++ b/src/nautilus-window-slot.h
@@ -87,9 +87,9 @@ char *  nautilus_window_slot_get_location_uri            (NautilusWindowSlot *slot);
 
 NautilusFile *    nautilus_window_slot_get_file            (NautilusWindowSlot *slot);
 NautilusBookmark *nautilus_window_slot_get_bookmark        (NautilusWindowSlot *slot);
-NautilusView *    nautilus_window_slot_get_view            (NautilusWindowSlot *slot);
+GtkWidget *       nautilus_window_slot_get_view            (NautilusWindowSlot *slot);
 
-NautilusView * nautilus_window_slot_get_current_view       (NautilusWindowSlot *slot);
+GtkWidget *    nautilus_window_slot_get_current_view       (NautilusWindowSlot *slot);
 char *         nautilus_window_slot_get_current_uri        (NautilusWindowSlot *slot);
 
 GList * nautilus_window_slot_get_back_history              (NautilusWindowSlot *slot);
diff --git a/src/nautilus-window.c b/src/nautilus-window.c
index ce4c93f..871e12c 100644
--- a/src/nautilus-window.c
+++ b/src/nautilus-window.c
@@ -656,13 +656,13 @@ void
 nautilus_window_grab_focus (NautilusWindow *window)
 {
        NautilusWindowSlot *slot;
-       NautilusView *view;
+       GtkWidget *view;
 
        slot = nautilus_window_get_active_slot (window);
        view = nautilus_window_slot_get_view (slot);
 
-       if (view) {
-               nautilus_view_grab_focus (view);
+       if (view && NAUTILUS_IS_VIEW (view)) {
+               nautilus_view_grab_focus (NAUTILUS_VIEW (view));
        }
 }
 
@@ -1032,6 +1032,17 @@ places_sidebar_open_location_cb (GtkPlacesSidebar        *sidebar,
                                                  NULL);
 }
 
+static void
+nautilus_window_show_other_locations_view (GtkPlacesSidebar *sidebar,
+                                           NautilusWindow   *window)
+{
+       NautilusWindowPrivate *priv;
+
+       g_return_if_fail (NAUTILUS_IS_WINDOW (window));
+
+       priv = window->priv;
+}
+
 /* Callback used when the places sidebar needs us to present an error message */
 static void
 places_sidebar_show_error_message_cb (GtkPlacesSidebar *sidebar,
@@ -1044,19 +1055,6 @@ places_sidebar_show_error_message_cb (GtkPlacesSidebar *sidebar,
        eel_show_error_dialog (primary, secondary, GTK_WINDOW (window));
 }
 
-/* Callback used when the places sidebar needs us to present the Connect to Server dialog */
-static void
-places_sidebar_show_connect_to_server_cb (GtkPlacesSidebar *sidebar,
-                                         gpointer          user_data)
-{
-       NautilusWindow *window = NAUTILUS_WINDOW (user_data);
-       NautilusApplication *application = NAUTILUS_APPLICATION (g_application_get_default ());
-       GtkWidget *dialog;
- 
-       dialog = nautilus_application_connect_server (application, window);
-       gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
-}
-
 static GList *
 build_selection_list_from_gfile_list (GList *gfile_list)
 {
@@ -1328,14 +1326,11 @@ nautilus_window_set_up_sidebar (NautilusWindow *window)
                                           (GTK_PLACES_OPEN_NORMAL
                                            | GTK_PLACES_OPEN_NEW_TAB
                                            | GTK_PLACES_OPEN_NEW_WINDOW));
-       gtk_places_sidebar_set_show_connect_to_server (GTK_PLACES_SIDEBAR (window->priv->places_sidebar), 
TRUE);
 
        g_signal_connect (window->priv->places_sidebar, "open-location",
                          G_CALLBACK (places_sidebar_open_location_cb), window);
        g_signal_connect (window->priv->places_sidebar, "show-error-message",
                          G_CALLBACK (places_sidebar_show_error_message_cb), window);
-       g_signal_connect (window->priv->places_sidebar, "show-connect-to-server",
-                         G_CALLBACK (places_sidebar_show_connect_to_server_cb), window);
        g_signal_connect (window->priv->places_sidebar, "drag-action-requested",
                          G_CALLBACK (places_sidebar_drag_action_requested_cb), window);
        g_signal_connect (window->priv->places_sidebar, "drag-action-ask",
@@ -1626,7 +1621,7 @@ path_bar_path_event_callback (NautilusPathBar *path_bar,
        NautilusWindowSlot *slot;
        NautilusWindowOpenFlags flags;
        int mask;
-       NautilusView *view;
+       GtkWidget *view;
        char *uri;
 
        if (event->type == GDK_BUTTON_RELEASE) {
@@ -1650,9 +1645,9 @@ path_bar_path_event_callback (NautilusPathBar *path_bar,
        if (event->button == 3) {
                slot = nautilus_window_get_active_slot (window);
                view = nautilus_window_slot_get_view (slot);
-               if (view != NULL) {
+               if (view != NULL && NAUTILUS_IS_VIEW (view)) {
                        uri = g_file_get_uri (location);
-                       nautilus_view_pop_up_pathbar_context_menu (view, event, uri);
+                       nautilus_view_pop_up_pathbar_context_menu (NAUTILUS_VIEW (view), event, uri);
                        g_free (uri);
                }
 
@@ -2256,7 +2251,7 @@ nautilus_window_key_press_event (GtkWidget *widget,
 {
        NautilusWindow *window;
        NautilusWindowSlot *active_slot;
-       NautilusView *view;
+       GtkWidget *view;
        GtkWidget *focus_widget;
        int i;
 
@@ -2282,8 +2277,8 @@ nautilus_window_key_press_event (GtkWidget *widget,
                        GAction *action;
 
                        action = g_action_map_lookup_action (G_ACTION_MAP (window), 
extra_window_keybindings[i].action);
-                       if (action == NULL) {
-                               action_group = nautilus_view_get_action_group (view);
+                       if (action == NULL && NAUTILUS_IS_VIEW (view)) {
+                               action_group = nautilus_view_get_action_group (NAUTILUS_VIEW (view));
                                action = g_action_map_lookup_action (G_ACTION_MAP (action_group), 
extra_window_keybindings[i].action);
                        }
 


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