[recipes] Revert "plurals api causing crash, working on converting between metric and imperial"
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [recipes] Revert "plurals api causing crash, working on converting between metric and imperial"
- Date: Mon, 12 Jun 2017 21:14:15 +0000 (UTC)
commit b4edb86bacb63ec9822a43be4a5fa0776cfb8d11
Author: Matthias Clasen <mclasen redhat com>
Date: Mon Jun 12 17:13:56 2017 -0400
Revert "plurals api causing crash, working on converting between metric and imperial"
This reverts commit f15e3de318c0d147f27156a923944e8940b572f6.
Pushed by accident.
src/gr-ingredients-viewer-row.c | 14 --------------
src/gr-unit.c | 22 +++-------------------
src/gr-unit.h | 1 -
3 files changed, 3 insertions(+), 34 deletions(-)
---
diff --git a/src/gr-ingredients-viewer-row.c b/src/gr-ingredients-viewer-row.c
index f142427..854a163 100644
--- a/src/gr-ingredients-viewer-row.c
+++ b/src/gr-ingredients-viewer-row.c
@@ -173,7 +173,6 @@ static void
gr_ingredients_viewer_row_set_amount (GrIngredientsViewerRow *row,
const char *amount)
{
- //amount here is number before unit in ingredient box
g_free (row->amount);
row->amount = g_strdup (amount);
update_unit (row);
@@ -184,9 +183,7 @@ gr_ingredients_viewer_row_set_unit (GrIngredientsViewerRow *row,
const char *unit)
{
g_free (row->unit);
- //unit here is the unit
row->unit = g_strdup (unit);
- g_message(unit);
update_unit (row);
}
@@ -710,18 +707,10 @@ get_units_model (GrIngredientsViewerRow *row)
for (i = 0; names[i]; i++) {
const char *abbrev;
const char *name;
- const char *plural;
-
g_autofree char *tmp = NULL;
abbrev = gr_unit_get_abbreviation (names[i]);
name = gr_unit_get_display_name (names[i]);
- plural = gr_unit_get_plural (names[i]);
-
- if (plural != NULL) {
- g_message(plural);
- }
-
if (strcmp (abbrev, name) == 0)
tmp = g_strdup (name);
else
@@ -730,7 +719,6 @@ get_units_model (GrIngredientsViewerRow *row)
0, abbrev,
1, name,
2, tmp,
- 3, plural,
-1);
}
}
@@ -772,7 +760,6 @@ match_func (GtkEntryCompletion *completion,
g_autofree char *name = NULL;
g_autofree char *amount = NULL;
g_autofree char *unit = NULL;
- g_autofree char *plural = NULL;
model = gtk_entry_completion_get_model (completion);
gtk_tree_model_get (model, iter, 0, &abbrev, 1, &name, -1);
@@ -799,7 +786,6 @@ match_selected (GtkEntryCompletion *completion,
g_autofree char *amount = NULL;
g_autofree char *unit = NULL;
g_autofree char *tmp = NULL;
- g_autofree char *plural = NULL;
gtk_tree_model_get (model, iter, 0, &abbrev, -1);
diff --git a/src/gr-unit.c b/src/gr-unit.c
index 1d1cc4c..7adf0a0 100644
--- a/src/gr-unit.c
+++ b/src/gr-unit.c
@@ -26,7 +26,7 @@
static const char * const unit_names[] = {
"g", "kg", "lb", "oz", "l", "dl", "ml", "fl oz", "pt", "qt", "gal", "cup",
- "tbsp", "tsp", "box", "pkg", "glass", "st", "pinch",
+ "tbsp", "tsp", "box", "pkg", "glass",
NULL
};
@@ -34,19 +34,17 @@ typedef struct {
const char *unit;
const char *abbreviation;
const char *display_name;
- const char *plural;
} GrUnit;
static GrUnit units[] = {
- { "g", NC_("unit abbreviation", "g"), NC_("unit name", "gram"), NC_("unit plural", "grams")
},
- { "kg", NC_("unit abbreviation", "kg"), NC_("unit name", "kilogram"), NC_("unit plural",
"kilograms") },
+ { "g", NC_("unit abbreviation", "g"), NC_("unit name", "gram") },
+ { "kg", NC_("unit abbreviation", "kg"), NC_("unit name", "kilogram") },
{ "lb", NC_("unit abbreviation", "lb"), NC_("unit name", "pound") },
{ "oz", NC_("unit abbreviation", "oz"), NC_("unit name", "ounce") },
{ "l", NC_("unit abbreviation", "l"), NC_("unit name", "liter") },
{ "dl", NC_("unit abbreviation", "dl"), NC_("unit name", "deciliter") },
{ "ml", NC_("unit abbreviation", "ml"), NC_("unit name", "milliliter") },
{ "fl oz", NC_("unit abbreviation", "fl oz"), NC_("unit name", "fluid ounce") },
- { "fl. oz.", NC_("unit abbreviation", "fl oz"), NC_("unit name", "fluid ounce") },
{ "pt", NC_("unit abbreviation", "pt"), NC_("unit name", "pint") },
{ "qt", NC_("unit abbreviation", "qt"), NC_("unit name", "quart") },
{ "gal", NC_("unit abbreviation", "gal"), NC_("unit name", "gallon") },
@@ -59,10 +57,6 @@ static GrUnit units[] = {
{ "mm", NC_("unit abbreviation", "mm"), NC_("unit name", "millimeter") },
{ "cm", NC_("unit abbreviation", "cm"), NC_("unit name", "centimeter") },
{ "m", NC_("unit abbreviation", "m"), NC_("unit name", "meter") },
- { "st", NC_("unit abbreviation", "st"), NC_("unit name", "stone") },
- { "pinch", NC_("unit abbreviation", "pinch"), NC_("unit name", "pinch") },
- { "bunch", NC_("unit abbreviation", "bunch"), NC_("unit name", "bunch"), NC_("unit plural",
"bunches") },
-
};
const char **
@@ -92,16 +86,6 @@ gr_unit_get_display_name (const char *name)
}
const char *
-gr_unit_get_plural (const char *name)
-{
- GrUnit *unit = find_unit (name);
- if (unit)
- return g_dpgettext2 (NULL, "unit plural", unit->plural);
- return NULL;
-
-}
-
-const char *
gr_unit_get_abbreviation (const char *name)
{
GrUnit *unit = find_unit (name);
diff --git a/src/gr-unit.h b/src/gr-unit.h
index 46d8278..bc143eb 100644
--- a/src/gr-unit.h
+++ b/src/gr-unit.h
@@ -28,6 +28,5 @@ const char *gr_unit_parse (char **string,
const char **gr_unit_get_names (void);
const char *gr_unit_get_abbreviation (const char *name);
const char *gr_unit_get_display_name (const char *name);
-const char *gr_unit_get_plural (const char *name);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]