Esempio n. 1
0
static void
search_bar_activate_callback (NemoSearchBar *bar,
			      NemoWindowPane *pane)
{
	char *uri, *current_uri;
	NemoDirectory *directory;
	NemoSearchDirectory *search_directory;
	NemoQuery *query;
	GFile *location;

	uri = nemo_search_directory_generate_new_uri ();
	location = g_file_new_for_uri (uri);

	directory = nemo_directory_get (location);
	g_assert (NEMO_IS_SEARCH_DIRECTORY (directory));
	search_directory = NEMO_SEARCH_DIRECTORY (directory);
	query = nemo_search_bar_get_query (NEMO_SEARCH_BAR (pane->search_bar));

	if (query != NULL) {
		current_uri = nemo_window_slot_get_location_uri (pane->active_slot);

		nemo_query_set_location (query, current_uri);
		nemo_search_directory_set_query (search_directory, query);

		g_free (current_uri);
		g_object_unref (query);
	}

	nemo_window_slot_go_to (pane->active_slot, location, FALSE);

	nemo_directory_unref (directory);
	g_object_unref (location);	
	g_free (uri);
}
Esempio n. 2
0
static void
navigation_bar_location_changed_callback (GtkWidget *widget,
					  const char *uri,
					  NemoWindowPane *pane)
{
	GFile *location;

	nemo_window_pane_hide_search_bar (pane);
	nemo_window_pane_hide_temporary_bars (pane);

	restore_focus_widget (pane);

	location = g_file_new_for_uri (uri);
	nemo_window_slot_go_to (pane->active_slot, location, FALSE);
	g_object_unref (location);
}
Esempio n. 3
0
static void
action_go_to_trash_callback (GtkAction *action, 
			     gpointer user_data) 
{
	NemoWindow *window;
	NemoWindowSlot *slot;
	GFile *trash;

	window = NEMO_WINDOW (user_data);
	slot = nemo_window_get_active_slot (window);

	trash = g_file_new_for_uri ("trash:///");
	nemo_window_slot_go_to (slot,
				    trash,
				    nemo_event_should_open_in_new_tab ());
	g_object_unref (trash);
}
Esempio n. 4
0
static void
action_go_to_network_callback (GtkAction *action, 
				gpointer user_data) 
{
	NemoWindow *window;
	NemoWindowSlot *slot;
	GFile *network;

	window = NEMO_WINDOW (user_data);
	slot = nemo_window_get_active_slot (window);

	network = g_file_new_for_uri (NETWORK_URI);
	nemo_window_slot_go_to (slot,
				    network,
				    nemo_event_should_open_in_new_tab ());
	g_object_unref (network);
}
Esempio n. 5
0
static void
action_go_to_computer_callback (GtkAction *action, 
				gpointer user_data) 
{
	NemoWindow *window;
	NemoWindowSlot *slot;
	GFile *computer;

	window = NEMO_WINDOW (user_data);
	slot = nemo_window_get_active_slot (window);

	computer = g_file_new_for_uri (COMPUTER_URI);
	nemo_window_slot_go_to (slot,
				    computer,
				    nemo_event_should_open_in_new_tab ());
	g_object_unref (computer);
}
Esempio n. 6
0
static void
path_bar_location_changed_callback (GtkWidget *widget,
				    GFile *location,
				    NemoWindowPane *pane)
{
	NemoWindowSlot *slot;
	int i;

	slot = pane->active_slot;
	nemo_window_set_active_pane (pane->window, pane);

	/* check whether we already visited the target location */
	i = bookmark_list_get_uri_index (slot->back_list, location);
	if (i >= 0) {
		nemo_window_back_or_forward (pane->window, TRUE, i, FALSE);
	} else {
		nemo_window_slot_go_to (pane->active_slot, location, FALSE);
	}
}
Esempio n. 7
0
static void
activate_bookmark_by_quicklist (DbusmenuMenuitem *menu,
								guint timestamp,
								NemoBookmark *bookmark)
{
	g_assert (NEMO_IS_BOOKMARK (bookmark));

	GFile *location;
	NemoApplication *application;
	NemoWindow *new_window;

	location = nemo_bookmark_get_location (bookmark);

	application = nemo_application_get_singleton ();
	new_window = nemo_application_create_window (application, gdk_screen_get_default ());
	nemo_window_slot_go_to (nemo_window_get_active_slot (new_window), location, FALSE);

	g_object_unref (location);
}
Esempio n. 8
0
static void
action_split_view_same_location_callback (GtkAction *action,
					  gpointer user_data)
{
	NemoWindow *window;
	NemoWindowPane *next_pane;
	GFile *location;

	window = NEMO_WINDOW (user_data);
	next_pane = nemo_window_get_next_pane (window);

	if (!next_pane) {
		return;
	}
	location = nemo_window_slot_get_location (next_pane->active_slot);
	if (location) {
		nemo_window_slot_go_to (nemo_window_get_active_slot (window), location, FALSE);
		g_object_unref (location);
	}
}
Esempio n. 9
0
static void
action_go_to_templates_callback (GtkAction *action,
				 gpointer user_data) 
{
	NemoWindow *window;
	NemoWindowSlot *slot;
	char *path;
	GFile *location;

	window = NEMO_WINDOW (user_data);
	slot = nemo_window_get_active_slot (window);

	path = nemo_get_templates_directory ();
	location = g_file_new_for_path (path);
	g_free (path);
	nemo_window_slot_go_to (slot,
				    location,
				    nemo_event_should_open_in_new_tab ());
	g_object_unref (location);
}
static void
activate_bookmark_in_menu_item (GtkAction *action, gpointer user_data)
{
	NemoWindowSlot *slot;
        BookmarkHolder *holder;
        GFile *location;

        holder = (BookmarkHolder *)user_data;

	if (!nemo_bookmark_get_exists (holder->bookmark)) {
		holder->failed_callback (holder->window, holder->bookmark);
	} else {
	        location = nemo_bookmark_get_location (holder->bookmark);
		slot = nemo_window_get_active_slot (holder->window);
	        nemo_window_slot_go_to (slot, 
					    location, 
					    nemo_event_should_open_in_new_tab ());
	        g_object_unref (location);
        }
}
Esempio n. 11
0
/* Called whenever a mount is unmounted. Check and see if there are
 * any windows open displaying contents on the mount. If there are,
 * close them.  It would also be cool to save open window and position
 * info.
 */
static void
mount_removed_callback (GVolumeMonitor *monitor,
			GMount *mount,
			NemoApplication *application)
{
	GList *window_list, *node, *close_list;
	NemoWindow *window;
	NemoWindowSlot *slot;
	NemoWindowSlot *force_no_close_slot;
	GFile *root, *computer;
	gchar *uri;
	gint n_slots;

	close_list = NULL;
	force_no_close_slot = NULL;
	n_slots = 0;

	/* Check and see if any of the open windows are displaying contents from the unmounted mount */
	window_list = gtk_application_get_windows (GTK_APPLICATION (application));

	root = g_mount_get_root (mount);
	uri = g_file_get_uri (root);

	DEBUG ("Removed mount at uri %s", uri);
	g_free (uri);

	/* Construct a list of windows to be closed. Do not add the non-closable windows to the list. */
	for (node = window_list; node != NULL; node = node->next) {
		window = NEMO_WINDOW (node->data);
		if (window != NULL && window_can_be_closed (window)) {
			GList *l;
			GList *lp;

			for (lp = window->details->panes; lp != NULL; lp = lp->next) {
				NemoWindowPane *pane;
				pane = (NemoWindowPane*) lp->data;
				for (l = pane->slots; l != NULL; l = l->next) {
					slot = l->data;
					n_slots++;
					if (nemo_window_slot_should_close_with_mount (slot, mount)) {
						close_list = g_list_prepend (close_list, slot);
					}
				} /* for all slots */
			} /* for all panes */
		}
	}

	if ((nemo_application_desktop_windows == NULL) &&
	    (close_list != NULL) &&
	    (g_list_length (close_list) == n_slots)) {
		/* We are trying to close all open slots. Keep one navigation slot open. */
		force_no_close_slot = close_list->data;
	}

	/* Handle the windows in the close list. */
	for (node = close_list; node != NULL; node = node->next) {
		slot = node->data;

		if (slot != force_no_close_slot) {
            if (g_settings_get_boolean (nemo_preferences, NEMO_PREFERENCES_CLOSE_DEVICE_VIEW_ON_EJECT))
                nemo_window_pane_slot_close (slot->pane, slot);
            else
                nemo_window_slot_go_home (slot, FALSE);
		} else {
			computer = g_file_new_for_path (g_get_home_dir ());
			nemo_window_slot_go_to (slot, computer, FALSE);
			g_object_unref(computer);
		}
	}

	g_list_free (close_list);
}