[gtranslator/dl-workflow: 6/10] gtr-profile: Create getters/setters for auth token




commit 33d1b9801c974d1a6fc65d7ee7cfa1a8ec4f0ade
Author: Amanda Shafack <shafack likhene gmail com>
Date:   Mon Feb 15 22:11:36 2021 +0100

    gtr-profile: Create getters/setters for auth token
    
    Create getter and setter functions for the user authentication token

 src/gtr-profile.c | 25 +++++++++++++++++++++++++
 src/gtr-profile.h |  4 ++++
 2 files changed, 29 insertions(+)
---
diff --git a/src/gtr-profile.c b/src/gtr-profile.c
index 6684b5a5..d8b6cf99 100644
--- a/src/gtr-profile.c
+++ b/src/gtr-profile.c
@@ -32,6 +32,9 @@ typedef struct
   /* Identify the profile */
   gchar *name;
 
+  /* Authentication token */
+  gchar *auth_token;
+
   /* Translator's information */
   gchar *author_name;
   gchar *author_email;
@@ -69,6 +72,7 @@ gtr_profile_finalize (GObject *object)
   GtrProfilePrivate *priv = gtr_profile_get_instance_private (profile);
 
   g_free (priv->name);
+  g_free (priv->auth_token);
   g_free (priv->author_name);
   g_free (priv->author_email);
   g_free (priv->language_name);
@@ -120,6 +124,27 @@ gtr_profile_set_name (GtrProfile  *profile,
   priv->name = g_strdup (data);
 }
 
+const gchar *
+gtr_profile_get_auth_token (GtrProfile *profile)
+{
+  GtrProfilePrivate *priv = gtr_profile_get_instance_private (profile);
+  g_return_val_if_fail (GTR_IS_PROFILE (profile), NULL);
+
+  return priv->auth_token;
+}
+
+void
+gtr_profile_set_auth_token (GtrProfile  *profile,
+                            const gchar *data)
+{
+  GtrProfilePrivate *priv = gtr_profile_get_instance_private (profile);
+  g_return_if_fail (GTR_IS_PROFILE (profile));
+  g_return_if_fail (data != NULL);
+
+  g_free (priv->auth_token);
+  priv->auth_token = g_strdup (data);
+}
+
 const gchar *
 gtr_profile_get_author_name (GtrProfile *profile)
 {
diff --git a/src/gtr-profile.h b/src/gtr-profile.h
index e7da567a..f95f3f7d 100644
--- a/src/gtr-profile.h
+++ b/src/gtr-profile.h
@@ -67,6 +67,10 @@ const gchar          *gtr_profile_get_name            (GtrProfile  *profile);
 void                  gtr_profile_set_name            (GtrProfile  *profile,
                                                        const gchar *data);
 
+const gchar          *gtr_profile_get_auth_token      (GtrProfile  *profile);
+void                  gtr_profile_set_auth_token      (GtrProfile  *profile,
+                                                       const gchar *data);                                   
                   
+
 const gchar          *gtr_profile_get_author_name     (GtrProfile  *profile);
 void                  gtr_profile_set_author_name     (GtrProfile  *profile,
                                                        const gchar *data);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]