From: Xavier Claessens Date: Thu, 3 May 2007 14:12:30 +0000 (+0000) Subject: [darcs-to-svn @ Remove EmpathySession and move all programs into src/] X-Git-Url: https://git.0d.be/?p=empathy.git;a=commitdiff_plain;h=214850e492efd75f8664bbfb98c6dd6bf161aeb6 [darcs-to-svn @ Remove EmpathySession and move all programs into src/] svn path=/trunk/; revision=28 --- diff --git a/Makefile.am b/Makefile.am index 87b6c62e..a14dcd11 100644 --- a/Makefile.am +++ b/Makefile.am @@ -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 index 589cae3a..00000000 --- a/accounts/Makefile.am +++ /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 index e6562034..00000000 --- a/accounts/empathy-accounts-main.c +++ /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 - */ - -#include - -#include -#include - -#include -#include - -#include -#include - -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 index d8ee78a0..00000000 --- a/chat/Makefile.am +++ /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 index 864e506b..00000000 --- a/chat/empathy-chat-main.c +++ /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 - */ - -#include - -#include - -#include -#include - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#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 index 4cfe75b0..00000000 --- a/chat/empathy-chat.chandler +++ /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 index 6a794e4b..00000000 --- a/chat/org.gnome.Empathy.Chat.service.in +++ /dev/null @@ -1,3 +0,0 @@ -[D-BUS Service] -Name=org.gnome.Empathy.Chat -Exec=@bindir@/empathy-chat diff --git a/configure.ac b/configure.ac index e750859b..2a84a1b7 100644 --- a/configure.ac +++ b/configure.ac @@ -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 index de678636..00000000 --- a/contact-list/Makefile.am +++ /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 index fa8d91b2..00000000 --- a/contact-list/empathy-contact-list-main.c +++ /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 - */ - -#include - -#include - -#include -#include - -#include - -#include -#include -#include -#include - -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; -} - diff --git a/libempathy-gtk/gossip-chat.c b/libempathy-gtk/gossip-chat.c index d1e03693..85aeee27 100644 --- a/libempathy-gtk/gossip-chat.c +++ b/libempathy-gtk/gossip-chat.c @@ -35,7 +35,6 @@ #include #include -#include #include #include #include @@ -63,22 +62,23 @@ #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; } diff --git a/libempathy-gtk/gossip-contact-list.c b/libempathy-gtk/gossip-contact-list.c index 8e7288e6..bf0556dc 100644 --- a/libempathy-gtk/gossip-contact-list.c +++ b/libempathy-gtk/gossip-contact-list.c @@ -36,7 +36,6 @@ #include #include -#include #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; diff --git a/libempathy/Makefile.am b/libempathy/Makefile.am index 30d40c59..c681aa83 100644 --- a/libempathy/Makefile.am +++ b/libempathy/Makefile.am @@ -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 \ diff --git a/libempathy/empathy-contact-list.c b/libempathy/empathy-contact-list.c index 9ed83df7..c3d3171d 100644 --- a/libempathy/empathy-contact-list.c +++ b/libempathy/empathy-contact-list.c @@ -34,7 +34,6 @@ #include #include "empathy-contact-list.h" -#include "empathy-session.h" #include "gossip-debug.h" #include "gossip-telepathy-group.h" diff --git a/libempathy/empathy-contact-manager.c b/libempathy/empathy-contact-manager.c index cf5a81fe..50ed576b 100644 --- a/libempathy/empathy-contact-manager.c +++ b/libempathy/empathy-contact-manager.c @@ -28,7 +28,6 @@ #include #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 index 86ac1e18..00000000 --- a/libempathy/empathy-session.c +++ /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 - */ - -#include - -#include - -#include - -#include - -#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 index af843a5e..00000000 --- a/libempathy/empathy-session.h +++ /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 - */ - -#ifndef __EMPATHY_SESSION_H__ -#define __EMPATHY_SESSION_H__ - -#include - -#include -#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__ */ diff --git a/libempathy/empathy-tp-chat.c b/libempathy/empathy-tp-chat.c index f72655ec..25639dd1 100644 --- a/libempathy/empathy-tp-chat.c +++ b/libempathy/empathy-tp-chat.c @@ -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" @@ -41,14 +40,15 @@ #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 ()); diff --git a/libempathy/gossip-utils.c b/libempathy/gossip-utils.c index 3dc4afd4..66889871 100644 --- a/libempathy/gossip-utils.c +++ b/libempathy/gossip-utils.c @@ -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; } diff --git a/src/Makefile.am b/src/Makefile.am index b9c9ca2e..83b07179 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -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 index 00000000..954b3cea --- /dev/null +++ b/src/empathy-accounts-main.c @@ -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 + */ + +#include + +#include +#include + +#include +#include + +#include + +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 index 00000000..7fde26ae --- /dev/null +++ b/src/empathy-chat-main.c @@ -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 + */ + +#include + +#include + +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#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 index 00000000..4cfe75b0 --- /dev/null +++ b/src/empathy-chat.chandler @@ -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 index 00000000..084649ba --- /dev/null +++ b/src/empathy-contact-list-main.c @@ -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 + */ + +#include + +#include + +#include +#include + +#include + +#include +#include +#include + +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; +} + diff --git a/src/empathy-main.c b/src/empathy-main.c index 94e29e2b..2aea589f 100644 --- a/src/empathy-main.c +++ b/src/empathy-main.c @@ -33,7 +33,6 @@ #include #include -#include #include #include #include @@ -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 index 00000000..6a794e4b --- /dev/null +++ b/src/org.gnome.Empathy.Chat.service.in @@ -0,0 +1,3 @@ +[D-BUS Service] +Name=org.gnome.Empathy.Chat +Exec=@bindir@/empathy-chat