]> git.0d.be Git - empathy.git/blobdiff - src/empathy-main-window.c
Remove useless mission-control includes
[empathy.git] / src / empathy-main-window.c
index d2cb832f28217907641cc1528132ea06db342373..0d04153a31698bcb4921090e84842d5438e3d02f 100644 (file)
 #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 <libmissioncontrol/mission-control.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 "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-new-chatroom-dialog.h"
 #include "empathy-map-view.h"
 #include "empathy-chatrooms-window.h"
@@ -196,7 +196,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;
                }
 
@@ -300,7 +300,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");
@@ -315,7 +315,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");
@@ -326,7 +326,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;
@@ -347,7 +347,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);
@@ -428,7 +428,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);
@@ -480,7 +480,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,
@@ -563,32 +563,39 @@ main_window_connection_changed_cb (EmpathyAccountManager *manager,
 static void
 main_window_contact_presence_changed_cb (EmpathyContactMonitor *monitor,
                                         EmpathyContact *contact,
-                                        McPresence current,
-                                        McPresence previous,
+                                        TpConnectionPresenceType current,
+                                        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;
        }
 
-       if (previous < MC_PRESENCE_AVAILABLE && current > MC_PRESENCE_OFFLINE) {
-               /* someone is logging in */
-               empathy_sound_play (GTK_WIDGET (window->window),
-                                   EMPATHY_SOUND_CONTACT_CONNECTED);
-               return;
-       }
-
-       if (previous > MC_PRESENCE_OFFLINE && current < MC_PRESENCE_AVAILABLE) {
-               /* someone is logging off */
-               empathy_sound_play (GTK_WIDGET (window->window),
-                                   EMPATHY_SOUND_CONTACT_DISCONNECTED);
-       }
+  if (tp_connection_presence_type_cmp_availability (previous,
+     TP_CONNECTION_PRESENCE_TYPE_OFFLINE) > 0)
+    {
+      /* contact was online */
+      if (tp_connection_presence_type_cmp_availability (current,
+          TP_CONNECTION_PRESENCE_TYPE_OFFLINE) <= 0)
+        /* someone is logging off */
+        empathy_sound_play (GTK_WIDGET (window->window),
+          EMPATHY_SOUND_CONTACT_DISCONNECTED);
+    }
+  else
+    {
+      /* contact was offline */
+      if (tp_connection_presence_type_cmp_availability (current,
+          TP_CONNECTION_PRESENCE_TYPE_OFFLINE) > 0)
+        /* someone is logging in */
+        empathy_sound_play (GTK_WIDGET (window->window),
+          EMPATHY_SOUND_CONTACT_CONNECTED);
+    }
 }
 
 static void
@@ -688,14 +695,7 @@ static void
 main_window_view_show_ft_manager (GtkAction         *action,
                                  EmpathyMainWindow *window)
 {
-       EmpathyFTManager *manager;
-       GtkWidget *dialog;
-
-       manager = empathy_ft_manager_dup_singleton ();
-       dialog = empathy_ft_manager_get_dialog (manager);
-
-       gtk_window_present (GTK_WINDOW (dialog));
-       g_object_unref (manager);
+       empathy_ft_manager_show ();
 }
 
 static void
@@ -727,16 +727,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);
@@ -945,6 +942,13 @@ main_window_help_about_cb (GtkAction         *action,
        empathy_about_dialog_new (GTK_WINDOW (window->window));
 }
 
+static void
+main_window_help_debug_cb (GtkAction         *action,
+                          EmpathyMainWindow *window)
+{
+       empathy_debug_dialog_new (GTK_WINDOW (window->window));
+}
+
 static void
 main_window_help_contents_cb (GtkAction         *action,
                              EmpathyMainWindow *window)
@@ -1000,7 +1004,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,
@@ -1157,6 +1161,7 @@ empathy_main_window_show (void)
                              "edit_personal_information", "activate", main_window_edit_personal_information_cb,
                              "edit_preferences", "activate", main_window_edit_preferences_cb,
                              "help_about", "activate", main_window_help_about_cb,
+                             "help_debug", "activate", main_window_help_debug_cb,
                              "help_contents", "activate", main_window_help_contents_cb,
                              NULL);