当前位置: 首页>>代码示例>>C++>>正文


C++ GTH_TASK函数代码示例

本文整理汇总了C++中GTH_TASK函数的典型用法代码示例。如果您正苦于以下问题:C++ GTH_TASK函数的具体用法?C++ GTH_TASK怎么用?C++ GTH_TASK使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了GTH_TASK函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: process_current_file

static void
process_current_file (GthPixbufListTask *self)
{
	GthFileData *file_data;
	GList       *singleton;

	if (self->priv->current == NULL) {
		gth_task_completed (GTH_TASK (self), NULL);
		return;
	}

	_g_object_unref (self->priv->original_pixbuf);
	self->priv->original_pixbuf = NULL;
	_g_object_unref (self->priv->new_pixbuf);
	self->priv->new_pixbuf = NULL;

	gth_task_progress (GTH_TASK (self),
			   NULL,
			   NULL,
			   FALSE,
			   ((double) self->priv->n_current + 1) / (self->priv->n_files + 1));

	file_data = self->priv->current->data;
	singleton = g_list_append (NULL, g_object_ref (file_data->file));
	_g_query_all_metadata_async (singleton,
				     FALSE,
				     TRUE,
				     "*",
				     gth_task_get_cancellable (GTH_TASK (self)),
				     file_info_ready_cb,
				     self);

	_g_object_list_unref (singleton);
}
开发者ID:Peliadia,项目名称:gthumb,代码行数:34,代码来源:gth-pixbuf-list-task.c

示例2: ask_authorization_dialog_loaded_cb

static void
ask_authorization_dialog_loaded_cb (OAuthAskAuthorizationDialog *dialog,
				    gpointer                     user_data)
{
	PicasaWebService *self = user_data;
	const char       *title;

	title = oauth_ask_authorization_dialog_get_title (dialog);
	if (title == NULL)
		return;

	if (g_str_has_prefix (title, PICASA_WEB_REDIRECT_TITLE)) {
		const char *authorization_code;

		gtk_widget_hide (GTK_WIDGET (dialog));
		gth_task_dialog (GTH_TASK (self), FALSE, NULL);

		authorization_code = title + strlen (PICASA_WEB_REDIRECT_TITLE);
		_picasa_web_service_get_refresh_token (self,
						       authorization_code,
						       gth_task_get_cancellable (GTH_TASK (self)),
						       refresh_token_ready_cb,
						       self);
	}
}
开发者ID:KapTmaN,项目名称:gthumb,代码行数:25,代码来源:picasa-web-service.c

示例3: auto_select_account

static void
auto_select_account (DialogData *data)
{
	gtk_widget_hide (data->dialog);
	if (data->conn != NULL)
		gth_task_dialog (GTH_TASK (data->conn), FALSE);

	if (data->accounts != NULL) {
		if (data->email != NULL) {
			connect_to_server (data);
		}
		else if (data->accounts->next == NULL) {
			data->email = g_strdup ((char *)data->accounts->data);
			connect_to_server (data);
		}
		else {
			GtkWidget *dialog;

			gth_task_dialog (GTH_TASK (data->conn), TRUE);
			dialog = picasa_account_chooser_dialog_new (data->accounts, data->email);
			g_signal_connect (dialog,
					  "response",
					  G_CALLBACK (account_chooser_dialog_response_cb),
					  data);

			gtk_window_set_title (GTK_WINDOW (dialog), _("Choose Account"));
			gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (data->browser));
			gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
			gtk_window_present (GTK_WINDOW (dialog));
		}
	}
	else
		account_properties_dialog (data, NULL);
}
开发者ID:Peliadia,项目名称:gthumb,代码行数:34,代码来源:dlg-export-to-picasaweb.c

示例4: file_buffer_ready_cb

static void
file_buffer_ready_cb (void     **buffer,
		      gsize      count,
		      GError    *error,
		      gpointer   user_data)
{
	GthPixbufListTask *self = user_data;
	GInputStream      *istream;
	GdkPixbuf         *pixbuf;

	if (error != NULL) {
		gth_task_completed (GTH_TASK (self), error);
		return;
	}

	istream = g_memory_input_stream_new_from_data (*buffer, count, NULL);
	pixbuf = gdk_pixbuf_new_from_stream (istream, gth_task_get_cancellable (GTH_TASK (self)), &error);
	if (pixbuf != NULL) {
		self->priv->original_pixbuf = gdk_pixbuf_apply_embedded_orientation (pixbuf);
		g_object_unref (pixbuf);
	}
	else
		self->priv->original_pixbuf = NULL;

	g_object_unref (istream);

	if (self->priv->original_pixbuf == NULL) {
		gth_task_completed (GTH_TASK (self), error);
		return;
	}

	gth_pixbuf_task_set_source (GTH_PIXBUF_TASK (self->priv->task), self->priv->original_pixbuf);
	gth_task_exec (self->priv->task, gth_task_get_cancellable (GTH_TASK (self)));
}
开发者ID:Peliadia,项目名称:gthumb,代码行数:34,代码来源:gth-pixbuf-list-task.c

示例5: organize_files_dialog_response_cb

static void
organize_files_dialog_response_cb (GtkDialog *dialog,
				   int        response_id,
				   gpointer   user_data)
{
	GthOrganizeTask *self = user_data;

	if (response_id == GTK_RESPONSE_DELETE_EVENT) {
		if (self->priv->organized)
			response_id = GTK_RESPONSE_CLOSE;
		else
			response_id = GTK_RESPONSE_CANCEL;
	}

	switch (response_id) {
	case GTK_RESPONSE_CANCEL:
		gth_task_cancel (GTH_TASK (self));
		break;

	case GTK_RESPONSE_CLOSE:
		gth_task_completed (GTH_TASK (self), NULL);
		break;

	case GTK_RESPONSE_OK:
		save_catalogs (self);
		break;
	}
}
开发者ID:Peliadia,项目名称:gthumb,代码行数:28,代码来源:gth-organize-task.c

示例6: list_albums_ready_cb

static void
list_albums_ready_cb (GObject      *source_object,
		      GAsyncResult *result,
		      gpointer      user_data)
{
	DialogData       *data = user_data;
	PicasaWebService *picasaweb = PICASA_WEB_SERVICE (source_object);
	GError           *error = NULL;

	_g_object_list_unref (data->albums);
	data->albums = picasa_web_service_list_albums_finish (picasaweb, result, &error);
	if (error != NULL) {
		gth_task_dialog (GTH_TASK (data->service), TRUE, NULL);
		_gtk_error_dialog_from_gerror_show (GTK_WINDOW (data->browser), _("Could not get the album list"), error);
		g_clear_error (&error);
		gtk_dialog_response (GTK_DIALOG (data->dialog), GTK_RESPONSE_DELETE_EVENT);
		return;
	}

	update_album_list (data);

	gth_task_dialog (GTH_TASK (data->service), TRUE, NULL);
	gtk_window_set_transient_for (GTK_WINDOW (data->dialog), GTK_WINDOW (data->browser));
	gtk_window_set_modal (GTK_WINDOW (data->dialog), FALSE);
	gtk_window_present (GTK_WINDOW (data->dialog));
}
开发者ID:KapTmaN,项目名称:gthumb,代码行数:26,代码来源:dlg-export-to-picasaweb.c

示例7: pixbuf_saved_cb

static void
pixbuf_saved_cb (GthFileData *file_data,
		 GError      *error,
		 gpointer     user_data)
{
	GthPixbufListTask *self = user_data;
	GFile             *parent;
	GList             *file_list;

	if (error != NULL) {
		if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_EXISTS)) {
			if (self->priv->overwrite_mode == GTH_OVERWRITE_SKIP) {
				process_next_file (self);
			}
			else  {
				GthFileData *file_data;
				GtkWidget   *dialog;

				gth_task_dialog (GTH_TASK (self), TRUE);

				file_data = self->priv->current->data;
				dialog = gth_overwrite_dialog_new (NULL,
								   self->priv->new_pixbuf,
								   file_data->file,
								   GTH_OVERWRITE_RESPONSE_YES,
								   (self->priv->n_files == 1));
				g_signal_connect (dialog,
						  "response",
						  G_CALLBACK (overwrite_dialog_response_cb),
						  self);
				gtk_widget_show (dialog);
			}
		}
		else
			gth_task_completed (GTH_TASK (self), error);
		return;
	}

	parent = g_file_get_parent (file_data->file);
	file_list = g_list_append (NULL, file_data->file);
	gth_monitor_folder_changed (gth_main_get_default_monitor (),
				    parent,
				    file_list,
				    GTH_MONITOR_EVENT_CHANGED);

	g_list_free (file_list);
	g_object_unref (parent);

	process_next_file (self);
}
开发者ID:Peliadia,项目名称:gthumb,代码行数:50,代码来源:gth-pixbuf-list-task.c

示例8: facebook_service_get_user_info

void
facebook_service_get_user_info (FacebookService     *self,
				const char          *fields,
				GCancellable        *cancellable,
				GAsyncReadyCallback  callback,
				gpointer             user_data)
{
	GHashTable  *data_set;
	SoupMessage *msg;

	gth_task_progress (GTH_TASK (self->priv->conn), _("Connecting to the server"), _("Getting account information"), TRUE, 0.0);

	data_set = g_hash_table_new (g_str_hash, g_str_equal);
	g_hash_table_insert (data_set, "method", "facebook.users.getInfo");
	g_hash_table_insert (data_set, "uids", (char *) facebook_connection_get_user_id (self->priv->conn));
	g_hash_table_insert (data_set, "fields", (char *) fields);
	facebook_connection_add_api_sig (self->priv->conn, data_set);
	msg = soup_form_request_new_from_hash ("POST", FACEBOOK_HTTPS_REST_SERVER, data_set);
	facebook_connection_send_message (self->priv->conn,
					  msg,
					  cancellable,
					  callback,
					  user_data,
					  facebook_service_get_user_info,
					  get_user_info_ready_cb,
					  self);

	g_hash_table_destroy (data_set);
}
开发者ID:Peliadia,项目名称:gthumb,代码行数:29,代码来源:facebook-service.c

示例9: ask_authorization_dialog_response_cb

static void
ask_authorization_dialog_response_cb (GtkDialog *dialog,
				      int        response_id,
				      gpointer   user_data)
{
	WebService *self = user_data;

	switch (response_id) {
	case GTK_RESPONSE_DELETE_EVENT:
	case GTK_RESPONSE_CANCEL:
		gtk_widget_destroy (GTK_WIDGET (dialog));
		gtk_dialog_response (GTK_DIALOG (self->priv->dialog), GTK_RESPONSE_DELETE_EVENT);
		break;

	case GTK_RESPONSE_OK:
		gtk_widget_destroy (GTK_WIDGET (dialog));
		gth_task_dialog (GTH_TASK (self), FALSE, NULL);
		web_service_get_user_info (self,
					   self->priv->cancellable,
					   get_user_info_ready_cb,
					   self);
		break;

	default:
		break;
	}
}
开发者ID:KapTmaN,项目名称:gthumb,代码行数:27,代码来源:web-service.c

示例10: show_authentication_error_dialog

static void
show_authentication_error_dialog (WebService  *self,
				  GError     **error)
{
	GtkWidget *dialog;

	if (g_error_matches (*error, WEB_SERVICE_ERROR, WEB_SERVICE_ERROR_TOKEN_EXPIRED)) {
		web_service_ask_authorization (self);
		return;
	}

	dialog = _gtk_message_dialog_new (GTK_WINDOW (self->priv->browser),
					  GTK_DIALOG_MODAL,
					  GTK_STOCK_DIALOG_ERROR,
					  _("Could not connect to the server"),
					  (*error)->message,
					  _("Choose _Account..."), WEB_AUTHENTICATION_RESPONSE_CHOOSE_ACCOUNT,
					  GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
					  NULL);
	gth_task_dialog (GTH_TASK (self), TRUE, dialog);

	g_signal_connect (dialog,
			  "delete-event",
			  G_CALLBACK (gtk_true),
			  NULL);
	g_signal_connect (dialog,
			  "response",
			  G_CALLBACK (authentication_error_dialog_response_cb),
			  self);
	gtk_widget_show (dialog);

	g_clear_error (error);
}
开发者ID:KapTmaN,项目名称:gthumb,代码行数:33,代码来源:web-service.c

示例11: pixbuf_task_progress_cb

static void
pixbuf_task_progress_cb (GthTask    *task,
		         const char *description,
		         const char *details,
		         gboolean    pulse,
		         double      fraction,
		         gpointer    user_data)
{
	GthPixbufListTask *self = user_data;
	double             total_fraction;
	double             file_fraction;

	total_fraction =  ((double) self->priv->n_current + 1) / (self->priv->n_files + 1);
	if (pulse)
		file_fraction = 0.5;
	else
		file_fraction = fraction;

	if (details == NULL) {
		GthFileData *file_data;

		file_data = self->priv->current->data;
		details = g_file_info_get_display_name (file_data->info);
	}

	gth_task_progress (GTH_TASK (self),
			   description,
			   details,
			   FALSE,
			   total_fraction + (file_fraction / (self->priv->n_files + 1)));
}
开发者ID:Peliadia,项目名称:gthumb,代码行数:31,代码来源:gth-pixbuf-list-task.c

示例12: pixbuf_task_dialog_cb

static void
pixbuf_task_dialog_cb (GthTask  *task,
		       gboolean  opened,
		       gpointer  user_data)
{
	gth_task_dialog (GTH_TASK (user_data), opened);
}
开发者ID:Peliadia,项目名称:gthumb,代码行数:7,代码来源:gth-pixbuf-list-task.c

示例13: connect_to_server

static void
connect_to_server (DialogData *data)
{
	if (data->conn == NULL) {
		data->conn = google_connection_new (GOOGLE_SERVICE_PICASA_WEB_ALBUM);
		data->progress_dialog = gth_progress_dialog_new (GTK_WINDOW (data->browser));
		gth_progress_dialog_add_task (GTH_PROGRESS_DIALOG (data->progress_dialog), GTH_TASK (data->conn));
	}

#ifdef HAVE_GNOME_KEYRING
	if ((data->password == NULL) && gnome_keyring_is_available ()) {
		gnome_keyring_find_password (GNOME_KEYRING_NETWORK_PASSWORD,
					     find_password_cb,
					     data,
					     NULL,
					     "user", data->email,
					     "server", "picasaweb.google.com",
					     "protocol", "http",
					     NULL);
		return;
	}
#endif

	connect_to_server_step2 (data);
}
开发者ID:Peliadia,项目名称:gthumb,代码行数:25,代码来源:dlg-export-to-picasaweb.c

示例14: facebook_service_get_albums

void
facebook_service_get_albums (FacebookService     *self,
			     const char          *user_id,
			     GCancellable        *cancellable,
			     GAsyncReadyCallback  callback,
			     gpointer             user_data)
{
	GHashTable  *data_set;
	SoupMessage *msg;

	g_return_if_fail (user_id != NULL);

	gth_task_progress (GTH_TASK (self->priv->conn), _("Getting the album list"), NULL, TRUE, 0.0);

	data_set = g_hash_table_new (g_str_hash, g_str_equal);
	g_hash_table_insert (data_set, "method", "facebook.photos.getAlbums");
	g_hash_table_insert (data_set, "uid", (char *) user_id);
	facebook_connection_add_api_sig (self->priv->conn, data_set);
	msg = soup_form_request_new_from_hash ("GET", FACEBOOK_HTTPS_REST_SERVER, data_set);
	facebook_connection_send_message (self->priv->conn,
					  msg,
					  cancellable,
					  callback,
					  user_data,
					  facebook_service_get_albums,
					  get_albums_ready_cb,
					  self);

	g_hash_table_destroy (data_set);
}
开发者ID:Peliadia,项目名称:gthumb,代码行数:30,代码来源:facebook-service.c

示例15: facebook_service_upload_photos

void
facebook_service_upload_photos (FacebookService     *self,
				FacebookAlbum       *album,
				GList               *file_list, /* GFile list */
				GCancellable        *cancellable,
				GAsyncReadyCallback  callback,
				gpointer             user_data)
{
	gth_task_progress (GTH_TASK (self->priv->conn), _("Uploading the files to the server"), NULL, TRUE, 0.0);

	post_photos_data_free (self->priv->post_photos);
	self->priv->post_photos = g_new0 (PostPhotosData, 1);
	self->priv->post_photos->album = _g_object_ref (album);
	self->priv->post_photos->cancellable = _g_object_ref (cancellable);
	self->priv->post_photos->callback = callback;
	self->priv->post_photos->user_data = user_data;
	self->priv->post_photos->total_size = 0;
	self->priv->post_photos->n_files = 0;

	_g_query_all_metadata_async (file_list,
				     FALSE,
				     TRUE,
				     "*",
				     self->priv->post_photos->cancellable,
				     upload_photos_info_ready_cb,
				     self);
}
开发者ID:Peliadia,项目名称:gthumb,代码行数:27,代码来源:facebook-service.c


注:本文中的GTH_TASK函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。