static NautilusView * get_current_view (NautilusWindow *window) { NautilusWindowSlot *slot; NautilusView *view; slot = nautilus_window_get_active_slot (window); view = nautilus_window_slot_get_current_view (slot); return view; }
static void view_menu_popover_closed (GtkPopover *popover, NautilusToolbar *self) { NautilusWindowSlot *slot; NautilusView *view; slot = nautilus_window_get_active_slot (self->priv->window); view = nautilus_window_slot_get_current_view (slot); nautilus_view_grab_focus (view); }
void nautilus_toolbar_reset_menus (NautilusToolbar *self) { NautilusWindowSlot *slot; NautilusView *view; GActionGroup *view_action_group; GVariant *variant; GVariantIter iter; gboolean show_sort_trash, show_sort_search, show_sort_access, show_sort_modification, enable_sort; const gchar *hint; /* Allow actions from the current view to be activated through * 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")); enable_sort = g_action_group_get_action_enabled (view_action_group, "sort"); show_sort_trash = show_sort_search = show_sort_modification = show_sort_access = FALSE; gtk_widget_set_visible (self->priv->sort_menu, enable_sort); if (enable_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) show_sort_trash = TRUE; if (g_strcmp0 (hint, "search-relevance") == 0) show_sort_search = TRUE; } g_variant_unref (variant); } gtk_widget_set_visible (self->priv->sort_trash_time, show_sort_trash); gtk_widget_set_visible (self->priv->sort_search_relevance, show_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); }
static void zoom_level_changed (GtkRange *range, NautilusToolbar *self) { NautilusWindowSlot *slot; NautilusView *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)); }
static void action_location_properties_callback (GtkAction *action, gpointer user_data) { NautilusWindowSlot *slot; GList *files; NautilusView *view; NautilusFile *file; slot = nautilus_window_get_active_slot (NAUTILUS_WINDOW (user_data)); view = nautilus_window_slot_get_current_view (slot); file = nautilus_view_get_directory_as_file (view); files = g_list_append (NULL, file); nautilus_properties_window_present (files, GTK_WIDGET (view), NULL); g_list_free (files); }
static void slot_proxy_handle_drop (GtkWidget *widget, GdkDragContext *context, unsigned int time, NautilusDragSlotProxyInfo *drag_info) { GtkWidget *window; NautilusWindowSlot *target_slot; NautilusFilesView *target_view; char *target_uri; GList *uri_list; GFile *location; if (!drag_info->have_data || !drag_info->have_valid_data) { gtk_drag_finish (context, FALSE, FALSE, time); drag_info_clear (drag_info); return; } window = gtk_widget_get_toplevel (widget); g_assert (NAUTILUS_IS_WINDOW (window)); if (drag_info->target_slot != NULL) { target_slot = drag_info->target_slot; } else { target_slot = nautilus_window_get_active_slot (NAUTILUS_WINDOW (window)); } target_uri = NULL; if (drag_info->target_file != NULL) { target_uri = nautilus_file_get_uri (drag_info->target_file); } else if (target_slot != NULL) { location = nautilus_window_slot_get_location (target_slot); target_uri = g_file_get_uri (location); } target_view = NULL; if (target_slot != NULL) { NautilusView *view; view = nautilus_window_slot_get_current_view (target_slot); if (view && NAUTILUS_IS_FILES_VIEW (view)) { target_view = NAUTILUS_FILES_VIEW (view); } } if (target_slot != NULL && target_view != NULL) { if (drag_info->info == NAUTILUS_ICON_DND_GNOME_ICON_LIST) { uri_list = nautilus_drag_uri_list_from_selection_list (drag_info->data.selection_list); g_assert (uri_list != NULL); nautilus_files_view_drop_proxy_received_uris (target_view, uri_list, target_uri, gdk_drag_context_get_selected_action (context)); g_list_free_full (uri_list, g_free); } else if (drag_info->info == NAUTILUS_ICON_DND_URI_LIST) { nautilus_files_view_drop_proxy_received_uris (target_view, drag_info->data.uri_list, target_uri, gdk_drag_context_get_selected_action (context)); } if (drag_info->info == NAUTILUS_ICON_DND_NETSCAPE_URL) { nautilus_files_view_handle_netscape_url_drop (target_view, drag_info->data.netscape_url, target_uri, gdk_drag_context_get_selected_action (context), 0, 0); } gtk_drag_finish (context, TRUE, FALSE, time); } else { gtk_drag_finish (context, FALSE, FALSE, time); } g_free (target_uri); drag_info_clear (drag_info); }