[gthumb] picasaweb: get the user id from the email instead of using 'default'
- From: Paolo Bacchilega <paobac src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gthumb] picasaweb: get the user id from the email instead of using 'default'
- Date: Mon, 13 Sep 2010 10:38:45 +0000 (UTC)
commit 4d80274ff221f28078f4924617ae4f290f435823
Author: Paolo Bacchilega <paobac src gnome org>
Date: Mon Sep 13 12:35:47 2010 +0200
picasaweb: get the user id from the email instead of using 'default'
Attempt to fix bug #629488
extensions/picasaweb/dlg-export-to-picasaweb.c | 9 ++++++++-
extensions/picasaweb/dlg-import-from-picasaweb.c | 10 ++++++++--
extensions/picasaweb/google-connection.c | 18 ++++++++++++++++++
extensions/picasaweb/google-connection.h | 1 +
4 files changed, 35 insertions(+), 3 deletions(-)
---
diff --git a/extensions/picasaweb/dlg-export-to-picasaweb.c b/extensions/picasaweb/dlg-export-to-picasaweb.c
index 9ce8aae..04f9d65 100644
--- a/extensions/picasaweb/dlg-export-to-picasaweb.c
+++ b/extensions/picasaweb/dlg-export-to-picasaweb.c
@@ -359,13 +359,20 @@ list_albums_ready_cb (GObject *source_object,
static void
get_album_list (DialogData *data)
{
+ char *user_id;
+
+ gth_task_dialog (GTH_TASK (data->conn), FALSE, NULL);
+
if (data->picasaweb == NULL)
data->picasaweb = picasa_web_service_new (data->conn);
+ user_id = google_utils_get_user_id_from_email (data->email);
picasa_web_service_list_albums (data->picasaweb,
- "default",
+ user_id,
data->cancellable,
list_albums_ready_cb,
data);
+
+ g_free (user_id);
}
diff --git a/extensions/picasaweb/dlg-import-from-picasaweb.c b/extensions/picasaweb/dlg-import-from-picasaweb.c
index c8b7f00..ca6e305 100644
--- a/extensions/picasaweb/dlg-import-from-picasaweb.c
+++ b/extensions/picasaweb/dlg-import-from-picasaweb.c
@@ -305,14 +305,20 @@ list_albums_ready_cb (GObject *source_object,
static void
get_album_list (DialogData *data)
{
+ char *user_id;
+
+ gth_task_dialog (GTH_TASK (data->conn), FALSE, NULL);
+
if (data->picasaweb == NULL)
data->picasaweb = picasa_web_service_new (data->conn);
- gth_task_dialog (GTH_TASK (data->conn), FALSE, NULL);
+ user_id = google_utils_get_user_id_from_email (data->email);
picasa_web_service_list_albums (data->picasaweb,
- "default",
+ user_id,
data->cancellable,
list_albums_ready_cb,
data);
+
+ g_free (user_id);
}
diff --git a/extensions/picasaweb/google-connection.c b/extensions/picasaweb/google-connection.c
index 627c0d9..280cd24 100644
--- a/extensions/picasaweb/google-connection.c
+++ b/extensions/picasaweb/google-connection.c
@@ -398,3 +398,21 @@ google_connection_get_challange_url (GoogleConnection *self)
{
return self->priv->challange_url;
}
+
+
+char *
+google_utils_get_user_id_from_email (const char *email)
+{
+ char *user_id = NULL;
+
+ if (email != NULL) {
+ char *at_sign = strchr (email, '@');
+ if (at_sign != NULL)
+ user_id = g_strndup (email, at_sign - email);
+ }
+
+ if (user_id == NULL)
+ user_id = g_strdup ("default");
+
+ return user_id;
+}
diff --git a/extensions/picasaweb/google-connection.h b/extensions/picasaweb/google-connection.h
index b0dee4a..03cac1e 100644
--- a/extensions/picasaweb/google-connection.h
+++ b/extensions/picasaweb/google-connection.h
@@ -92,5 +92,6 @@ gboolean google_connection_connect_finish (GoogleConnection *
GAsyncResult *result,
GError **error);
const char * google_connection_get_challange_url (GoogleConnection *self);
+char * google_utils_get_user_id_from_email (const char *email);
#endif /* GOOGLE_CONNECTION_H */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]