static void nemo_location_bar_cancel (NemoLocationBar *bar) { char *last_location; last_location = bar->details->last_location; nemo_location_bar_set_location (bar, last_location); }
void nemo_window_pane_sync_location_widgets (NemoWindowPane *pane) { NemoWindowSlot *slot, *active_slot; NemoNavigationState *nav_state; gchar *view_id; slot = pane->active_slot; nemo_window_pane_hide_temporary_bars (pane); /* Change the location bar and path bar to match the current location. */ if (slot->location != NULL) { char *uri; /* this may be NULL if we just created the slot */ uri = nemo_window_slot_get_location_uri (slot); nemo_location_bar_set_location (NEMO_LOCATION_BAR (pane->location_bar), uri); g_free (uri); nemo_path_bar_set_path (NEMO_PATH_BAR (pane->path_bar), slot->location); restore_focus_widget (pane); } /* Update window global UI if this is the active pane */ if (pane == nemo_window_get_active_pane (pane->window)) { nemo_window_sync_up_button (pane->window); /* Check if the back and forward buttons need enabling or disabling. */ active_slot = nemo_window_get_active_slot (pane->window); nav_state = nemo_window_get_navigation_state (pane->window); nemo_navigation_state_set_boolean (nav_state, NEMO_ACTION_BACK, active_slot->back_list != NULL); nemo_navigation_state_set_boolean (nav_state, NEMO_ACTION_FORWARD, active_slot->forward_list != NULL); } }
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; NemoApplication *application; int name_count; NemoWindow *new_window, *window; GdkScreen *screen; gboolean new_windows_for_extras; char *prompt; char *detail; GFile *location; NemoLocationBar *self = NEMO_LOCATION_BAR (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"); g_strfreev (names); gtk_drag_finish (context, FALSE, FALSE, time); return; } window = nemo_location_bar_get_window (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, GTK_STOCK_CANCEL, GTK_STOCK_OK, NULL) != 0 /* GNOME_OK */; g_free (prompt); g_free (detail); if (!new_windows_for_extras) { g_strfreev (names); gtk_drag_finish (context, FALSE, FALSE, time); return; } } nemo_location_bar_set_location (self, names[0]); emit_location_changed (self); if (new_windows_for_extras) { int i; application = nemo_application_get_singleton (); screen = gtk_window_get_screen (GTK_WINDOW (window)); for (i = 1; names[i] != NULL; ++i) { new_window = nemo_application_create_window (application, screen); location = g_file_new_for_uri (names[i]); nemo_window_go_to (new_window, location); g_object_unref (location); } } g_strfreev (names); gtk_drag_finish (context, TRUE, FALSE, time); }