static void
show_bogus_bookmark_window (NautilusWindow *window,
			    NautilusBookmark *bookmark)
{
	GtkDialog *dialog;
	GFile *location;
	char *uri_for_display;
	char *prompt;
	char *detail;

	location = nautilus_bookmark_get_location (bookmark);
	uri_for_display = g_file_get_parse_name (location);
	
	prompt = _("Do you want to remove any bookmarks with the "
		   "non-existing location from your list?");
	detail = g_strdup_printf (_("The location \"%s\" does not exist."), uri_for_display);
	
	dialog = eel_show_yes_no_dialog (prompt, detail,
					 _("Bookmark for Nonexistent Location"),
					 GTK_STOCK_CANCEL,
					 GTK_WINDOW (window));

	g_signal_connect (dialog, "response",
	                  G_CALLBACK (remove_bookmarks_for_uri_if_yes), window);
	g_object_set_data_full (G_OBJECT (dialog), "uri", g_file_get_uri (location), g_free);

	gtk_dialog_set_default_response (dialog, GTK_RESPONSE_NO);

	g_object_unref (location);
	g_free (uri_for_display);
	g_free (detail);
}
Ejemplo n.º 2
0
static void
activate_bookmark_in_menu_item (GtkAction *action, gpointer user_data)
{
    BookmarkHolder *holder;
    GFile *location;

    holder = (BookmarkHolder *)user_data;

    if (nautilus_bookmark_uri_known_not_to_exist (holder->bookmark)) {
        holder->failed_callback (holder->window, holder->bookmark);
    } else {
        location = nautilus_bookmark_get_location (holder->bookmark);
        nautilus_window_go_to (holder->window, location);
        g_object_unref (location);
    }
}
static void
on_selection_changed (GtkTreeSelection *treeselection,
		      gpointer user_data)
{
	NautilusBookmark *selected;
	const char *name = NULL;
	char *entry_text = NULL;
	GFile *location;

	g_assert (GTK_IS_ENTRY (name_field));
	g_assert (GTK_IS_ENTRY (uri_field));

	selected = get_selected_bookmark ();

	if (selected) {
		name = nautilus_bookmark_get_name (selected);
		location = nautilus_bookmark_get_location (selected);
		entry_text = g_file_get_parse_name (location);

		g_object_unref (location);
	}
	
	/* Set the sensitivity of widgets that require a selection */
	gtk_widget_set_sensitive (remove_button, selected != NULL);
        gtk_widget_set_sensitive (jump_button, selected != NULL);
	gtk_widget_set_sensitive (name_field, selected != NULL);
	gtk_widget_set_sensitive (uri_field, selected != NULL);

	g_signal_handler_block (name_field, name_field_changed_signal_id);
	nautilus_entry_set_text (NAUTILUS_ENTRY (name_field),
				 name ? name : "");
	g_signal_handler_unblock (name_field, name_field_changed_signal_id);

	g_signal_handler_block (uri_field, uri_field_changed_signal_id);
	nautilus_entry_set_text (NAUTILUS_ENTRY (uri_field),
				 entry_text ? entry_text : "");
	g_signal_handler_unblock (uri_field, uri_field_changed_signal_id);

	text_changed = FALSE;
	name_text_changed = FALSE;

	g_free (entry_text);
}
Ejemplo n.º 4
0
static void
open_selected_bookmark (gpointer user_data, GdkScreen *screen)
{
	NautilusBookmark *selected;
	NautilusWindow *window;
	GFile *location;
	
	selected = get_selected_bookmark ();

	if (!selected) {
		return;
	}

	location = nautilus_bookmark_get_location (selected);
	if (location == NULL) { 
		return;
	}

	if (NAUTILUS_IS_NAVIGATION_WINDOW (user_data)) {
		nautilus_window_go_to (NAUTILUS_WINDOW (user_data), location);
	} else if (NAUTILUS_IS_SPATIAL_WINDOW (user_data)) {
		window = nautilus_application_present_spatial_window (application, 
								      NULL,
								      NULL,
								      location,
								      screen);
	} else { /* window that opened bookmarks window has been closed */
		if (parent_is_browser_window || eel_preferences_get_boolean (NAUTILUS_PREFERENCES_ALWAYS_USE_BROWSER)) {
			window = nautilus_application_create_navigation_window (application, 
										NULL,
										screen);
			nautilus_window_go_to (window, location);
		} else {
			window = nautilus_application_present_spatial_window (application, 
									      NULL,
									      NULL,
									      location,
									      screen);
		}
	}

	g_object_unref (location);
}
static void
activate_bookmark_in_menu_item (GtkAction *action, gpointer user_data)
{
	NautilusWindowSlot *slot;
        BookmarkHolder *holder;
        GFile *location;

        holder = (BookmarkHolder *)user_data;

	if (nautilus_bookmark_uri_known_not_to_exist (holder->bookmark)) {
		holder->failed_callback (holder->window, holder->bookmark);
	} else {
	        location = nautilus_bookmark_get_location (holder->bookmark);
		slot = nautilus_window_get_active_slot (holder->window);
	        nautilus_window_slot_go_to (slot, 
					    location, 
					    should_open_in_new_tab ());
	        g_object_unref (location);
        }
}
static void
show_bogus_history_window (NautilusWindow *window,
			   NautilusBookmark *bookmark)
{
	GFile *file;
	char *uri_for_display;
	char *detail;

	file = nautilus_bookmark_get_location (bookmark);
	uri_for_display = g_file_get_parse_name (file);
	
	detail = g_strdup_printf (_("The location \"%s\" does not exist."), uri_for_display);

	eel_show_warning_dialog (_("The history location doesn't exist."),
				 detail,
				 GTK_WINDOW (window));

	g_object_unref (file);
	g_free (uri_for_display);
	g_free (detail);
}
static void
open_selected_bookmark (gpointer user_data, GdkScreen *screen)
{
	NautilusBookmark *selected;
	NautilusWindow *window;
	GFile *location;
	
	selected = get_selected_bookmark ();

	if (!selected) {
		return;
	}

	location = nautilus_bookmark_get_location (selected);
	if (location == NULL) { 
		return;
	}

	window = user_data;
	nautilus_window_go_to (window, location);

	g_object_unref (location);
}
Ejemplo n.º 8
0
static void
on_selection_changed (GtkTreeSelection *treeselection,
		      gpointer user_data)
{
	NautilusBookmarksWindow *self = user_data;
	NautilusBookmark *selected;
	const char *name = NULL;
	char *entry_text = NULL;
	GFile *location;

	selected = get_selected_bookmark (self);

	if (selected) {
		name = nautilus_bookmark_get_name (selected);
		location = nautilus_bookmark_get_location (selected);
		entry_text = g_file_get_parse_name (location);

		g_object_unref (location);
	}

	update_widgets_sensitivity (self);

	g_signal_handler_block (self->priv->name_field, self->priv->name_changed_id);
	nautilus_entry_set_text (NAUTILUS_ENTRY (self->priv->name_field),
				 name ? name : "");
	g_signal_handler_unblock (self->priv->name_field, self->priv->name_changed_id);

	g_signal_handler_block (self->priv->uri_field, self->priv->uri_changed_id);
	nautilus_entry_set_text (NAUTILUS_ENTRY (self->priv->uri_field),
				 entry_text ? entry_text : "");
	g_signal_handler_unblock (self->priv->uri_field, self->priv->uri_changed_id);

	self->priv->text_changed = FALSE;
	self->priv->name_text_changed = FALSE;

	g_free (entry_text);
}
Ejemplo n.º 9
0
static void
on_row_activated (GtkTreeView       *view,
                  GtkTreePath       *path,
                  GtkTreeViewColumn *column,
                  gpointer           user_data)
{
	NautilusBookmarksWindow *self = user_data;
	NautilusBookmark *selected;
	GFile *location;

	selected = get_selected_bookmark (self);

	if (!selected) {
		return;
	}

	location = nautilus_bookmark_get_location (selected);
	if (location == NULL) {
		return;
	}

	nautilus_window_go_to (self->priv->parent_window, location);
	g_object_unref (location);
}