#include <libempathy-gtk/empathy-sound.h>
#include <libempathy-gtk/empathy-ui-utils.h>
-#include <libmissioncontrol/mission-control.h>
-
#include "empathy-accounts-dialog.h"
#include "empathy-main-window.h"
#include "ephy-spinner.h"
#include "empathy-preferences.h"
#include "empathy-about-dialog.h"
-#include "empathy-debug-dialog.h"
+#include "empathy-debug-window.h"
#include "empathy-new-chatroom-dialog.h"
#include "empathy-map-view.h"
#include "empathy-chatrooms-window.h"
typedef struct {
EmpathyContactListView *list_view;
EmpathyContactListStore *list_store;
- MissionControl *mc;
EmpathyAccountManager *account_manager;
EmpathyChatroomManager *chatroom_manager;
EmpathyEventManager *event_manager;
{
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);
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);
g_list_free (window->actions_connected);
- g_object_unref (window->mc);
g_object_unref (window->account_manager);
g_object_unref (window->list_store);
g_hash_table_destroy (window->errors);
//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,
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;
- 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);
}
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)
main_window_help_debug_cb (GtkAction *action,
EmpathyMainWindow *window)
{
- empathy_debug_dialog_new (GTK_WINDOW (window->window));
+ empathy_debug_window_new (GTK_WINDOW (window->window));
}
static void
}
}
-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)
gtk_action_set_visible (show_map_widget, FALSE);
#endif
- window->mc = empathy_mission_control_dup_singleton ();
window->account_manager = empathy_account_manager_dup_singleton ();
g_signal_connect (window->account_manager,
"account-connection-changed",
G_CALLBACK (main_window_connection_changed_cb), window);
- window->errors = g_hash_table_new_full (empathy_account_hash,
- empathy_account_equal,
+ window->errors = g_hash_table_new_full (g_direct_hash,
+ g_direct_equal,
g_object_unref,
NULL);
main_window_update_status (window, window->account_manager);
+ gtk_widget_show (window->window);
+
return window->window;
}