aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/empathy-accounts-dialog.ui43
-rw-r--r--src/empathy-call-window-fullscreen.c6
-rw-r--r--src/empathy-call-window.c12
-rw-r--r--src/empathy-chat-window.c38
-rw-r--r--src/empathy-debug-dialog.c4
-rw-r--r--src/empathy-main-window.c226
-rw-r--r--src/empathy-main-window.ui57
-rw-r--r--src/empathy-new-chatroom-dialog.ui43
-rw-r--r--src/empathy-preferences.c223
-rw-r--r--src/empathy-preferences.ui138
-rw-r--r--src/empathy-sidebar.c2
-rw-r--r--src/empathy.c65
-rw-r--r--src/ephy-spinner.c4
13 files changed, 399 insertions, 462 deletions
diff --git a/src/empathy-accounts-dialog.ui b/src/empathy-accounts-dialog.ui
index a76b4ae7f..7c899a3cb 100644
--- a/src/empathy-accounts-dialog.ui
+++ b/src/empathy-accounts-dialog.ui
@@ -2,6 +2,10 @@
<interface>
<requires lib="gtk+" version="2.16"/>
<!-- interface-naming-policy toplevel-contextual -->
+ <object class="GtkImage" id="add_image">
+ <property name="stock">gtk-add</property>
+ <property name="icon-size">4</property>
+ </object>
<object class="GtkDialog" id="accounts_dialog">
<property name="border_width">5</property>
<property name="title" translatable="yes">Accounts</property>
@@ -56,42 +60,9 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
- <child>
- <object class="GtkAlignment" id="alignment2">
- <property name="visible">True</property>
- <property name="xscale">0</property>
- <property name="yscale">0</property>
- <child>
- <object class="GtkHBox" id="hbox2">
- <property name="visible">True</property>
- <property name="spacing">2</property>
- <child>
- <object class="GtkImage" id="image2">
- <property name="visible">True</property>
- <property name="stock">gtk-add</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label3">
- <property name="visible">True</property>
- <property name="label" translatable="yes">_Add...</property>
- <property name="use_underline">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- </child>
- </object>
- </child>
+ <property name="image">add_image</property>
+ <property name="label" translatable="yes">_Add...</property>
+ <property name="use_underline">True</property>
</object>
<packing>
<property name="position">0</property>
diff --git a/src/empathy-call-window-fullscreen.c b/src/empathy-call-window-fullscreen.c
index 33f4085b3..e1c3d7a39 100644
--- a/src/empathy-call-window-fullscreen.c
+++ b/src/empathy-call-window-fullscreen.c
@@ -71,11 +71,11 @@ empathy_call_window_fullscreen_set_cursor_visible (
if (priv->video_widget != NULL && !show_cursor)
{
- gdk_window_set_cursor (priv->video_widget->window,
+ gdk_window_set_cursor (gtk_widget_get_window (priv->video_widget),
gdk_cursor_new (GDK_BLANK_CURSOR));
}
else
- gdk_window_set_cursor (priv->video_widget->window, NULL);
+ gdk_window_set_cursor (gtk_widget_get_window (priv->video_widget), NULL);
}
static void
@@ -130,7 +130,7 @@ empathy_call_window_fullscreen_show_popup (EmpathyCallWindowFullscreen *self)
screen = gtk_window_get_screen (GTK_WINDOW (priv->parent_window));
gdk_screen_get_monitor_geometry (screen,
gdk_screen_get_monitor_at_window (screen,
- GTK_WIDGET (priv->parent_window)->window),
+ gtk_widget_get_window (GTK_WIDGET (priv->parent_window))),
&fullscreen_rect);
/* Getting the popup window sizes */
diff --git a/src/empathy-call-window.c b/src/empathy-call-window.c
index a71e9c8be..520a92821 100644
--- a/src/empathy-call-window.c
+++ b/src/empathy-call-window.c
@@ -809,7 +809,6 @@ static void
init_contact_avatar_with_size (EmpathyContact *contact, GtkWidget *image_widget,
gint size)
{
-
GdkPixbuf *pixbuf_avatar = NULL;
if (contact != NULL)
@@ -1347,6 +1346,8 @@ empathy_call_window_connected (gpointer user_data)
EmpathyCallWindow *self = EMPATHY_CALL_WINDOW (user_data);
EmpathyCallWindowPriv *priv = GET_PRIV (self);
EmpathyTpCall *call;
+ gboolean can_send_video = priv->video_input != NULL && priv->contact != NULL
+ && empathy_contact_can_voip_video (priv->contact);
g_object_get (priv->handler, "tp-call", &call, NULL);
@@ -1357,9 +1358,10 @@ empathy_call_window_connected (gpointer user_data)
gtk_widget_set_sensitive (priv->dtmf_panel, TRUE);
if (priv->video_input == NULL)
- empathy_call_window_set_send_video (self, FALSE);
+ empathy_call_window_set_send_video (self, FALSE);
- priv->sending_video = empathy_tp_call_is_sending_video (call);
+ priv->sending_video = can_send_video ?
+ empathy_tp_call_is_sending_video (call) : FALSE;
gtk_action_set_sensitive (priv->show_preview, TRUE);
gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (priv->show_preview),
@@ -1370,8 +1372,8 @@ empathy_call_window_connected (gpointer user_data)
gtk_toggle_tool_button_set_active (
GTK_TOGGLE_TOOL_BUTTON (priv->camera_button),
priv->sending_video && priv->video_input != NULL);
- gtk_widget_set_sensitive (priv->camera_button, priv->video_input != NULL);
- gtk_action_set_sensitive (priv->send_video, priv->video_input != NULL);
+ gtk_widget_set_sensitive (priv->camera_button, can_send_video);
+ gtk_action_set_sensitive (priv->send_video, can_send_video);
gtk_action_set_sensitive (priv->redial, FALSE);
gtk_widget_set_sensitive (priv->redial_button, FALSE);
diff --git a/src/empathy-chat-window.c b/src/empathy-chat-window.c
index 937e68aff..03644026b 100644
--- a/src/empathy-chat-window.c
+++ b/src/empathy-chat-window.c
@@ -175,7 +175,7 @@ chat_tab_style_set_cb (GtkWidget *hbox,
"chat-window-tab-close-button");
context = gtk_widget_get_pango_context (hbox);
- metrics = pango_context_get_metrics (context, hbox->style->font_desc,
+ metrics = pango_context_get_metrics (context, gtk_widget_get_style (hbox)->font_desc,
pango_context_get_language (context));
char_width = pango_font_metrics_get_approximate_char_width (metrics);
pango_font_metrics_unref (metrics);
@@ -994,6 +994,24 @@ chat_window_show_or_update_notification (EmpathyChatWindow *window,
}
static void
+chat_window_set_highlight_room_tab_label (EmpathyChat *chat)
+{
+ gchar *markup;
+ GtkWidget *widget;
+
+ if (empathy_chat_is_room (chat) == FALSE)
+ return;
+
+ markup = g_markup_printf_escaped ("<span color=\"%s\">%s</span>",
+ "red",
+ empathy_chat_get_name (chat));
+
+ widget = g_object_get_data (G_OBJECT (chat), "chat-window-tab-label");
+ gtk_label_set_markup (GTK_LABEL (widget), markup);
+ g_free (markup);
+}
+
+static void
chat_window_new_message_cb (EmpathyChat *chat,
EmpathyMessage *message,
EmpathyChatWindow *window)
@@ -1025,6 +1043,11 @@ chat_window_new_message_cb (EmpathyChat *chat,
return;
}
+ if (!g_list_find (priv->chats_new_msg, chat)) {
+ priv->chats_new_msg = g_list_prepend (priv->chats_new_msg, chat);
+ chat_window_update_chat_tab (chat);
+ }
+
/* If empathy_chat_is_room () returns TRUE, that means it's a named MUC.
* If empathy_chat_get_remote_contact () returns NULL, that means it's
* an unamed MUC (msn-like).
@@ -1038,18 +1061,15 @@ chat_window_new_message_cb (EmpathyChat *chat,
}
if (needs_urgency) {
- if (!has_focus)
+ if (!has_focus) {
chat_window_set_urgency_hint (window, TRUE);
+ chat_window_set_highlight_room_tab_label (chat);
+ }
empathy_sound_play (GTK_WIDGET (priv->dialog),
EMPATHY_SOUND_MESSAGE_INCOMING);
chat_window_show_or_update_notification (window, message, chat);
}
-
- if (!g_list_find (priv->chats_new_msg, chat)) {
- priv->chats_new_msg = g_list_prepend (priv->chats_new_msg, chat);
- chat_window_update_chat_tab (chat);
- }
}
static GtkNotebook *
@@ -1241,7 +1261,7 @@ chat_window_drag_data_received (GtkWidget *widget,
const gchar *account_id;
const gchar *contact_id;
- id = (const gchar*) selection->data;
+ id = (const gchar*) gtk_selection_data_get_data (selection);
account_manager = empathy_account_manager_dup_singleton ();
DEBUG ("DND contact from roster with id:'%s'", id);
@@ -1298,7 +1318,7 @@ chat_window_drag_data_received (GtkWidget *widget,
DEBUG ("DND tab");
- chat = (void *) selection->data;
+ chat = (void *) gtk_selection_data_get_data (selection);
old_window = chat_window_find_chat (*chat);
if (old_window) {
diff --git a/src/empathy-debug-dialog.c b/src/empathy-debug-dialog.c
index 9b420fd02..d71542db0 100644
--- a/src/empathy-debug-dialog.c
+++ b/src/empathy-debug-dialog.c
@@ -212,7 +212,7 @@ debug_dialog_set_toolbar_sensitivity (EmpathyDebugDialog *debug_dialog,
gboolean sensitive)
{
EmpathyDebugDialogPriv *priv = GET_PRIV (debug_dialog);
- GtkWidget *vbox = GTK_DIALOG (debug_dialog)->vbox;
+ GtkWidget *vbox = gtk_dialog_get_content_area (GTK_DIALOG (debug_dialog));
gtk_widget_set_sensitive (GTK_WIDGET (priv->save_button), sensitive);
gtk_widget_set_sensitive (GTK_WIDGET (priv->copy_button), sensitive);
@@ -944,7 +944,7 @@ debug_dialog_constructor (GType type,
gtk_window_set_title (GTK_WINDOW (object), _("Debug Window"));
gtk_window_set_default_size (GTK_WINDOW (object), 800, 400);
- vbox = GTK_DIALOG (object)->vbox;
+ vbox = gtk_dialog_get_content_area (GTK_DIALOG (object));
toolbar = gtk_toolbar_new ();
gtk_toolbar_set_style (GTK_TOOLBAR (toolbar), GTK_TOOLBAR_BOTH_HORIZ);
diff --git a/src/empathy-main-window.c b/src/empathy-main-window.c
index 05eb0774e..4a9f80f76 100644
--- a/src/empathy-main-window.c
+++ b/src/empathy-main-window.c
@@ -92,6 +92,12 @@ typedef struct {
GtkWidget *presence_chooser;
GtkWidget *errors_vbox;
+ GtkRadioAction *sort_by_name;
+ GtkRadioAction *sort_by_status;
+ GtkRadioAction *normal_with_avatars;
+ GtkRadioAction *normal_size;
+ GtkRadioAction *compact_size;
+
GtkUIManager *ui_manager;
GtkAction *view_history;
GtkAction *room_join_favorites;
@@ -602,7 +608,7 @@ main_window_accels_load (void)
{
gchar *filename;
- filename = g_build_filename (g_get_home_dir (), ".gnome2", PACKAGE_NAME, ACCELS_FILENAME, NULL);
+ filename = g_build_filename (g_get_user_config_dir (), PACKAGE_NAME, ACCELS_FILENAME, NULL);
if (g_file_test (filename, G_FILE_TEST_EXISTS)) {
DEBUG ("Loading from:'%s'", filename);
gtk_accel_map_load (filename);
@@ -617,7 +623,7 @@ main_window_accels_save (void)
gchar *dir;
gchar *file_with_path;
- dir = g_build_filename (g_get_home_dir (), ".gnome2", PACKAGE_NAME, NULL);
+ dir = g_build_filename (g_get_user_config_dir (), PACKAGE_NAME, NULL);
g_mkdir_with_parents (dir, S_IRUSR | S_IWUSR | S_IXUSR);
file_with_path = g_build_filename (dir, ACCELS_FILENAME, NULL);
g_free (dir);
@@ -714,6 +720,120 @@ main_window_view_show_offline_cb (GtkToggleAction *action,
}
static void
+main_window_notify_sort_contact_cb (EmpathyConf *conf,
+ const gchar *key,
+ EmpathyMainWindow *window)
+{
+ gchar *str = NULL;
+
+ if (empathy_conf_get_string (conf, key, &str) && str) {
+ GType type;
+ GEnumClass *enum_class;
+ GEnumValue *enum_value;
+
+ type = empathy_contact_list_store_sort_get_type ();
+ enum_class = G_ENUM_CLASS (g_type_class_peek (type));
+ enum_value = g_enum_get_value_by_nick (enum_class, str);
+ if (enum_value) {
+ /* By changing the value of the GtkRadioAction,
+ it emits a signal that calls main_window_view_sort_contacts_cb
+ which updates the contacts list */
+ gtk_radio_action_set_current_value (window->sort_by_name,
+ enum_value->value);
+ } else {
+ g_warning ("Wrong value for sort_criterium configuration : %s", str);
+ }
+ g_free (str);
+ }
+}
+
+static void
+main_window_view_sort_contacts_cb (GtkRadioAction *action,
+ GtkRadioAction *current,
+ EmpathyMainWindow *window)
+{
+ EmpathyContactListStoreSort value;
+ GSList *group;
+ GType type;
+ GEnumClass *enum_class;
+ GEnumValue *enum_value;
+
+ value = gtk_radio_action_get_current_value (action);
+ group = gtk_radio_action_get_group (action);
+
+ /* Get string from index */
+ type = empathy_contact_list_store_sort_get_type ();
+ enum_class = G_ENUM_CLASS (g_type_class_peek (type));
+ enum_value = g_enum_get_value (enum_class, g_slist_index (group, current));
+
+ if (!enum_value) {
+ g_warning ("No GEnumValue for EmpathyContactListSort with GtkRadioAction index:%d",
+ g_slist_index (group, action));
+ } else {
+ empathy_conf_set_string (empathy_conf_get (),
+ EMPATHY_PREFS_CONTACTS_SORT_CRITERIUM,
+ enum_value->value_nick);
+ }
+ empathy_contact_list_store_set_sort_criterium (window->list_store, value);
+}
+
+/* Matches GtkRadioAction values set in empathy-main-window.ui */
+#define CONTACT_LIST_NORMAL_SIZE_WITH_AVATARS 0
+#define CONTACT_LIST_NORMAL_SIZE 1
+#define CONTACT_LIST_COMPACT_SIZE 2
+
+static void
+main_window_view_contacts_list_size_cb (GtkRadioAction *action,
+ GtkRadioAction *current,
+ EmpathyMainWindow *window)
+{
+ gint value;
+
+ value = gtk_radio_action_get_current_value (action);
+
+ empathy_conf_set_bool (empathy_conf_get (),
+ EMPATHY_PREFS_UI_SHOW_AVATARS,
+ value == CONTACT_LIST_NORMAL_SIZE_WITH_AVATARS);
+ empathy_conf_set_bool (empathy_conf_get (),
+ EMPATHY_PREFS_UI_COMPACT_CONTACT_LIST,
+ value == CONTACT_LIST_COMPACT_SIZE);
+
+ empathy_contact_list_store_set_show_avatars (window->list_store,
+ value == CONTACT_LIST_NORMAL_SIZE_WITH_AVATARS);
+ empathy_contact_list_store_set_is_compact (window->list_store,
+ value == CONTACT_LIST_COMPACT_SIZE);
+}
+
+static void
+main_window_notify_contact_list_size_cb (EmpathyConf *conf,
+ const gchar *key,
+ EmpathyMainWindow *window)
+{
+ gboolean show_avatars;
+ gboolean compact_contact_list;
+ gint value = CONTACT_LIST_NORMAL_SIZE_WITH_AVATARS;
+
+ if (empathy_conf_get_bool (conf,
+ EMPATHY_PREFS_UI_SHOW_AVATARS,
+ &show_avatars)
+ && empathy_conf_get_bool (conf,
+ EMPATHY_PREFS_UI_COMPACT_CONTACT_LIST,
+ &compact_contact_list)) {
+ if (compact_contact_list) {
+ value = CONTACT_LIST_COMPACT_SIZE;
+ } else if (show_avatars) {
+ value = CONTACT_LIST_NORMAL_SIZE_WITH_AVATARS;
+ } else {
+ value = CONTACT_LIST_NORMAL_SIZE;
+ }
+ }
+ /* By changing the value of the GtkRadioAction,
+ it emits a signal that calls main_window_view_contacts_list_size_cb
+ which updates the contacts list */
+ gtk_radio_action_set_current_value (window->normal_with_avatars, value);
+}
+
+static void
main_window_view_show_map_cb (GtkCheckMenuItem *item,
EmpathyMainWindow *window)
{
@@ -1022,56 +1142,6 @@ main_window_notify_show_offline_cb (EmpathyConf *conf,
}
static void
-main_window_notify_show_avatars_cb (EmpathyConf *conf,
- const gchar *key,
- EmpathyMainWindow *window)
-{
- gboolean show_avatars;
-
- if (empathy_conf_get_bool (conf, key, &show_avatars)) {
- empathy_contact_list_store_set_show_avatars (window->list_store,
- show_avatars);
- }
-}
-
-static void
-main_window_notify_compact_contact_list_cb (EmpathyConf *conf,
- const gchar *key,
- EmpathyMainWindow *window)
-{
- gboolean compact_contact_list;
-
- if (empathy_conf_get_bool (conf, key, &compact_contact_list)) {
- empathy_contact_list_store_set_is_compact (window->list_store,
- compact_contact_list);
- }
-}
-
-static void
-main_window_notify_sort_criterium_cb (EmpathyConf *conf,
- const gchar *key,
- EmpathyMainWindow *window)
-{
- gchar *str = NULL;
-
- if (empathy_conf_get_string (conf, key, &str) && str) {
- GType type;
- GEnumClass *enum_class;
- GEnumValue *enum_value;
-
- type = empathy_contact_list_store_sort_get_type ();
- enum_class = G_ENUM_CLASS (g_type_class_peek (type));
- enum_value = g_enum_get_value_by_nick (enum_class, str);
- g_free (str);
-
- if (enum_value) {
- empathy_contact_list_store_set_sort_criterium (window->list_store,
- enum_value->value);
- }
- }
-}
-
-static void
main_window_connection_items_setup (EmpathyMainWindow *window,
GtkBuilder *gui)
{
@@ -1112,8 +1182,6 @@ empathy_main_window_show (void)
GtkAction *show_map_widget;
GtkToolItem *item;
gboolean show_offline;
- gboolean show_avatars;
- gboolean compact_contact_list;
gint x, y, w, h;
gchar *filename;
GSList *l;
@@ -1133,6 +1201,11 @@ empathy_main_window_show (void)
"errors_vbox", &window->errors_vbox,
"ui_manager", &window->ui_manager,
"view_show_offline", &show_offline_widget,
+ "view_sort_by_name", &window->sort_by_name,
+ "view_sort_by_status", &window->sort_by_status,
+ "view_normal_size_with_avatars", &window->normal_with_avatars,
+ "view_normal_size", &window->normal_size,
+ "view_compact_size", &window->compact_size,
"view_history", &window->view_history,
"view_show_map", &show_map_widget,
"room_join_favorites", &window->room_join_favorites,
@@ -1153,6 +1226,8 @@ empathy_main_window_show (void)
"chat_add_contact", "activate", main_window_chat_add_contact_cb,
"view_show_ft_manager", "activate", main_window_view_show_ft_manager,
"view_show_offline", "toggled", main_window_view_show_offline_cb,
+ "view_sort_by_name", "changed", main_window_view_sort_contacts_cb,
+ "view_normal_size_with_avatars", "changed", main_window_view_contacts_list_size_cb,
"view_show_map", "activate", main_window_view_show_map_cb,
"edit", "activate", main_window_edit_cb,
"edit_accounts", "activate", main_window_edit_accounts_cb,
@@ -1303,34 +1378,29 @@ empathy_main_window_show (void)
gtk_toggle_action_set_active (show_offline_widget, show_offline);
- /* Show avatars ? */
- empathy_conf_get_bool (conf,
- EMPATHY_PREFS_UI_SHOW_AVATARS,
- &show_avatars);
+ /* Sort by name / by status ? */
empathy_conf_notify_add (conf,
- EMPATHY_PREFS_UI_SHOW_AVATARS,
- (EmpathyConfNotifyFunc) main_window_notify_show_avatars_cb,
- window);
- empathy_contact_list_store_set_show_avatars (window->list_store, show_avatars);
+ EMPATHY_PREFS_CONTACTS_SORT_CRITERIUM,
+ (EmpathyConfNotifyFunc) main_window_notify_sort_contact_cb,
+ window);
- /* Is compact ? */
- empathy_conf_get_bool (conf,
- EMPATHY_PREFS_UI_COMPACT_CONTACT_LIST,
- &compact_contact_list);
- empathy_conf_notify_add (conf,
- EMPATHY_PREFS_UI_COMPACT_CONTACT_LIST,
- (EmpathyConfNotifyFunc) main_window_notify_compact_contact_list_cb,
- window);
- empathy_contact_list_store_set_is_compact (window->list_store, compact_contact_list);
+ main_window_notify_sort_contact_cb (conf,
+ EMPATHY_PREFS_CONTACTS_SORT_CRITERIUM,
+ window);
- /* Sort criterium */
+ /* Contacts list size */
empathy_conf_notify_add (conf,
- EMPATHY_PREFS_CONTACTS_SORT_CRITERIUM,
- (EmpathyConfNotifyFunc) main_window_notify_sort_criterium_cb,
- window);
- main_window_notify_sort_criterium_cb (conf,
- EMPATHY_PREFS_CONTACTS_SORT_CRITERIUM,
- window);
+ EMPATHY_PREFS_UI_COMPACT_CONTACT_LIST,
+ (EmpathyConfNotifyFunc) main_window_notify_contact_list_size_cb,
+ window);
+ empathy_conf_notify_add (conf,
+ EMPATHY_PREFS_UI_SHOW_AVATARS,
+ (EmpathyConfNotifyFunc) main_window_notify_contact_list_size_cb,
+ window);
+
+ main_window_notify_contact_list_size_cb (conf,
+ EMPATHY_PREFS_UI_SHOW_AVATARS,
+ window);
main_window_update_status (window, window->account_manager);
diff --git a/src/empathy-main-window.ui b/src/empathy-main-window.ui
index f914979f6..85d4a0559 100644
--- a/src/empathy-main-window.ui
+++ b/src/empathy-main-window.ui
@@ -99,6 +99,56 @@
</object>
</child>
<child>
+ <object class="GtkRadioAction" id="view_sort_by_name">
+ <property name="name">view_sort_by_name</property>
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Sort by _Name</property>
+ <property name="draw_as_radio">True</property>
+ <property name="value">1</property>
+ <property name="current-value">1</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkRadioAction" id="view_sort_by_status">
+ <property name="name">view_sort_by_status</property>
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Sort by _Status</property>
+ <property name="draw_as_radio">True</property>
+ <property name="group">view_sort_by_name</property>
+ <property name="value">0</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkRadioAction" id="view_normal_size_with_avatars">
+ <property name="name">view_normal_size_with_avatars</property>
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Normal Size With _Avatars</property>
+ <property name="draw_as_radio">True</property>
+ <property name="value">0</property>
+ <property name="current-value">0</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkRadioAction" id="view_normal_size">
+ <property name="name">view_normal_size</property>
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">N_ormal Size</property>
+ <property name="draw_as_radio">True</property>
+ <property name="group">view_normal_size_with_avatars</property>
+ <property name="value">1</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkRadioAction" id="view_compact_size">
+ <property name="name">view_compact_size</property>
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Compact Size</property>
+ <property name="draw_as_radio">True</property>
+ <property name="group">view_normal_size_with_avatars</property>
+ <property name="value">2</property>
+ </object>
+ </child>
+ <child>
<object class="GtkAction" id="room">
<property name="name">room</property>
<property name="label" translatable="yes">_Room</property>
@@ -172,6 +222,13 @@
<menu action="view">
<menuitem action="view_show_offline"/>
<separator/>
+ <menuitem action="view_sort_by_name"/>
+ <menuitem action="view_sort_by_status"/>
+ <separator/>
+ <menuitem action="view_normal_size_with_avatars"/>
+ <menuitem action="view_normal_size"/>
+ <menuitem action="view_compact_size"/>
+ <separator/>
<menuitem action="view_history"/>
<menuitem action="view_show_ft_manager"/>
<menuitem action="view_show_map"/>
diff --git a/src/empathy-new-chatroom-dialog.ui b/src/empathy-new-chatroom-dialog.ui
index a8fccf4a0..c2fb13470 100644
--- a/src/empathy-new-chatroom-dialog.ui
+++ b/src/empathy-new-chatroom-dialog.ui
@@ -2,6 +2,10 @@
<interface>
<requires lib="gtk+" version="2.16"/>
<!-- interface-naming-policy toplevel-contextual -->
+ <object class="GtkImage" id="join_image">
+ <property name="stock">gtk-jump-to</property>
+ <property name="icon-size">4</property>
+ </object>
<object class="GtkDialog" id="new_chatroom_dialog">
<property name="visible">True</property>
<property name="border_width">5</property>
@@ -245,42 +249,9 @@
<property name="can_default">True</property>
<property name="has_default">True</property>
<property name="receives_default">False</property>
- <child>
- <object class="GtkAlignment" id="alignment4">
- <property name="visible">True</property>
- <property name="xscale">0</property>
- <property name="yscale">0</property>
- <child>
- <object class="GtkHBox" id="hbox29">
- <property name="visible">True</property>
- <property name="spacing">2</property>
- <child>
- <object class="GtkImage" id="image4">
- <property name="visible">True</property>
- <property name="stock">gtk-jump-to</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label79">
- <property name="visible">True</property>
- <property name="label" translatable="yes">_Join</property>
- <property name="use_underline">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- </child>
- </object>
- </child>
+ <property name="image">join_image</property>
+ <property name="label" translatable="yes">_Join</property>
+ <property name="use_underline">True</property>
</object>
<packing>
<property name="expand">False</property>
diff --git a/src/empathy-preferences.c b/src/empathy-preferences.c
index 0e2299cac..65c496547 100644
--- a/src/empathy-preferences.c
+++ b/src/empathy-preferences.c
@@ -28,6 +28,7 @@
#include <gtk/gtk.h>
#include <glib/gi18n.h>
+#include <telepathy-glib/dbus.h>
#include <libempathy/empathy-utils.h>
@@ -49,18 +50,11 @@ typedef struct {
GtkWidget *notebook;
- GtkWidget *checkbutton_show_avatars;
- GtkWidget *checkbutton_compact_contact_list;
GtkWidget *checkbutton_show_smileys;
GtkWidget *checkbutton_show_contacts_in_rooms;
GtkWidget *combobox_chat_theme;
- GtkWidget *hbox_adium_theme;
- GtkWidget *filechooserbutton_adium_theme;
- GtkWidget *label_invalid_adium_theme;
GtkWidget *checkbutton_separate_chat_windows;
GtkWidget *checkbutton_autoconnect;
- GtkWidget *radiobutton_contact_list_sort_by_name;
- GtkWidget *radiobutton_contact_list_sort_by_state;
GtkWidget *checkbutton_sounds_enabled;
GtkWidget *checkbutton_sounds_disabled_away;
@@ -101,11 +95,6 @@ static void preferences_languages_cell_toggled_cb (GtkCellRendererToggle
EmpathyPreferences *preferences);
static void preferences_widget_sync_bool (const gchar *key,
GtkWidget *widget);
-static void preferences_widget_sync_string (const gchar *key,
- GtkWidget *widget);
-static void preferences_notify_string_cb (EmpathyConf *conf,
- const gchar *key,
- gpointer user_data);
static void preferences_notify_bool_cb (EmpathyConf *conf,
const gchar *key,
gpointer user_data);
@@ -115,16 +104,11 @@ static void preferences_notify_sensitivity_cb (EmpathyConf
static void preferences_hookup_toggle_button (EmpathyPreferences *preferences,
const gchar *key,
GtkWidget *widget);
-static void preferences_hookup_radio_button (EmpathyPreferences *preferences,
- const gchar *key,
- GtkWidget *widget);
static void preferences_hookup_sensitivity (EmpathyPreferences *preferences,
const gchar *key,
GtkWidget *widget);
static void preferences_toggle_button_toggled_cb (GtkWidget *button,
gpointer user_data);
-static void preferences_radio_button_toggled_cb (GtkWidget *button,
- gpointer user_data);
static void preferences_destroy_cb (GtkWidget *widget,
EmpathyPreferences *preferences);
static void preferences_response_cb (GtkWidget *widget,
@@ -139,8 +123,10 @@ enum {
};
enum {
+ COL_COMBO_IS_ADIUM,
COL_COMBO_VISIBLE_NAME,
COL_COMBO_NAME,
+ COL_COMBO_PATH,
COL_COMBO_COUNT
};
@@ -175,24 +161,8 @@ preferences_add_id (EmpathyPreferences *preferences, guint id)
}
static void
-preferences_compact_contact_list_changed_cb (EmpathyConf *conf,
- const gchar *key,
- gpointer user_data)
-{
- EmpathyPreferences *preferences = user_data;
- gboolean value;
-
- if (empathy_conf_get_bool (empathy_conf_get (), key, &value)) {
- gtk_widget_set_sensitive (preferences->checkbutton_show_avatars,
- !value);
- }
-}
-
-static void
preferences_setup_widgets (EmpathyPreferences *preferences)
{
- guint id;
-
preferences_hookup_toggle_button (preferences,
EMPATHY_PREFS_NOTIFICATIONS_ENABLED,
preferences->checkbutton_notifications_enabled);
@@ -241,14 +211,6 @@ preferences_setup_widgets (EmpathyPreferences *preferences)
preferences->checkbutton_separate_chat_windows);
preferences_hookup_toggle_button (preferences,
- EMPATHY_PREFS_UI_SHOW_AVATARS,
- preferences->checkbutton_show_avatars);
-
- preferences_hookup_toggle_button (preferences,
- EMPATHY_PREFS_UI_COMPACT_CONTACT_LIST,
- preferences->checkbutton_compact_contact_list);
-
- preferences_hookup_toggle_button (preferences,
EMPATHY_PREFS_CHAT_SHOW_SMILEYS,
preferences->checkbutton_show_smileys);
@@ -256,10 +218,6 @@ preferences_setup_widgets (EmpathyPreferences *preferences)
EMPATHY_PREFS_CHAT_SHOW_CONTACTS_IN_ROOMS,
preferences->checkbutton_show_contacts_in_rooms);
- preferences_hookup_radio_button (preferences,
- EMPATHY_PREFS_CONTACTS_SORT_CRITERIUM,
- preferences->radiobutton_contact_list_sort_by_name);
-
preferences_hookup_toggle_button (preferences,
EMPATHY_PREFS_AUTOCONNECT,
preferences->checkbutton_autoconnect);
@@ -295,17 +253,6 @@ preferences_setup_widgets (EmpathyPreferences *preferences)
preferences_hookup_sensitivity (preferences,
EMPATHY_PREFS_LOCATION_PUBLISH,
preferences->checkbutton_location_reduce_accuracy);
-
- id = empathy_conf_notify_add (empathy_conf_get (),
- EMPATHY_PREFS_UI_COMPACT_CONTACT_LIST,
- preferences_compact_contact_list_changed_cb,
- preferences);
- if (id) {
- preferences_add_id (preferences, id);
- }
- preferences_compact_contact_list_changed_cb (empathy_conf_get (),
- EMPATHY_PREFS_UI_COMPACT_CONTACT_LIST,
- preferences);
}
static void
@@ -659,6 +606,7 @@ preferences_widget_sync_bool (const gchar *key, GtkWidget *widget)
}
}
+#if 0
static void
preferences_widget_sync_string (const gchar *key, GtkWidget *widget)
{
@@ -701,7 +649,7 @@ preferences_notify_string_cb (EmpathyConf *conf,
{
preferences_widget_sync_string (key, user_data);
}
-
+#endif
static void
preferences_notify_bool_cb (EmpathyConf *conf,
@@ -849,6 +797,7 @@ preferences_hookup_toggle_button (EmpathyPreferences *preferences,
}
}
+#if 0
static void
preferences_hookup_radio_button (EmpathyPreferences *preferences,
const gchar *key,
@@ -878,6 +827,7 @@ preferences_hookup_radio_button (EmpathyPreferences *preferences,
preferences_add_id (preferences, id);
}
}
+#endif
static void
preferences_hookup_sensitivity (EmpathyPreferences *preferences,
@@ -913,6 +863,7 @@ preferences_toggle_button_toggled_cb (GtkWidget *button,
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button)));
}
+#if 0
static void
preferences_radio_button_toggled_cb (GtkWidget *button,
gpointer user_data)
@@ -952,73 +903,7 @@ preferences_radio_button_toggled_cb (GtkWidget *button,
empathy_conf_set_string (empathy_conf_get (), key, value);
}
-
-
-static void
-preferences_theme_adium_update_visibility (EmpathyPreferences *preferences,
- const gchar *name)
-{
- if (name && strcmp (name, "adium") == 0) {
- gtk_widget_show (preferences->hbox_adium_theme);
- } else {
- gtk_widget_hide (preferences->hbox_adium_theme);
- gtk_widget_hide (preferences->label_invalid_adium_theme);
- }
-}
-
-static void
-preferences_theme_adium_update_validity (EmpathyPreferences *preferences,
- const gchar *path)
-{
-#ifdef HAVE_WEBKIT
- if (empathy_adium_path_is_valid (path)) {
- gtk_widget_hide (preferences->label_invalid_adium_theme);
- } else {
- gtk_widget_show (preferences->label_invalid_adium_theme);
- }
#endif
-}
-
-static void
-preferences_theme_adium_path_notify_cb (EmpathyConf *conf,
- const gchar *key,
- gpointer user_data)
-{
- EmpathyPreferences *preferences = user_data;
- GtkFileChooser *chooser;
- gchar *value;
- const gchar *path;
-
- if (!empathy_conf_get_string (conf, key, &value)) {
- return;
- }
-
- if (EMP_STR_EMPTY (value)) {
- path = g_get_home_dir ();
- } else {
- path = value;
- }
-
- chooser = GTK_FILE_CHOOSER (preferences->filechooserbutton_adium_theme);
- gtk_file_chooser_set_current_folder (chooser, path);
- preferences_theme_adium_update_validity (preferences, path);
- g_free (value);
-}
-
-static void
-preferences_theme_adium_file_set_cb (GtkFileChooser *chooser,
- EmpathyPreferences *preferences)
-{
- gchar *path;
-
- path = gtk_file_chooser_get_current_folder (chooser);
- empathy_conf_set_string (empathy_conf_get (),
- EMPATHY_PREFS_CHAT_ADIUM_PATH,
- path);
- preferences_theme_adium_update_validity (preferences, path);
-
- g_free (path);
-}
static void
preferences_theme_notify_cb (EmpathyConf *conf,
@@ -1027,34 +912,48 @@ preferences_theme_notify_cb (EmpathyConf *conf,
{
EmpathyPreferences *preferences = user_data;
GtkComboBox *combo;
- gchar *value;
+ gchar *conf_name;
+ gchar *conf_path;
GtkTreeModel *model;
GtkTreeIter iter;
gboolean found = FALSE;
- if (!empathy_conf_get_string (conf, key, &value)) {
+ if (!empathy_conf_get_string (conf, EMPATHY_PREFS_CHAT_THEME, &conf_name)) {
return;
}
- preferences_theme_adium_update_visibility (preferences, value);
+ if (!empathy_conf_get_string (conf, EMPATHY_PREFS_CHAT_ADIUM_PATH, &conf_path)) {
+ g_free (conf_name);
+ return;
+ }
combo = GTK_COMBO_BOX (preferences->combobox_chat_theme);
model = gtk_combo_box_get_model (combo);
- if (value && gtk_tree_model_get_iter_first (model, &iter)) {
+ if (gtk_tree_model_get_iter_first (model, &iter)) {
+ gboolean is_adium;
gchar *name;
+ gchar *path;
do {
gtk_tree_model_get (model, &iter,
+ COL_COMBO_IS_ADIUM, &is_adium,
COL_COMBO_NAME, &name,
+ COL_COMBO_PATH, &path,
-1);
- if (strcmp (name, value) == 0) {
- found = TRUE;
- gtk_combo_box_set_active_iter (combo, &iter);
- break;
+ if (strcmp (name, conf_name) == 0) {
+ if (strcmp (name, "adium") != 0 ||
+ strcmp (path, conf_path) == 0) {
+ found = TRUE;
+ gtk_combo_box_set_active_iter (combo, &iter);
+ g_free (name);
+ g_free (path);
+ break;
+ }
}
g_free (name);
+ g_free (path);
} while (gtk_tree_model_iter_next (model, &iter));
}
@@ -1065,7 +964,8 @@ preferences_theme_notify_cb (EmpathyConf *conf,
}
}
- g_free (value);
+ g_free (conf_name);
+ g_free (conf_path);
}
static void
@@ -1074,21 +974,28 @@ preferences_theme_changed_cb (GtkComboBox *combo,
{
GtkTreeModel *model;
GtkTreeIter iter;
+ gboolean is_adium;
gchar *name;
+ gchar *path;
if (gtk_combo_box_get_active_iter (combo, &iter)) {
model = gtk_combo_box_get_model (combo);
gtk_tree_model_get (model, &iter,
+ COL_COMBO_IS_ADIUM, &is_adium,
COL_COMBO_NAME, &name,
+ COL_COMBO_PATH, &path,
-1);
- preferences_theme_adium_update_visibility (preferences, name);
-
empathy_conf_set_string (empathy_conf_get (),
EMPATHY_PREFS_CHAT_THEME,
name);
+ if (is_adium == TRUE)
+ empathy_conf_set_string (empathy_conf_get (),
+ EMPATHY_PREFS_CHAT_ADIUM_PATH,
+ path);
g_free (name);
+ g_free (path);
}
}
@@ -1100,6 +1007,7 @@ preferences_themes_setup (EmpathyPreferences *preferences)
GtkCellRenderer *renderer;
GtkListStore *store;
const gchar **themes;
+ GList *adium_themes;
gint i;
guint id;
@@ -1108,18 +1016,46 @@ preferences_themes_setup (EmpathyPreferences *preferences)
/* Create the model */
store = gtk_list_store_new (COL_COMBO_COUNT,
+ G_TYPE_BOOLEAN, /* Is an Adium theme */
G_TYPE_STRING, /* Display name */
- G_TYPE_STRING); /* Theme name */
+ G_TYPE_STRING, /* Theme name */
+ G_TYPE_STRING); /* Theme path */
+ gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (store),
+ COL_COMBO_VISIBLE_NAME, GTK_SORT_ASCENDING);
/* Fill the model */
themes = empathy_theme_manager_get_themes ();
for (i = 0; themes[i]; i += 2) {
gtk_list_store_insert_with_values (store, NULL, -1,
+ COL_COMBO_IS_ADIUM, FALSE,
COL_COMBO_VISIBLE_NAME, _(themes[i + 1]),
COL_COMBO_NAME, themes[i],
+ COL_COMBO_PATH, NULL,
-1);
}
+ adium_themes = empathy_theme_manager_get_adium_themes ();
+ while (adium_themes != NULL) {
+ GHashTable *info;
+ const gchar *name;
+ const gchar *path;
+
+ info = adium_themes->data;
+ name = tp_asv_get_string (info, "CFBundleName");
+ path = tp_asv_get_string (info, "path");
+
+ if (name != NULL && path != NULL) {
+ gtk_list_store_insert_with_values (store, NULL, -1,
+ COL_COMBO_IS_ADIUM, TRUE,
+ COL_COMBO_VISIBLE_NAME, name,
+ COL_COMBO_NAME, "adium",
+ COL_COMBO_PATH, path,
+ -1);
+ }
+ g_hash_table_unref (info);
+ adium_themes = g_list_delete_link (adium_themes, adium_themes);
+ }
+
/* Add cell renderer */
renderer = gtk_cell_renderer_text_new ();
gtk_cell_layout_pack_start (cell_layout, renderer, TRUE);
@@ -1145,17 +1081,9 @@ preferences_themes_setup (EmpathyPreferences *preferences)
preferences_add_id (preferences, id);
}
- g_signal_connect (preferences->filechooserbutton_adium_theme,
- "file-set",
- G_CALLBACK (preferences_theme_adium_file_set_cb),
- preferences);
- /* Select the adium path from the gconf key and track changes */
- preferences_theme_adium_path_notify_cb (empathy_conf_get (),
- EMPATHY_PREFS_CHAT_ADIUM_PATH,
- preferences);
id = empathy_conf_notify_add (empathy_conf_get (),
EMPATHY_PREFS_CHAT_ADIUM_PATH,
- preferences_theme_adium_path_notify_cb,
+ preferences_theme_notify_cb,
preferences);
if (id) {
preferences_add_id (preferences, id);
@@ -1206,18 +1134,11 @@ empathy_preferences_show (GtkWindow *parent)
gui = empathy_builder_get_file (filename,
"preferences_dialog", &preferences->dialog,
"notebook", &preferences->notebook,
- "checkbutton_show_avatars", &preferences->checkbutton_show_avatars,
- "checkbutton_compact_contact_list", &preferences->checkbutton_compact_contact_list,
"checkbutton_show_smileys", &preferences->checkbutton_show_smileys,
"checkbutton_show_contacts_in_rooms", &preferences->checkbutton_show_contacts_in_rooms,
"combobox_chat_theme", &preferences->combobox_chat_theme,
- "hbox_adium_theme", &preferences->hbox_adium_theme,
- "filechooserbutton_adium_theme", &preferences->filechooserbutton_adium_theme,
- "label_invalid_adium_theme", &preferences->label_invalid_adium_theme,
"checkbutton_separate_chat_windows", &preferences->checkbutton_separate_chat_windows,
"checkbutton_autoconnect", &preferences->checkbutton_autoconnect,
- "radiobutton_contact_list_sort_by_name", &preferences->radiobutton_contact_list_sort_by_name,
- "radiobutton_contact_list_sort_by_state", &preferences->radiobutton_contact_list_sort_by_state,
"checkbutton_notifications_enabled", &preferences->checkbutton_notifications_enabled,
"checkbutton_notifications_disabled_away", &preferences->checkbutton_notifications_disabled_away,
"checkbutton_notifications_focus", &preferences->checkbutton_notifications_focus,
diff --git a/src/empathy-preferences.ui b/src/empathy-preferences.ui
index 38cfd3419..a383607aa 100644
--- a/src/empathy-preferences.ui
+++ b/src/empathy-preferences.ui
@@ -38,38 +38,6 @@
<object class="GtkVBox" id="vbox199">
<property name="visible">True</property>
<child>
- <object class="GtkCheckButton" id="checkbutton_compact_contact_list">
- <property name="label" translatable="yes">Show co_mpact contact list</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="use_underline">True</property>
- <property name="draw_indicator">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkCheckButton" id="checkbutton_show_avatars">
- <property name="label" translatable="yes">Show _avatars</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="tooltip_text" translatable="yes">Avatars are user chosen images shown in the contact list</property>
- <property name="use_underline">True</property>
- <property name="active">True</property>
- <property name="draw_indicator">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
<object class="GtkCheckButton" id="checkbutton_show_smileys">
<property name="label" translatable="yes">Show _smileys as images</property>
<property name="visible">True</property>
@@ -183,68 +151,6 @@
<property name="position">1</property>
</packing>
</child>
- <child>
- <object class="GtkFrame" id="frame13">
- <property name="visible">True</property>
- <property name="label_xalign">0</property>
- <property name="shadow_type">none</property>
- <child>
- <object class="GtkAlignment" id="alignment31">
- <property name="visible">True</property>
- <property name="top_padding">6</property>
- <property name="left_padding">12</property>
- <child>
- <object class="GtkVBox" id="vbox217">
- <property name="visible">True</property>
- <child>
- <object class="GtkRadioButton" id="radiobutton_contact_list_sort_by_name">
- <property name="label" translatable="yes">Sort by _name</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="use_underline">True</property>
- <property name="draw_indicator">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkRadioButton" id="radiobutton_contact_list_sort_by_state">
- <property name="label" translatable="yes">Sort by s_tate</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="use_underline">True</property>
- <property name="draw_indicator">True</property>
- <property name="group">radiobutton_contact_list_sort_by_name</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- </child>
- </object>
- </child>
- <child type="label">
- <object class="GtkLabel" id="label644">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Contact List</property>
- <attributes>
- <attribute name="weight" value="bold"/>
- </attributes>
- </object>
- </child>
- </object>
- <packing>
- <property name="position">2</property>
- </packing>
- </child>
</object>
</child>
<child type="tab">
@@ -851,50 +757,6 @@
<property name="position">0</property>
</packing>
</child>
- <child>
- <object class="GtkHBox" id="hbox_adium_theme">
- <property name="visible">True</property>
- <property name="spacing">6</property>
- <child>
- <object class="GtkLabel" id="label587">
- <property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">Adium theme to use:</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
- <child>
- <object class="GtkFileChooserButton" id="filechooserbutton_adium_theme">
- <property name="visible">True</property>
- <property name="preview_widget_active">False</property>
- <property name="action">GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER</property>
- </object>
- <packing>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label_invalid_adium_theme">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Not a valid adium theme</property>
- <attributes>
- <attribute name="foreground" value="red"/>
- </attributes>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">2</property>
- </packing>
- </child>
</object>
</child>
</object>
diff --git a/src/empathy-sidebar.c b/src/empathy-sidebar.c
index 7b70229e2..85a38267a 100644
--- a/src/empathy-sidebar.c
+++ b/src/empathy-sidebar.c
@@ -243,7 +243,7 @@ empathy_sidebar_menu_position_under (GtkMenu *menu,
widget = GTK_WIDGET (user_data);
- gdk_window_get_origin (widget->window, x, y);
+ gdk_window_get_origin (gtk_widget_get_window (widget), x, y);
*x += widget->allocation.x;
*y += widget->allocation.y + widget->allocation.height;
diff --git a/src/empathy.c b/src/empathy.c
index 3d8fe6e12..4e824bcb4 100644
--- a/src/empathy.c
+++ b/src/empathy.c
@@ -342,6 +342,67 @@ create_salut_account (void)
}
}
+static void
+migrate_config_to_xdg_dir (void)
+{
+ gchar *xdg_dir, *old_dir, *xdg_filename, *old_filename;
+ int i;
+ GFile *xdg_file, *old_file;
+ static const gchar* filenames[] = {
+ "geometry.ini",
+ "irc-networks.xml",
+ "chatrooms.xml",
+ "contact-groups.xml",
+ "status-presets.xml",
+ "accels.txt",
+ NULL
+ };
+
+ xdg_dir = g_build_filename (g_get_user_config_dir (), PACKAGE_NAME, NULL);
+ if (g_file_test (xdg_dir, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR)) {
+ /* xdg config dir already exists */
+ g_free (xdg_dir);
+ return;
+ }
+
+ old_dir = g_build_filename (g_get_home_dir (), ".gnome2", PACKAGE_NAME, NULL);
+ if (!g_file_test (old_dir, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR)) {
+ /* old config dir didn't exist */
+ g_free (xdg_dir);
+ g_free (old_dir);
+ return;
+ }
+
+ if (g_mkdir_with_parents (xdg_dir, (S_IRUSR | S_IWUSR | S_IXUSR)) == -1) {
+ DEBUG ("Failed to create configuration directory; aborting migration");
+ g_free (xdg_dir);
+ g_free (old_dir);
+ return;
+ }
+
+ for (i = 0; filenames[i]; i++) {
+ old_filename = g_build_filename (old_dir, filenames[i], NULL);
+ if (!g_file_test (old_filename, G_FILE_TEST_EXISTS)) {
+ g_free (old_filename);
+ continue;
+ }
+ xdg_filename = g_build_filename (xdg_dir, filenames[i], NULL);
+ old_file = g_file_new_for_path (old_filename);
+ xdg_file = g_file_new_for_path (xdg_filename);
+ if (!g_file_move (old_file, xdg_file, G_FILE_COPY_NONE,
+ NULL, NULL, NULL, NULL)) {
+ DEBUG ("Failed to migrate %s", filenames[i]);
+ }
+ g_free (old_filename);
+ g_free (xdg_filename);
+ g_object_unref (old_file);
+ g_object_unref (xdg_file);
+ }
+
+ g_free (xdg_dir);
+ g_free (old_dir);
+}
+
/* The code that handles single-instance and startup notification is
* copied from gedit.
*
@@ -378,7 +439,7 @@ on_bacon_message_received (const char *message,
gtk_widget_realize (GTK_WIDGET (window));
}
- startup_timestamp = gdk_x11_get_server_time (window->window);
+ startup_timestamp = gdk_x11_get_server_time (gtk_widget_get_window (window));
}
gtk_window_present_with_time (GTK_WINDOW (window), startup_timestamp);
@@ -670,6 +731,8 @@ main (int argc, char *argv[])
g_signal_connect (account_manager, "notify::ready",
G_CALLBACK (account_manager_ready_cb), NULL);
+ migrate_config_to_xdg_dir ();
+
/* Setting up UI */
window = empathy_main_window_show ();
icon = empathy_status_icon_new (GTK_WINDOW (window), hide_contact_list);
diff --git a/src/ephy-spinner.c b/src/ephy-spinner.c
index 30ffa57c1..e7285bc0d 100644
--- a/src/ephy-spinner.c
+++ b/src/ephy-spinner.c
@@ -666,8 +666,8 @@ ephy_spinner_expose (GtkWidget *widget,
return FALSE;
}
- gc = gdk_gc_new (widget->window);
- gdk_draw_pixbuf (widget->window, gc, pixbuf,
+ gc = gdk_gc_new (gtk_widget_get_window (widget));
+ gdk_draw_pixbuf (gtk_widget_get_window (widget), gc, pixbuf,
dest.x - x_offset - widget->allocation.x,
dest.y - y_offset - widget->allocation.y,
dest.x, dest.y,