Esempio n. 1
0
static void
challange_account_dialog_response_cb (GtkDialog *dialog,
				      int        response_id,
				      gpointer   user_data)
{
	DialogData *data = user_data;

	switch (response_id) {
	case GTK_RESPONSE_HELP:
		show_help_dialog (GTK_WINDOW (dialog), "picasaweb-account-challange");
		break;

	case GTK_RESPONSE_DELETE_EVENT:
	case GTK_RESPONSE_CANCEL:
		gtk_widget_destroy (GTK_WIDGET (dialog));
		gtk_dialog_response (GTK_DIALOG (data->dialog), GTK_RESPONSE_DELETE_EVENT);
		break;

	case GTK_RESPONSE_OK:
		g_free (data->email);
		g_free (data->password);
		data->email = g_strdup (picasa_account_properties_dialog_get_email (PICASA_ACCOUNT_PROPERTIES_DIALOG (dialog)));
		data->password = g_strdup (picasa_account_properties_dialog_get_password (PICASA_ACCOUNT_PROPERTIES_DIALOG (dialog)));
		data->challange = g_strdup (picasa_account_properties_dialog_get_challange (PICASA_ACCOUNT_PROPERTIES_DIALOG (dialog)));
		gtk_widget_destroy (GTK_WIDGET (dialog));
		connect_to_server (data);
		break;

	default:
		break;
	}
}
static void
new_file_response_cb (GtkWidget  *w,
		      int         response,
		      DlgNewData *data)
{
	char *path;

	if ((response == GTK_RESPONSE_CANCEL) || (response == GTK_RESPONSE_DELETE_EVENT)) {
		fr_archive_action_completed (data->window->archive,
					     FR_ACTION_CREATING_NEW_ARCHIVE,
					     FR_PROC_ERROR_STOPPED,
					     NULL);
		gtk_widget_destroy (data->dialog);
		return;
	}

	if (response == GTK_RESPONSE_HELP) {
		show_help_dialog (GTK_WINDOW (data->dialog), "archive-create");
		return;
	}

	path = get_archive_filename_from_selector (data);
	if (path != NULL) {
		new_archive (data, path);
		g_free (path);
	}
}
Esempio n. 3
0
static int
help_cb (GtkWidget   *w,
	 DialogData  *data)
{
	show_help_dialog (GTK_WINDOW (data->dialog), "exred-view-archive-properties");
	return TRUE;
}
void
activate_action_manual (GtkAction *action,
			gpointer   data)
{
	FrWindow *window = data;

	show_help_dialog (GTK_WINDOW (window) , NULL);
}
void
gth_application_activate_show_help (GSimpleAction *action,
				    GVariant      *parameter,
				    gpointer       user_data)
{
        GApplication *application = user_data;
        GtkWidget    *browser;

        browser = _gth_application_get_current_window (application);
        show_help_dialog (GTK_WINDOW (browser), NULL);
}
Esempio n. 6
0
static void
export_dialog_response_cb (GtkDialog *dialog,
			   int        response_id,
			   gpointer   user_data)
{
	DialogData *data = user_data;

	switch (response_id) {
	case GTK_RESPONSE_HELP:
		show_help_dialog (GTK_WINDOW (data->browser), "export-to-picasaweb");
		break;

	case GTK_RESPONSE_DELETE_EVENT:
	case GTK_RESPONSE_CANCEL:
		picasa_web_accounts_save_to_file (data->accounts, data->email);
		gth_file_list_cancel (GTH_FILE_LIST (data->list_view), (DataFunc) destroy_dialog, data);
		break;

	case GTK_RESPONSE_OK:
		{
			GtkTreeModel *tree_model;
			GtkTreeIter   iter;
			GList        *file_list;

			if (! gtk_tree_selection_get_selected (gtk_tree_view_get_selection (GTK_TREE_VIEW (GET_WIDGET ("albums_treeview"))), &tree_model, &iter)) {
				gtk_widget_set_sensitive (GET_WIDGET ("upload_button"), FALSE);
				return;
			}

			_g_clear_object (&data->album);
			gtk_tree_model_get (tree_model, &iter,
					    ALBUM_DATA_COLUMN, &data->album,
					    -1);

			gtk_widget_hide (data->dialog);
			gth_task_dialog (GTH_TASK (data->conn), FALSE);

			file_list = gth_file_data_list_to_file_list (data->file_list);
			picasa_web_service_post_photos (data->picasaweb,
							data->album,
							file_list,
							data->cancellable,
							post_photos_ready_cb,
							data);

			_g_object_list_unref (file_list);
		}
		break;

	default:
		break;
	}
}
Esempio n. 7
0
static int
file_sel_response_cb (GtkWidget    *widget,
		      int           response,
		      DialogData   *data)
{
	if ((response == GTK_RESPONSE_CANCEL) || (response == GTK_RESPONSE_DELETE_EVENT)) {
		gtk_widget_destroy (data->dialog);
		return TRUE;
	}

	if (response == GTK_RESPONSE_HELP) {
		show_help_dialog (GTK_WINDOW (data->dialog), "exred-extract-options");
		return TRUE;
	}

	if (response == GTK_RESPONSE_OK)
		return extract_cb (widget, data);

	return FALSE;
}
static void
save_file_response_cb (GtkWidget  *w,
		       gint        response,
		       DlgNewData *data)
{
	char       *path;
	const char *password;
	gboolean    encrypt_header;
	int         volume_size;
	GSettings  *settings;

	if ((response == GTK_RESPONSE_CANCEL) || (response == GTK_RESPONSE_DELETE_EVENT)) {
		gtk_widget_destroy (data->dialog);
		return;
	}

	if (response == GTK_RESPONSE_HELP) {
		show_help_dialog (GTK_WINDOW (data->dialog), "archive-convert");
		return;
	}

	path = get_archive_filename_from_selector (data);
	if (path == NULL)
		return;

	password = dlg_new_data_get_password (data);
	encrypt_header = dlg_new_data_get_encrypt_header (data);
	volume_size = dlg_new_data_get_volume_size (data);

	settings = g_settings_new (FILE_ROLLER_SCHEMA_BATCH_ADD);
	g_settings_set_int (settings, PREF_BATCH_ADD_VOLUME_SIZE, volume_size);
	g_object_unref (settings);

	fr_window_archive_save_as (data->window, path, password, encrypt_header, volume_size);
	gtk_widget_destroy (data->dialog);

	g_free (path);
}
Esempio n. 9
0
static void
edit_metadata_dialog__response_cb (GtkDialog *dialog,
				   int        response,
				   gpointer   user_data)
{
	DialogData *data = user_data;
	GthMonitor *monitor;
	GHashTable *parents;
	GList      *scan;
	GthTask    *task;

	if (response == GTK_RESPONSE_HELP) {
		show_help_dialog (GTK_WINDOW (dialog), data->dialog_name);
		return;
	}

	if ((response != GTK_RESPONSE_OK) && (response != GTK_RESPONSE_APPLY)) {
		cancel_file_list_loading (data);
		close_dialog (data);
		return;
	}

	if (data->file_list == NULL)
		return;

	data->close_dialog = (response == GTK_RESPONSE_OK);

	/* get the parents list */

	parents = g_hash_table_new_full (g_file_hash, (GEqualFunc) g_file_equal, g_object_unref, NULL);
	for (scan = data->file_list; scan; scan = scan->next) {
		GthFileData *file_data = scan->data;
		GFile       *parent;

		parent = g_file_get_parent (file_data->file);
		if (G_LIKELY (parent != NULL)) {
			if (g_hash_table_lookup (parents, parent) == NULL)
				g_hash_table_insert (parents, g_object_ref (parent), GINT_TO_POINTER (1));
			g_object_unref (parent);
		}
	}
	_g_object_list_unref (data->parents);
	data->parents = g_hash_table_get_keys (parents);
	g_list_foreach (data->parents, (GFunc) g_object_ref, NULL);
	g_hash_table_unref (parents);

	/* ignore changes to all the parents */

	monitor = gth_main_get_default_monitor ();
	for (scan = data->parents; scan; scan = scan->next)
		gth_monitor_pause (monitor, (GFile *) scan->data);

	gth_edit_metadata_dialog_update_info (GTH_EDIT_METADATA_DIALOG (data->dialog), data->file_list);

	dialog_data_ref (data);
	task = gth_save_file_data_task_new (data->file_list, "*");
	g_signal_connect (task,
			  "completed",
			  G_CALLBACK (saver_completed_cb),
			  data);
	gth_browser_exec_task (data->browser, task, FALSE);

	g_object_unref (task);

}
Esempio n. 10
0
static int
file_sel_response_cb (GtkWidget    *widget,
		      int           response,
		      DialogData   *data)
{
	GtkFileChooser *file_sel = GTK_FILE_CHOOSER (widget);
	FrWindow       *window = data->window;
	char           *selected_folder;
	gboolean        update, UNUSED_VARIABLE recursive, follow_links;
	const char     *include_files;
	const char     *exclude_files;
	const char     *exclude_folders;
	char           *dest_dir;
	char           *local_filename;


	dlg_add_folder_save_last_options (data);

	if ((response == GTK_RESPONSE_CANCEL) || (response == GTK_RESPONSE_DELETE_EVENT)) {
		gtk_widget_destroy (data->dialog);
		return TRUE;
	}

	if (response == GTK_RESPONSE_HELP) {
		show_help_dialog (GTK_WINDOW (data->dialog), "engrampa-add-options");
		return TRUE;
	}

	selected_folder = gtk_file_chooser_get_uri (file_sel);

	/* check folder permissions. */

	if (! check_permissions (selected_folder, R_OK)) {
		GtkWidget *d;
		char      *utf8_path;

		utf8_path = g_filename_display_name (selected_folder);

		d = _gtk_error_dialog_new (GTK_WINDOW (window),
					   GTK_DIALOG_MODAL,
					   NULL,
					   _("Could not add the files to the archive"),
					   _("You don't have the right permissions to read files from folder \"%s\""),
					   utf8_path);
		gtk_dialog_run (GTK_DIALOG (d));
		gtk_widget_destroy (GTK_WIDGET (d));

		g_free (utf8_path);
		g_free (selected_folder);

		return FALSE;
	}

	update = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (data->add_if_newer_checkbutton));
	recursive = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (data->include_subfold_checkbutton));
	follow_links = ! gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (data->exclude_symlinks));

	include_files = gtk_entry_get_text (GTK_ENTRY (data->include_files_entry));
	if (utf8_only_spaces (include_files))
		include_files = "*";

	exclude_files = gtk_entry_get_text (GTK_ENTRY (data->exclude_files_entry));
	if (utf8_only_spaces (exclude_files))
		exclude_files = NULL;

	exclude_folders = gtk_entry_get_text (GTK_ENTRY (data->exclude_folders_entry));
	if (utf8_only_spaces (exclude_folders))
		exclude_folders = NULL;

	local_filename = g_filename_from_uri (selected_folder, NULL, NULL);
	dest_dir = build_uri (fr_window_get_current_location (window),
			      file_name_from_path (local_filename),
			      NULL);

	fr_window_archive_add_with_wildcard (window,
					     include_files,
					     exclude_files,
					     exclude_folders,
					     selected_folder,
					     dest_dir,
					     update,
					     follow_links);

	g_free (local_filename);
	g_free (dest_dir);
	g_free (selected_folder);

	gtk_widget_destroy (data->dialog);

	return TRUE;
}
Esempio n. 11
0
static void
help_clicked_cb (GtkWidget  *widget,
		 DialogData *data)
{
	show_help_dialog (GTK_WINDOW (data->dialog), "webalbums");
}
Esempio n. 12
0
static void
import_dialog_response_cb (GtkDialog *dialog,
			   int        response_id,
			   gpointer   user_data)
{
	DialogData *data = user_data;

	switch (response_id) {
	case GTK_RESPONSE_HELP:
		show_help_dialog (GTK_WINDOW (data->browser), "export-to-picasaweb");
		break;

	case GTK_RESPONSE_DELETE_EVENT:
	case GTK_RESPONSE_CANCEL:
		gth_file_list_cancel (GTH_FILE_LIST (data->file_list), (DataFunc) gtk_widget_destroy, data->dialog);
		break;

	case GTK_RESPONSE_OK:
		{
			GtkTreeIter     iter;
			FlickrPhotoset *photoset;
			GList          *file_list;

			if (! gtk_combo_box_get_active_iter (GTK_COMBO_BOX (GET_WIDGET ("photoset_combobox")), &iter)) {
				gtk_widget_set_sensitive (GET_WIDGET ("download_button"), FALSE);
				return;
			}

			gtk_tree_model_get (GTK_TREE_MODEL (GET_WIDGET ("photoset_liststore")), &iter,
					    PHOTOSET_DATA_COLUMN, &photoset,
					    -1);

			file_list = get_files_to_download (data);
			if (file_list != NULL) {
				GSettings           *settings;
				GFile               *destination;
				gboolean             single_subfolder;
				GthSubfolderType     subfolder_type;
				GthSubfolderFormat   subfolder_format;
				char                *custom_format;
				GthTask             *task;

				settings = g_settings_new (GTHUMB_IMPORTER_SCHEMA);
				destination = gth_import_preferences_get_destination ();
				subfolder_type = g_settings_get_enum (settings, PREF_IMPORTER_SUBFOLDER_TYPE);
				subfolder_format = g_settings_get_enum (settings, PREF_IMPORTER_SUBFOLDER_FORMAT);
				single_subfolder = g_settings_get_boolean (settings, PREF_IMPORTER_SUBFOLDER_SINGLE);
				custom_format = g_settings_get_string (settings, PREF_IMPORTER_SUBFOLDER_CUSTOM_FORMAT);

				task = gth_import_task_new (data->browser,
							    file_list,
							    destination,
							    subfolder_type,
							    subfolder_format,
							    single_subfolder,
							    custom_format,
							    (photoset->title != NULL ? photoset->title : ""),
							    NULL,
							    FALSE,
							    FALSE,
							    FALSE);
				gth_browser_exec_task (data->browser, task, FALSE);
				gtk_widget_destroy (data->dialog);

				g_object_unref (task);
				_g_object_unref (destination);
				g_object_unref (settings);
			}

			_g_object_list_unref (file_list);
			g_object_unref (photoset);
		}
		break;

	default:
		break;
	}
}
Esempio n. 13
0
static void
help_clicked_cb (GtkWidget  *widget,
		 DialogData *data)
{
	show_help_dialog (GTK_WINDOW (data->dialog), "gthumb-batch-resize");
}
static int
file_sel_response_cb (GtkWidget      *widget,
		      int             response,
		      DialogData     *data)
{
	GtkFileChooser *file_sel = GTK_FILE_CHOOSER (widget);
	FrWindow       *window = data->window;
	char           *current_folder;
	char           *uri;
	gboolean        update;
	GSList         *selections, *iter;
	GList          *item_list = NULL;

	current_folder = gtk_file_chooser_get_current_folder_uri (file_sel);
	uri = gtk_file_chooser_get_uri (file_sel);

	if (current_folder != NULL) {
		g_settings_set_string (data->settings, PREF_ADD_CURRENT_FOLDER, current_folder);
		fr_window_set_add_default_dir (window, current_folder);
	}
	if (uri != NULL) {
		g_settings_set_string (data->settings, PREF_ADD_FILENAME, uri);
		g_free (uri);
	}

	if ((response == GTK_RESPONSE_CANCEL) || (response == GTK_RESPONSE_DELETE_EVENT)) {
		gtk_widget_destroy (data->dialog);
		g_free (current_folder);
		return TRUE;
	}

	if (response == GTK_RESPONSE_HELP) {
		show_help_dialog (GTK_WINDOW (data->dialog), "archive-edit");
		g_free (current_folder);
		return TRUE;
	}

	/* check folder permissions. */

	if (uri_is_dir (current_folder) && ! check_permissions (current_folder, R_OK)) {
		GtkWidget *d;
		char      *utf8_path;

		utf8_path = g_filename_display_name (current_folder);

		d = _gtk_error_dialog_new (GTK_WINDOW (window),
					   GTK_DIALOG_MODAL,
					   NULL,
					   _("Could not add the files to the archive"),
					   _("You don't have the right permissions to read files from folder \"%s\""),
					   utf8_path);
		gtk_dialog_run (GTK_DIALOG (d));
		gtk_widget_destroy (GTK_WIDGET (d));

		g_free (utf8_path);
		g_free (current_folder);
		return FALSE;
	}

	update = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (data->add_if_newer_checkbutton));

	/**/

	selections = gtk_file_chooser_get_uris (file_sel);
	for (iter = selections; iter != NULL; iter = iter->next) {
		char *uri = iter->data;
		item_list = g_list_prepend (item_list, g_file_new_for_uri (uri));
	}

	if (item_list != NULL)
		fr_window_archive_add_files (window, item_list, update);

	gio_file_list_free (item_list);
	g_slist_foreach (selections, (GFunc) g_free, NULL);
	g_slist_free (selections);
	g_free (current_folder);

	gtk_widget_destroy (data->dialog);

	return TRUE;
}
Esempio n. 15
0
static void
help_clicked_cb (GtkWidget  *widget,
		 DialogData *data)
{
	show_help_dialog (GTK_WINDOW (data->dialog), "image-wall");
}
Esempio n. 16
0
static void
help_button_cb (GtkWidget  *widget,
		DialogData *data)
{
	show_help_dialog (GTK_WINDOW (data->dialog), "pix-batch-change-date");
}
Esempio n. 17
0
static void
help_button_clicked_cb (GtkWidget  *widget,
			DialogData *data)
{
	show_help_dialog (GTK_WINDOW (data->dialog), "catalog-properties");
}
Esempio n. 18
0
static void
help_clicked_cb (GtkWidget  *widget,
		 DialogData *data)
{
	show_help_dialog (GTK_WINDOW (data->dialog), "engrampa-fmgr-add");
}