]> git.0d.be Git - empathy.git/blobdiff - src/empathy-main.c
[darcs-to-svn @ Ctr+Enter adds a new line in and empathy-chat exits 5sec after the...
[empathy.git] / src / empathy-main.c
index 94e29e2b510f5a318c4f9fceaaeb777150a648ce..077e1a6b6fa907cbd99beb370636d30114cba66b 100644 (file)
 #include <libmissioncontrol/mc-account-monitor.h>
 #include <libmissioncontrol/mission-control.h>
 
-#include <libempathy/empathy-session.h>
 #include <libempathy/gossip-debug.h>
 #include <libempathy-gtk/empathy-main-window.h>
+#include <libempathy-gtk/empathy-images.h>
 #include <libempathy-gtk/gossip-status-presets.h>
-#include <libempathy-gtk/gossip-stock.h>
 #include <libempathy-gtk/gossip-accounts-dialog.h>
 
-#define DEBUG_DOMAIN "Empathy"
+#include "empathy-filter.h"
+
+#define DEBUG_DOMAIN "EmpathyMain"
 
 static void error_cb              (MissionControl *mc,
                                   GError         *error,
@@ -105,8 +106,6 @@ static void
 destroy_cb (GtkWidget *window,
            gpointer   user_data)
 {
-       gossip_stock_finalize ();
-       empathy_session_finalize ();
        gtk_main_quit ();
 }
 
@@ -121,6 +120,18 @@ icon_activate_cb (GtkStatusIcon *status_icon,
        }
 }
 
+static void
+new_channel_cb (EmpathyFilter *filter,
+               TpConn        *tp_conn,
+               TpChan        *tp_chan,
+               guint          context_handle,
+               gpointer       user_data)
+{
+       gossip_debug (DEBUG_DOMAIN, "Filtering context handle: %d",
+                     context_handle);
+       empathy_filter_process (filter, context_handle, TRUE);
+}
+
 int
 main (int argc, char *argv[])
 {
@@ -129,11 +140,15 @@ main (int argc, char *argv[])
        GtkWidget        *window;
        MissionControl   *mc;
        McAccountMonitor *monitor;
+       EmpathyFilter    *filter;
 
        gtk_init (&argc, &argv);
 
-       /* FIXME: This is a horrible hack */
-       gossip_stock_init (gtk_window_new (GTK_WINDOW_TOPLEVEL));
+       /* Setting up channel filter */
+       filter = empathy_filter_new ();
+       g_signal_connect (filter, "new-channel",
+                         G_CALLBACK (new_channel_cb),
+                         NULL);
 
        /* Setting up MC */
        monitor = mc_account_monitor_new ();
@@ -156,7 +171,7 @@ main (int argc, char *argv[])
                          NULL);
 
        /* Setting up the tray icon */
-       icon = gtk_status_icon_new_from_stock (GOSSIP_STOCK_MESSAGE);
+       icon = gtk_status_icon_new_from_icon_name (EMPATHY_IMAGE_MESSAGE);
        gtk_status_icon_set_tooltip (icon, "Empathy - click here to show/hide the main window");
        gtk_status_icon_set_visible (icon, TRUE);
        g_signal_connect (icon, "activate",