diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile.am | 3 | ||||
-rw-r--r-- | src/empathy-accounts-dialog.c | 136 | ||||
-rw-r--r-- | src/empathy-accounts-dialog.h | 4 | ||||
-rw-r--r-- | src/empathy-accounts-dialog.ui | 6 | ||||
-rw-r--r-- | src/empathy-call-window.c | 91 | ||||
-rw-r--r-- | src/empathy-chat-window.c | 104 | ||||
-rw-r--r-- | src/empathy-chat-window.h | 4 | ||||
-rw-r--r-- | src/empathy-chat-window.ui | 8 | ||||
-rw-r--r-- | src/empathy-chatrooms-window.c | 4 | ||||
-rw-r--r-- | src/empathy-debug-dialog.c | 12 | ||||
-rw-r--r-- | src/empathy-event-manager.c | 175 | ||||
-rw-r--r-- | src/empathy-event-manager.h | 1 | ||||
-rw-r--r-- | src/empathy-import-dialog.c | 24 | ||||
-rw-r--r-- | src/empathy-import-dialog.h | 1 | ||||
-rw-r--r-- | src/empathy-import-pidgin.c | 1 | ||||
-rw-r--r-- | src/empathy-main-window.c | 38 | ||||
-rw-r--r-- | src/empathy-map-view.c | 2 | ||||
-rw-r--r-- | src/empathy-new-chatroom-dialog.c | 22 | ||||
-rw-r--r-- | src/empathy-preferences.c | 38 | ||||
-rw-r--r-- | src/empathy-preferences.ui | 45 | ||||
-rw-r--r-- | src/empathy-sidebar.c | 2 | ||||
-rw-r--r-- | src/empathy-status-icon.c | 35 | ||||
-rw-r--r-- | src/empathy.c | 59 |
23 files changed, 515 insertions, 300 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index dbcd6d43d..42485b7d1 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -3,6 +3,7 @@ include $(top_srcdir)/tools/flymake.mk AM_CPPFLAGS = \ -I$(top_srcdir) \ + -DG_LOG_DOMAIN=\"empathy\" \ $(EMPATHY_CFLAGS) \ $(LIBNOTIFY_CFLAGS) \ $(LIBCHAMPLAIN_CFLAGS) \ @@ -82,7 +83,7 @@ EXTRA_DIST = \ $(ui_DATA) if HAVE_LIBCHAMPLAIN -empathy_SOURCES += \ +empathy_handwritten_source += \ empathy-map-view.c \ empathy-map-view.h diff --git a/src/empathy-accounts-dialog.c b/src/empathy-accounts-dialog.c index 1dcde458f..98e848566 100644 --- a/src/empathy-accounts-dialog.c +++ b/src/empathy-accounts-dialog.c @@ -31,7 +31,6 @@ #include <glib/gi18n.h> #include <dbus/dbus-glib.h> -#include <libmissioncontrol/mc-account.h> #include <libmissioncontrol/mc-profile.h> #include <telepathy-glib/util.h> @@ -96,7 +95,7 @@ enum { }; static void accounts_dialog_update_account (EmpathyAccountsDialog *dialog, - McAccount *account); + EmpathyAccount *account); static void accounts_dialog_model_setup (EmpathyAccountsDialog *dialog); static void accounts_dialog_model_add_columns (EmpathyAccountsDialog *dialog); static void accounts_dialog_name_editing_started_cb (GtkCellRenderer *renderer, @@ -109,19 +108,19 @@ static void accounts_dialog_model_pixbuf_data_func (GtkTreeViewColumn GtkTreeModel *model, GtkTreeIter *iter, EmpathyAccountsDialog *dialog); -static McAccount *accounts_dialog_model_get_selected (EmpathyAccountsDialog *dialog); +static EmpathyAccount *accounts_dialog_model_get_selected (EmpathyAccountsDialog *dialog); static void accounts_dialog_model_set_selected (EmpathyAccountsDialog *dialog, - McAccount *account); + EmpathyAccount *account); static gboolean accounts_dialog_model_remove_selected (EmpathyAccountsDialog *dialog); static void accounts_dialog_model_selection_changed (GtkTreeSelection *selection, EmpathyAccountsDialog *dialog); static void accounts_dialog_add_or_update_account (EmpathyAccountsDialog *dialog, - McAccount *account); + EmpathyAccount *account); static void accounts_dialog_account_added_cb (EmpathyAccountManager *manager, - McAccount *account, + EmpathyAccount *account, EmpathyAccountsDialog *dialog); static void accounts_dialog_account_removed_cb (EmpathyAccountManager *manager, - McAccount *account, + EmpathyAccount *account, EmpathyAccountsDialog *dialog); static gboolean accounts_dialog_row_changed_foreach (GtkTreeModel *model, GtkTreePath *path, @@ -129,7 +128,7 @@ static gboolean accounts_dialog_row_changed_foreach (GtkTreeModel gpointer user_data); static gboolean accounts_dialog_flash_connecting_cb (EmpathyAccountsDialog *dialog); static void accounts_dialog_connection_changed_cb (EmpathyAccountManager *manager, - McAccount *account, + EmpathyAccount *account, TpConnectionStatusReason reason, TpConnectionStatus current, TpConnectionStatus previous, @@ -154,12 +153,12 @@ static void accounts_dialog_destroy_cb (GtkWidget static void accounts_dialog_update_name_label (EmpathyAccountsDialog *dialog, - McAccount *account) + EmpathyAccount *account) { gchar *text; text = g_markup_printf_escaped ("<big><b>%s</b></big>", - mc_account_get_display_name (account)); + empathy_account_get_display_name (account)); gtk_label_set_markup (GTK_LABEL (dialog->label_name), text); g_free (text); @@ -167,7 +166,7 @@ accounts_dialog_update_name_label (EmpathyAccountsDialog *dialog, static void accounts_dialog_update_account (EmpathyAccountsDialog *dialog, - McAccount *account) + EmpathyAccount *account) { McProfile *profile; const gchar *config_ui; @@ -216,7 +215,7 @@ accounts_dialog_update_account (EmpathyAccountsDialog *dialog, dialog->settings_widget = NULL; } - profile = mc_account_get_profile (account); + profile = empathy_account_get_profile (account); config_ui = mc_profile_get_configuration_ui (profile); if (!tp_strdiff (config_ui, "jabber")) { dialog->settings_widget = @@ -282,10 +281,10 @@ accounts_dialog_model_setup (EmpathyAccountsDialog *dialog) GtkTreeSelection *selection; store = gtk_list_store_new (COL_COUNT, - G_TYPE_BOOLEAN, /* enabled */ - G_TYPE_STRING, /* name */ - G_TYPE_UINT, /* status */ - MC_TYPE_ACCOUNT); /* account */ + G_TYPE_BOOLEAN, /* enabled */ + G_TYPE_STRING, /* name */ + G_TYPE_UINT, /* status */ + EMPATHY_TYPE_ACCOUNT); /* account */ gtk_tree_view_set_model (GTK_TREE_VIEW (dialog->treeview), GTK_TREE_MODEL (store)); @@ -311,7 +310,7 @@ accounts_dialog_name_edited_cb (GtkCellRendererText *renderer, gchar *new_text, EmpathyAccountsDialog *dialog) { - McAccount *account; + EmpathyAccount *account; GtkTreeModel *model; GtkTreePath *treepath; GtkTreeIter iter; @@ -333,7 +332,7 @@ accounts_dialog_name_edited_cb (GtkCellRendererText *renderer, -1); gtk_tree_path_free (treepath); - mc_account_set_display_name (account, new_text); + empathy_account_set_display_name (account, new_text); g_object_unref (account); } @@ -342,7 +341,7 @@ accounts_dialog_enable_toggled_cb (GtkCellRendererToggle *cell_renderer, gchar *path, EmpathyAccountsDialog *dialog) { - McAccount *account; + EmpathyAccount *account; GtkTreeModel *model; GtkTreePath *treepath; GtkTreeIter iter; @@ -356,11 +355,11 @@ accounts_dialog_enable_toggled_cb (GtkCellRendererToggle *cell_renderer, -1); gtk_tree_path_free (treepath); - enabled = mc_account_is_enabled (account); - mc_account_set_enabled (account, !enabled); + enabled = empathy_account_is_enabled (account); + empathy_account_set_enabled (account, !enabled); DEBUG ("%s account %s", enabled ? "Disabled" : "Enable", - mc_account_get_display_name (account)); + empathy_account_get_display_name (account)); g_object_unref (account); } @@ -397,7 +396,7 @@ accounts_dialog_model_add_columns (EmpathyAccountsDialog *dialog) g_signal_connect (cell, "toggled", G_CALLBACK (accounts_dialog_enable_toggled_cb), dialog); - + /* Account column */ column = gtk_tree_view_column_new (); gtk_tree_view_column_set_title (column, _("Accounts")); @@ -417,6 +416,7 @@ accounts_dialog_model_add_columns (EmpathyAccountsDialog *dialog) cell = gtk_cell_renderer_text_new (); g_object_set (cell, "ellipsize", PANGO_ELLIPSIZE_END, + "width-chars", 25, "editable", TRUE, NULL); gtk_tree_view_column_pack_start (column, cell, TRUE); @@ -440,7 +440,7 @@ accounts_dialog_model_select_first (EmpathyAccountsDialog *dialog) /* select first */ view = GTK_TREE_VIEW (dialog->treeview); model = gtk_tree_view_get_model (view); - + if (gtk_tree_model_get_iter_first (model, &iter)) { selection = gtk_tree_view_get_selection (view); gtk_tree_selection_select_iter (selection, &iter); @@ -456,7 +456,7 @@ accounts_dialog_model_pixbuf_data_func (GtkTreeViewColumn *tree_column, GtkTreeIter *iter, EmpathyAccountsDialog *dialog) { - McAccount *account; + EmpathyAccount *account; const gchar *icon_name; GdkPixbuf *pixbuf; TpConnectionStatus status; @@ -503,14 +503,14 @@ accounts_dialog_model_pixbuf_data_func (GtkTreeViewColumn *tree_column, static gboolean accounts_dialog_get_account_iter (EmpathyAccountsDialog *dialog, - McAccount *account, + EmpathyAccount *account, GtkTreeIter *iter) { GtkTreeView *view; GtkTreeSelection *selection; GtkTreeModel *model; gboolean ok; - + /* Update the status in the model */ view = GTK_TREE_VIEW (dialog->treeview); selection = gtk_tree_view_get_selection (view); @@ -519,7 +519,7 @@ accounts_dialog_get_account_iter (EmpathyAccountsDialog *dialog, for (ok = gtk_tree_model_get_iter_first (model, iter); ok; ok = gtk_tree_model_iter_next (model, iter)) { - McAccount *this_account; + EmpathyAccount *this_account; gboolean equal; gtk_tree_model_get (model, iter, @@ -537,14 +537,14 @@ accounts_dialog_get_account_iter (EmpathyAccountsDialog *dialog, return FALSE; } -static McAccount * +static EmpathyAccount * accounts_dialog_model_get_selected (EmpathyAccountsDialog *dialog) { GtkTreeView *view; GtkTreeModel *model; GtkTreeSelection *selection; GtkTreeIter iter; - McAccount *account; + EmpathyAccount *account; view = GTK_TREE_VIEW (dialog->treeview); selection = gtk_tree_view_get_selection (view); @@ -560,7 +560,7 @@ accounts_dialog_model_get_selected (EmpathyAccountsDialog *dialog) static void accounts_dialog_model_set_selected (EmpathyAccountsDialog *dialog, - McAccount *account) + EmpathyAccount *account) { GtkTreeSelection *selection; GtkTreeIter iter; @@ -593,7 +593,7 @@ static void accounts_dialog_model_selection_changed (GtkTreeSelection *selection, EmpathyAccountsDialog *dialog) { - McAccount *account; + EmpathyAccount *account; GtkTreeModel *model; GtkTreeIter iter; gboolean is_selection; @@ -610,7 +610,7 @@ accounts_dialog_model_selection_changed (GtkTreeSelection *selection, static void accounts_dialog_add_or_update_account (EmpathyAccountsDialog *dialog, - McAccount *account) + EmpathyAccount *account) { GtkTreeModel *model; GtkTreeIter iter; @@ -619,9 +619,9 @@ accounts_dialog_add_or_update_account (EmpathyAccountsDialog *dialog, gboolean enabled; model = gtk_tree_view_get_model (GTK_TREE_VIEW (dialog->treeview)); - status = mission_control_get_connection_status (dialog->mc, account, NULL); - name = mc_account_get_display_name (account); - enabled = mc_account_is_enabled (account); + g_object_get (account, "status", &status, NULL); + name = empathy_account_get_display_name (account); + enabled = empathy_account_is_enabled (account); if (!accounts_dialog_get_account_iter (dialog, account, &iter)) { DEBUG ("Adding new account"); @@ -645,7 +645,7 @@ accounts_dialog_add_or_update_account (EmpathyAccountsDialog *dialog, static void accounts_dialog_account_added_cb (EmpathyAccountManager *manager, - McAccount *account, + EmpathyAccount *account, EmpathyAccountsDialog *dialog) { const gchar *current_name; @@ -655,25 +655,25 @@ accounts_dialog_account_added_cb (EmpathyAccountManager *manager, /* Change the display name to "%s (%s)" % (protocol, account). * - The protocol is the display name of the profile. - * - The account should be the normalized name of the McAccount but + * - The account should be the normalized name of the EmpathyAccount but * it's not set until first connection, so we get the "account" * parameter for CM that have it. */ - current_name = mc_account_get_display_name (account); - mc_account_get_param_string (account, "account", &account_param); + current_name = empathy_account_get_display_name (account); + account_param = empathy_account_get_param_string (account, "account"); if (!EMP_STR_EMPTY (account_param)) { McProfile *profile; const gchar *profile_name; gchar *new_name; - profile = mc_account_get_profile (account); + profile = empathy_account_get_profile (account); profile_name = mc_profile_get_display_name (profile); new_name = g_strdup_printf ("%s (%s)", profile_name, account_param); DEBUG ("Setting new display name for account %s: '%s'", - mc_account_get_unique_name (account), new_name); + empathy_account_get_unique_name (account), new_name); - mc_account_set_display_name (account, new_name); + empathy_account_set_display_name (account, new_name); g_free (new_name); g_object_unref (profile); } else { @@ -684,7 +684,7 @@ accounts_dialog_account_added_cb (EmpathyAccountManager *manager, static void accounts_dialog_account_removed_cb (EmpathyAccountManager *manager, - McAccount *account, + EmpathyAccount *account, EmpathyAccountsDialog *dialog) { @@ -721,7 +721,7 @@ accounts_dialog_flash_connecting_cb (EmpathyAccountsDialog *dialog) static void accounts_dialog_connection_changed_cb (EmpathyAccountManager *manager, - McAccount *account, + EmpathyAccount *account, TpConnectionStatusReason reason, TpConnectionStatus current, TpConnectionStatus previous, @@ -730,7 +730,7 @@ accounts_dialog_connection_changed_cb (EmpathyAccountManager *manager, GtkTreeModel *model; GtkTreeIter iter; gboolean found; - + /* Update the status in the model */ model = gtk_tree_view_get_model (GTK_TREE_VIEW (dialog->treeview)); @@ -762,7 +762,7 @@ accounts_dialog_connection_changed_cb (EmpathyAccountManager *manager, static void enable_or_disable_account (EmpathyAccountsDialog *dialog, - McAccount *account, + EmpathyAccount *account, gboolean enabled) { GtkTreeModel *model; @@ -772,7 +772,7 @@ enable_or_disable_account (EmpathyAccountsDialog *dialog, model = gtk_tree_view_get_model (GTK_TREE_VIEW (dialog->treeview)); DEBUG ("Account %s is now %s", - mc_account_get_display_name (account), + empathy_account_get_display_name (account), enabled ? "enabled" : "disabled"); if (accounts_dialog_get_account_iter (dialog, account, &iter)) { @@ -784,7 +784,7 @@ enable_or_disable_account (EmpathyAccountsDialog *dialog, static void accounts_dialog_account_disabled_cb (EmpathyAccountManager *manager, - McAccount *account, + EmpathyAccount *account, EmpathyAccountsDialog *dialog) { enable_or_disable_account (dialog, account, FALSE); @@ -792,7 +792,7 @@ accounts_dialog_account_disabled_cb (EmpathyAccountManager *manager, static void accounts_dialog_account_enabled_cb (EmpathyAccountManager *manager, - McAccount *account, + EmpathyAccount *account, EmpathyAccountsDialog *dialog) { enable_or_disable_account (dialog, account, TRUE); @@ -800,10 +800,10 @@ accounts_dialog_account_enabled_cb (EmpathyAccountManager *manager, static void accounts_dialog_account_changed_cb (EmpathyAccountManager *manager, - McAccount *account, + EmpathyAccount *account, EmpathyAccountsDialog *dialog) { - McAccount *selected_account; + EmpathyAccount *selected_account; accounts_dialog_add_or_update_account (dialog, account); selected_account = accounts_dialog_model_get_selected (dialog); @@ -817,7 +817,7 @@ accounts_dialog_button_create_clicked_cb (GtkWidget *button, EmpathyAccountsDialog *dialog) { McProfile *profile; - McAccount *account; + EmpathyAccount *account; gchar *str; McProfileCapabilityFlags cap; @@ -825,7 +825,7 @@ accounts_dialog_button_create_clicked_cb (GtkWidget *button, EMPATHY_PROFILE_CHOOSER (dialog->combobox_profile)); /* Create account */ - account = mc_account_create (profile); + account = empathy_account_manager_create (dialog->account_manager, profile); if (account == NULL) { /* We can't display an error to the user as MC doesn't give us * any clue about the reason of the failure... */ @@ -836,7 +836,7 @@ accounts_dialog_button_create_clicked_cb (GtkWidget *button, /* To translator: %s is the protocol name */ str = g_strdup_printf (_("New %s account"), mc_profile_get_display_name (profile)); - mc_account_set_display_name (account, str); + empathy_account_set_display_name (account, str); g_free (str); cap = mc_profile_get_capabilities (profile); @@ -845,7 +845,7 @@ accounts_dialog_button_create_clicked_cb (GtkWidget *button, active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->radiobutton_register)); if (active) { - mc_account_set_param_boolean (account, "register", TRUE); + empathy_account_set_param_boolean (account, "register", TRUE); } } @@ -860,7 +860,7 @@ static void accounts_dialog_button_back_clicked_cb (GtkWidget *button, EmpathyAccountsDialog *dialog) { - McAccount *account; + EmpathyAccount *account; account = accounts_dialog_model_get_selected (dialog); accounts_dialog_update_account (dialog, account); @@ -931,13 +931,13 @@ static void accounts_dialog_button_remove_clicked_cb (GtkWidget *button, EmpathyAccountsDialog *dialog) { - McAccount *account; + EmpathyAccount *account; GtkWidget *message_dialog; gint res; account = accounts_dialog_model_get_selected (dialog); - if (!mc_account_is_complete (account)) { + if (!empathy_account_is_valid (account)) { accounts_dialog_model_remove_selected (dialog); accounts_dialog_model_select_first (dialog); return; @@ -949,7 +949,7 @@ accounts_dialog_button_remove_clicked_cb (GtkWidget *button, GTK_BUTTONS_NONE, _("You are about to remove your %s account!\n" "Are you sure you want to proceed?"), - mc_account_get_display_name (account)); + empathy_account_get_display_name (account)); gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (message_dialog), @@ -970,7 +970,7 @@ accounts_dialog_button_remove_clicked_cb (GtkWidget *button, res = gtk_dialog_run (GTK_DIALOG (message_dialog)); if (res == GTK_RESPONSE_YES) { - mc_account_delete (account); + empathy_account_manager_remove (dialog->account_manager, account); accounts_dialog_model_select_first (dialog); } gtk_widget_destroy (message_dialog); @@ -1020,15 +1020,15 @@ accounts_dialog_destroy_cb (GtkWidget *widget, dialog); /* Delete incomplete accounts */ - accounts = mc_accounts_list (); + accounts = empathy_account_manager_dup_accounts (dialog->account_manager); for (l = accounts; l; l = l->next) { - McAccount *account; + EmpathyAccount *account; account = l->data; - if (!mc_account_is_complete (account)) { + if (!empathy_account_is_valid (account)) { /* FIXME: Warn the user the account is not complete * and is going to be removed. */ - mc_account_delete (account); + empathy_account_manager_remove (dialog->account_manager, account); } g_object_unref (account); @@ -1041,13 +1041,13 @@ accounts_dialog_destroy_cb (GtkWidget *widget, g_object_unref (dialog->account_manager); g_object_unref (dialog->mc); - + g_free (dialog); } GtkWidget * empathy_accounts_dialog_show (GtkWindow *parent, - McAccount *selected_account) + EmpathyAccount *selected_account) { static EmpathyAccountsDialog *dialog = NULL; GtkBuilder *gui; @@ -1135,7 +1135,7 @@ empathy_accounts_dialog_show (GtkWindow *parent, accounts_dialog_model_setup (dialog); /* Add existing accounts */ - accounts = mc_accounts_list (); + accounts = empathy_account_manager_dup_accounts (dialog->account_manager); for (l = accounts; l; l = l->next) { accounts_dialog_add_or_update_account (dialog, l->data); g_object_unref (l->data); diff --git a/src/empathy-accounts-dialog.h b/src/empathy-accounts-dialog.h index b8c3d3691..11e237c8f 100644 --- a/src/empathy-accounts-dialog.h +++ b/src/empathy-accounts-dialog.h @@ -27,12 +27,12 @@ #include <gtk/gtk.h> -#include <libmissioncontrol/mc-account.h> +#include <libempathy/empathy-account.h> G_BEGIN_DECLS GtkWidget *empathy_accounts_dialog_show (GtkWindow *parent, - McAccount *selected_account); + EmpathyAccount *selected_account); G_END_DECLS diff --git a/src/empathy-accounts-dialog.ui b/src/empathy-accounts-dialog.ui index 7f17f82ce..cf1b23ef4 100644 --- a/src/empathy-accounts-dialog.ui +++ b/src/empathy-accounts-dialog.ui @@ -23,15 +23,14 @@ <property name="spacing">6</property> <child> <object class="GtkScrolledWindow" id="scrolledwindow17"> + <property name="height_request">200</property> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="hscrollbar_policy">automatic</property> + <property name="hscrollbar_policy">never</property> <property name="vscrollbar_policy">automatic</property> <property name="shadow_type">in</property> <child> <object class="GtkTreeView" id="treeview"> - <property name="width_request">250</property> - <property name="height_request">200</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="enable_search">False</property> @@ -143,7 +142,6 @@ </child> <child> <object class="GtkVBox" id="vbox214"> - <property name="width_request">415</property> <property name="visible">True</property> <property name="spacing">18</property> <child> diff --git a/src/empathy-call-window.c b/src/empathy-call-window.c index 4ad1b2609..a71e9c8be 100644 --- a/src/empathy-call-window.c +++ b/src/empathy-call-window.c @@ -40,9 +40,9 @@ #include <libempathy-gtk/empathy-audio-sink.h> #include <libempathy-gtk/empathy-video-src.h> #include <libempathy-gtk/empathy-ui-utils.h> +#include <libempathy-gtk/empathy-sound.h> #include "empathy-call-window.h" - #include "empathy-call-window-fullscreen.h" #include "empathy-sidebar.h" @@ -60,11 +60,12 @@ #define REMOTE_CONTACT_AVATAR_DEFAULT_WIDTH EMPATHY_VIDEO_WIDGET_DEFAULT_HEIGHT #define REMOTE_CONTACT_AVATAR_DEFAULT_HEIGHT EMPATHY_VIDEO_WIDGET_DEFAULT_HEIGHT -#define CONNECTING_STATUS_TEXT _("Connecting...") - /* If an video input error occurs, the error message will start with "v4l" */ #define VIDEO_INPUT_ERROR_PREFIX "v4l" +/* The time interval in milliseconds between 2 outgoing rings */ +#define MS_BETWEEN_RING 500 + G_DEFINE_TYPE(EmpathyCallWindow, empathy_call_window, GTK_TYPE_WINDOW) /* signal enum */ @@ -81,6 +82,13 @@ enum { PROP_CALL_HANDLER = 1, }; +typedef enum { + CONNECTING, + CONNECTED, + DISCONNECTED, + REDIALING +} CallState; + /* private structure */ typedef struct _EmpathyCallWindowPriv EmpathyCallWindowPriv; @@ -90,7 +98,8 @@ struct _EmpathyCallWindowPriv EmpathyCallHandler *handler; EmpathyContact *contact; - gboolean connected; + guint call_state; + gboolean outgoing; GtkUIManager *ui_manager; GtkWidget *video_output; @@ -165,10 +174,6 @@ struct _EmpathyCallWindowPriv gboolean sidebar_was_visible_before_fs; gint original_width_before_fs; gint original_height_before_fs; - - /* Used to indicate if we are currently redialing. If we are, as soon as the - channel is closed, the call is automatically re-initiated.*/ - gboolean redialing; }; #define GET_PRIV(o) \ @@ -488,7 +493,7 @@ empathy_call_window_mic_volume_changed_cb (GtkAdjustment *adj, priv->volume = volume; /* Ensure that the toggle button is active if the volume is > 0 and inactive - * if it's smaller then 0 */ + * if it's smaller than 0 */ if ((volume > 0) != gtk_toggle_tool_button_get_active ( GTK_TOGGLE_TOOL_BUTTON (priv->mic_button))) gtk_toggle_tool_button_set_active ( @@ -650,6 +655,19 @@ empathy_call_window_setup_video_preview (EmpathyCallWindow *window) } static void +empathy_call_window_set_state_connecting (EmpathyCallWindow *window) +{ + EmpathyCallWindowPriv *priv = GET_PRIV (window); + + empathy_call_window_status_message (window, _("Connecting...")); + priv->call_state = CONNECTING; + + if (priv->outgoing) + empathy_sound_start_playing (GTK_WIDGET (window), + EMPATHY_SOUND_PHONE_OUTGOING, MS_BETWEEN_RING); +} + +static void empathy_call_window_init (EmpathyCallWindow *self) { EmpathyCallWindowPriv *priv = GET_PRIV (self); @@ -778,8 +796,6 @@ empathy_call_window_init (EmpathyCallWindow *self) g_signal_connect (G_OBJECT (self), "key-press-event", G_CALLBACK (empathy_call_window_key_press_cb), self); - empathy_call_window_status_message (self, CONNECTING_STATUS_TEXT); - priv->timer = g_timer_new (); g_object_ref (priv->ui_manager); @@ -921,10 +937,18 @@ empathy_call_window_constructed (GObject *object) { EmpathyCallWindow *self = EMPATHY_CALL_WINDOW (object); EmpathyCallWindowPriv *priv = GET_PRIV (self); + EmpathyTpCall *call; g_assert (priv->handler != NULL); + + g_object_get (priv->handler, "tp-call", &call, NULL); + priv->outgoing = (call == NULL); + if (call != NULL) + g_object_unref (call); + empathy_call_window_setup_avatars (self, priv->handler); empathy_call_window_setup_video_preview_visibility (self, priv->handler); + empathy_call_window_set_state_connecting (self); } static void empathy_call_window_dispose (GObject *object); @@ -985,7 +1009,6 @@ empathy_call_window_class_init ( G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS); g_object_class_install_property (object_class, PROP_CALL_HANDLER, param_spec); - } static void @@ -1180,7 +1203,11 @@ empathy_call_window_disconnected (EmpathyCallWindow *self) EmpathyCallWindowPriv *priv = GET_PRIV (self); gboolean could_reset_pipeline = empathy_call_window_reset_pipeline (self); - priv->connected = FALSE; + if (priv->call_state == CONNECTING) + empathy_sound_stop (EMPATHY_SOUND_PHONE_OUTGOING); + + if (priv->call_state != REDIALING) + priv->call_state = DISCONNECTED; if (could_reset_pipeline) { @@ -1201,13 +1228,17 @@ empathy_call_window_disconnected (EmpathyCallWindow *self) gtk_action_set_sensitive (priv->redial, TRUE); gtk_widget_set_sensitive (priv->redial_button, TRUE); - /* Reseting the send_video and camera_buton to their initial state */ + /* Reseting the send_video, camera_buton and mic_button to their + initial state */ gtk_widget_set_sensitive (priv->camera_button, FALSE); + gtk_widget_set_sensitive (priv->mic_button, FALSE); gtk_action_set_sensitive (priv->send_video, FALSE); gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (priv->send_video), initial_video); gtk_toggle_tool_button_set_active ( GTK_TOGGLE_TOOL_BUTTON (priv->camera_button), initial_video); + gtk_toggle_tool_button_set_active ( + GTK_TOGGLE_TOOL_BUTTON (priv->mic_button), TRUE); gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (priv->show_preview), FALSE); @@ -1232,11 +1263,8 @@ empathy_call_window_channel_closed_cb (TfChannel *channel, gpointer user_data) EmpathyCallWindow *self = EMPATHY_CALL_WINDOW (user_data); EmpathyCallWindowPriv *priv = GET_PRIV (self); - if (empathy_call_window_disconnected (self) && priv->redialing) - { + if (empathy_call_window_disconnected (self) && priv->call_state == REDIALING) empathy_call_window_restart_call (self); - priv->redialing = FALSE; - } } /* Called with global lock held */ @@ -1348,6 +1376,8 @@ empathy_call_window_connected (gpointer user_data) gtk_action_set_sensitive (priv->redial, FALSE); gtk_widget_set_sensitive (priv->redial_button, FALSE); + gtk_widget_set_sensitive (priv->mic_button, TRUE); + empathy_call_window_update_avatars_visibility (call, self); g_object_unref (call); @@ -1377,11 +1407,12 @@ empathy_call_window_src_added_cb (EmpathyCallHandler *handler, g_mutex_lock (priv->lock); - if (priv->connected == FALSE) + if (priv->call_state != CONNECTED) { g_timer_start (priv->timer); priv->timer_id = g_idle_add (empathy_call_window_connected, self); - priv->connected = TRUE; + priv->call_state = CONNECTED; + empathy_sound_stop (EMPATHY_SOUND_PHONE_OUTGOING); } switch (media_type) @@ -1623,6 +1654,9 @@ empathy_call_window_delete_cb (GtkWidget *widget, GdkEvent*event, if (priv->pipeline != NULL) gst_element_set_state (priv->pipeline, GST_STATE_NULL); + if (priv->call_state == CONNECTING) + empathy_sound_stop (EMPATHY_SOUND_PHONE_OUTGOING); + return FALSE; } @@ -1790,7 +1824,7 @@ empathy_call_window_camera_toggled_cb (GtkToggleToolButton *toggle, EmpathyCallWindowPriv *priv = GET_PRIV (window); gboolean active; - if (!priv->connected) + if (priv->call_state != CONNECTED) return; active = (gtk_toggle_tool_button_get_active (toggle)); @@ -1809,7 +1843,7 @@ empathy_call_window_send_video_toggled_cb (GtkToggleAction *toggle, EmpathyCallWindowPriv *priv = GET_PRIV (window); gboolean active; - if (!priv->connected) + if (priv->call_state != CONNECTED) return; active = (gtk_toggle_action_get_active (toggle)); @@ -1850,6 +1884,9 @@ empathy_call_window_mic_toggled_cb (GtkToggleToolButton *toggle, EmpathyCallWindowPriv *priv = GET_PRIV (window); gboolean active; + if (priv->audio_input == NULL) + return; + active = (gtk_toggle_tool_button_get_active (toggle)); if (active) @@ -1922,7 +1959,9 @@ empathy_call_window_restart_call (EmpathyCallWindow *window) if (!empathy_call_handler_has_initial_video (priv->handler)) gtk_widget_hide (priv->self_user_output_frame); - empathy_call_window_status_message (window, CONNECTING_STATUS_TEXT); + priv->outgoing = TRUE; + empathy_call_window_set_state_connecting (window); + priv->call_started = TRUE; empathy_call_handler_start_call (priv->handler); empathy_call_window_setup_avatars (window, priv->handler); @@ -1938,12 +1977,12 @@ empathy_call_window_redial_cb (gpointer object, { EmpathyCallWindowPriv *priv = GET_PRIV (window); - if (priv->connected) - priv->redialing = TRUE; + if (priv->call_state == CONNECTED) + priv->call_state = REDIALING; empathy_call_handler_stop_call (priv->handler); - if (!priv->connected) + if (priv->call_state != CONNECTED) empathy_call_window_restart_call (window); } diff --git a/src/empathy-chat-window.c b/src/empathy-chat-window.c index 118c7375e..f9d0b924a 100644 --- a/src/empathy-chat-window.c +++ b/src/empathy-chat-window.c @@ -50,6 +50,7 @@ #include <libempathy-gtk/empathy-log-window.h> #include <libempathy-gtk/empathy-geometry.h> #include <libempathy-gtk/empathy-smiley-manager.h> +#include <libempathy-gtk/empathy-sound.h> #include <libempathy-gtk/empathy-ui-utils.h> #include "empathy-chat-window.h" @@ -77,6 +78,7 @@ typedef struct { GtkUIManager *ui_manager; GtkAction *menu_conv_insert_smiley; GtkAction *menu_conv_favorite; + GtkAction *menu_conv_toggle_contacts; GtkAction *menu_edit_cut; GtkAction *menu_edit_copy; @@ -406,7 +408,7 @@ chat_window_update_chat_tab (EmpathyChat *chat) EmpathyContact *remote_contact; const gchar *name; const gchar *id; - McAccount *account; + EmpathyAccount *account; const gchar *subject; const gchar *status = NULL; GtkWidget *widget; @@ -427,7 +429,7 @@ chat_window_update_chat_tab (EmpathyChat *chat) remote_contact = empathy_chat_get_remote_contact (chat); DEBUG ("Updating chat tab, name=%s, account=%s, subject=%s, remote_contact=%p", - name, mc_account_get_unique_name (account), subject, remote_contact); + name, empathy_account_get_unique_name (account), subject, remote_contact); /* Update tab image */ if (g_list_find (priv->chats_new_msg, chat)) { @@ -459,7 +461,7 @@ chat_window_update_chat_tab (EmpathyChat *chat) append_markup_printf (tooltip, "<b>%s</b><small> (%s)</small>", id, - mc_account_get_display_name (account)); + empathy_account_get_display_name (account)); if (!EMP_STR_EMPTY (status)) { append_markup_printf (tooltip, "\n<i>%s</i>", status); @@ -547,24 +549,45 @@ chat_window_conv_activate_cb (GtkAction *action, { EmpathyChatWindowPriv *priv = GET_PRIV (window); gboolean is_room; + gboolean active; + EmpathyContact *remote_contact = NULL; /* Favorite room menu */ is_room = empathy_chat_is_room (priv->current_chat); if (is_room) { const gchar *room; - McAccount *account; - gboolean found; + EmpathyAccount *account; + gboolean found = FALSE; + EmpathyChatroom *chatroom; room = empathy_chat_get_id (priv->current_chat); account = empathy_chat_get_account (priv->current_chat); - found = empathy_chatroom_manager_find (priv->chatroom_manager, - account, room) != NULL; + chatroom = empathy_chatroom_manager_find (priv->chatroom_manager, + account, room); + if (chatroom != NULL) + found = empathy_chatroom_is_favorite (chatroom); DEBUG ("This room %s favorite", found ? "is" : "is not"); gtk_toggle_action_set_active ( GTK_TOGGLE_ACTION (priv->menu_conv_favorite), found); } gtk_action_set_visible (priv->menu_conv_favorite, is_room); + + /* Show contacts menu */ + g_object_get (priv->current_chat, + "remote-contact", &remote_contact, + "show-contacts", &active, + NULL); + if (remote_contact == NULL) { + gtk_toggle_action_set_active ( + GTK_TOGGLE_ACTION (priv->menu_conv_toggle_contacts), + active); + } + gtk_action_set_visible (priv->menu_conv_toggle_contacts, + (remote_contact == NULL)); + if (remote_contact != NULL) { + g_object_unref (remote_contact); + } } static void @@ -582,7 +605,7 @@ chat_window_favorite_toggled_cb (GtkToggleAction *toggle_action, { EmpathyChatWindowPriv *priv = GET_PRIV (window); gboolean active; - McAccount *account; + EmpathyAccount *account; const gchar *room; EmpathyChatroom *chatroom; @@ -593,19 +616,28 @@ chat_window_favorite_toggled_cb (GtkToggleAction *toggle_action, chatroom = empathy_chatroom_manager_find (priv->chatroom_manager, account, room); - if (active && !chatroom) { + if (chatroom == NULL) { const gchar *name; name = empathy_chat_get_name (priv->current_chat); chatroom = empathy_chatroom_new_full (account, room, name, FALSE); empathy_chatroom_manager_add (priv->chatroom_manager, chatroom); g_object_unref (chatroom); - return; - } - - if (!active && chatroom) { - empathy_chatroom_manager_remove (priv->chatroom_manager, chatroom); - } + } + + empathy_chatroom_set_favorite (chatroom, active); +} + +static void +chat_window_contacts_toggled_cb (GtkToggleAction *toggle_action, + EmpathyChatWindow *window) +{ + EmpathyChatWindowPriv *priv = GET_PRIV (window); + gboolean active; + + active = gtk_toggle_action_get_active (toggle_action); + + empathy_chat_set_show_contacts (priv->current_chat, active); } static const gchar * @@ -942,11 +974,15 @@ chat_window_show_or_update_notification (EmpathyChatWindow *window, if (priv->notification != NULL) { notify_notification_update (priv->notification, header, escaped, NULL); - notify_notification_set_icon_from_pixbuf (priv->notification, pixbuf); + /* if icon doesn't exist libnotify will crash */ + if (pixbuf != NULL) + notify_notification_set_icon_from_pixbuf (priv->notification, pixbuf); } else { priv->notification = notify_notification_new (header, escaped, NULL, NULL); notify_notification_set_timeout (priv->notification, NOTIFY_EXPIRES_DEFAULT); - notify_notification_set_icon_from_pixbuf (priv->notification, pixbuf); + /* if icon doesn't exist libnotify will crash */ + if (pixbuf != NULL) + notify_notification_set_icon_from_pixbuf (priv->notification, pixbuf); g_signal_connect (priv->notification, "closed", G_CALLBACK (chat_window_notification_closed_cb), cb_data); @@ -1179,7 +1215,7 @@ chat_window_focus_in_event_cb (GtkWidget *widget, priv->chats_new_msg = g_list_remove (priv->chats_new_msg, priv->current_chat); chat_window_set_urgency_hint (window, FALSE); - + /* Update the title, since we now mark all unread messages as read. */ chat_window_update_chat_tab (priv->current_chat); @@ -1199,55 +1235,54 @@ chat_window_drag_data_received (GtkWidget *widget, if (info == DND_DRAG_TYPE_CONTACT_ID) { EmpathyChat *chat; EmpathyChatWindow *old_window; - McAccount *account; + EmpathyAccount *account; + EmpathyAccountManager *account_manager; const gchar *id; gchar **strv; const gchar *account_id; const gchar *contact_id; id = (const gchar*) selection->data; + account_manager = empathy_account_manager_dup_singleton (); DEBUG ("DND contact from roster with id:'%s'", id); - + strv = g_strsplit (id, "/", 2); account_id = strv[0]; contact_id = strv[1]; - account = mc_account_lookup (account_id); + account = empathy_account_manager_lookup (account_manager, account_id); chat = empathy_chat_window_find_chat (account, contact_id); if (!chat) { - EmpathyAccountManager *account_manager; TpConnection *connection; - account_manager = empathy_account_manager_dup_singleton (); - connection = empathy_account_manager_get_connection ( - account_manager, account); + connection = empathy_account_get_connection (account); if (connection) { empathy_dispatcher_chat_with_contact_id ( connection, contact_id, NULL, NULL); } - g_object_unref (account_manager); g_object_unref (account); g_strfreev (strv); return; } g_object_unref (account); + g_object_unref (account_manager); g_strfreev (strv); - old_window = chat_window_find_chat (chat); + old_window = chat_window_find_chat (chat); if (old_window) { if (old_window == window) { gtk_drag_finish (context, TRUE, FALSE, time); return; } - + empathy_chat_window_move_chat (old_window, window, chat); } else { empathy_chat_window_add_chat (window, chat); } - + /* Added to take care of any outstanding chat events */ empathy_chat_window_present_chat (chat); @@ -1278,7 +1313,7 @@ chat_window_drag_data_received (GtkWidget *widget, gtk_drag_finish (context, TRUE, FALSE, time); return; } - + priv->dnd_same_window = FALSE; } @@ -1368,6 +1403,7 @@ empathy_chat_window_init (EmpathyChatWindow *window) "ui_manager", &priv->ui_manager, "menu_conv_insert_smiley", &priv->menu_conv_insert_smiley, "menu_conv_favorite", &priv->menu_conv_favorite, + "menu_conv_toggle_contacts", &priv->menu_conv_toggle_contacts, "menu_edit_cut", &priv->menu_edit_cut, "menu_edit_copy", &priv->menu_edit_copy, "menu_edit_paste", &priv->menu_edit_paste, @@ -1384,6 +1420,7 @@ empathy_chat_window_init (EmpathyChatWindow *window) "menu_conv", "activate", chat_window_conv_activate_cb, "menu_conv_clear", "activate", chat_window_clear_activate_cb, "menu_conv_favorite", "toggled", chat_window_favorite_toggled_cb, + "menu_conv_toggle_contacts", "toggled", chat_window_contacts_toggled_cb, "menu_conv_close", "activate", chat_window_close_activate_cb, "menu_edit", "activate", chat_window_edit_activate_cb, "menu_edit_cut", "activate", chat_window_cut_activate_cb, @@ -1565,14 +1602,14 @@ empathy_chat_window_add_chat (EmpathyChatWindow *window, /* If this window has just been created, position it */ if (priv->chats == NULL) { empathy_geometry_load (chat_get_window_id_for_geometry (chat), &x, &y, &w, &h); - + if (x >= 0 && y >= 0) { /* Let the window manager position it if we don't have * good x, y coordinates. */ gtk_window_move (GTK_WINDOW (priv->dialog), x, y); } - + if (w > 0 && h > 0) { /* Use the defaults from the ui file if we don't have * good w, h geometry. @@ -1702,12 +1739,11 @@ empathy_chat_window_has_focus (EmpathyChatWindow *window) } EmpathyChat * -empathy_chat_window_find_chat (McAccount *account, +empathy_chat_window_find_chat (EmpathyAccount *account, const gchar *id) { GList *l; - g_return_val_if_fail (MC_IS_ACCOUNT (account), NULL); g_return_val_if_fail (!EMP_STR_EMPTY (id), NULL); for (l = chat_windows; l; l = l->next) { diff --git a/src/empathy-chat-window.h b/src/empathy-chat-window.h index c46ef8fc4..6f3d21fca 100644 --- a/src/empathy-chat-window.h +++ b/src/empathy-chat-window.h @@ -31,7 +31,7 @@ #include <glib-object.h> #include <gtk/gtk.h> -#include <libmissioncontrol/mc-account.h> +#include <libempathy/empathy-account.h> #include <libempathy-gtk/empathy-chat.h> G_BEGIN_DECLS @@ -69,7 +69,7 @@ void empathy_chat_window_move_chat (EmpathyChatWindow *old_wi void empathy_chat_window_switch_to_chat (EmpathyChatWindow *window, EmpathyChat *chat); gboolean empathy_chat_window_has_focus (EmpathyChatWindow *window); -EmpathyChat * empathy_chat_window_find_chat (McAccount *account, +EmpathyChat * empathy_chat_window_find_chat (EmpathyAccount *account, const gchar *id); void empathy_chat_window_present_chat (EmpathyChat *chat); diff --git a/src/empathy-chat-window.ui b/src/empathy-chat-window.ui index 0d5a83180..8c8ea7d00 100644 --- a/src/empathy-chat-window.ui +++ b/src/empathy-chat-window.ui @@ -32,6 +32,13 @@ </object> </child> <child> + <object class="GtkToggleAction" id="menu_conv_toggle_contacts"> + <property name="name">menu_conv_toggle_contacts</property> + <property name="active">TRUE</property> + <property name="label" translatable="yes">_Show Contact List</property> + </object> + </child> + <child> <object class="GtkAction" id="menu_conv_close"> <property name="stock_id">gtk-close</property> <property name="name">menu_conv_close</property> @@ -137,6 +144,7 @@ <menuitem action="menu_conv_clear"/> <menuitem action="menu_conv_insert_smiley"/> <menuitem action="menu_conv_favorite"/> + <menuitem action="menu_conv_toggle_contacts"/> <separator/> <menuitem action="menu_conv_close"/> </menu> diff --git a/src/empathy-chatrooms-window.c b/src/empathy-chatrooms-window.c index a0fb8e6ec..3b5dd1f77 100644 --- a/src/empathy-chatrooms-window.c +++ b/src/empathy-chatrooms-window.c @@ -308,7 +308,7 @@ chatrooms_window_model_refresh_data (EmpathyChatroomsWindow *window, GtkTreeIter iter; GtkTreeViewColumn *column; EmpathyAccountChooser *account_chooser; - McAccount *account; + EmpathyAccount *account; GList *chatrooms, *l; view = GTK_TREE_VIEW (window->treeview); @@ -506,7 +506,7 @@ chatrooms_window_chatroom_added_cb (EmpathyChatroomManager *manager, EmpathyChatroomsWindow *window) { EmpathyAccountChooser *account_chooser; - McAccount *account; + EmpathyAccount *account; account_chooser = EMPATHY_ACCOUNT_CHOOSER (window->account_chooser); account = empathy_account_chooser_dup_account (account_chooser); diff --git a/src/empathy-debug-dialog.c b/src/empathy-debug-dialog.c index f6fe6e8b2..cd0d925f9 100644 --- a/src/empathy-debug-dialog.c +++ b/src/empathy-debug-dialog.c @@ -430,8 +430,6 @@ debug_dialog_get_name_owner_cb (TpDBusDaemon *proxy, COL_CM_NAME, data->cm_name, COL_CM_UNIQUE_NAME, out, -1); - - gtk_combo_box_set_active (GTK_COMBO_BOX (priv->cm_chooser), 0); } OUT: @@ -568,6 +566,7 @@ debug_dialog_fill_cm_chooser (EmpathyDebugDialog *debug_dialog) { EmpathyDebugDialogPriv *priv = GET_PRIV (debug_dialog); GError *error = NULL; + GtkTreeIter iter; priv->dbus = tp_dbus_daemon_dup (&error); @@ -578,6 +577,15 @@ debug_dialog_fill_cm_chooser (EmpathyDebugDialog *debug_dialog) return; } + /* Add empathy */ + gtk_list_store_append (priv->cms, &iter); + gtk_list_store_set (priv->cms, &iter, + COL_CM_NAME, "empathy", + COL_CM_UNIQUE_NAME, "org.gnome.Empathy", + -1); + gtk_combo_box_set_active (GTK_COMBO_BOX (priv->cm_chooser), 0); + + /* Add CMs to list */ tp_list_connection_names (priv->dbus, debug_dialog_list_connection_names_cb, debug_dialog, NULL, NULL); diff --git a/src/empathy-event-manager.c b/src/empathy-event-manager.c index 1ee619e58..1a7ec09cb 100644 --- a/src/empathy-event-manager.c +++ b/src/empathy-event-manager.c @@ -26,6 +26,7 @@ #include <telepathy-glib/util.h> +#include <libempathy/empathy-account-manager.h> #include <libempathy/empathy-dispatcher.h> #include <libempathy/empathy-tp-contact-factory.h> #include <libempathy/empathy-contact-manager.h> @@ -37,9 +38,10 @@ #include <extensions/extensions.h> +#include <libempathy-gtk/empathy-conf.h> #include <libempathy-gtk/empathy-images.h> #include <libempathy-gtk/empathy-contact-dialogs.h> -#include <libempathy-gtk/empathy-ui-utils.h> +#include <libempathy-gtk/empathy-sound.h> #include "empathy-event-manager.h" #include "empathy-main-window.h" @@ -50,6 +52,11 @@ #define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyEventManager) +#define NOTIFICATION_TIMEOUT 2 /* seconds */ + +/* The time interval in milliseconds between 2 incoming rings */ +#define MS_BETWEEN_RING 500 + typedef struct { EmpathyEventManager *manager; EmpathyDispatchOperation *operation; @@ -74,8 +81,6 @@ typedef struct { /* Ongoing approvals */ GSList *approvals; - /* voip ringing sound */ - guint voip_timeout; gint ringing; } EmpathyEventManagerPriv; @@ -161,81 +166,6 @@ event_free (EventPriv *event) g_slice_free (EventPriv, event); } -static void event_manager_ringing_finished_cb (ca_context *c, guint id, - int error_code, gpointer user_data); - -static gboolean -event_manager_ringing_timeout_cb (gpointer data) -{ - EmpathyEventManager *manager = EMPATHY_EVENT_MANAGER (data); - EmpathyEventManagerPriv *priv = GET_PRIV (manager); - - priv->voip_timeout = 0; - - empathy_sound_play_full (empathy_main_window_get (), - EMPATHY_SOUND_PHONE_INCOMING, event_manager_ringing_finished_cb, - manager); - - return FALSE; -} - -static gboolean -event_manager_ringing_idle_cb (gpointer data) -{ - EmpathyEventManager *manager = EMPATHY_EVENT_MANAGER (data); - EmpathyEventManagerPriv *priv = GET_PRIV (manager); - - if (priv->ringing > 0) - priv->voip_timeout = g_timeout_add (500, event_manager_ringing_timeout_cb, - data); - - return FALSE; -} - -static void -event_manager_ringing_finished_cb (ca_context *c, guint id, int error_code, - gpointer user_data) -{ - if (error_code == CA_ERROR_CANCELED) - return; - - g_idle_add (event_manager_ringing_idle_cb, user_data); -} - -static void -event_manager_start_ringing (EmpathyEventManager *manager) -{ - EmpathyEventManagerPriv *priv = GET_PRIV (manager); - - priv->ringing++; - - if (priv->ringing == 1) - { - empathy_sound_play_full (empathy_main_window_get (), - EMPATHY_SOUND_PHONE_INCOMING, event_manager_ringing_finished_cb, - manager); - } -} - -static void -event_manager_stop_ringing (EmpathyEventManager *manager) -{ - EmpathyEventManagerPriv *priv = GET_PRIV (manager); - - priv->ringing--; - - if (priv->ringing > 0) - return; - - empathy_sound_stop (EMPATHY_SOUND_PHONE_INCOMING); - - if (priv->voip_timeout != 0) - { - g_source_remove (priv->voip_timeout); - priv->voip_timeout = 0; - } -} - static void event_remove (EventPriv *event) { @@ -247,6 +177,13 @@ event_remove (EventPriv *event) event_free (event); } +static gboolean +autoremove_event_timeout_cb (EventPriv *event) +{ + event_remove (event); + return FALSE; +} + static void event_manager_add (EmpathyEventManager *manager, EmpathyContact *contact, const gchar *icon_name, const gchar *header, const gchar *message, @@ -260,6 +197,7 @@ event_manager_add (EmpathyEventManager *manager, EmpathyContact *contact, event->public.icon_name = g_strdup (icon_name); event->public.header = g_strdup (header); event->public.message = g_strdup (message); + event->public.must_ack = (func != NULL); event->inhibit = FALSE; event->func = func; event->user_data = user_data; @@ -269,6 +207,12 @@ event_manager_add (EmpathyEventManager *manager, EmpathyContact *contact, DEBUG ("Adding event %p", event); priv->events = g_slist_prepend (priv->events, event); g_signal_emit (event->manager, signals[EVENT_ADDED], 0, event); + + if (!event->public.must_ack) + { + g_timeout_add_seconds (NOTIFICATION_TIMEOUT, + (GSourceFunc) autoremove_event_timeout_cb, event); + } } static void @@ -455,7 +399,9 @@ event_manager_approval_done (EventManagerApproval *approval) approval->operation); if (channel_type == TP_IFACE_QUARK_CHANNEL_TYPE_STREAMED_MEDIA) { - event_manager_stop_ringing (approval->manager); + priv->ringing--; + if (priv->ringing == 0) + empathy_sound_stop (EMPATHY_SOUND_PHONE_INCOMING); } } @@ -500,6 +446,7 @@ event_manager_operation_invalidated_cb (EmpathyDispatchOperation *operation, static void event_manager_media_channel_got_contact (EventManagerApproval *approval) { + EmpathyEventManagerPriv *priv = GET_PRIV (approval->manager); gchar *header; header = g_strdup_printf (_("Incoming call from %s"), @@ -510,7 +457,11 @@ event_manager_media_channel_got_contact (EventManagerApproval *approval) approval, event_channel_process_voip_func, NULL); g_free (header); - event_manager_start_ringing (approval->manager); + + priv->ringing++; + if (priv->ringing == 1) + empathy_sound_start_playing (empathy_main_window_get (), + EMPATHY_SOUND_PHONE_INCOMING, MS_BETWEEN_RING); } static void @@ -956,6 +907,58 @@ event_manager_pendings_changed_cb (EmpathyContactList *list, g_free (header); } +static void +event_manager_presence_changed_cb (EmpathyContactMonitor *monitor, + EmpathyContact *contact, + TpConnectionPresenceType current, + TpConnectionPresenceType previous, + EmpathyEventManager *manager) +{ + EmpathyAccount *account; + gchar *header = NULL; + gboolean preference = FALSE; + + account = empathy_contact_get_account (contact); + if (empathy_account_is_just_connected (account)) + return; + + if (tp_connection_presence_type_cmp_availability (previous, + TP_CONNECTION_PRESENCE_TYPE_OFFLINE) > 0) + { + /* contact was online */ + empathy_conf_get_bool (empathy_conf_get (), + EMPATHY_PREFS_NOTIFICATIONS_CONTACT_SIGNOUT, &preference); + if (preference && tp_connection_presence_type_cmp_availability (current, + TP_CONNECTION_PRESENCE_TYPE_OFFLINE) <= 0) + { + /* someone is logging off */ + header = g_strdup_printf (_("%s is now offline."), + empathy_contact_get_name (contact)); + + event_manager_add (manager, contact, GTK_STOCK_DIALOG_INFO, header, + NULL, NULL, NULL, NULL); + } + } + else + { + /* contact was offline */ + empathy_conf_get_bool (empathy_conf_get (), + EMPATHY_PREFS_NOTIFICATIONS_CONTACT_SIGNIN, &preference); + if (preference && tp_connection_presence_type_cmp_availability (current, + TP_CONNECTION_PRESENCE_TYPE_OFFLINE) > 0) + { + /* someone is logging in */ + header = g_strdup_printf (_("%s is now online."), + empathy_contact_get_name (contact)); + + event_manager_add (manager, contact, GTK_STOCK_DIALOG_INFO, header, + NULL, NULL, NULL, NULL); + } + } + g_free (header); +} + + static GObject * event_manager_constructor (GType type, guint n_props, @@ -981,6 +984,9 @@ event_manager_finalize (GObject *object) { EmpathyEventManagerPriv *priv = GET_PRIV (object); + if (priv->ringing > 0) + empathy_sound_stop (EMPATHY_SOUND_PHONE_INCOMING); + g_slist_foreach (priv->events, (GFunc) event_free, NULL); g_slist_free (priv->events); g_slist_foreach (priv->approvals, (GFunc) event_manager_approval_free, NULL); @@ -1034,6 +1040,12 @@ empathy_event_manager_init (EmpathyEventManager *manager) { EmpathyEventManagerPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (manager, EMPATHY_TYPE_EVENT_MANAGER, EmpathyEventManagerPriv); + EmpathyContactMonitor *monitor; + EmpathyContactList *list_iface; + + list_iface = EMPATHY_CONTACT_LIST (empathy_contact_manager_dup_singleton ()); + monitor = empathy_contact_list_get_monitor (list_iface); + g_object_unref (list_iface); manager->priv = priv; @@ -1043,6 +1055,8 @@ empathy_event_manager_init (EmpathyEventManager *manager) G_CALLBACK (event_manager_approve_channel_cb), manager); g_signal_connect (priv->contact_manager, "pendings-changed", G_CALLBACK (event_manager_pendings_changed_cb), manager); + g_signal_connect (monitor, "contact-presence-changed", + G_CALLBACK (event_manager_presence_changed_cb), manager); } EmpathyEventManager * @@ -1093,4 +1107,3 @@ empathy_event_inhibit_updates (EmpathyEvent *event_public) event->inhibit = TRUE; } - diff --git a/src/empathy-event-manager.h b/src/empathy-event-manager.h index 42fd0c090..af73c8ea7 100644 --- a/src/empathy-event-manager.h +++ b/src/empathy-event-manager.h @@ -53,6 +53,7 @@ typedef struct { gchar *icon_name; gchar *header; gchar *message; + gboolean must_ack; } EmpathyEvent; GType empathy_event_manager_get_type (void) G_GNUC_CONST; diff --git a/src/empathy-import-dialog.c b/src/empathy-import-dialog.c index 8e9a04595..1e135892d 100644 --- a/src/empathy-import-dialog.c +++ b/src/empathy-import-dialog.c @@ -27,7 +27,6 @@ #include <gtk/gtk.h> #include <glib/gi18n.h> -#include <libmissioncontrol/mc-account.h> #include <telepathy-glib/util.h> #include "empathy-import-dialog.h" @@ -36,6 +35,7 @@ #define DEBUG_FLAG EMPATHY_DEBUG_OTHER #include <libempathy/empathy-debug.h> #include <libempathy/empathy-utils.h> +#include <libempathy/empathy-account-manager.h> #include <libempathy-gtk/empathy-ui-utils.h> @@ -91,13 +91,16 @@ empathy_import_account_data_free (EmpathyImportAccountData *data) static void import_dialog_add_account (EmpathyImportAccountData *data) { - McAccount *account; + EmpathyAccountManager *account_manager; + EmpathyAccount *account; GHashTableIter iter; gpointer key, value; gchar *display_name; GValue *username; - account = mc_account_create (data->profile); + account_manager = empathy_account_manager_dup_singleton (); + account = empathy_account_manager_create (account_manager, data->profile); + g_object_unref (account_manager); if (account == NULL) { DEBUG ("Failed to create account"); @@ -115,21 +118,21 @@ import_dialog_add_account (EmpathyImportAccountData *data) case G_TYPE_STRING: DEBUG ("Set param '%s' to '%s' (string)", param, g_value_get_string (gvalue)); - mc_account_set_param_string (account, + empathy_account_set_param_string (account, param, g_value_get_string (gvalue)); break; case G_TYPE_BOOLEAN: DEBUG ("Set param '%s' to %s (boolean)", param, g_value_get_boolean (gvalue) ? "TRUE" : "FALSE"); - mc_account_set_param_boolean (account, + empathy_account_set_param_boolean (account, param, g_value_get_boolean (gvalue)); break; case G_TYPE_INT: DEBUG ("Set param '%s' to '%i' (integer)", param, g_value_get_int (gvalue)); - mc_account_set_param_int (account, + empathy_account_set_param_int (account, param, g_value_get_int (gvalue)); break; } @@ -140,7 +143,7 @@ import_dialog_add_account (EmpathyImportAccountData *data) display_name = g_strdup_printf ("%s (%s)", mc_profile_get_display_name (data->profile), g_value_get_string (username)); - mc_account_set_display_name (account, display_name); + empathy_account_set_display_name (account, display_name); g_free (display_name); g_object_unref (account); @@ -155,11 +158,12 @@ import_dialog_account_id_in_list (GList *accounts, for (l = accounts; l; l = l->next) { McAccount *account = l->data; - gchar *value; + gchar *value = NULL; gboolean result; - if (mc_account_get_param_string (account, "account", &value) - == MC_ACCOUNT_SETTING_ABSENT) + mc_account_get_param_string (account, "account", &value); + + if (value == NULL) continue; result = tp_strdiff (value, account_id); diff --git a/src/empathy-import-dialog.h b/src/empathy-import-dialog.h index a3ef3e13c..0e3fd148f 100644 --- a/src/empathy-import-dialog.h +++ b/src/empathy-import-dialog.h @@ -20,6 +20,7 @@ */ #include <gtk/gtk.h> +#include <libmissioncontrol/mc-profile.h> #ifndef __EMPATHY_IMPORT_DIALOG_H__ #define __EMPATHY_IMPORT_DIALOG_H__ diff --git a/src/empathy-import-pidgin.c b/src/empathy-import-pidgin.c index 804936eae..935c022ea 100644 --- a/src/empathy-import-pidgin.c +++ b/src/empathy-import-pidgin.c @@ -28,7 +28,6 @@ #include <libxml/parser.h> #include <libxml/tree.h> -#include <libmissioncontrol/mc-account.h> #include <telepathy-glib/util.h> #include <telepathy-glib/dbus.h> diff --git a/src/empathy-main-window.c b/src/empathy-main-window.c index 5830d2b71..c7816d7fd 100644 --- a/src/empathy-main-window.c +++ b/src/empathy-main-window.c @@ -37,16 +37,17 @@ #include <libempathy/empathy-contact-manager.h> #include <libempathy/empathy-status-presets.h> +#include <libempathy-gtk/empathy-conf.h> #include <libempathy-gtk/empathy-contact-dialogs.h> #include <libempathy-gtk/empathy-contact-list-store.h> #include <libempathy-gtk/empathy-contact-list-view.h> -#include <libempathy-gtk/empathy-presence-chooser.h> -#include <libempathy-gtk/empathy-ui-utils.h> #include <libempathy-gtk/empathy-geometry.h> -#include <libempathy-gtk/empathy-conf.h> -#include <libempathy-gtk/empathy-log-window.h> -#include <libempathy-gtk/empathy-new-message-dialog.h> #include <libempathy-gtk/empathy-gtk-enum-types.h> +#include <libempathy-gtk/empathy-new-message-dialog.h> +#include <libempathy-gtk/empathy-log-window.h> +#include <libempathy-gtk/empathy-presence-chooser.h> +#include <libempathy-gtk/empathy-sound.h> +#include <libempathy-gtk/empathy-ui-utils.h> #include <libmissioncontrol/mission-control.h> @@ -197,7 +198,7 @@ main_window_flash_cb (EmpathyMainWindow *window) events = empathy_event_manager_get_events (window->event_manager); for (l = events; l; l = l->next) { data.event = l->data; - if (!data.event->contact) { + if (!data.event->contact || !data.event->must_ack) { continue; } @@ -301,7 +302,7 @@ static void main_window_error_edit_clicked_cb (GtkButton *button, EmpathyMainWindow *window) { - McAccount *account; + EmpathyAccount *account; GtkWidget *error_widget; account = g_object_get_data (G_OBJECT (button), "account"); @@ -316,7 +317,7 @@ static void main_window_error_clear_clicked_cb (GtkButton *button, EmpathyMainWindow *window) { - McAccount *account; + EmpathyAccount *account; GtkWidget *error_widget; account = g_object_get_data (G_OBJECT (button), "account"); @@ -327,7 +328,7 @@ main_window_error_clear_clicked_cb (GtkButton *button, static void main_window_error_display (EmpathyMainWindow *window, - McAccount *account, + EmpathyAccount *account, const gchar *message) { GtkWidget *child; @@ -348,7 +349,7 @@ main_window_error_display (EmpathyMainWindow *window, /* Just set the latest error and return */ str = g_markup_printf_escaped ("<b>%s</b>\n%s", - mc_account_get_display_name (account), + empathy_account_get_display_name (account), message); gtk_label_set_markup (GTK_LABEL (label), str); g_free (str); @@ -429,7 +430,7 @@ main_window_error_display (EmpathyMainWindow *window, gtk_misc_set_alignment (GTK_MISC (label), 0, 0); str = g_markup_printf_escaped ("<b>%s</b>\n%s", - mc_account_get_display_name (account), + empathy_account_get_display_name (account), message); gtk_label_set_markup (GTK_LABEL (label), str); g_free (str); @@ -481,7 +482,7 @@ main_window_update_status (EmpathyMainWindow *window, EmpathyAccountManager *man static void main_window_connection_changed_cb (EmpathyAccountManager *manager, - McAccount *account, + EmpathyAccount *account, TpConnectionStatusReason reason, TpConnectionStatus current, TpConnectionStatus previous, @@ -568,11 +569,11 @@ main_window_contact_presence_changed_cb (EmpathyContactMonitor *monitor, TpConnectionPresenceType previous, EmpathyMainWindow *window) { - McAccount *account; + EmpathyAccount *account; gboolean should_play; account = empathy_contact_get_account (contact); - should_play = !empathy_account_manager_is_account_just_connected (window->account_manager, account); + should_play = !empathy_account_is_just_connected (account); if (!should_play) { return; @@ -728,16 +729,13 @@ main_window_view_show_map_cb (GtkCheckMenuItem *item, static void main_window_favorite_chatroom_join (EmpathyChatroom *chatroom) { - EmpathyAccountManager *manager; - McAccount *account; + EmpathyAccount *account; TpConnection *connection; const gchar *room; - manager = empathy_account_manager_dup_singleton (); account = empathy_chatroom_get_account (chatroom); - connection = empathy_account_manager_get_connection (manager, account); + connection = empathy_account_get_connection (account); room = empathy_chatroom_get_room (chatroom); - g_object_unref (manager); if (connection != NULL) { DEBUG ("Requesting channel for '%s'", room); @@ -1008,7 +1006,7 @@ main_window_configure_event_cb (GtkWidget *widget, static void main_window_account_created_or_deleted_cb (EmpathyAccountManager *manager, - McAccount *account, + EmpathyAccount *account, EmpathyMainWindow *window) { gtk_action_set_sensitive (window->view_history, diff --git a/src/empathy-map-view.c b/src/empathy-map-view.c index 99c496b23..86e15bdff 100644 --- a/src/empathy-map-view.c +++ b/src/empathy-map-view.c @@ -161,7 +161,7 @@ map_view_contacts_foreach (GtkTreeModel *model, GtkTreeIter *iter, gpointer user_data) { - EmpathyMapView *window = (EmpathyMapView*) user_data; + EmpathyMapView *window = (EmpathyMapView *) user_data; EmpathyContact *contact; ClutterActor *marker; ClutterActor *texture; diff --git a/src/empathy-new-chatroom-dialog.c b/src/empathy-new-chatroom-dialog.c index 563665932..e16da91a7 100644 --- a/src/empathy-new-chatroom-dialog.c +++ b/src/empathy-new-chatroom-dialog.c @@ -33,7 +33,6 @@ #include <glib/gprintf.h> #include <libmissioncontrol/mission-control.h> -#include <libmissioncontrol/mc-account.h> #include <libmissioncontrol/mc-profile.h> #include <libempathy/empathy-tp-roomlist.h> @@ -358,14 +357,14 @@ static void new_chatroom_dialog_update_widgets (EmpathyNewChatroomDialog *dialog) { EmpathyAccountChooser *account_chooser; - McAccount *account; + EmpathyAccount *account; McProfile *profile; const gchar *protocol; const gchar *room; - + account_chooser = EMPATHY_ACCOUNT_CHOOSER (dialog->account_chooser); account = empathy_account_chooser_dup_account (account_chooser); - profile = mc_account_get_profile (account); + profile = empathy_account_get_profile (account); protocol = mc_profile_get_protocol_name (profile); gtk_entry_set_text (GTK_ENTRY (dialog->entry_server), ""); @@ -399,12 +398,13 @@ new_chatroom_dialog_account_changed_cb (GtkComboBox *combobox, EmpathyNewChatroomDialog *dialog) { EmpathyAccountChooser *account_chooser; - McAccount *account; + EmpathyAccount *account; gboolean listing = FALSE; gboolean expanded = FALSE; if (dialog->room_list) { g_object_unref (dialog->room_list); + dialog->room_list = NULL; } ephy_spinner_stop (EPHY_SPINNER (dialog->throbber)); @@ -412,6 +412,9 @@ new_chatroom_dialog_account_changed_cb (GtkComboBox *combobox, account_chooser = EMPATHY_ACCOUNT_CHOOSER (dialog->account_chooser); account = empathy_account_chooser_dup_account (account_chooser); + if (account == NULL) + goto out; + dialog->room_list = empathy_tp_roomlist_new (account); if (dialog->room_list) { @@ -444,9 +447,10 @@ new_chatroom_dialog_account_changed_cb (GtkComboBox *combobox, } } - new_chatroom_dialog_update_widgets (dialog); - g_object_unref (account); + +out: + new_chatroom_dialog_update_widgets (dialog); } static void @@ -545,7 +549,7 @@ new_chatroom_dialog_listing_cb (EmpathyTpRoomlist *room_list, /* Update the throbber */ if (listing) { - ephy_spinner_start (EPHY_SPINNER (dialog->throbber)); + ephy_spinner_start (EPHY_SPINNER (dialog->throbber)); } else { ephy_spinner_stop (EPHY_SPINNER (dialog->throbber)); } @@ -572,7 +576,7 @@ new_chatroom_dialog_model_row_activated_cb (GtkTreeView *tree_view, static void new_chatroom_dialog_model_selection_changed (GtkTreeSelection *selection, EmpathyNewChatroomDialog *dialog) -{ +{ GtkTreeModel *model; GtkTreeIter iter; gchar *room = NULL; diff --git a/src/empathy-preferences.c b/src/empathy-preferences.c index 4c88db675..0e2299cac 100644 --- a/src/empathy-preferences.c +++ b/src/empathy-preferences.c @@ -52,6 +52,7 @@ typedef struct { 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; @@ -68,6 +69,8 @@ typedef struct { GtkWidget *checkbutton_notifications_enabled; GtkWidget *checkbutton_notifications_disabled_away; GtkWidget *checkbutton_notifications_focus; + GtkWidget *checkbutton_notifications_contact_signin; + GtkWidget *checkbutton_notifications_contact_signout; GtkWidget *treeview_spell_checker; @@ -199,6 +202,12 @@ preferences_setup_widgets (EmpathyPreferences *preferences) preferences_hookup_toggle_button (preferences, EMPATHY_PREFS_NOTIFICATIONS_FOCUS, preferences->checkbutton_notifications_focus); + preferences_hookup_toggle_button (preferences, + EMPATHY_PREFS_NOTIFICATIONS_CONTACT_SIGNIN, + preferences->checkbutton_notifications_contact_signin); + preferences_hookup_toggle_button (preferences, + EMPATHY_PREFS_NOTIFICATIONS_CONTACT_SIGNOUT, + preferences->checkbutton_notifications_contact_signout); preferences_hookup_sensitivity (preferences, EMPATHY_PREFS_NOTIFICATIONS_ENABLED, @@ -206,6 +215,12 @@ preferences_setup_widgets (EmpathyPreferences *preferences) preferences_hookup_sensitivity (preferences, EMPATHY_PREFS_NOTIFICATIONS_ENABLED, preferences->checkbutton_notifications_focus); + preferences_hookup_sensitivity (preferences, + EMPATHY_PREFS_NOTIFICATIONS_ENABLED, + preferences->checkbutton_notifications_contact_signin); + preferences_hookup_sensitivity (preferences, + EMPATHY_PREFS_NOTIFICATIONS_ENABLED, + preferences->checkbutton_notifications_contact_signout); preferences_hookup_toggle_button (preferences, EMPATHY_PREFS_SOUNDS_ENABLED, @@ -237,6 +252,10 @@ preferences_setup_widgets (EmpathyPreferences *preferences) EMPATHY_PREFS_CHAT_SHOW_SMILEYS, preferences->checkbutton_show_smileys); + preferences_hookup_toggle_button (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); @@ -457,7 +476,7 @@ preferences_languages_add (EmpathyPreferences *preferences) codes != NULL); if (!codes) { gtk_widget_set_sensitive (preferences->treeview_spell_checker, FALSE); - } + } for (l = codes; l; l = l->next) { GtkTreeIter iter; @@ -655,12 +674,12 @@ preferences_widget_sync_string (const gchar *key, GtkWidget *widget) GEnumValue *enum_value; GSList *list; GtkWidget *toggle_widget; - + /* Get index from new string */ 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, value); - + if (enum_value) { list = gtk_radio_button_get_group (GTK_RADIO_BUTTON (widget)); toggle_widget = g_slist_nth_data (list, enum_value->value); @@ -722,7 +741,7 @@ preferences_notify_int_cb (EmpathyConf *conf, const gchar *key, gpointer user_data) { - preferences_widget_sync_int (key, user_data); + preferences_widget_sync_int (key, user_data); } static void @@ -912,14 +931,14 @@ preferences_radio_button_toggled_cb (GtkWidget *button, GType type; GEnumClass *enum_class; GEnumValue *enum_value; - + group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (button)); - + /* 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, button)); - + if (!enum_value) { g_warning ("No GEnumValue for EmpathyContactListSort with GtkRadioButton index:%d", g_slist_index (group, button)); @@ -952,7 +971,7 @@ preferences_theme_adium_update_validity (EmpathyPreferences *preferences, const gchar *path) { #ifdef HAVE_WEBKIT - if (empathy_theme_adium_is_valid (path)) { + if (empathy_adium_path_is_valid (path)) { gtk_widget_hide (preferences->label_invalid_adium_theme); } else { gtk_widget_show (preferences->label_invalid_adium_theme); @@ -1190,6 +1209,7 @@ empathy_preferences_show (GtkWindow *parent) "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, @@ -1201,6 +1221,8 @@ empathy_preferences_show (GtkWindow *parent) "checkbutton_notifications_enabled", &preferences->checkbutton_notifications_enabled, "checkbutton_notifications_disabled_away", &preferences->checkbutton_notifications_disabled_away, "checkbutton_notifications_focus", &preferences->checkbutton_notifications_focus, + "checkbutton_notifications_contact_signin", &preferences->checkbutton_notifications_contact_signin, + "checkbutton_notifications_contact_signout", &preferences->checkbutton_notifications_contact_signout, "checkbutton_sounds_enabled", &preferences->checkbutton_sounds_enabled, "checkbutton_sounds_disabled_away", &preferences->checkbutton_sounds_disabled_away, "treeview_sounds", &preferences->treeview_sounds, diff --git a/src/empathy-preferences.ui b/src/empathy-preferences.ui index 6ae92d17c..38cfd3419 100644 --- a/src/empathy-preferences.ui +++ b/src/empathy-preferences.ui @@ -37,7 +37,6 @@ <child> <object class="GtkVBox" id="vbox199"> <property name="visible">True</property> - <property name="spacing">6</property> <child> <object class="GtkCheckButton" id="checkbutton_compact_contact_list"> <property name="label" translatable="yes">Show co_mpact contact list</property> @@ -86,6 +85,22 @@ <property name="position">2</property> </packing> </child> + <child> + <object class="GtkCheckButton" id="checkbutton_show_contacts_in_rooms"> + <property name="label" translatable="yes">Show contact _list in rooms</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="active">True</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">3</property> + </packing> + </child> </object> </child> </object> @@ -295,6 +310,32 @@ <property name="position">1</property> </packing> </child> + <child> + <object class="GtkCheckButton" id="checkbutton_notifications_contact_signin"> + <property name="label" translatable="yes">Enable notifications when a contact comes online</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="position">2</property> + </packing> + </child> + <child> + <object class="GtkCheckButton" id="checkbutton_notifications_contact_signout"> + <property name="label" translatable="yes">Enable notifications when a contact goes offline</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="position">3</property> + </packing> + </child> </object> </child> </object> @@ -815,7 +856,7 @@ <property name="visible">True</property> <property name="spacing">6</property> <child> - <object class="GtkLabel" id="label1"> + <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> diff --git a/src/empathy-sidebar.c b/src/empathy-sidebar.c index caca6b5e3..7b70229e2 100644 --- a/src/empathy-sidebar.c +++ b/src/empathy-sidebar.c @@ -165,7 +165,7 @@ empathy_sidebar_set_property (GObject *object, switch (prop_id) { case PROP_CURRENT_PAGE: - empathy_sidebar_set_page (sidebar, g_value_get_object (value)); + empathy_sidebar_set_page (sidebar, g_value_get_object (value)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); diff --git a/src/empathy-status-icon.c b/src/empathy-status-icon.c index 9c2194880..f6c63c537 100644 --- a/src/empathy-status-icon.c +++ b/src/empathy-status-icon.c @@ -153,7 +153,9 @@ status_icon_update_notification (EmpathyStatusIcon *icon) G_CALLBACK (status_icon_notification_closed_cb), icon); } - notify_notification_set_icon_from_pixbuf (priv->notification, + /* if icon doesn't exist libnotify will crash */ + if (pixbuf != NULL) + notify_notification_set_icon_from_pixbuf (priv->notification, pixbuf); notify_notification_show (priv->notification, NULL); @@ -229,13 +231,14 @@ status_icon_event_added_cb (EmpathyEventManager *manager, DEBUG ("New event %p", event); priv->event = event; - priv->showing_event_icon = TRUE; - - status_icon_update_icon (icon); - status_icon_update_tooltip (icon); + if (event->must_ack) { + priv->showing_event_icon = TRUE; + status_icon_update_icon (icon); + status_icon_update_tooltip (icon); + } status_icon_update_notification (icon); - if (!priv->blink_timeout) { + if (!priv->blink_timeout && priv->showing_event_icon) { priv->blink_timeout = g_timeout_add (BLINK_TIMEOUT, (GSourceFunc) status_icon_blink_timeout_cb, icon); @@ -260,7 +263,7 @@ status_icon_event_removed_cb (EmpathyEventManager *manager, /* update notification anyway, as it's safe and we might have been * changed presence in the meanwhile - */ + */ status_icon_update_notification (icon); if (!priv->event && priv->blink_timeout) { @@ -303,14 +306,20 @@ status_icon_set_visibility (EmpathyStatusIcon *icon, empathy_window_iconify (priv->window, priv->icon); } else { GList *accounts; + GList *l; + gboolean one_enabled = FALSE; empathy_window_present (GTK_WINDOW (priv->window), TRUE); /* Show the accounts dialog if there is no enabled accounts */ - accounts = mc_accounts_list_by_enabled (TRUE); - if (accounts) { - mc_accounts_list_free (accounts); - } else { + accounts = empathy_account_manager_dup_accounts (priv->account_manager); + for (l = accounts ; l != NULL ; l = g_list_next (l)) { + one_enabled = empathy_account_is_enabled (EMPATHY_ACCOUNT (l->data)) + || one_enabled; + g_object_unref (l->data); + } + g_list_free (accounts); + if (!one_enabled) { DEBUG ("No enabled account, Showing account dialog"); empathy_accounts_dialog_show (GTK_WINDOW (priv->window), NULL); } @@ -378,7 +387,7 @@ status_icon_key_press_event_cb (GtkWidget *window, } return FALSE; } - + static void status_icon_activate_cb (GtkStatusIcon *status_icon, EmpathyStatusIcon *icon) @@ -481,7 +490,7 @@ status_icon_create_menu (EmpathyStatusIcon *icon) static void status_icon_connection_changed_cb (EmpathyAccountManager *manager, - McAccount *account, + EmpathyAccount *account, TpConnectionStatusReason reason, TpConnectionStatus current, TpConnectionStatus previous, diff --git a/src/empathy.c b/src/empathy.c index f23ce9145..40626b532 100644 --- a/src/empathy.c +++ b/src/empathy.c @@ -40,7 +40,6 @@ #include <telepathy-glib/dbus.h> #include <telepathy-glib/util.h> -#include <libmissioncontrol/mc-account.h> #include <libmissioncontrol/mission-control.h> #include <libempathy/empathy-idle.h> @@ -48,6 +47,7 @@ #include <libempathy/empathy-call-factory.h> #include <libempathy/empathy-chatroom-manager.h> #include <libempathy/empathy-account-manager.h> +#include <libempathy/empathy-debugger.h> #include <libempathy/empathy-dispatcher.h> #include <libempathy/empathy-dispatch-operation.h> #include <libempathy/empathy-log-manager.h> @@ -106,7 +106,7 @@ dispatch_cb (EmpathyDispatcher *dispatcher, if (id) { EmpathyAccountManager *manager; TpConnection *connection; - McAccount *account; + EmpathyAccount *account; manager = empathy_account_manager_dup_singleton (); connection = empathy_tp_chat_get_connection (tp_chat); @@ -226,7 +226,8 @@ create_salut_account (void) McProfile *profile; McProtocol *protocol; gboolean salut_created = FALSE; - McAccount *account; + EmpathyAccount *account; + EmpathyAccountManager *account_manager; GList *accounts; EBook *book; EContact *contact; @@ -283,15 +284,17 @@ create_salut_account (void) return; } - account = mc_account_create (profile); - mc_account_set_display_name (account, _("People nearby")); - + account_manager = empathy_account_manager_dup_singleton (); + account = empathy_account_manager_create (account_manager, profile); + empathy_account_set_display_name (account, _("People nearby")); + g_object_unref (account_manager); + nickname = e_contact_get (contact, E_CONTACT_NICKNAME); first_name = e_contact_get (contact, E_CONTACT_GIVEN_NAME); last_name = e_contact_get (contact, E_CONTACT_FAMILY_NAME); email = e_contact_get (contact, E_CONTACT_EMAIL_1); jid = e_contact_get (contact, E_CONTACT_IM_JABBER_HOME_1); - + if (!tp_strdiff (nickname, "nickname")) { g_free (nickname); nickname = NULL; @@ -301,11 +304,11 @@ create_salut_account (void) "last-name=%s\nemail=%s\njid=%s\n", nickname, first_name, last_name, email, jid); - mc_account_set_param_string (account, "nickname", nickname ? nickname : ""); - mc_account_set_param_string (account, "first-name", first_name ? first_name : ""); - mc_account_set_param_string (account, "last-name", last_name ? last_name : ""); - mc_account_set_param_string (account, "email", email ? email : ""); - mc_account_set_param_string (account, "jid", jid ? jid : ""); + empathy_account_set_param_string (account, "nickname", nickname ? nickname : ""); + empathy_account_set_param_string (account, "first-name", first_name ? first_name : ""); + empathy_account_set_param_string (account, "last-name", last_name ? last_name : ""); + empathy_account_set_param_string (account, "email", email ? email : ""); + empathy_account_set_param_string (account, "jid", jid ? jid : ""); g_free (nickname); g_free (first_name); @@ -450,6 +453,31 @@ new_call_handler_cb (EmpathyCallFactory *factory, EmpathyCallHandler *handler, gtk_widget_show (GTK_WIDGET (window)); } +#ifdef ENABLE_DEBUG +static void +default_log_handler (const gchar *log_domain, + GLogLevelFlags log_level, + const gchar *message, + gpointer user_data) +{ + g_log_default_handler (log_domain, log_level, message, NULL); + + /* G_LOG_DOMAIN = "empathy". No need to send empathy messages to the + * debugger as they already have in empathy_debug. */ + if (log_level != G_LOG_LEVEL_DEBUG + || tp_strdiff (log_domain, G_LOG_DOMAIN)) { + EmpathyDebugger *dbg; + GTimeVal now; + + dbg = empathy_debugger_get_singleton (); + g_get_current_time (&now); + + empathy_debugger_add_message (dbg, &now, log_domain, + log_level, message); + } +} +#endif /* ENABLE_DEBUG */ + int main (int argc, char *argv[]) { @@ -514,6 +542,11 @@ main (int argc, char *argv[]) gtk_window_set_default_icon_name ("empathy"); textdomain (GETTEXT_PACKAGE); +#ifdef ENABLE_DEBUG + /* Set up debugger */ + g_log_set_default_handler (default_log_handler, NULL); +#endif + /* Setting up the bacon connection */ startup_timestamp = get_startup_timestamp (); connection = bacon_message_connection_new ("empathy"); @@ -603,7 +636,7 @@ main (int argc, char *argv[]) (idle), TP_CONNECTION_PRESENCE_TYPE_OFFLINE) <= 0) { empathy_idle_set_state (idle, MC_PRESENCE_AVAILABLE); } - + create_salut_account (); /* Setting up UI */ |