Пример #1
0
void
gth_browser_activate_go_to_container_from_catalog (GSimpleAction	 *action,
						   GVariant		 *parameter,
						   gpointer		  user_data)
{
	GthBrowser *browser = GTH_BROWSER (user_data);
	GList *items;
	GList *file_list = NULL;

	items = gth_file_selection_get_selected (GTH_FILE_SELECTION (gth_browser_get_file_list_view (browser)));
	file_list = gth_file_list_get_files (GTH_FILE_LIST (gth_browser_get_file_list (browser)), items);

	if (file_list != NULL) {
		GthFileData *first_file = file_list->data;
		GFile       *parent;

		parent = g_file_get_parent (first_file->file);
		gth_browser_go_to (browser, parent, first_file->file);

		g_object_unref (parent);
	}

	_g_object_list_unref (file_list);
	_gtk_tree_path_list_free (items);
}
Пример #2
0
static void
catalog_save_done_cb (void     **buffer,
		      gsize      count,
		      GError    *error,
		      gpointer   user_data)
{
	AddData *add_data = user_data;

	if (error != NULL) {
		_gtk_error_dialog_from_gerror_show (GTK_WINDOW (add_data->parent_window), _("Could not add the files to the catalog"), &error);
		return;
	}

	gth_monitor_folder_changed (gth_main_get_default_monitor (),
				    add_data->catalog_file,
				    add_data->files,
				    GTH_MONITOR_EVENT_CREATED);

	if (add_data->view_destination)
		gth_browser_go_to (add_data->browser, add_data->catalog_file, NULL);

	if (add_data->dialog != NULL)
		gtk_widget_destroy (add_data->dialog);

	add_data_free (add_data);
}
void
gth_browser_activate_go_to_location (GSimpleAction *action,
				     GVariant      *parameter,
				     gpointer       user_data)
{
	GFile *file;

	file = g_file_new_for_uri (g_variant_get_string (parameter, NULL));
	gth_browser_go_to (GTH_BROWSER (user_data), file, NULL);

	g_object_unref (file);
}
Пример #4
0
void
gth_browser_activate_action_go_to_container (GtkAction  *action,
					     GthBrowser *browser)
{
	GList *items;
	GList *file_list = NULL;

	items = gth_file_selection_get_selected (GTH_FILE_SELECTION (gth_browser_get_file_list_view (browser)));
	file_list = gth_file_list_get_files (GTH_FILE_LIST (gth_browser_get_file_list (browser)), items);

	if (file_list != NULL) {
		GthFileData *first_file = file_list->data;
		GFile       *parent;

		parent = g_file_get_parent (first_file->file);
		gth_browser_go_to (browser, parent, first_file->file);

		g_object_unref (parent);
	}

	_g_object_list_unref (file_list);
	_gtk_tree_path_list_free (items);
}
Пример #5
0
static void
open_browser_window (GFile    *location,
		     GFile    *file_to_select,
		     gboolean  force_new_window)
{
	gboolean   reuse_active_window;
	GtkWidget *window;

	if (! force_new_window) {
		GSettings *settings;

		settings = g_settings_new (GTHUMB_BROWSER_SCHEMA);
		reuse_active_window = g_settings_get_boolean (settings, PREF_BROWSER_REUSE_ACTIVE_WINDOW);
		g_object_unref (settings);
	}
	else
		reuse_active_window = FALSE;

	window = NULL;

	if (reuse_active_window) {
		GList *windows = gtk_application_get_windows (Main_Application);
		if (windows != NULL)
			window = windows->data;
	}

	if (window == NULL)
		window = gth_browser_new (location, file_to_select);
	else if (file_to_select != NULL)
		gth_browser_go_to (GTH_BROWSER (window), location, file_to_select);
	else
		gth_browser_load_location (GTH_BROWSER (window), location);

	if (! StartSlideshow)
		gtk_window_present (GTK_WINDOW (window));
}