From 9fe194288e580fcbd79fcae90050ccb8b6380a63 Mon Sep 17 00:00:00 2001 From: Jonathan Tellier Date: Thu, 2 Jul 2009 12:08:43 -0400 Subject: Added functions to determine if a contact has video capabilities Activating the "Video Call" button only if the remote contact support video. The call window's "Send Video" is only sensitive if the contact has video capabilities. --- src/empathy-call-window.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src') 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); -- cgit v1.2.3 From 9f148e53e8086daff05f7ce9801a405c61182864 Mon Sep 17 00:00:00 2001 From: Pierre-Luc Beaudoin Date: Mon, 29 Jun 2009 20:07:33 -0400 Subject: List installed adium themes --- src/empathy-preferences.c | 159 ++++++++++++++++++--------------------------- src/empathy-preferences.ui | 44 ------------- 2 files changed, 65 insertions(+), 138 deletions(-) (limited to 'src') diff --git a/src/empathy-preferences.c b/src/empathy-preferences.c index 0e2299cac..ddae0ae9f 100644 --- a/src/empathy-preferences.c +++ b/src/empathy-preferences.c @@ -28,6 +28,7 @@ #include #include +#include #include @@ -54,9 +55,6 @@ typedef struct { 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; @@ -139,8 +137,10 @@ enum { }; enum { + COL_COMBO_IS_ADIUM, COL_COMBO_VISIBLE_NAME, COL_COMBO_NAME, + COL_COMBO_PATH, COL_COMBO_COUNT }; @@ -953,73 +953,6 @@ 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, const gchar *key, @@ -1027,34 +960,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 +1012,8 @@ preferences_theme_notify_cb (EmpathyConf *conf, } } - g_free (value); + g_free (conf_name); + g_free (conf_path); } static void @@ -1074,21 +1022,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 +1055,7 @@ preferences_themes_setup (EmpathyPreferences *preferences) GtkCellRenderer *renderer; GtkListStore *store; const gchar **themes; + GList *adium_themes; gint i; guint id; @@ -1108,18 +1064,44 @@ 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 */ /* 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 +1127,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); @@ -1211,9 +1185,6 @@ empathy_preferences_show (GtkWindow *parent) "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, diff --git a/src/empathy-preferences.ui b/src/empathy-preferences.ui index 38cfd3419..e4ec183bd 100644 --- a/src/empathy-preferences.ui +++ b/src/empathy-preferences.ui @@ -851,50 +851,6 @@ 0 - - - True - 6 - - - True - 0 - Adium theme to use: - - - False - False - - - - - True - False - GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER - - - 1 - - - - - 1 - - - - - True - Not a valid adium theme - - - - - - False - False - 2 - - -- cgit v1.2.3 From baec7d9dc896aa9297c18310c27060f4125e812b Mon Sep 17 00:00:00 2001 From: Pierre-Luc Beaudoin Date: Fri, 26 Jun 2009 19:02:07 -0400 Subject: Sort themes by name --- src/empathy-preferences.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/empathy-preferences.c b/src/empathy-preferences.c index ddae0ae9f..c6545ead0 100644 --- a/src/empathy-preferences.c +++ b/src/empathy-preferences.c @@ -1068,6 +1068,8 @@ preferences_themes_setup (EmpathyPreferences *preferences) G_TYPE_STRING, /* Display 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 (); -- cgit v1.2.3 From 7deb4ea20b08eab10473f2620c90f6b896d5af10 Mon Sep 17 00:00:00 2001 From: Jonny Lamb Date: Sat, 20 Jun 2009 17:27:06 +0100 Subject: Use accessor functions instead direct access (Fixes #586476) Signed-off-by: Jonny Lamb --- src/empathy-call-window-fullscreen.c | 6 +++--- src/empathy-chat-window.c | 6 +++--- src/empathy-debug-dialog.c | 4 ++-- src/empathy-sidebar.c | 2 +- src/empathy.c | 2 +- src/ephy-spinner.c | 4 ++-- 6 files changed, 12 insertions(+), 12 deletions(-) (limited to 'src') 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-chat-window.c b/src/empathy-chat-window.c index f9d0b924a..7bc64bb08 100644 --- a/src/empathy-chat-window.c +++ b/src/empathy-chat-window.c @@ -176,7 +176,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); @@ -1242,7 +1242,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); @@ -1299,7 +1299,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 cd0d925f9..9d047bab1 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); @@ -948,7 +948,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-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 40626b532..aef361052 100644 --- a/src/empathy.c +++ b/src/empathy.c @@ -357,7 +357,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); 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, -- cgit v1.2.3 From 29cbf3a2b4c6c2a73b04d4e369a4ffc35a5dcfb2 Mon Sep 17 00:00:00 2001 From: Gabriel Millaire Date: Wed, 10 Jun 2009 21:43:19 -0400 Subject: Work in progress : move preferences to View menu Moving Sort by name / by status and Show Avatars / Compact contact list preferences to View menu : Sort by name / Sort by status and Normal Size / Normal Without Icons / Compact Size --- src/empathy-main-window.c | 145 +++++++++++++++++++++++++++++++++++---------- src/empathy-main-window.ui | 57 ++++++++++++++++++ 2 files changed, 172 insertions(+), 30 deletions(-) (limited to 'src') diff --git a/src/empathy-main-window.c b/src/empathy-main-window.c index c7816d7fd..ce9022de3 100644 --- a/src/empathy-main-window.c +++ b/src/empathy-main-window.c @@ -717,6 +717,36 @@ main_window_view_show_offline_cb (GtkToggleAction *action, //empathy_sound_set_enabled (TRUE); } +static void +main_window_view_sort_contacts_cb (GtkRadioAction *action, + GtkRadioAction *current, + EmpathyMainWindow *window) +{ + EmpathyContactListStoreSort value; + + value = gtk_radio_action_get_current_value (action); + + 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 0 +#define CONTACT_LIST_NORMAL_WITHOUT_ICONS 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_contact_list_store_set_show_avatars (window->list_store, value == CONTACT_LIST_NORMAL_SIZE); + empathy_contact_list_store_set_is_compact (window->list_store, value == CONTACT_LIST_COMPACT_SIZE); +} + static void main_window_view_show_map_cb (GtkCheckMenuItem *item, EmpathyMainWindow *window) @@ -1052,9 +1082,10 @@ main_window_notify_compact_contact_list_cb (EmpathyConf *conf, } static void -main_window_notify_sort_criterium_cb (EmpathyConf *conf, - const gchar *key, - EmpathyMainWindow *window) +main_window_conf_sort_criterium (EmpathyConf *conf, + const gchar *key, + EmpathyMainWindow *window, + GtkRadioAction *action) { gchar *str = NULL; @@ -1067,11 +1098,17 @@ main_window_notify_sort_criterium_cb (EmpathyConf *conf, 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); + + if (enum_value->value == EMPATHY_CONTACT_LIST_STORE_SORT_STATE) { + gtk_radio_action_set_current_value (action, 2); + } else { + gtk_radio_action_set_current_value (action, 1); } + +// if (enum_value) { +// empathy_contact_list_store_set_sort_criterium (window->list_store, +// enum_value->value); +// } } } @@ -1112,6 +1149,11 @@ empathy_main_window_show (void) EmpathyConf *conf; GtkWidget *sw; GtkToggleAction *show_offline_widget; + GtkRadioAction *sort_by_name; + GtkRadioAction *sort_by_status; + GtkRadioAction *normal_size; + GtkRadioAction *normal_without_icons; + GtkRadioAction *compact_size; GtkWidget *ebox; GtkAction *show_map_widget; GtkToolItem *item; @@ -1119,6 +1161,7 @@ empathy_main_window_show (void) gboolean show_avatars; gboolean compact_contact_list; gint x, y, w, h; + gint value = 1; gchar *filename; GSList *l; @@ -1137,6 +1180,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", &sort_by_name, + "view_sort_by_status", &sort_by_status, + "view_normal_size", &normal_size, + "view_normal_without_icons", &normal_without_icons, + "view_compact_size", &compact_size, "view_history", &window->view_history, "view_show_map", &show_map_widget, "room_join_favorites", &window->room_join_favorites, @@ -1157,6 +1205,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", "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, @@ -1307,35 +1357,70 @@ empathy_main_window_show (void) show_offline_widget); gtk_toggle_action_set_active (show_offline_widget, show_offline); + + /* Sort by name / by status ? */ + /* without conf */ + main_window_view_sort_contacts_cb (sort_by_name, sort_by_name, window); + + /* with conf */ +// main_window_conf_sort_criterium (conf, +// EMPATHY_PREFS_CONTACTS_SORT_CRITERIUM, +// window, +// sort_by_name); + + + /* Contacts list size */ + /* whithout conf */ + main_window_view_contacts_list_size_cb (normal_size, normal_size, window); + + /* with conf */ +// 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 == TRUE) { +// value = CONTACT_LIST_COMPACT_SIZE; +// } else if (show_avatars == TRUE) { +// value = CONTACT_LIST_NORMAL_SIZE; +// } else { +// value = CONTACT_LIST_NORMAL_WITHOUT_ICONS; +// } +// gtk_radio_action_set_current_value (normal_size, value); + + /* Show avatars ? */ - empathy_conf_get_bool (conf, - EMPATHY_PREFS_UI_SHOW_AVATARS, - &show_avatars); - 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_conf_get_bool (conf, +// EMPATHY_PREFS_UI_SHOW_AVATARS, +// &show_avatars); +// 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); /* 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); +// 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); /* Sort criterium */ - 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); + /* with conf */ + // 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); main_window_update_status (window, window->account_manager); diff --git a/src/empathy-main-window.ui b/src/empathy-main-window.ui index f914979f6..d6fcb1e51 100644 --- a/src/empathy-main-window.ui +++ b/src/empathy-main-window.ui @@ -98,6 +98,56 @@ _View + + + view_sort_by_name + True + Sort by _Name + True + 1 + 1 + + + + + view_sort_by_status + True + Sort by _Status + True + view_sort_by_name + 0 + + + + + view_normal_size + True + N_ormal Size + True + 0 + 0 + + + + + view_normal_without_icons + True + Normal Size _Without Icons + True + view_normal_size + 1 + + + + + view_compact_size + True + _Compact Size + True + view_normal_size + 2 + + room @@ -172,6 +222,13 @@ + + + + + + + -- cgit v1.2.3 From 4fa12b80765dcb6059017a43e1c419f6bf2c9b3f Mon Sep 17 00:00:00 2001 From: Gabriel Millaire Date: Fri, 19 Jun 2009 16:11:14 -0400 Subject: Move Compact List and Sort Contacts from Preferences to View menu --- src/empathy-main-window.c | 155 ++++++++++++++++++--------------------------- src/empathy-preferences.c | 133 +++++++++++++++++++++----------------- src/empathy-preferences.ui | 94 --------------------------- 3 files changed, 135 insertions(+), 247 deletions(-) (limited to 'src') diff --git a/src/empathy-main-window.c b/src/empathy-main-window.c index ce9022de3..e9c98c701 100644 --- a/src/empathy-main-window.c +++ b/src/empathy-main-window.c @@ -723,9 +723,33 @@ main_window_view_sort_contacts_cb (GtkRadioAction *action, EmpathyMainWindow *window) { EmpathyContactListStoreSort value; + const gchar *valueStr = NULL; value = gtk_radio_action_get_current_value (action); - + + GSList *group; + GType type; + GEnumClass *enum_class; + GEnumValue *enum_value; + + 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 GtkRadioButton index:%d", + g_slist_index (group, action)); + } else { + valueStr = enum_value->value_nick; + + empathy_conf_set_string (empathy_conf_get (), + EMPATHY_PREFS_CONTACTS_SORT_CRITERIUM, + valueStr); + } + empathy_contact_list_store_set_sort_criterium (window->list_store, value); } @@ -742,7 +766,14 @@ main_window_view_contacts_list_size_cb (GtkRadioAction *action, 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); + 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); empathy_contact_list_store_set_is_compact (window->list_store, value == CONTACT_LIST_COMPACT_SIZE); } @@ -1055,31 +1086,9 @@ 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); - } -} +/* Matches GtkRadioAction values set in empathy-main-window.ui */ +#define CONTACT_LIST_SORT_BY_STATUS 0 +#define CONTACT_LIST_SORT_BY_NAME 1 static void main_window_conf_sort_criterium (EmpathyConf *conf, @@ -1098,17 +1107,12 @@ main_window_conf_sort_criterium (EmpathyConf *conf, 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->value == EMPATHY_CONTACT_LIST_STORE_SORT_STATE) { - gtk_radio_action_set_current_value (action, 2); + gtk_radio_action_set_current_value (action, CONTACT_LIST_SORT_BY_STATUS); } else { - gtk_radio_action_set_current_value (action, 1); + gtk_radio_action_set_current_value (action, CONTACT_LIST_SORT_BY_NAME); } - -// if (enum_value) { -// empathy_contact_list_store_set_sort_criterium (window->list_store, -// enum_value->value); -// } } } @@ -1357,70 +1361,31 @@ empathy_main_window_show (void) show_offline_widget); gtk_toggle_action_set_active (show_offline_widget, show_offline); - + /* Sort by name / by status ? */ - /* without conf */ - main_window_view_sort_contacts_cb (sort_by_name, sort_by_name, window); - - /* with conf */ -// main_window_conf_sort_criterium (conf, -// EMPATHY_PREFS_CONTACTS_SORT_CRITERIUM, -// window, -// sort_by_name); + main_window_conf_sort_criterium (conf, + EMPATHY_PREFS_CONTACTS_SORT_CRITERIUM, + window, + sort_by_name); /* Contacts list size */ - /* whithout conf */ - main_window_view_contacts_list_size_cb (normal_size, normal_size, window); - - /* with conf */ -// 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 == TRUE) { -// value = CONTACT_LIST_COMPACT_SIZE; -// } else if (show_avatars == TRUE) { -// value = CONTACT_LIST_NORMAL_SIZE; -// } else { -// value = CONTACT_LIST_NORMAL_WITHOUT_ICONS; -// } -// gtk_radio_action_set_current_value (normal_size, value); - - - - /* Show avatars ? */ -// empathy_conf_get_bool (conf, -// EMPATHY_PREFS_UI_SHOW_AVATARS, -// &show_avatars); -// 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); - - /* 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); - - /* Sort criterium */ - /* with conf */ - // 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_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; + } else { + value = CONTACT_LIST_NORMAL_WITHOUT_ICONS; + } + gtk_radio_action_set_current_value (normal_size, value); + main_window_update_status (window, window->account_manager); diff --git a/src/empathy-preferences.c b/src/empathy-preferences.c index c6545ead0..3bfd7a69d 100644 --- a/src/empathy-preferences.c +++ b/src/empathy-preferences.c @@ -50,15 +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 *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; @@ -99,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); @@ -113,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, @@ -174,25 +160,9 @@ preferences_add_id (EmpathyPreferences *preferences, guint id) GUINT_TO_POINTER (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); @@ -240,14 +210,6 @@ preferences_setup_widgets (EmpathyPreferences *preferences) EMPATHY_PREFS_UI_SEPARATE_CHAT_WINDOWS, 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,6 +903,76 @@ preferences_radio_button_toggled_cb (GtkWidget *button, empathy_conf_set_string (empathy_conf_get (), key, value); } +<<<<<<< HEAD:src/empathy-preferences.c +======= +#endif + +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); +} +>>>>>>> Move Compact List and Sort Contacts from Preferences to View menu:src/empathy-preferences.c static void preferences_theme_notify_cb (EmpathyConf *conf, @@ -1182,15 +1203,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, "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 e4ec183bd..a383607aa 100644 --- a/src/empathy-preferences.ui +++ b/src/empathy-preferences.ui @@ -37,38 +37,6 @@ True - - - Show co_mpact contact list - True - True - False - True - True - - - False - False - 0 - - - - - Show _avatars - True - True - False - Avatars are user chosen images shown in the contact list - True - True - True - - - False - False - 1 - - Show _smileys as images @@ -183,68 +151,6 @@ 1 - - - True - 0 - none - - - True - 6 - 12 - - - True - - - Sort by _name - True - True - False - True - True - - - False - False - 0 - - - - - Sort by s_tate - True - True - False - True - True - radiobutton_contact_list_sort_by_name - - - False - False - 1 - - - - - - - - - True - Contact List - - - - - - - - 2 - - -- cgit v1.2.3 From 40869ce43c263c1e20f79ec342415fea749cc9a7 Mon Sep 17 00:00:00 2001 From: Gabriel Millaire Date: Fri, 19 Jun 2009 15:22:19 -0400 Subject: Added notification for confs Show avatar, Compact Size and Sort criterium Now checks for wrong string in Sort criterium --- src/empathy-main-window.c | 124 ++++++++++++++++++++++++++++------------------ 1 file changed, 77 insertions(+), 47 deletions(-) (limited to 'src') diff --git a/src/empathy-main-window.c b/src/empathy-main-window.c index e9c98c701..a40e29649 100644 --- a/src/empathy-main-window.c +++ b/src/empathy-main-window.c @@ -95,6 +95,12 @@ typedef struct { GtkWidget *presence_chooser; GtkWidget *errors_vbox; + GtkRadioAction *sort_by_name; + GtkRadioAction *sort_by_status; + GtkRadioAction *normal_size; + GtkRadioAction *normal_without_icons; + GtkRadioAction *compact_size; + GtkUIManager *ui_manager; GtkAction *view_history; GtkAction *room_join_favorites; @@ -749,7 +755,6 @@ main_window_view_sort_contacts_cb (GtkRadioAction *action, EMPATHY_PREFS_CONTACTS_SORT_CRITERIUM, valueStr); } - empathy_contact_list_store_set_sort_criterium (window->list_store, value); } @@ -768,14 +773,16 @@ main_window_view_contacts_list_size_cb (GtkRadioAction *action, 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); + EMPATHY_PREFS_UI_SHOW_AVATARS, + value == CONTACT_LIST_NORMAL_SIZE); empathy_conf_set_bool (empathy_conf_get (), - EMPATHY_PREFS_UI_COMPACT_CONTACT_LIST, - value == CONTACT_LIST_COMPACT_SIZE); + 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); - empathy_contact_list_store_set_is_compact (window->list_store, value == CONTACT_LIST_COMPACT_SIZE); + empathy_contact_list_store_set_show_avatars (window->list_store, + value == CONTACT_LIST_NORMAL_SIZE); + empathy_contact_list_store_set_is_compact (window->list_store, + value == CONTACT_LIST_COMPACT_SIZE); } static void @@ -1086,15 +1093,41 @@ main_window_notify_show_offline_cb (EmpathyConf *conf, } } +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; + + 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; + } else { + value = CONTACT_LIST_NORMAL_WITHOUT_ICONS; + } + } + gtk_radio_action_set_current_value (window->normal_size, value); +} + + /* Matches GtkRadioAction values set in empathy-main-window.ui */ #define CONTACT_LIST_SORT_BY_STATUS 0 #define CONTACT_LIST_SORT_BY_NAME 1 static void -main_window_conf_sort_criterium (EmpathyConf *conf, - const gchar *key, - EmpathyMainWindow *window, - GtkRadioAction *action) +main_window_notify_sort_contact_cb (EmpathyConf *conf, + const gchar *key, + EmpathyMainWindow *window) { gchar *str = NULL; @@ -1106,13 +1139,19 @@ main_window_conf_sort_criterium (EmpathyConf *conf, 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->value == EMPATHY_CONTACT_LIST_STORE_SORT_STATE) { - gtk_radio_action_set_current_value (action, CONTACT_LIST_SORT_BY_STATUS); + if (enum_value) { + if (enum_value->value == EMPATHY_CONTACT_LIST_STORE_SORT_STATE) { + gtk_radio_action_set_current_value (window->sort_by_name, + CONTACT_LIST_SORT_BY_STATUS); + } else { + gtk_radio_action_set_current_value (window->sort_by_name, + CONTACT_LIST_SORT_BY_NAME); + } } else { - gtk_radio_action_set_current_value (action, CONTACT_LIST_SORT_BY_NAME); + g_warning ("Wrong value for sort_criterium configuration : %s", str); } + g_free (str); } } @@ -1153,19 +1192,11 @@ empathy_main_window_show (void) EmpathyConf *conf; GtkWidget *sw; GtkToggleAction *show_offline_widget; - GtkRadioAction *sort_by_name; - GtkRadioAction *sort_by_status; - GtkRadioAction *normal_size; - GtkRadioAction *normal_without_icons; - GtkRadioAction *compact_size; GtkWidget *ebox; GtkAction *show_map_widget; GtkToolItem *item; gboolean show_offline; - gboolean show_avatars; - gboolean compact_contact_list; gint x, y, w, h; - gint value = 1; gchar *filename; GSList *l; @@ -1184,11 +1215,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", &sort_by_name, - "view_sort_by_status", &sort_by_status, - "view_normal_size", &normal_size, - "view_normal_without_icons", &normal_without_icons, - "view_compact_size", &compact_size, + "view_sort_by_name", &window->sort_by_name, + "view_sort_by_status", &window->sort_by_status, + "view_normal_size", &window->normal_size, + "view_normal_without_icons", &window->normal_without_icons, + "view_compact_size", &window->compact_size, "view_history", &window->view_history, "view_show_map", &show_map_widget, "room_join_favorites", &window->room_join_favorites, @@ -1363,29 +1394,28 @@ empathy_main_window_show (void) gtk_toggle_action_set_active (show_offline_widget, show_offline); /* Sort by name / by status ? */ - main_window_conf_sort_criterium (conf, - EMPATHY_PREFS_CONTACTS_SORT_CRITERIUM, - window, - sort_by_name); + empathy_conf_notify_add (conf, + EMPATHY_PREFS_CONTACTS_SORT_CRITERIUM, + (EmpathyConfNotifyFunc) main_window_notify_sort_contact_cb, + window); + main_window_notify_sort_contact_cb (conf, + EMPATHY_PREFS_CONTACTS_SORT_CRITERIUM, + window); /* Contacts list size */ - 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; - } else { - value = CONTACT_LIST_NORMAL_WITHOUT_ICONS; - } - gtk_radio_action_set_current_value (normal_size, value); + empathy_conf_notify_add (conf, + 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); -- cgit v1.2.3 From c74b8f99f8b3c706d18cc280c35748d8e5282660 Mon Sep 17 00:00:00 2001 From: Gabriel Millaire Date: Mon, 29 Jun 2009 22:37:23 -0400 Subject: Changed menu label and various review fixes --- src/empathy-main-window.c | 34 ++++++++++++++++------------------ src/empathy-main-window.ui | 18 +++++++++--------- 2 files changed, 25 insertions(+), 27 deletions(-) (limited to 'src') diff --git a/src/empathy-main-window.c b/src/empathy-main-window.c index a40e29649..2e2e93a81 100644 --- a/src/empathy-main-window.c +++ b/src/empathy-main-window.c @@ -97,8 +97,8 @@ typedef struct { GtkRadioAction *sort_by_name; GtkRadioAction *sort_by_status; + GtkRadioAction *normal_with_avatars; GtkRadioAction *normal_size; - GtkRadioAction *normal_without_icons; GtkRadioAction *compact_size; GtkUIManager *ui_manager; @@ -729,15 +729,12 @@ main_window_view_sort_contacts_cb (GtkRadioAction *action, EmpathyMainWindow *window) { EmpathyContactListStoreSort value; - const gchar *valueStr = NULL; - - value = gtk_radio_action_get_current_value (action); - 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 */ @@ -749,19 +746,20 @@ main_window_view_sort_contacts_cb (GtkRadioAction *action, g_warning ("No GEnumValue for EmpathyContactListSort with GtkRadioButton index:%d", g_slist_index (group, action)); } else { - valueStr = enum_value->value_nick; + const gchar *value_str; + value_str = enum_value->value_nick; empathy_conf_set_string (empathy_conf_get (), EMPATHY_PREFS_CONTACTS_SORT_CRITERIUM, - valueStr); + value_str); } 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 0 -#define CONTACT_LIST_NORMAL_WITHOUT_ICONS 1 -#define CONTACT_LIST_COMPACT_SIZE 2 +#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, @@ -774,13 +772,13 @@ main_window_view_contacts_list_size_cb (GtkRadioAction *action, empathy_conf_set_bool (empathy_conf_get (), EMPATHY_PREFS_UI_SHOW_AVATARS, - value == CONTACT_LIST_NORMAL_SIZE); + 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); + value == CONTACT_LIST_NORMAL_SIZE_WITH_AVATARS); empathy_contact_list_store_set_is_compact (window->list_store, value == CONTACT_LIST_COMPACT_SIZE); } @@ -1100,7 +1098,7 @@ main_window_notify_contact_list_size_cb (EmpathyConf *conf, { gboolean show_avatars; gboolean compact_contact_list; - gint value = CONTACT_LIST_NORMAL_SIZE; + gint value = CONTACT_LIST_NORMAL_SIZE_WITH_AVATARS; if (empathy_conf_get_bool (conf, EMPATHY_PREFS_UI_SHOW_AVATARS, @@ -1111,12 +1109,12 @@ main_window_notify_contact_list_size_cb (EmpathyConf *conf, if (compact_contact_list) { value = CONTACT_LIST_COMPACT_SIZE; } else if (show_avatars) { - value = CONTACT_LIST_NORMAL_SIZE; + value = CONTACT_LIST_NORMAL_SIZE_WITH_AVATARS; } else { - value = CONTACT_LIST_NORMAL_WITHOUT_ICONS; + value = CONTACT_LIST_NORMAL_SIZE; } } - gtk_radio_action_set_current_value (window->normal_size, value); + gtk_radio_action_set_current_value (window->normal_with_avatars, value); } @@ -1217,8 +1215,8 @@ empathy_main_window_show (void) "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_normal_without_icons", &window->normal_without_icons, "view_compact_size", &window->compact_size, "view_history", &window->view_history, "view_show_map", &show_map_widget, @@ -1241,7 +1239,7 @@ empathy_main_window_show (void) "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", "changed", main_window_view_contacts_list_size_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, diff --git a/src/empathy-main-window.ui b/src/empathy-main-window.ui index d6fcb1e51..85d4a0559 100644 --- a/src/empathy-main-window.ui +++ b/src/empathy-main-window.ui @@ -119,22 +119,22 @@ - - view_normal_size + + view_normal_size_with_avatars True - N_ormal Size + Normal Size With _Avatars True 0 0 - - view_normal_without_icons + + view_normal_size True - Normal Size _Without Icons + N_ormal Size True - view_normal_size + view_normal_size_with_avatars 1 @@ -144,7 +144,7 @@ True _Compact Size True - view_normal_size + view_normal_size_with_avatars 2 @@ -225,8 +225,8 @@ + - -- cgit v1.2.3 From 2a5d562c839106c2edacd58cbdc003e0aead635b Mon Sep 17 00:00:00 2001 From: Gabriel Millaire Date: Fri, 10 Jul 2009 11:28:54 -0400 Subject: Regrouped similar functions, uses enum instead of define --- src/empathy-main-window.c | 118 +++++++++++++++++++++------------------------- 1 file changed, 55 insertions(+), 63 deletions(-) (limited to 'src') diff --git a/src/empathy-main-window.c b/src/empathy-main-window.c index 2e2e93a81..06238b2a4 100644 --- a/src/empathy-main-window.c +++ b/src/empathy-main-window.c @@ -723,6 +723,34 @@ main_window_view_show_offline_cb (GtkToggleAction *action, //empathy_sound_set_enabled (TRUE); } +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, @@ -743,7 +771,7 @@ main_window_view_sort_contacts_cb (GtkRadioAction *action, enum_value = g_enum_get_value (enum_class, g_slist_index (group, current)); if (!enum_value) { - g_warning ("No GEnumValue for EmpathyContactListSort with GtkRadioButton index:%d", + g_warning ("No GEnumValue for EmpathyContactListSort with GtkRadioAction index:%d", g_slist_index (group, action)); } else { const gchar *value_str; @@ -783,6 +811,32 @@ main_window_view_contacts_list_size_cb (GtkRadioAction *action, 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; + } + } + gtk_radio_action_set_current_value (window->normal_with_avatars, value); +} + static void main_window_view_show_map_cb (GtkCheckMenuItem *item, EmpathyMainWindow *window) @@ -1091,68 +1145,6 @@ main_window_notify_show_offline_cb (EmpathyConf *conf, } } -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; - } - } - gtk_radio_action_set_current_value (window->normal_with_avatars, value); -} - - -/* Matches GtkRadioAction values set in empathy-main-window.ui */ -#define CONTACT_LIST_SORT_BY_STATUS 0 -#define CONTACT_LIST_SORT_BY_NAME 1 - -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) { - if (enum_value->value == EMPATHY_CONTACT_LIST_STORE_SORT_STATE) { - gtk_radio_action_set_current_value (window->sort_by_name, - CONTACT_LIST_SORT_BY_STATUS); - } else { - gtk_radio_action_set_current_value (window->sort_by_name, - CONTACT_LIST_SORT_BY_NAME); - } - } else { - g_warning ("Wrong value for sort_criterium configuration : %s", str); - } - g_free (str); - } -} - static void main_window_connection_items_setup (EmpathyMainWindow *window, GtkBuilder *gui) -- cgit v1.2.3 From 3a3e74fe6ca8e99e11d54a1c43ec87cc2e6b02c4 Mon Sep 17 00:00:00 2001 From: Gabriel Millaire Date: Fri, 10 Jul 2009 11:48:39 -0400 Subject: Remove old code --- src/empathy-preferences.c | 69 ----------------------------------------------- 1 file changed, 69 deletions(-) (limited to 'src') diff --git a/src/empathy-preferences.c b/src/empathy-preferences.c index 3bfd7a69d..65c496547 100644 --- a/src/empathy-preferences.c +++ b/src/empathy-preferences.c @@ -903,77 +903,8 @@ preferences_radio_button_toggled_cb (GtkWidget *button, empathy_conf_set_string (empathy_conf_get (), key, value); } -<<<<<<< HEAD:src/empathy-preferences.c -======= #endif -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); -} ->>>>>>> Move Compact List and Sort Contacts from Preferences to View menu:src/empathy-preferences.c - static void preferences_theme_notify_cb (EmpathyConf *conf, const gchar *key, -- cgit v1.2.3 From 972532d4223b01ae12fcae945620615fbc9f5ccd Mon Sep 17 00:00:00 2001 From: Gabriel Millaire Date: Fri, 10 Jul 2009 12:55:43 -0400 Subject: Minor changes --- src/empathy-main-window.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/empathy-main-window.c b/src/empathy-main-window.c index 06238b2a4..4b1af853d 100644 --- a/src/empathy-main-window.c +++ b/src/empathy-main-window.c @@ -774,12 +774,9 @@ main_window_view_sort_contacts_cb (GtkRadioAction *action, g_warning ("No GEnumValue for EmpathyContactListSort with GtkRadioAction index:%d", g_slist_index (group, action)); } else { - const gchar *value_str; - value_str = enum_value->value_nick; - empathy_conf_set_string (empathy_conf_get (), EMPATHY_PREFS_CONTACTS_SORT_CRITERIUM, - value_str); + enum_value->value_nick); } empathy_contact_list_store_set_sort_criterium (window->list_store, value); } @@ -834,6 +831,9 @@ main_window_notify_contact_list_size_cb (EmpathyConf *conf, 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); } -- cgit v1.2.3 From ad1cc3ce5f2e21766e7cd0f05669e3510048eacb Mon Sep 17 00:00:00 2001 From: Guillaume Desmottes Date: Mon, 13 Jul 2009 18:04:56 +0100 Subject: empathy-main-window.c: remove a trailing space --- src/empathy-main-window.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/empathy-main-window.c b/src/empathy-main-window.c index 4b1af853d..0e71229c5 100644 --- a/src/empathy-main-window.c +++ b/src/empathy-main-window.c @@ -739,7 +739,7 @@ main_window_notify_sort_contact_cb (EmpathyConf *conf, 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, + /* 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, -- cgit v1.2.3 From 2a6048e015b83b22eb2c771412b2e4770c4ada01 Mon Sep 17 00:00:00 2001 From: Abner Silva Date: Mon, 13 Jul 2009 18:41:09 -0300 Subject: Chat window's tab label changes the font color when got an incoming msg. (Fixes #588498) --- src/empathy-chat-window.c | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/empathy-chat-window.c b/src/empathy-chat-window.c index 7bc64bb08..8dcb68d2f 100644 --- a/src/empathy-chat-window.c +++ b/src/empathy-chat-window.c @@ -994,6 +994,24 @@ chat_window_show_or_update_notification (EmpathyChatWindow *window, g_free (escaped); } +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 ("%s", + "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, @@ -1026,6 +1044,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). @@ -1039,18 +1062,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 * -- cgit v1.2.3 From 98655aa5cae4870b377cf21b9b442fb08c4d003d Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sat, 18 Jul 2009 01:39:02 -0400 Subject: Respect the button-images setting Streamline the construction of some buttons, with the nice side-effect that they now obey the button-images setting. See bug 588810. --- src/empathy-accounts-dialog.ui | 43 +++++++------------------------------- src/empathy-new-chatroom-dialog.ui | 43 +++++++------------------------------- 2 files changed, 14 insertions(+), 72 deletions(-) (limited to 'src') diff --git a/src/empathy-accounts-dialog.ui b/src/empathy-accounts-dialog.ui index cf1b23ef4..da00f45d7 100644 --- a/src/empathy-accounts-dialog.ui +++ b/src/empathy-accounts-dialog.ui @@ -2,6 +2,10 @@ + + gtk-add + 4 + 5 Accounts @@ -56,42 +60,9 @@ True True False - - - True - 0 - 0 - - - True - 2 - - - True - gtk-add - - - False - False - 0 - - - - - True - _Add... - True - - - False - False - 1 - - - - - - + add_image + _Add... + True 0 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 @@ + + gtk-jump-to + 4 + True 5 @@ -245,42 +249,9 @@ True True False - - - True - 0 - 0 - - - True - 2 - - - True - gtk-jump-to - - - False - False - 0 - - - - - True - _Join - True - - - False - False - 1 - - - - - - + join_image + _Join + True False -- cgit v1.2.3 From e1fa17399fc137a508f195aa6976b5f32189de96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Wed, 17 Jun 2009 10:01:52 +0200 Subject: Put configuration data in XDG_CONFIG_DIRS (GNOME bug 494007) --- src/empathy-main-window.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/empathy-main-window.c b/src/empathy-main-window.c index 0e71229c5..a600fd429 100644 --- a/src/empathy-main-window.c +++ b/src/empathy-main-window.c @@ -611,7 +611,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); @@ -626,7 +626,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); -- cgit v1.2.3 From 6fa59ef0e20828af6404821b198468ae3a9ef158 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Mon, 20 Jul 2009 19:13:37 +0200 Subject: migrate configuration files to XDG config directory --- src/empathy.c | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) (limited to 'src') diff --git a/src/empathy.c b/src/empathy.c index aef361052..ea14c4da9 100644 --- a/src/empathy.c +++ b/src/empathy.c @@ -321,6 +321,67 @@ create_salut_account (void) g_object_unref (book); } +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. * @@ -637,6 +698,8 @@ main (int argc, char *argv[]) empathy_idle_set_state (idle, MC_PRESENCE_AVAILABLE); } + + migrate_config_to_xdg_dir (); create_salut_account (); /* Setting up UI */ -- cgit v1.2.3 From 2ca42ded917d24b66628c40cf2f4e2b4aa5b518b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Wed, 22 Jul 2009 17:15:52 +0200 Subject: remove trailing tabulation --- src/empathy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/empathy.c b/src/empathy.c index ea14c4da9..0754eb7ab 100644 --- a/src/empathy.c +++ b/src/empathy.c @@ -698,7 +698,7 @@ main (int argc, char *argv[]) empathy_idle_set_state (idle, MC_PRESENCE_AVAILABLE); } - + migrate_config_to_xdg_dir (); create_salut_account (); -- cgit v1.2.3