And use strings for the --show-preferences argument.
#include "empathy-audio-sink.h"
#include "empathy-video-src.h"
#include "empathy-mic-menu.h"
+#include "empathy-preferences.h"
#define CONTENT_HBOX_BORDER_WIDTH 6
#define CONTENT_HBOX_SPACING 3
empathy_call_window_settings_cb (GtkAction *action,
EmpathyCallWindow *self)
{
- empathy_launch_program (BIN_DIR, "empathy", "-p 3");
+ empathy_launch_program (BIN_DIR, "empathy",
+ "-p " EMPATHY_PREFERENCES_STR_TAB_CALLS);
}
static void
void
empathy_main_window_show_preferences (EmpathyMainWindow *window,
- gint tab)
+ const gchar *tab)
{
EmpathyMainWindowPriv *priv = GET_PRIV (window);
gtk_window_present (GTK_WINDOW (priv->preferences));
}
- if (tab != -1)
+ if (tab != NULL)
empathy_preferences_show_tab (
EMPATHY_PREFERENCES (priv->preferences), tab);
}
main_window_edit_preferences_cb (GtkAction *action,
EmpathyMainWindow *window)
{
- empathy_main_window_show_preferences (window, -1);
+ empathy_main_window_show_preferences (window, NULL);
}
static void
GtkWidget *empathy_main_window_dup (void);
void empathy_main_window_show_preferences (EmpathyMainWindow *window,
- gint tab);
+ const gchar *tab);
G_END_DECLS
preferences_sound_load (preferences);
if (empathy_spell_supported ()) {
- page = gtk_notebook_get_nth_page (GTK_NOTEBOOK (priv->notebook), 5);
+ page = gtk_notebook_get_nth_page (GTK_NOTEBOOK (priv->notebook), EMPATHY_PREFERENCES_TAB_SPELL);
gtk_widget_show (page);
}
- page = gtk_notebook_get_nth_page (GTK_NOTEBOOK (priv->notebook), 4);
+ page = gtk_notebook_get_nth_page (GTK_NOTEBOOK (priv->notebook), EMPATHY_PREFERENCES_TAB_LOCATION);
#ifdef HAVE_GEOCLUE
gtk_widget_show (page);
#else
#endif
}
+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;
+
+ g_warn_if_reached ();
+ return -1;
+}
+
GtkWidget *
empathy_preferences_new (GtkWindow *parent)
{
void
empathy_preferences_show_tab (EmpathyPreferences *self,
- gint tab)
+ const gchar *page)
{
EmpathyPreferencesPriv *priv = GET_PRIV (self);
- gtk_notebook_set_current_page (GTK_NOTEBOOK (priv->notebook), tab);
+ gtk_notebook_set_current_page (GTK_NOTEBOOK (priv->notebook),
+ empathy_preferences_tab_from_string (page));
}
EMPATHY_PREFERENCES_TAB_THEMES,
} EmpathyPreferencesTab;
+#define EMPATHY_PREFERENCES_STR_TAB_GENERAL "general"
+#define EMPATHY_PREFERENCES_STR_TAB_NOTIFICATIONS "notifications"
+#define EMPATHY_PREFERENCES_STR_TAB_SOUNDS "sounds"
+#define EMPATHY_PREFERENCES_STR_TAB_CALLS "calls"
+#define EMPATHY_PREFERENCES_STR_TAB_LOCATION "location"
+#define EMPATHY_PREFERENCES_STR_TAB_SPELL "spell"
+#define EMPATHY_PREFERENCES_STR_TAB_THEMES "themes"
+
GType empathy_preferences_get_type (void);
GtkWidget *empathy_preferences_new (GtkWindow *parent);
void empathy_preferences_show_tab (EmpathyPreferences *self,
- gint tab);
+ const gchar *tab);
G_END_DECLS
#endif /* __EMPATHY_PREFERENCES_H__ */
-
-
gboolean no_connect;
gboolean start_hidden;
gboolean show_preferences;
- gint preferences_tab;
+ gchar *preferences_tab;
gboolean activated;
void (*finalize) (GObject *) =
G_OBJECT_CLASS (empathy_app_parent_class)->finalize;
+ g_free (self->preferences_tab);
+
if (self->window != NULL)
gtk_widget_destroy (self->window);
self->show_preferences = TRUE;
- self->preferences_tab = -1;
-
- if (value != NULL)
- self->preferences_tab = atoi (value);
+ g_free (self->preferences_tab);
+ self->preferences_tab = g_strdup (value);
return TRUE;
}