[recipes/todoist: 4/12] Fix the sequence of function calls to initialize and export shopping list. Change the return type of
- From: Ekta Nandwani <ektan src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [recipes/todoist: 4/12] Fix the sequence of function calls to initialize and export shopping list. Change the return type of
- Date: Fri, 27 Oct 2017 15:06:47 +0000 (UTC)
commit c9a8b79de2f6eb58cce549fe8766a355868c510a
Author: Ekta Nandwani <mailnandwaniekta gmail com>
Date: Fri Aug 18 07:10:42 2017 +0530
Fix the sequence of function calls to initialize and export shopping list.
Change the return type of get_project_id() to ensure it sets the value for project_id
src/gr-shopping-list-exporter.c | 28 +++++++++++++++-------------
1 files changed, 15 insertions(+), 13 deletions(-)
---
diff --git a/src/gr-shopping-list-exporter.c b/src/gr-shopping-list-exporter.c
index 65352ed..e9f34f8 100644
--- a/src/gr-shopping-list-exporter.c
+++ b/src/gr-shopping-list-exporter.c
@@ -36,7 +36,7 @@
#define TODOIST_URL "https://todoist.com/API/v7/sync"
-static void get_project_id (GrShoppingListExporter *exporter);
+static gboolean get_project_id (GrShoppingListExporter *exporter);
struct _GrShoppingListExporter
{
@@ -382,7 +382,7 @@ add_project_id (GrShoppingListExporter *exporter)
g_object_unref (call);
}
-static void
+static gboolean
get_project_id (GrShoppingListExporter *exporter)
{
RestProxy *proxy;
@@ -457,21 +457,20 @@ get_project_id (GrShoppingListExporter *exporter)
if (strcmp (name, list_title) == 0) {
id = json_object_get_double_member (object, "id");
exporter->project_id = (glong) id;
- goto export;
+ break;
}
}
- if (!exporter->project_id)
- add_project_id (exporter);
-
- export:
- sync_token = json_object_get_string_member (object, "sync_token");
- exporter->sync_token = sync_token;
- export_shopping_list_to_todoist (exporter);
+ sync_token = json_object_get_string_member (object, "sync_token");
+ exporter->sync_token = sync_token;
out:
g_object_unref (proxy);
g_object_unref (call);
+ if (exporter->project_id)
+ return TRUE;
+ else
+ return FALSE;
}
static void
@@ -557,14 +556,17 @@ share_list (GrShoppingListExporter *exporter)
static void
initialize_export (GrShoppingListExporter *exporter)
{
-
+ gboolean project_present;
if (exporter->account_row_selected == exporter->todoist_row) {
if (!exporter->access_token) {
get_access_token (exporter);
}
- if (!exporter->project_id) {
- get_project_id (exporter);
+ project_present = get_project_id (exporter);
+ if (!project_present)
+ {
+ add_project_id (exporter);
}
+ export_shopping_list_to_todoist (exporter);
}
else if (exporter->account_row_selected == exporter->email_row)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]