static void action_new_window (GSimpleAction *action, GVariant *parameter, gpointer user_data) { GtkApplication *application = user_data; GFile *home; home = g_file_new_for_path (g_get_home_dir ()); nautilus_application_open_location_full (NAUTILUS_APPLICATION (application), home, NAUTILUS_WINDOW_OPEN_FLAG_NEW_WINDOW, NULL, NULL, NULL); g_object_unref (home); }
static void switch_location (NautilusDragSlotProxyInfo *drag_info) { GFile *location; GtkWidget *window; if (drag_info->target_file == NULL) { return; } window = gtk_widget_get_toplevel (drag_info->widget); g_assert (NAUTILUS_IS_WINDOW (window)); location = nautilus_file_get_location (drag_info->target_file); nautilus_application_open_location_full (NAUTILUS_APPLICATION (g_application_get_default ()), location, NAUTILUS_WINDOW_OPEN_FLAG_DONT_MAKE_ACTIVE, NULL, NAUTILUS_WINDOW (window), NULL); g_object_unref (location); }
static void drag_data_received_callback (GtkWidget *widget, GdkDragContext *context, int x, int y, GtkSelectionData *data, guint info, guint32 time, gpointer callback_data) { char **names; int name_count; GtkWidget *window; gboolean new_windows_for_extras; char *prompt; char *detail; GFile *location; NautilusLocationEntry *self = NAUTILUS_LOCATION_ENTRY (widget); g_assert (data != NULL); g_assert (callback_data == NULL); names = g_uri_list_extract_uris ((const gchar *) gtk_selection_data_get_data (data)); if (names == NULL || *names == NULL) { g_warning ("No D&D URI's"); gtk_drag_finish (context, FALSE, FALSE, time); return; } window = gtk_widget_get_toplevel (widget); new_windows_for_extras = FALSE; /* Ask user if they really want to open multiple windows * for multiple dropped URIs. This is likely to have been * a mistake. */ name_count = g_strv_length (names); if (name_count > 1) { prompt = g_strdup_printf (ngettext("Do you want to view %d location?", "Do you want to view %d locations?", name_count), name_count); detail = g_strdup_printf (ngettext("This will open %d separate window.", "This will open %d separate windows.", name_count), name_count); /* eel_run_simple_dialog should really take in pairs * like gtk_dialog_new_with_buttons() does. */ new_windows_for_extras = eel_run_simple_dialog (GTK_WIDGET (window), TRUE, GTK_MESSAGE_QUESTION, prompt, detail, _("_Cancel"), _("_OK"), NULL) != 0 /* GNOME_OK */; g_free (prompt); g_free (detail); if (!new_windows_for_extras) { gtk_drag_finish (context, FALSE, FALSE, time); return; } } location = g_file_new_for_uri (names[0]); nautilus_location_entry_set_location (self, location); emit_location_changed (self); g_object_unref (location); if (new_windows_for_extras) { int i; for (i = 1; names[i] != NULL; ++i) { location = g_file_new_for_uri (names[i]); nautilus_application_open_location_full (NAUTILUS_APPLICATION (g_application_get_default ()), location, NAUTILUS_WINDOW_OPEN_FLAG_NEW_WINDOW, NULL, NULL, NULL); g_object_unref (location); } } g_strfreev (names); gtk_drag_finish (context, TRUE, FALSE, time); }