[gimp] app: prepare another refactoring
- From: Sven Neumann <neo src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gimp] app: prepare another refactoring
- Date: Tue, 5 Jan 2010 21:44:29 +0000 (UTC)
commit 8f6fea7636118eb427b1497a353aaa446b0a1e16
Author: Sven Neumann <sven gimp org>
Date: Thu Dec 31 14:13:11 2009 +0100
app: prepare another refactoring
app/widgets/gimplanguagecombobox.c | 10 +++++-----
app/widgets/gimplanguagecombobox.h | 10 +++++-----
app/widgets/gimplanguageentry.c | 20 ++++++++++----------
app/widgets/gimplanguageentry.h | 8 ++++----
app/widgets/gimplanguagestore.c | 32 +++++++++++++++-----------------
app/widgets/gimplanguagestore.h | 8 ++++----
app/widgets/gimppropwidgets.c | 12 ++++++------
7 files changed, 49 insertions(+), 51 deletions(-)
---
diff --git a/app/widgets/gimplanguagecombobox.c b/app/widgets/gimplanguagecombobox.c
index 4411c6b..6d1db23 100644
--- a/app/widgets/gimplanguagecombobox.c
+++ b/app/widgets/gimplanguagecombobox.c
@@ -60,7 +60,7 @@ gimp_language_combo_box_init (GimpLanguageComboBox *combo)
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), renderer, TRUE);
gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo), renderer,
- "text", GIMP_LANGUAGE_STORE_LANGUAGE,
+ "text", GIMP_LANGUAGE_STORE_LABEL,
NULL);
}
@@ -82,7 +82,7 @@ gimp_language_combo_box_new (void)
}
gchar *
-gimp_language_combo_box_get_iso_code (GimpLanguageComboBox *combo)
+gimp_language_combo_box_get_code (GimpLanguageComboBox *combo)
{
GtkTreeIter iter;
gchar *code;
@@ -93,15 +93,15 @@ gimp_language_combo_box_get_iso_code (GimpLanguageComboBox *combo)
return NULL;
gtk_tree_model_get (gtk_combo_box_get_model (GTK_COMBO_BOX (combo)), &iter,
- GIMP_LANGUAGE_STORE_ISO_639_1, &code,
+ GIMP_LANGUAGE_STORE_CODE, &code,
-1);
return code;
}
gboolean
-gimp_language_combo_box_set_iso_code (GimpLanguageComboBox *combo,
- const gchar *code)
+gimp_language_combo_box_set_code (GimpLanguageComboBox *combo,
+ const gchar *code)
{
GtkTreeModel *model;
GtkTreeIter iter;
diff --git a/app/widgets/gimplanguagecombobox.h b/app/widgets/gimplanguagecombobox.h
index cfc645e..5e5cd9e 100644
--- a/app/widgets/gimplanguagecombobox.h
+++ b/app/widgets/gimplanguagecombobox.h
@@ -38,13 +38,13 @@ struct _GimpLanguageComboBoxClass
};
-GType gimp_language_combo_box_get_type (void) G_GNUC_CONST;
+GType gimp_language_combo_box_get_type (void) G_GNUC_CONST;
-GtkWidget * gimp_language_combo_box_new (void);
+GtkWidget * gimp_language_combo_box_new (void);
-gchar * gimp_language_combo_box_get_iso_code (GimpLanguageComboBox *combo);
-gboolean gimp_language_combo_box_set_iso_code (GimpLanguageComboBox *combo,
- const gchar *code);
+gchar * gimp_language_combo_box_get_code (GimpLanguageComboBox *combo);
+gboolean gimp_language_combo_box_set_code (GimpLanguageComboBox *combo,
+ const gchar *code);
#endif /* __GIMP_LANGUAGE_COMBO_BOX_H__ */
diff --git a/app/widgets/gimplanguageentry.c b/app/widgets/gimplanguageentry.c
index 303f8f5..b3ecde2 100644
--- a/app/widgets/gimplanguageentry.c
+++ b/app/widgets/gimplanguageentry.c
@@ -121,7 +121,7 @@ gimp_language_entry_constructor (GType type,
* otherwise we won't get a cell renderer for free.
*/
gtk_entry_completion_set_text_column (completion,
- GIMP_LANGUAGE_STORE_LANGUAGE);
+ GIMP_LANGUAGE_STORE_LABEL);
gtk_entry_set_completion (GTK_ENTRY (entry), completion);
g_object_unref (completion);
@@ -204,7 +204,7 @@ gimp_language_entry_language_selected (GtkEntryCompletion *completion,
g_free (entry->code);
gtk_tree_model_get (model, iter,
- GIMP_LANGUAGE_STORE_ISO_639_1, &entry->code,
+ GIMP_LANGUAGE_STORE_CODE, &entry->code,
-1);
return FALSE;
@@ -228,7 +228,7 @@ gimp_language_entry_new (void)
}
const gchar *
-gimp_language_entry_get_iso_code (GimpLanguageEntry *entry)
+gimp_language_entry_get_code (GimpLanguageEntry *entry)
{
g_return_val_if_fail (GIMP_IS_LANGUAGE_ENTRY (entry), NULL);
@@ -236,8 +236,8 @@ gimp_language_entry_get_iso_code (GimpLanguageEntry *entry)
}
gboolean
-gimp_language_entry_set_iso_code (GimpLanguageEntry *entry,
- const gchar *code)
+gimp_language_entry_set_code (GimpLanguageEntry *entry,
+ const gchar *code)
{
GtkTreeIter iter;
@@ -259,15 +259,15 @@ gimp_language_entry_set_iso_code (GimpLanguageEntry *entry,
if (gimp_language_store_lookup (GIMP_LANGUAGE_STORE (entry->store),
code, &iter))
{
- gchar *language;
+ gchar *label;
gtk_tree_model_get (GTK_TREE_MODEL (entry->store), &iter,
- GIMP_LANGUAGE_STORE_LANGUAGE, &language,
- GIMP_LANGUAGE_STORE_ISO_639_1, &entry->code,
+ GIMP_LANGUAGE_STORE_LABEL, &label,
+ GIMP_LANGUAGE_STORE_CODE, &entry->code,
-1);
- gtk_entry_set_text (GTK_ENTRY (entry), language);
- g_free (language);
+ gtk_entry_set_text (GTK_ENTRY (entry), label);
+ g_free (label);
return TRUE;
}
diff --git a/app/widgets/gimplanguageentry.h b/app/widgets/gimplanguageentry.h
index 68e4ff6..911165e 100644
--- a/app/widgets/gimplanguageentry.h
+++ b/app/widgets/gimplanguageentry.h
@@ -40,11 +40,11 @@ struct _GimpLanguageEntryClass
GType gimp_language_entry_get_type (void) G_GNUC_CONST;
-GtkWidget * gimp_language_entry_new (void);
+GtkWidget * gimp_language_entry_new (void);
-const gchar * gimp_language_entry_get_iso_code (GimpLanguageEntry *entry);
-gboolean gimp_language_entry_set_iso_code (GimpLanguageEntry *entry,
- const gchar *code);
+const gchar * gimp_language_entry_get_code (GimpLanguageEntry *entry);
+gboolean gimp_language_entry_set_code (GimpLanguageEntry *entry,
+ const gchar *code);
#endif /* __GIMP_LANGUAGE_ENTRY_H__ */
diff --git a/app/widgets/gimplanguagestore.c b/app/widgets/gimplanguagestore.c
index 198f3cd..b579465 100644
--- a/app/widgets/gimplanguagestore.c
+++ b/app/widgets/gimplanguagestore.c
@@ -35,7 +35,7 @@ static GObject * gimp_language_store_constructor (GType type,
GObjectConstructParam *params);
static void gimp_language_store_real_add (GimpLanguageStore *store,
- const gchar *lang,
+ const gchar *label,
const gchar *code);
static gint gimp_language_store_sort (GtkTreeModel *model,
@@ -68,10 +68,10 @@ gimp_language_store_init (GimpLanguageStore *store)
G_N_ELEMENTS (column_types), column_types);
gtk_tree_sortable_set_sort_func (GTK_TREE_SORTABLE (store),
- GIMP_LANGUAGE_STORE_LANGUAGE,
+ GIMP_LANGUAGE_STORE_LABEL,
gimp_language_store_sort, NULL, NULL);
gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (store),
- GIMP_LANGUAGE_STORE_LANGUAGE,
+ GIMP_LANGUAGE_STORE_LABEL,
GTK_SORT_ASCENDING);
}
@@ -91,15 +91,15 @@ gimp_language_store_constructor (GType type,
static void
gimp_language_store_real_add (GimpLanguageStore *store,
- const gchar *lang,
+ const gchar *label,
const gchar *code)
{
GtkTreeIter iter;
gtk_list_store_append (GTK_LIST_STORE (store), &iter);
gtk_list_store_set (GTK_LIST_STORE (store), &iter,
- GIMP_LANGUAGE_STORE_LANGUAGE, lang,
- GIMP_LANGUAGE_STORE_ISO_639_1, code,
+ GIMP_LANGUAGE_STORE_LABEL, label,
+ GIMP_LANGUAGE_STORE_CODE, code,
-1);
}
@@ -114,10 +114,8 @@ gimp_language_store_sort (GtkTreeModel *model,
gint cmp = 0;
/* keep system language at the top of the list */
- gtk_tree_model_get_value (model, a,
- GIMP_LANGUAGE_STORE_ISO_639_1, &avalue);
- gtk_tree_model_get_value (model, b,
- GIMP_LANGUAGE_STORE_ISO_639_1, &bvalue);
+ gtk_tree_model_get_value (model, a, GIMP_LANGUAGE_STORE_CODE, &avalue);
+ gtk_tree_model_get_value (model, b, GIMP_LANGUAGE_STORE_CODE, &bvalue);
if (! g_value_get_string (&avalue))
cmp = -1;
@@ -131,9 +129,9 @@ gimp_language_store_sort (GtkTreeModel *model,
if (cmp)
return cmp;
- /* sort lanugages alphabetically */
- gtk_tree_model_get_value (model, a, GIMP_LANGUAGE_STORE_LANGUAGE, &avalue);
- gtk_tree_model_get_value (model, b, GIMP_LANGUAGE_STORE_LANGUAGE, &bvalue);
+ /* sort labels alphabetically */
+ gtk_tree_model_get_value (model, a, GIMP_LANGUAGE_STORE_LABEL, &avalue);
+ gtk_tree_model_get_value (model, b, GIMP_LANGUAGE_STORE_LABEL, &bvalue);
cmp = g_utf8_collate (g_value_get_string (&avalue),
g_value_get_string (&bvalue));
@@ -152,13 +150,13 @@ gimp_language_store_new (void)
void
gimp_language_store_add (GimpLanguageStore *store,
- const gchar *lang,
+ const gchar *label,
const gchar *code)
{
g_return_if_fail (GIMP_IS_LANGUAGE_STORE (store));
- g_return_if_fail (lang != NULL);
+ g_return_if_fail (label != NULL);
- GIMP_LANGUAGE_STORE_GET_CLASS (store)->add (store, lang, code);
+ GIMP_LANGUAGE_STORE_GET_CLASS (store)->add (store, label, code);
}
gboolean
@@ -194,7 +192,7 @@ gimp_language_store_lookup (GimpLanguageStore *store,
gchar *value;
gtk_tree_model_get (model, iter,
- GIMP_LANGUAGE_STORE_ISO_639_1, &value,
+ GIMP_LANGUAGE_STORE_CODE, &value,
-1);
if (value && strncmp (code, value, len) == 0)
diff --git a/app/widgets/gimplanguagestore.h b/app/widgets/gimplanguagestore.h
index 51e9b8d..88200a6 100644
--- a/app/widgets/gimplanguagestore.h
+++ b/app/widgets/gimplanguagestore.h
@@ -24,8 +24,8 @@
enum
{
- GIMP_LANGUAGE_STORE_LANGUAGE,
- GIMP_LANGUAGE_STORE_ISO_639_1
+ GIMP_LANGUAGE_STORE_LABEL,
+ GIMP_LANGUAGE_STORE_CODE
};
@@ -44,7 +44,7 @@ struct _GimpLanguageStoreClass
GtkListStoreClass parent_class;
void (* add) (GimpLanguageStore *store,
- const gchar *lang,
+ const gchar *label,
const gchar *code);
};
@@ -64,7 +64,7 @@ gboolean gimp_language_store_lookup (GimpLanguageStore *store,
/* used from gimplanguagestore-parser.c */
void gimp_language_store_add (GimpLanguageStore *store,
- const gchar *lang,
+ const gchar *label,
const gchar *code);
diff --git a/app/widgets/gimppropwidgets.c b/app/widgets/gimppropwidgets.c
index 21a9de3..8791328 100644
--- a/app/widgets/gimppropwidgets.c
+++ b/app/widgets/gimppropwidgets.c
@@ -851,7 +851,7 @@ gimp_prop_language_combo_box_new (GObject *config,
property_name, &value,
NULL);
- gimp_language_combo_box_set_iso_code (GIMP_LANGUAGE_COMBO_BOX (combo), value);
+ gimp_language_combo_box_set_code (GIMP_LANGUAGE_COMBO_BOX (combo), value);
g_free (value);
set_param_spec (G_OBJECT (combo), combo, param_spec);
@@ -878,7 +878,7 @@ gimp_prop_language_combo_box_callback (GtkWidget *combo,
if (! param_spec)
return;
- code = gimp_language_combo_box_get_iso_code (GIMP_LANGUAGE_COMBO_BOX (combo));
+ code = gimp_language_combo_box_get_code (GIMP_LANGUAGE_COMBO_BOX (combo));
g_signal_handlers_block_by_func (config,
gimp_prop_language_combo_box_notify,
@@ -910,7 +910,7 @@ gimp_prop_language_combo_box_notify (GObject *config,
gimp_prop_language_combo_box_callback,
config);
- gimp_language_combo_box_set_iso_code (GIMP_LANGUAGE_COMBO_BOX (combo), value);
+ gimp_language_combo_box_set_code (GIMP_LANGUAGE_COMBO_BOX (combo), value);
g_signal_handlers_unblock_by_func (combo,
gimp_prop_language_combo_box_callback,
@@ -949,7 +949,7 @@ gimp_prop_language_entry_new (GObject *config,
property_name, &value,
NULL);
- gimp_language_entry_set_iso_code (GIMP_LANGUAGE_ENTRY (entry), value);
+ gimp_language_entry_set_code (GIMP_LANGUAGE_ENTRY (entry), value);
g_free (value);
set_param_spec (G_OBJECT (entry), entry, param_spec);
@@ -976,7 +976,7 @@ gimp_prop_language_entry_callback (GtkWidget *entry,
if (! param_spec)
return;
- code = gimp_language_entry_get_iso_code (GIMP_LANGUAGE_ENTRY (entry));
+ code = gimp_language_entry_get_code (GIMP_LANGUAGE_ENTRY (entry));
g_signal_handlers_block_by_func (config,
gimp_prop_language_entry_notify,
@@ -1006,7 +1006,7 @@ gimp_prop_language_entry_notify (GObject *config,
gimp_prop_language_entry_callback,
config);
- gimp_language_entry_set_iso_code (GIMP_LANGUAGE_ENTRY (entry), value);
+ gimp_language_entry_set_code (GIMP_LANGUAGE_ENTRY (entry), value);
g_signal_handlers_unblock_by_func (entry,
gimp_prop_language_entry_callback,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]