aboutsummaryrefslogtreecommitdiffstats
path: root/src/empathy-preferences.c
diff options
context:
space:
mode:
authorEmilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>2011-08-04 16:53:25 +0800
committerEmilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>2011-08-04 17:10:20 +0800
commitf9716e53331ccbd0725a14089ad30e9d6c84a463 (patch)
treeaeab0ca24aa23cdb2e447998af8511cc8d0af770 /src/empathy-preferences.c
parent2e7a0efc837d4b38290dffbd04a1c9d70df64db2 (diff)
downloadgsoc2013-empathy-f9716e53331ccbd0725a14089ad30e9d6c84a463.tar
gsoc2013-empathy-f9716e53331ccbd0725a14089ad30e9d6c84a463.tar.gz
gsoc2013-empathy-f9716e53331ccbd0725a14089ad30e9d6c84a463.tar.bz2
gsoc2013-empathy-f9716e53331ccbd0725a14089ad30e9d6c84a463.tar.lz
gsoc2013-empathy-f9716e53331ccbd0725a14089ad30e9d6c84a463.tar.xz
gsoc2013-empathy-f9716e53331ccbd0725a14089ad30e9d6c84a463.tar.zst
gsoc2013-empathy-f9716e53331ccbd0725a14089ad30e9d6c84a463.zip
Make the #defines an static array
Diffstat (limited to 'src/empathy-preferences.c')
-rw-r--r--src/empathy-preferences.c40
1 files changed, 26 insertions, 14 deletions
diff --git a/src/empathy-preferences.c b/src/empathy-preferences.c
index 4b3e0766f..e593c6f76 100644
--- a/src/empathy-preferences.c
+++ b/src/empathy-preferences.c
@@ -55,6 +55,17 @@ G_DEFINE_TYPE (EmpathyPreferences, empathy_preferences, GTK_TYPE_DIALOG);
#define GET_PRIV(self) ((EmpathyPreferencesPriv *)((EmpathyPreferences *) self)->priv)
+static const gchar * empathy_preferences_tabs[] =
+{
+ "general",
+ "notifications",
+ "sounds",
+ "calls",
+ "location",
+ "spell",
+ "themes",
+};
+
struct _EmpathyPreferencesPriv {
GtkWidget *notebook;
@@ -1241,25 +1252,26 @@ empathy_preferences_init (EmpathyPreferences *preferences)
static EmpathyPreferencesTab
empathy_preferences_tab_from_string (const gchar *str)
{
- if (!tp_strdiff (str, EMPATHY_PREFERENCES_STR_TAB_GENERAL))
- return EMPATHY_PREFERENCES_TAB_GENERAL;
- else if (!tp_strdiff (str, EMPATHY_PREFERENCES_STR_TAB_NOTIFICATIONS))
- return EMPATHY_PREFERENCES_TAB_NOTIFICATIONS;
- else if (!tp_strdiff (str, EMPATHY_PREFERENCES_STR_TAB_SOUNDS))
- return EMPATHY_PREFERENCES_TAB_SOUNDS;
- else if (!tp_strdiff (str, EMPATHY_PREFERENCES_STR_TAB_CALLS))
- return EMPATHY_PREFERENCES_TAB_CALLS;
- else if (!tp_strdiff (str, EMPATHY_PREFERENCES_STR_TAB_LOCATION))
- return EMPATHY_PREFERENCES_TAB_LOCATION;
- else if (!tp_strdiff (str, EMPATHY_PREFERENCES_STR_TAB_SPELL))
- return EMPATHY_PREFERENCES_TAB_SPELL;
- else if (!tp_strdiff (str, EMPATHY_PREFERENCES_STR_TAB_THEMES))
- return EMPATHY_PREFERENCES_TAB_THEMES;
+ guint i;
+
+ for (i = 0; i < G_N_ELEMENTS (empathy_preferences_tabs); i++)
+ {
+ if (!tp_strdiff (str, empathy_preferences_tabs[i]))
+ return i;
+ }
g_warn_if_reached ();
return -1;
}
+const gchar *
+empathy_preferences_tab_to_string (EmpathyPreferencesTab tab)
+{
+ g_return_val_if_fail (tab < G_N_ELEMENTS (empathy_preferences_tabs), NULL);
+
+ return empathy_preferences_tabs[tab];
+}
+
GtkWidget *
empathy_preferences_new (GtkWindow *parent)
{