[frogr] Mark when we received extra information for an account.
- From: Mario Sanchez Prada <msanchez src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [frogr] Mark when we received extra information for an account.
- Date: Fri, 2 Nov 2012 08:50:28 +0000 (UTC)
commit b1c1b74d6ad53827ce97d3b3b41891f9b0b7416f
Author: Mario Sanchez Prada <msanchez gnome org>
Date: Fri Nov 2 09:27:35 2012 +0100
Mark when we received extra information for an account.
This will allow to easily check whether we have actually
connected or not to Flickr using frogr.
src/frogr-account.c | 41 +++++++++++++++++++++++++++++++++++++++++
src/frogr-account.h | 4 ++++
src/frogr-controller.c | 3 +++
3 files changed, 48 insertions(+), 0 deletions(-)
---
diff --git a/src/frogr-account.c b/src/frogr-account.c
index 4c185f2..6fd2133 100644
--- a/src/frogr-account.c
+++ b/src/frogr-account.c
@@ -42,6 +42,7 @@ struct _FrogrAccountPrivate
gchar *fullname;
gchar *version;
gboolean is_active;
+ gboolean has_extra_info;
/* Following properties won't be persistent */
gulong remaining_bandwidth;
@@ -62,6 +63,7 @@ enum {
PROP_FULLNAME,
PROP_VERSION,
PROP_IS_ACTIVE,
+ PROP_HAS_EXTRA_INFO,
PROP_REMAINING_BANDWIDTH,
PROP_MAX_BANDWIDTH,
PROP_MAX_FILESIZE,
@@ -113,6 +115,10 @@ _frogr_account_set_property (GObject *object,
frogr_account_set_is_active (self, g_value_get_boolean (value));
break;
+ case PROP_HAS_EXTRA_INFO:
+ frogr_account_set_has_extra_info (self, g_value_get_boolean (value));
+ break;
+
case PROP_REMAINING_BANDWIDTH:
frogr_account_set_remaining_bandwidth (self, g_value_get_ulong (value));
break;
@@ -176,6 +182,10 @@ _frogr_account_get_property (GObject *object,
g_value_set_boolean (value, priv->is_active);
break;
+ case PROP_HAS_EXTRA_INFO:
+ g_value_set_boolean (value, priv->has_extra_info);
+ break;
+
case PROP_REMAINING_BANDWIDTH:
g_value_set_ulong (value, priv->remaining_bandwidth);
break;
@@ -281,6 +291,14 @@ frogr_account_class_init (FrogrAccountClass *klass)
G_PARAM_READWRITE);
g_object_class_install_property (obj_class, PROP_IS_ACTIVE, pspec);
+ pspec = g_param_spec_boolean ("has-extra-info",
+ "has-extra-info",
+ "Whether the account has been filled with "
+ "extra information as retrieved from flickr",
+ FALSE,
+ G_PARAM_READWRITE);
+ g_object_class_install_property (obj_class, PROP_HAS_EXTRA_INFO, pspec);
+
pspec = g_param_spec_ulong ("remaining-bandwidth",
"remaining-bandwidth",
"Remaining monthly bandwidth in KB",
@@ -324,6 +342,7 @@ frogr_account_init (FrogrAccount *self)
priv->fullname = NULL;
priv->version = NULL;
priv->is_active = FALSE;
+ priv->has_extra_info = FALSE;
priv->remaining_bandwidth = G_MAXULONG;
priv->max_bandwidth = G_MAXULONG;
priv->max_filesize = G_MAXULONG;
@@ -515,6 +534,28 @@ frogr_account_set_is_active (FrogrAccount *self, gboolean is_active)
priv->is_active = is_active;
}
+gboolean
+frogr_account_has_extra_info (FrogrAccount *self)
+{
+ FrogrAccountPrivate *priv = NULL;
+
+ g_return_val_if_fail (FROGR_IS_ACCOUNT (self), FALSE);
+
+ priv = FROGR_ACCOUNT_GET_PRIVATE (self);
+ return priv->has_extra_info;
+}
+
+void
+frogr_account_set_has_extra_info (FrogrAccount *self, gboolean has_extra_info)
+{
+ FrogrAccountPrivate *priv = NULL;
+
+ g_return_if_fail (FROGR_IS_ACCOUNT (self));
+
+ priv = FROGR_ACCOUNT_GET_PRIVATE (self);
+ priv->has_extra_info = has_extra_info;
+}
+
gulong
frogr_account_get_remaining_bandwidth (FrogrAccount *self)
{
diff --git a/src/frogr-account.h b/src/frogr-account.h
index 83821d2..62adc47 100644
--- a/src/frogr-account.h
+++ b/src/frogr-account.h
@@ -96,6 +96,10 @@ gboolean frogr_account_is_active (FrogrAccount *self);
void frogr_account_set_is_active (FrogrAccount *self, gboolean is_active);
+gboolean frogr_account_has_extra_info (FrogrAccount *self);
+
+void frogr_account_set_has_extra_info (FrogrAccount *self, gboolean has_extra_info);
+
gulong frogr_account_get_remaining_bandwidth (FrogrAccount *self);
void frogr_account_set_remaining_bandwidth (FrogrAccount *self,
diff --git a/src/frogr-controller.c b/src/frogr-controller.c
index f80f36f..a493401 100644
--- a/src/frogr-controller.c
+++ b/src/frogr-controller.c
@@ -1636,6 +1636,9 @@ _fetch_account_extra_info_cb (GObject *object, GAsyncResult *res, gpointer data)
frogr_account_set_max_filesize (priv->account, upload_status->fs_max_kb);
frogr_account_set_is_pro (priv->account, upload_status->pro_user);
+ /* Mark that we received this extra info for the user */
+ frogr_account_set_has_extra_info (priv->account, TRUE);
+
if (old_remaining_bw != upload_status->bw_remaining_kb
|| old_max_bw != upload_status->bw_max_kb
|| old_is_pro != upload_status->pro_user)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]