[darcs-to-svn @ Remove EmpathySession and move all programs into src/]
authorXavier Claessens <xclaesse@src.gnome.org>
Thu, 3 May 2007 14:12:30 +0000 (14:12 +0000)
committerXavier Claessens <xclaesse@src.gnome.org>
Thu, 3 May 2007 14:12:30 +0000 (14:12 +0000)
svn path=/trunk/; revision=28

26 files changed:
Makefile.am
accounts/Makefile.am [deleted file]
accounts/empathy-accounts-main.c [deleted file]
chat/Makefile.am [deleted file]
chat/empathy-chat-main.c [deleted file]
chat/empathy-chat.chandler [deleted file]
chat/org.gnome.Empathy.Chat.service.in [deleted file]
configure.ac
contact-list/Makefile.am [deleted file]
contact-list/empathy-contact-list-main.c [deleted file]
libempathy-gtk/gossip-chat.c
libempathy-gtk/gossip-contact-list.c
libempathy/Makefile.am
libempathy/empathy-contact-list.c
libempathy/empathy-contact-manager.c
libempathy/empathy-session.c [deleted file]
libempathy/empathy-session.h [deleted file]
libempathy/empathy-tp-chat.c
libempathy/gossip-utils.c
src/Makefile.am
src/empathy-accounts-main.c [new file with mode: 0644]
src/empathy-chat-main.c [new file with mode: 0644]
src/empathy-chat.chandler [new file with mode: 0644]
src/empathy-contact-list-main.c [new file with mode: 0644]
src/empathy-main.c
src/org.gnome.Empathy.Chat.service.in [new file with mode: 0644]

index 87b6c62..a14dcd1 100644 (file)
@@ -1,4 +1,4 @@
-SUBDIRS = po profiles pixmaps libempathy libempathy-gtk accounts contact-list chat src
+SUBDIRS = po profiles pixmaps libempathy libempathy-gtk src
 
 DISTCHECK_CONFIGURE_FLAGS =    \
        --disable-scrollkeeper
@@ -22,3 +22,7 @@ DISTCLEANFILES =              \
 # Workaround broken scrollkeeper that doesn't remove its files on
 # uninstall.
 distuninstallcheck_listfiles = find . -type f -print | grep -v '^\./var/scrollkeeper'
+
+dist-hook:
+       chmod a+w ${distdir}/ChangeLog
+       if test -d _darcs; then darcs changes >${distdir}/ChangeLog; fi
diff --git a/accounts/Makefile.am b/accounts/Makefile.am
deleted file mode 100644 (file)
index 589cae3..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-AM_CPPFLAGS =                                          \
-       -I$(top_srcdir)                                 \
-       -DPREFIX="\"$(prefix)"\"                        \
-       -DSYSCONFDIR=\""$(sysconfdir)"\"                \
-       -DDATADIR=\""$(datadir)"\"                      \
-       -DLIBDIR=\""$(libdir)"\"                        \
-       $(EMPATHY_CFLAGS)                               \
-       $(WARN_CFLAGS)
-
-bin_PROGRAMS = empathy-accounts
-
-empathy_accounts_SOURCES =                                                     \
-       empathy-accounts-main.c
-
-empathy_accounts_LDADD = \
-       $(top_builddir)/libempathy/libempathy.la                                \
-       $(top_builddir)/libempathy-gtk/libempathy-gtk.la                        \
-       $(EMPATHY_LIBS)
-
diff --git a/accounts/empathy-accounts-main.c b/accounts/empathy-accounts-main.c
deleted file mode 100644 (file)
index e656203..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Copyright (C) 2007 Collabora Ltd.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- * 
- * Authors: Xavier Claessens <xclaesse@gmail.com>
- */
-
-#include <config.h>
-
-#include <string.h>
-#include <stdlib.h>
-
-#include <glib.h>
-#include <gtk/gtk.h>
-
-#include <libempathy/empathy-session.h>
-#include <libempathy-gtk/gossip-accounts-dialog.h>
-
-static void
-destroy_cb (GtkWidget *dialog,
-           gpointer   user_data)
-{
-       empathy_session_finalize ();
-       gtk_main_quit ();
-}
-
-int
-main (int argc, char *argv[])
-{
-       GtkWidget *dialog;
-
-       gtk_init (&argc, &argv);
-
-       dialog = gossip_accounts_dialog_show ();
-
-       g_signal_connect (dialog, "destroy",
-                         G_CALLBACK (destroy_cb),
-                         NULL);
-
-       gtk_main ();
-
-       return EXIT_SUCCESS;
-}
-
diff --git a/chat/Makefile.am b/chat/Makefile.am
deleted file mode 100644 (file)
index d8ee78a..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-AM_CPPFLAGS =                                                  \
-       -I$(top_srcdir)                                         \
-       -DPREFIX="\"$(prefix)"\"                                \
-       -DSYSCONFDIR=\""$(sysconfdir)"\"                        \
-       -DDATADIR=\""$(datadir)"\"                              \
-       -DLIBDIR=\""$(libdir)"\"                                \
-       $(EMPATHY_CFLAGS)                                       \
-       $(WARN_CFLAGS)
-
-bin_PROGRAMS = empathy-chat
-
-empathy_chat_SOURCES =                                 \
-       empathy-chat-main.c
-
-empathy_chat_LDADD =                                           \
-       $(top_builddir)/libempathy/libempathy.la                \
-       $(top_builddir)/libempathy-gtk/libempathy-gtk.la        \
-       $(EMPATHY_LIBS)
-
-# Dbus service file
-servicedir = $(datadir)/dbus-1/services
-service_in_files = org.gnome.Empathy.Chat.service.in
-service_DATA = $(service_in_files:.service.in=.service)
-
-# Rule to make the service file with bindir expanded
-$(service_DATA): $(service_in_files) Makefile
-       @sed -e "s|\@bindir\@|$(bindir)|" $< > $@
-
-chandlerdir = $(datadir)/telepathy/managers
-chandler_DATA = empathy-chat.chandler
-
-
-EXTRA_DIST =                                   \
-       org.gnome.Empathy.Chat.service.in       \
-       $(chandler_DATA)
-
-BUILT_SOURCES =                                \
-       org.gnome.Empathy.Chat.service
-       
-CLEANFILES = $(BUILT_SOURCES)
diff --git a/chat/empathy-chat-main.c b/chat/empathy-chat-main.c
deleted file mode 100644 (file)
index 864e506..0000000
+++ /dev/null
@@ -1,96 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Copyright (C) 2007 Collabora Ltd.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- * 
- * Authors: Xavier Claessens <xclaesse@gmail.com>
- */
-
-#include <config.h>
-
-#include <stdlib.h>
-
-#include <glib.h>
-#include <gtk/gtk.h>
-
-#include <libtelepathy/tp-conn.h>
-#include <libtelepathy/tp-chan.h>
-#include <libtelepathy/tp-helpers.h>
-#include <libmissioncontrol/mc-account.h>
-
-#include <libempathy/gossip-contact.h>
-#include <libempathy/empathy-chandler.h>
-#include <libempathy/empathy-session.h>
-#include <libempathy/empathy-contact-manager.h>
-#include <libempathy/empathy-contact-list.h>
-#include <libempathy-gtk/gossip-private-chat.h>
-#include <libempathy-gtk/gossip-stock.h>
-
-#define BUS_NAME "org.gnome.Empathy.Chat"
-#define OBJECT_PATH "/org/freedesktop/Telepathy/ChannelHandler"
-
-static void
-new_channel_cb (EmpathyChandler *chandler,
-               TpConn          *tp_conn,
-               TpChan          *tp_chan,
-               gpointer         user_data)
-{
-       if (tp_chan->handle_type == TP_HANDLE_TYPE_CONTACT) {
-               MissionControl        *mc;
-               McAccount             *account;
-               EmpathyContactManager *manager;
-               EmpathyContactList    *list;
-               GossipContact         *contact;
-               GossipPrivateChat     *chat;
-
-               /* We have a private chat channel */
-               mc = mission_control_new (tp_get_bus ());
-               account = mission_control_get_account_for_connection (mc, tp_conn, NULL);
-               manager = empathy_session_get_contact_manager ();
-               list = empathy_contact_manager_get_list (manager, account);
-               contact = empathy_contact_list_get_from_handle (list, tp_chan->handle);
-
-               chat = gossip_private_chat_new_with_channel (contact, tp_chan);
-               gossip_chat_present (GOSSIP_CHAT (chat));
-
-               g_object_unref (mc);
-               g_object_unref (account);
-               g_object_unref (contact);
-               g_object_unref (chat);
-       }
-}
-
-int
-main (int argc, char *argv[])
-{
-       EmpathyChandler *chandler;
-
-       gtk_init (&argc, &argv);
-       /* FIXME: This is a horrible hack */
-       gossip_stock_init (gtk_window_new (GTK_WINDOW_TOPLEVEL));
-
-       chandler = empathy_chandler_new (BUS_NAME, OBJECT_PATH);
-
-       g_signal_connect (chandler, "new-channel",
-                         G_CALLBACK (new_channel_cb),
-                         NULL);
-
-       gtk_main ();
-
-       return EXIT_SUCCESS;
-}
-
diff --git a/chat/empathy-chat.chandler b/chat/empathy-chat.chandler
deleted file mode 100644 (file)
index 4cfe75b..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-[ChannelHandler]
-BusName = org.gnome.Empathy.Chat
-ObjectPath = /org/freedesktop/Telepathy/ChannelHandler
-ChannelType = org.freedesktop.Telepathy.Channel.Type.Text
-
diff --git a/chat/org.gnome.Empathy.Chat.service.in b/chat/org.gnome.Empathy.Chat.service.in
deleted file mode 100644 (file)
index 6a794e4..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-[D-BUS Service]
-Name=org.gnome.Empathy.Chat
-Exec=@bindir@/empathy-chat
index e750859..2a84a1b 100644 (file)
@@ -1,4 +1,4 @@
-AC_INIT(Empathy, 0.1)
+AC_INIT(Empathy, 0.3)
 AC_PREREQ(2.59)
 AC_COPYRIGHT([Copyright (C) 2003-2007 Imendio AB])
 
@@ -67,9 +67,6 @@ AC_OUTPUT([
   pixmaps/Makefile
   libempathy/Makefile
   libempathy-gtk/Makefile
-  accounts/Makefile
-  contact-list/Makefile
-  chat/Makefile
   src/Makefile
 ])
 
diff --git a/contact-list/Makefile.am b/contact-list/Makefile.am
deleted file mode 100644 (file)
index de67863..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-AM_CPPFLAGS =                                          \
-       -I$(top_srcdir)                                 \
-       -DPREFIX="\"$(prefix)"\"                        \
-       -DSYSCONFDIR=\""$(sysconfdir)"\"                \
-       -DDATADIR=\""$(datadir)"\"                      \
-       -DLIBDIR=\""$(libdir)"\"                        \
-       $(EMPATHY_CFLAGS)                               \
-       $(WARN_CFLAGS)
-
-bin_PROGRAMS = empathy-contact-list
-
-empathy_contact_list_SOURCES =                                                 \
-       empathy-contact-list-main.c
-
-empathy_contact_list_LDADD = \
-       $(top_builddir)/libempathy/libempathy.la                                \
-       $(top_builddir)/libempathy-gtk/libempathy-gtk.la                        \
-       $(EMPATHY_LIBS)
-
-
diff --git a/contact-list/empathy-contact-list-main.c b/contact-list/empathy-contact-list-main.c
deleted file mode 100644 (file)
index fa8d91b..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Copyright (C) 2007 Collabora Ltd.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- * 
- * Authors: Xavier Claessens <xclaesse@gmail.com>
- */
-
-#include <config.h>
-
-#include <stdlib.h>
-
-#include <glib.h>
-#include <gtk/gtk.h>
-
-#include <libmissioncontrol/mc-account.h>
-
-#include <libempathy/empathy-session.h>
-#include <libempathy-gtk/empathy-main-window.h>
-#include <libempathy-gtk/gossip-stock.h>
-#include <libempathy-gtk/gossip-accounts-dialog.h>
-
-static void
-destroy_cb (GtkWidget *window,
-           gpointer   user_data)
-{
-       gossip_stock_finalize ();
-       empathy_session_finalize ();
-       gtk_main_quit ();
-}
-
-int
-main (int argc, char *argv[])
-{
-       GtkWidget *window;
-       GList     *accounts;
-
-       gtk_init (&argc, &argv);
-
-       /* FIXME: This is a horrible hack */
-       gossip_stock_init (gtk_window_new (GTK_WINDOW_TOPLEVEL));
-
-       window = empathy_main_window_show ();
-       g_signal_connect (window, "destroy",
-                         G_CALLBACK (destroy_cb),
-                         NULL);
-
-       /* 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 {
-               gossip_accounts_dialog_show ();
-       }
-
-       gtk_main ();
-
-       return EXIT_SUCCESS;
-}
-
index d1e0369..85aeee2 100644 (file)
@@ -35,7 +35,6 @@
 #include <gtk/gtk.h>
 #include <glade/glade.h>
 
-#include <libempathy/empathy-session.h>
 #include <libempathy/empathy-contact-manager.h>
 #include <libempathy/gossip-debug.h>
 #include <libempathy/gossip-utils.h>
 #define COMPOSING_STOP_TIMEOUT 5
 
 struct _GossipChatPriv {
-       EmpathyTpChat    *tp_chat;
-       GossipChatWindow *window;
-
-       GtkTooltips      *tooltips;
-       guint             composing_stop_timeout_id;
-       gboolean          sensitive;
-       gchar            *id;
-       GSList           *sent_messages;
-       gint              sent_messages_index;
+       EmpathyContactManager *manager;
+       EmpathyTpChat         *tp_chat;
+       GossipChatWindow      *window;
+
+       GtkTooltips           *tooltips;
+       guint                  composing_stop_timeout_id;
+       gboolean               sensitive;
+       gchar                 *id;
+       GSList                *sent_messages;
+       gint                   sent_messages_index;
        /* Used to automatically shrink a window that has temporarily
         * grown due to long input. 
         */
-       gint              padding_height;
-       gint              default_window_height;
-       gint              last_input_height;
-       gboolean          vscroll_visible;
+       gint                   padding_height;
+       gint                   default_window_height;
+       gint                   last_input_height;
+       gboolean               vscroll_visible;
 };
 
 typedef struct {
@@ -220,8 +220,8 @@ gossip_chat_init (GossipChat *chat)
 
        priv = GET_PRIV (chat);
 
+       priv->manager = empathy_contact_manager_new ();
        priv->tooltips = gtk_tooltips_new ();
-
        priv->default_window_height = -1;
        priv->vscroll_visible = FALSE;
        priv->sensitive = TRUE;
@@ -238,7 +238,7 @@ gossip_chat_init (GossipChat *chat)
                          "changed",
                          G_CALLBACK (chat_input_text_buffer_changed_cb),
                          chat);
-       g_signal_connect (GOSSIP_CHAT (chat)->view,
+       g_signal_connect (chat->view,
                          "focus_in_event",
                          G_CALLBACK (chat_text_view_focus_in_event_cb),
                          chat);
@@ -280,7 +280,8 @@ chat_finalize (GObject *object)
        g_slist_free (priv->sent_messages);
 
        chat_composing_remove_timeout (chat);
-       g_object_unref (GOSSIP_CHAT (object)->account);
+       g_object_unref (chat->account);
+       g_object_unref (priv->manager);
 
        if (priv->tp_chat) {
                g_object_unref (priv->tp_chat);
@@ -1097,13 +1098,13 @@ gossip_chat_get_contact (GossipChat *chat)
 GossipContact *
 gossip_chat_get_own_contact (GossipChat *chat)
 {
-       EmpathyContactManager *manager;
+       GossipChatPriv *priv;
 
        g_return_val_if_fail (GOSSIP_IS_CHAT (chat), NULL);
 
-       manager = empathy_session_get_contact_manager ();
+       priv = GET_PRIV (chat);
 
-       return empathy_contact_manager_get_own (manager, chat->account);
+       return empathy_contact_manager_get_own (priv->manager, chat->account);
 }
 
 GtkWidget *
@@ -1367,7 +1368,7 @@ gossip_chat_should_play_sound (GossipChat *chat)
 
        g_return_val_if_fail (GOSSIP_IS_CHAT (chat), FALSE);
 
-       window = gossip_chat_get_window (GOSSIP_CHAT (chat));
+       window = gossip_chat_get_window (chat);
        if (!window) {
                return TRUE;
        }
index 8e7288e..bf0556d 100644 (file)
@@ -36,7 +36,6 @@
 
 #include <libempathy/empathy-contact-manager.h>
 #include <libempathy/gossip-debug.h>
-#include <libempathy/empathy-session.h>
 
 #include "gossip-contact-list.h"
 #include "gossip-contact-groups.h"
@@ -420,8 +419,7 @@ gossip_contact_list_init (GossipContactList *list)
 
        priv = GET_PRIV (list);
 
-       priv->manager = empathy_session_get_contact_manager ();
-       g_object_ref (priv->manager);
+       priv->manager = empathy_contact_manager_new ();
        priv->is_compact = FALSE;
        priv->show_active = TRUE;
        priv->show_avatars = TRUE;
index 30d40c5..c681aa8 100644 (file)
@@ -24,7 +24,6 @@ libempathy_la_SOURCES =                                                       \
        gossip-debug.c                  gossip-debug.h                          \
        gossip-utils.c                  gossip-utils.h                          \
        gossip-message.c                gossip-message.h                        \
-       empathy-session.c               empathy-session.h                       \
        empathy-contact-list.c          empathy-contact-list.h                  \
        empathy-contact-manager.c       empathy-contact-manager.h               \
        empathy-tp-chat.c               empathy-tp-chat.h                       \
index 9ed83df..c3d3171 100644 (file)
@@ -34,7 +34,6 @@
 #include <libtelepathy/tp-conn-iface-avatars-gen.h>
 
 #include "empathy-contact-list.h"
-#include "empathy-session.h"
 #include "gossip-debug.h"
 #include "gossip-telepathy-group.h"
 
index cf5a81f..50ed576 100644 (file)
@@ -28,7 +28,6 @@
 #include <libtelepathy/tp-constants.h>
 
 #include "empathy-contact-manager.h"
-#include "empathy-session.h"
 #include "gossip-utils.h"
 #include "gossip-debug.h"
 
@@ -175,7 +174,16 @@ contact_manager_finalize (GObject *object)
 EmpathyContactManager *
 empathy_contact_manager_new (void)
 {
-       return g_object_new (EMPATHY_TYPE_CONTACT_MANAGER, NULL);
+       static EmpathyContactManager *manager = NULL;
+
+       if (!manager) {
+               manager = g_object_new (EMPATHY_TYPE_CONTACT_MANAGER, NULL);
+               g_object_add_weak_pointer (G_OBJECT (manager), (gpointer) &manager);
+       } else {
+               g_object_ref (manager);
+       }
+
+       return manager;
 }
 
 void
diff --git a/libempathy/empathy-session.c b/libempathy/empathy-session.c
deleted file mode 100644 (file)
index 86ac1e1..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Copyright (C) 2007 Collabora Ltd.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- * 
- * Authors: Xavier Claessens <xclaesse@gmail.com>
- */
-
-#include <config.h>
-
-#include <glib.h>
-
-#include <libtelepathy/tp-helpers.h>
-
-#include <libmissioncontrol/mc-account-monitor.h>
-
-#include "empathy-session.h"
-#include "gossip-debug.h"
-
-#define DEBUG_DOMAIN "Session"
-
-static EmpathyContactManager *contact_manager = NULL;
-
-void
-empathy_session_finalize (void)
-{
-       if (contact_manager) {
-               g_object_unref (contact_manager);
-               contact_manager = NULL;
-       }
-}
-
-EmpathyContactManager *
-empathy_session_get_contact_manager (void)
-{
-       if (!contact_manager) {
-               contact_manager = empathy_contact_manager_new ();
-       }
-
-       return contact_manager;
-}
-
diff --git a/libempathy/empathy-session.h b/libempathy/empathy-session.h
deleted file mode 100644 (file)
index af843a5..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Copyright (C) 2007 Collabora Ltd.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- * Authors: Xavier Claessens <xclaesse@gmail.com>
- */
-
-#ifndef __EMPATHY_SESSION_H__
-#define __EMPATHY_SESSION_H__
-
-#include <glib.h>
-
-#include <libmissioncontrol/mission-control.h>
-#include "empathy-contact-manager.h"
-
-G_BEGIN_DECLS
-
-void                   empathy_session_finalize            (void);
-EmpathyContactManager *empathy_session_get_contact_manager (void);
-
-G_END_DECLS
-
-#endif /* __EMPATHY_MISSION_CONTROL_H__ */
index f72655e..25639dd 100644 (file)
@@ -30,7 +30,6 @@
 #include "empathy-tp-chat.h"
 #include "empathy-contact-manager.h"
 #include "empathy-contact-list.h"
-#include "empathy-session.h"
 #include "empathy-marshal.h"
 #include "gossip-debug.h"
 #include "gossip-time.h"
 #define DEBUG_DOMAIN "TpChat"
 
 struct _EmpathyTpChatPriv {
-       EmpathyContactList *list;
-       McAccount          *account;
-       gchar              *id;
-       MissionControl     *mc;
-
-       TpChan             *tp_chan;
-       DBusGProxy         *text_iface;
-       DBusGProxy         *chat_state_iface;
+       EmpathyContactList    *list;
+       EmpathyContactManager *manager;
+       McAccount             *account;
+       gchar                 *id;
+       MissionControl        *mc;
+
+       TpChan                *tp_chan;
+       DBusGProxy            *text_iface;
+       DBusGProxy            *chat_state_iface;
 };
 
 static void empathy_tp_chat_class_init (EmpathyTpChatClass *klass);
@@ -162,6 +162,9 @@ tp_chat_finalize (GObject *object)
                g_object_unref (priv->tp_chan);
        }
 
+       if (priv->manager) {
+               g_object_unref (priv->manager);
+       }
        if (priv->list) {
                g_object_unref (priv->list);
        }
@@ -182,7 +185,6 @@ empathy_tp_chat_new (McAccount *account,
 {
        EmpathyTpChatPriv     *priv;
        EmpathyTpChat         *chat;
-       EmpathyContactManager *manager;
 
        g_return_val_if_fail (MC_IS_ACCOUNT (account), NULL);
        g_return_val_if_fail (TELEPATHY_IS_CHAN (tp_chan), NULL);
@@ -190,8 +192,8 @@ empathy_tp_chat_new (McAccount *account,
        chat = g_object_new (EMPATHY_TYPE_TP_CHAT, NULL);
        priv = GET_PRIV (chat);
 
-       manager = empathy_session_get_contact_manager ();
-       priv->list = empathy_contact_manager_get_list (manager, account);
+       priv->manager = empathy_contact_manager_new ();
+       priv->list = empathy_contact_manager_get_list (priv->manager, account);
        priv->tp_chan = g_object_ref (tp_chan);
        priv->account = g_object_ref (account);
        priv->mc = mission_control_new (tp_get_bus ());
index 3dc4afd..6688987 100644 (file)
@@ -38,7 +38,6 @@
 #include "gossip-debug.h"
 #include "gossip-utils.h"
 #include "gossip-paths.h"
-#include "empathy-session.h"
 #include "empathy-contact-manager.h"
 
 #define DEBUG_DOMAIN "Utils"
@@ -437,12 +436,15 @@ gossip_get_own_contact_from_contact (GossipContact  *contact)
 {
        EmpathyContactManager *manager;
        McAccount             *account;
+       GossipContact         *own_contact;
 
        g_return_val_if_fail (GOSSIP_IS_CONTACT (contact), NULL);
 
-       manager = empathy_session_get_contact_manager ();
+       manager = empathy_contact_manager_new ();
        account = gossip_contact_get_account (contact);
+       own_contact = empathy_contact_manager_get_own (manager, account);
+       g_object_unref (manager);
 
-       return empathy_contact_manager_get_own (manager, account);
+       return own_contact;
 }
 
index b9c9ca2..83b0717 100644 (file)
@@ -1,23 +1,54 @@
-AM_CPPFLAGS =                                          \
-       -I$(top_srcdir)                                 \
-       -DPREFIX="\"$(prefix)"\"                        \
-       -DSYSCONFDIR=\""$(sysconfdir)"\"                \
-       -DDATADIR=\""$(datadir)"\"                      \
-       -DLIBDIR=\""$(libdir)"\"                        \
-       $(EMPATHY_CFLAGS)                               \
+AM_CPPFLAGS =                                                  \
+       -I$(top_srcdir)                                         \
+       -DPREFIX="\"$(prefix)"\"                                \
+       -DSYSCONFDIR=\""$(sysconfdir)"\"                        \
+       -DDATADIR=\""$(datadir)"\"                              \
+       -DLIBDIR=\""$(libdir)"\"                                \
+       $(EMPATHY_CFLAGS)                                       \
        $(WARN_CFLAGS)
 
-bin_PROGRAMS = empathy
+LDADD =                                                                \
+       $(top_builddir)/libempathy/libempathy.la                \
+       $(top_builddir)/libempathy-gtk/libempathy-gtk.la        \
+       $(EMPATHY_LIBS)
 
-empathy_SOURCES =                                              \
+bin_PROGRAMS = empathy empathy-accounts empathy-chat empathy-contact-list
+empathy_SOURCES =                                              \
        empathy-main.c
 
-empathy_LDADD = \
-       $(top_builddir)/libempathy/libempathy.la                                \
-       $(top_builddir)/libempathy-gtk/libempathy-gtk.la                        \
-       $(EMPATHY_LIBS)
+empathy_accounts_SOURCES =                                     \
+       empathy-accounts-main.c
+
+empathy_chat_SOURCES =                                         \
+       empathy-chat-main.c
+
+empathy_contact_list_SOURCES =                                 \
+       empathy-contact-list-main.c
+
+# Dbus service file
+servicedir = $(datadir)/dbus-1/services
+service_in_files = org.gnome.Empathy.Chat.service.in
+service_DATA = $(service_in_files:.service.in=.service)
+
+# Rule to make the service file with bindir expanded
+$(service_DATA): $(service_in_files) Makefile
+       @sed -e "s|\@bindir\@|$(bindir)|" $< > $@
+
+chandlerdir = $(datadir)/telepathy/managers
+chandler_DATA = empathy-chat.chandler
 
 autostartdir = $(datadir)/gnome/autostart
 autostart_in_files = empathy.desktop.in
 autostart_DATA = $(autostart_in_files:.desktop.in=.desktop)
 @INTLTOOL_DESKTOP_RULE@
+
+BUILT_SOURCES =                                                        \
+       org.gnome.Empathy.Chat.service
+
+EXTRA_DIST =                                                   \
+       org.gnome.Empathy.Chat.service.in                       \
+       $(autostart_DATA)                                       \
+       $(chandler_DATA)
+
+CLEANFILES = $(BUILT_SOURCES)
+
diff --git a/src/empathy-accounts-main.c b/src/empathy-accounts-main.c
new file mode 100644 (file)
index 0000000..954b3ce
--- /dev/null
@@ -0,0 +1,57 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2007 Collabora Ltd.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ * 
+ * Authors: Xavier Claessens <xclaesse@gmail.com>
+ */
+
+#include <config.h>
+
+#include <string.h>
+#include <stdlib.h>
+
+#include <glib.h>
+#include <gtk/gtk.h>
+
+#include <libempathy-gtk/gossip-accounts-dialog.h>
+
+static void
+destroy_cb (GtkWidget *dialog,
+           gpointer   user_data)
+{
+       gtk_main_quit ();
+}
+
+int
+main (int argc, char *argv[])
+{
+       GtkWidget *dialog;
+
+       gtk_init (&argc, &argv);
+
+       dialog = gossip_accounts_dialog_show ();
+
+       g_signal_connect (dialog, "destroy",
+                         G_CALLBACK (destroy_cb),
+                         NULL);
+
+       gtk_main ();
+
+       return EXIT_SUCCESS;
+}
+
diff --git a/src/empathy-chat-main.c b/src/empathy-chat-main.c
new file mode 100644 (file)
index 0000000..7fde26a
--- /dev/null
@@ -0,0 +1,96 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2007 Collabora Ltd.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ * 
+ * Authors: Xavier Claessens <xclaesse@gmail.com>
+ */
+
+#include <config.h>
+
+#include <stdlib.h>
+
+#include <glib.h>
+#include <gtk/gtk.h>
+
+#include <libtelepathy/tp-conn.h>
+#include <libtelepathy/tp-chan.h>
+#include <libtelepathy/tp-helpers.h>
+#include <libmissioncontrol/mc-account.h>
+
+#include <libempathy/gossip-contact.h>
+#include <libempathy/empathy-chandler.h>
+#include <libempathy/empathy-contact-manager.h>
+#include <libempathy/empathy-contact-list.h>
+#include <libempathy-gtk/gossip-private-chat.h>
+#include <libempathy-gtk/gossip-stock.h>
+
+#define BUS_NAME "org.gnome.Empathy.Chat"
+#define OBJECT_PATH "/org/freedesktop/Telepathy/ChannelHandler"
+
+static void
+new_channel_cb (EmpathyChandler *chandler,
+               TpConn          *tp_conn,
+               TpChan          *tp_chan,
+               gpointer         user_data)
+{
+       if (tp_chan->handle_type == TP_HANDLE_TYPE_CONTACT) {
+               MissionControl        *mc;
+               McAccount             *account;
+               EmpathyContactManager *manager;
+               EmpathyContactList    *list;
+               GossipContact         *contact;
+               GossipPrivateChat     *chat;
+
+               /* We have a private chat channel */
+               mc = mission_control_new (tp_get_bus ());
+               account = mission_control_get_account_for_connection (mc, tp_conn, NULL);
+               manager = empathy_contact_manager_new ();
+               list = empathy_contact_manager_get_list (manager, account);
+               contact = empathy_contact_list_get_from_handle (list, tp_chan->handle);
+
+               chat = gossip_private_chat_new_with_channel (contact, tp_chan);
+               gossip_chat_present (GOSSIP_CHAT (chat));
+
+               g_object_unref (mc);
+               g_object_unref (account);
+               g_object_unref (contact);
+               g_object_unref (chat);
+               g_object_unref (manager);
+       }
+}
+
+int
+main (int argc, char *argv[])
+{
+       EmpathyChandler *chandler;
+
+       gtk_init (&argc, &argv);
+       /* FIXME: This is a horrible hack */
+       gossip_stock_init (gtk_window_new (GTK_WINDOW_TOPLEVEL));
+
+       chandler = empathy_chandler_new (BUS_NAME, OBJECT_PATH);
+
+       g_signal_connect (chandler, "new-channel",
+                         G_CALLBACK (new_channel_cb),
+                         NULL);
+
+       gtk_main ();
+
+       return EXIT_SUCCESS;
+}
+
diff --git a/src/empathy-chat.chandler b/src/empathy-chat.chandler
new file mode 100644 (file)
index 0000000..4cfe75b
--- /dev/null
@@ -0,0 +1,5 @@
+[ChannelHandler]
+BusName = org.gnome.Empathy.Chat
+ObjectPath = /org/freedesktop/Telepathy/ChannelHandler
+ChannelType = org.freedesktop.Telepathy.Channel.Type.Text
+
diff --git a/src/empathy-contact-list-main.c b/src/empathy-contact-list-main.c
new file mode 100644 (file)
index 0000000..084649b
--- /dev/null
@@ -0,0 +1,72 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2007 Collabora Ltd.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ * 
+ * Authors: Xavier Claessens <xclaesse@gmail.com>
+ */
+
+#include <config.h>
+
+#include <stdlib.h>
+
+#include <glib.h>
+#include <gtk/gtk.h>
+
+#include <libmissioncontrol/mc-account.h>
+
+#include <libempathy-gtk/empathy-main-window.h>
+#include <libempathy-gtk/gossip-stock.h>
+#include <libempathy-gtk/gossip-accounts-dialog.h>
+
+static void
+destroy_cb (GtkWidget *window,
+           gpointer   user_data)
+{
+       gossip_stock_finalize ();
+       gtk_main_quit ();
+}
+
+int
+main (int argc, char *argv[])
+{
+       GtkWidget *window;
+       GList     *accounts;
+
+       gtk_init (&argc, &argv);
+
+       /* FIXME: This is a horrible hack */
+       gossip_stock_init (gtk_window_new (GTK_WINDOW_TOPLEVEL));
+
+       window = empathy_main_window_show ();
+       g_signal_connect (window, "destroy",
+                         G_CALLBACK (destroy_cb),
+                         NULL);
+
+       /* 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 {
+               gossip_accounts_dialog_show ();
+       }
+
+       gtk_main ();
+
+       return EXIT_SUCCESS;
+}
+
index 94e29e2..2aea589 100644 (file)
@@ -33,7 +33,6 @@
 #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/gossip-status-presets.h>
@@ -106,7 +105,6 @@ destroy_cb (GtkWidget *window,
            gpointer   user_data)
 {
        gossip_stock_finalize ();
-       empathy_session_finalize ();
        gtk_main_quit ();
 }
 
diff --git a/src/org.gnome.Empathy.Chat.service.in b/src/org.gnome.Empathy.Chat.service.in
new file mode 100644 (file)
index 0000000..6a794e4
--- /dev/null
@@ -0,0 +1,3 @@
+[D-BUS Service]
+Name=org.gnome.Empathy.Chat
+Exec=@bindir@/empathy-chat