[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-anastasis-gtk] 03/04: use enum instead of hard-coded constants fo
From: |
gnunet |
Subject: |
[taler-anastasis-gtk] 03/04: use enum instead of hard-coded constants for GtkXstore columns |
Date: |
Sat, 13 Mar 2021 19:23:32 +0100 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository anastasis-gtk.
commit 37ad347bd759bbf755b2b6fa40f18a8ea855fd72
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Sat Mar 13 18:37:46 2021 +0100
use enum instead of hard-coded constants for GtkXstore columns
---
contrib/anastasis_gtk_main_window.glade | 10 --
src/anastasis/anastasis-gtk_action.c | 43 ++++----
...astasis-gtk_handle-auth-edit-provider-clicked.c | 4 +-
src/anastasis/anastasis-gtk_helper.h | 108 +++++++++++++++++++++
4 files changed, 131 insertions(+), 34 deletions(-)
diff --git a/contrib/anastasis_gtk_main_window.glade
b/contrib/anastasis_gtk_main_window.glade
index 2d79cc9..8c31973 100644
--- a/contrib/anastasis_gtk_main_window.glade
+++ b/contrib/anastasis_gtk_main_window.glade
@@ -75,16 +75,6 @@ Author: Christian Grothoff, Dennis Neufeld
<property name="can_focus">False</property>
<property name="stock">gtk-dialog-question</property>
</object>
- <object class="GtkListStore" id="paid_qrcodes_liststore">
- <columns>
- <!-- column-name qr -->
- <column type="GdkPixbuf"/>
- <!-- column-name url -->
- <column type="gchararray"/>
- <!-- column-name provider -->
- <column type="gchararray"/>
- </columns>
- </object>
<object class="GtkTreeStore" id="policy_review_treestore">
<columns>
<!-- column-name policy_name -->
diff --git a/src/anastasis/anastasis-gtk_action.c
b/src/anastasis/anastasis-gtk_action.c
index 7aa910e..b0cb8f5 100644
--- a/src/anastasis/anastasis-gtk_action.c
+++ b/src/anastasis/anastasis-gtk_action.c
@@ -70,7 +70,7 @@ action_continent_selecting (void)
gtk_list_store_insert_with_values (continent_liststore,
NULL,
-1,
- 0, json_string_value (continent),
+ AG_CMC_CONTINENT_NAME,
json_string_value (continent),
-1);
}
}
@@ -114,18 +114,17 @@ action_country_selecting (void)
GtkTreeIter iter;
const char *code;
- /* FIXME: use proper enum for columns instead of 0/1/2 */
code = json_string_value (json_object_get (country,
"code"));
gtk_list_store_insert_with_values (
country_liststore,
&iter,
-1,
- 0,
+ AG_CCMC_COUNTRY_NAME,
json_string_value (json_object_get (country, "name")),
- 1,
+ AG_CCMC_COUNTRY_CODE,
code,
- 2,
+ AG_CCMC_COUNTRY_CURRENCY,
json_string_value (json_object_get (country, "currency")),
-1);
if ( (NULL != selected_country) &&
@@ -599,13 +598,13 @@ action_authentications_editing (void)
GNUNET_JSON_parse (am,
spec,
NULL, NULL));
- // FIXME: use proper enum
- gtk_list_store_insert_with_values (ls,
+ gtk_list_store_insert_with_values (
+ ls,
NULL,
-1,
- 0, type,
- 1, instructions,
- 2, (guint) index,
+ AG_AMMC_TYPE, type,
+ AG_AMMC_VISUALIZATION, instructions,
+ AG_AMMC_INDEX, (guint) index,
-1);
have_auth = true;
}
@@ -731,7 +730,7 @@ action_policies_reviewing (void)
&piter,
NULL, /* no parent */
-1, /* append */
- 2,
+ AG_PRMC_COST,
TALER_amount2s (&recovery_cost),
-1);
@@ -793,13 +792,13 @@ action_policies_reviewing (void)
&miter,
&piter, /* parent */
-1, /* append */
- 0,
+ AG_PRMC_POLICY_NAME,
instructions,
- 1,
+ AG_PRMC_METHOD_TYPE,
type,
- 2,
+ AG_PRMC_COST,
TALER_amount2s (&recovery_cost),
- 3,
+ AG_PRMC_PROVIDER_URL,
provider,
-1);
if (NULL == summary)
@@ -824,7 +823,7 @@ action_policies_reviewing (void)
{
gtk_tree_store_set (ts,
&piter,
- 0, summary,
+ AG_PRMC_POLICY_NAME, summary,
-1);
GNUNET_free (summary);
}
@@ -1041,9 +1040,9 @@ action_truths_paying (void)
gtk_list_store_insert_with_values (ls,
NULL,
-1, /* append */
- 0, pb,
- 1, payto,
- 2, "",
+ AG_UQRMC_QR_IMAGE, pb,
+ AG_UQRMC_URL, payto,
+ AG_UQRMC_PROVIDER, "",
-1);
}
if (0 == index)
@@ -1125,9 +1124,9 @@ action_policies_paying (void)
gtk_list_store_insert_with_values (ls,
NULL,
-1, /* append */
- 0, pb,
- 1, payto,
- 2, provider,
+ AG_UQRMC_QR_IMAGE, pb,
+ AG_UQRMC_URL, payto,
+ AG_UQRMC_PROVIDER, provider,
-1);
}
if (0 == index)
diff --git a/src/anastasis/anastasis-gtk_handle-auth-edit-provider-clicked.c
b/src/anastasis/anastasis-gtk_handle-auth-edit-provider-clicked.c
index d6def4d..47c12cc 100644
--- a/src/anastasis/anastasis-gtk_handle-auth-edit-provider-clicked.c
+++ b/src/anastasis/anastasis-gtk_handle-auth-edit-provider-clicked.c
@@ -50,7 +50,7 @@ url_add_button_clicked_cb (GtkButton *button,
gtk_list_store_insert_with_values (ls,
NULL,
-1,
- 0, url,
+ AG_PMC_PROVIDER_URL, url,
-1);
gtk_entry_set_text (entry,
"");
@@ -185,7 +185,7 @@ anastasis_gtk_edit_provider_list_clicked_cb (GtkButton
*object,
gtk_list_store_insert_with_values (ls,
NULL,
-1,
- 0, url,
+ AG_PMC_PROVIDER_URL, url,
-1);
}
}
diff --git a/src/anastasis/anastasis-gtk_helper.h
b/src/anastasis/anastasis-gtk_helper.h
index a340a52..c346cef 100644
--- a/src/anastasis/anastasis-gtk_helper.h
+++ b/src/anastasis/anastasis-gtk_helper.h
@@ -33,6 +33,114 @@
#include "anastasis-gtk.h"
+/**
+ * Columns of the continent_liststore.
+ */
+enum AG_ContinentsModelColumns
+ {
+ /**
+ * A gchararray.
+ */
+ AG_CMC_CONTINENT_NAME = 0
+ };
+
+
+/**
+ * Columns of the provider_liststore.
+ */
+enum AG_ProviderModelColumns
+ {
+ /**
+ * A gchararray.
+ */
+ AG_PMC_PROVIDER_URL = 0
+ };
+
+/**
+ * Columns of the country_liststore.
+ */
+enum AG_CountryCodeModelColumns
+ {
+ /**
+ * A gchararray.
+ */
+ AG_CCMC_COUNTRY_NAME = 0,
+ /**
+ * A gchararray.
+ */
+ AG_CCMC_COUNTRY_CODE = 1,
+ /**
+ * A gchararray.
+ */
+ AG_CCMC_COUNTRY_CURRENCY = 2
+ };
+
+/**
+ * Columns of the authentication_methods_liststore.
+ */
+enum AG_AuthenticationMethodsModelColumns
+ {
+ /**
+ * A gchararray.
+ */
+ AG_AMMC_TYPE = 0,
+ /**
+ * A gchararray.
+ */
+ AG_AMMC_VISUALIZATION = 1,
+ /**
+ * A guint.
+ */
+ AG_AMMC_INDEX = 2
+ };
+
+
+/**
+ * Columns of the unpaid_qrcodes_liststore.
+ */
+enum AG_UnpaidQrcodesModelColumns
+ {
+ /**
+ * A GdkPixbuf.
+ */
+ AG_UQRMC_QR_IMAGE = 0,
+ /**
+ * A gchararray.
+ */
+ AG_UQRMC_URL = 1,
+ /**
+ * A gchararray.
+ */
+ AG_UQRMC_PROVIDER = 2
+ };
+
+
+/**
+ * Columns of the policy_review_treestore.
+ */
+enum AG_PolicyReviewModelColumns
+ {
+ /**
+ * A gchararray.
+ */
+ AG_PRMC_POLICY_NAME = 0,
+ /**
+ * A gchararray.
+ */
+ AG_PRMC_METHOD_TYPE = 1,
+ /**
+ * A gchararray.
+ */
+ AG_PRMC_COST = 2,
+ /**
+ * A gchararray.
+ */
+ AG_PRMC_PROVIDER_URL = 3
+ };
+
+
+
+
/**
* Hide widget of the given @a name of the main window
*
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.