diff options
21 files changed, 104 insertions, 242 deletions
diff --git a/Makefile.am b/Makefile.am index 87b6c62e3..a14dcd113 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 589cae3a3..000000000 --- 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/chat/Makefile.am b/chat/Makefile.am deleted file mode 100644 index d8ee78a07..000000000 --- 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/configure.ac b/configure.ac index e750859b1..2a84a1b7c 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 de6786368..000000000 --- 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/libempathy-gtk/gossip-chat.c b/libempathy-gtk/gossip-chat.c index d1e036936..85aeee274 100644 --- a/libempathy-gtk/gossip-chat.c +++ b/libempathy-gtk/gossip-chat.c @@ -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> @@ -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 8e7288e6f..bf0556dcb 100644 --- a/libempathy-gtk/gossip-contact-list.c +++ b/libempathy-gtk/gossip-contact-list.c @@ -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; diff --git a/libempathy/Makefile.am b/libempathy/Makefile.am index 30d40c595..c681aa83f 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 9ed83df70..c3d3171d4 100644 --- a/libempathy/empathy-contact-list.c +++ b/libempathy/empathy-contact-list.c @@ -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" diff --git a/libempathy/empathy-contact-manager.c b/libempathy/empathy-contact-manager.c index cf5a81fe2..50ed576b5 100644 --- a/libempathy/empathy-contact-manager.c +++ b/libempathy/empathy-contact-manager.c @@ -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 index 86ac1e180..000000000 --- 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 <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 index af843a5e0..000000000 --- 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 <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__ */ diff --git a/libempathy/empathy-tp-chat.c b/libempathy/empathy-tp-chat.c index f72655eca..25639dd14 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 3dc4afd48..668898712 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 b9c9ca2e8..83b071790 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/accounts/empathy-accounts-main.c b/src/empathy-accounts-main.c index e65620342..954b3cea7 100644 --- a/accounts/empathy-accounts-main.c +++ b/src/empathy-accounts-main.c @@ -28,14 +28,12 @@ #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 (); } diff --git a/chat/empathy-chat-main.c b/src/empathy-chat-main.c index 864e506b7..7fde26ae0 100644 --- a/chat/empathy-chat-main.c +++ b/src/empathy-chat-main.c @@ -34,7 +34,6 @@ #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> @@ -60,7 +59,7 @@ new_channel_cb (EmpathyChandler *chandler, /* 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 (); + manager = empathy_contact_manager_new (); list = empathy_contact_manager_get_list (manager, account); contact = empathy_contact_list_get_from_handle (list, tp_chan->handle); @@ -71,6 +70,7 @@ new_channel_cb (EmpathyChandler *chandler, g_object_unref (account); g_object_unref (contact); g_object_unref (chat); + g_object_unref (manager); } } diff --git a/chat/empathy-chat.chandler b/src/empathy-chat.chandler index 4cfe75b01..4cfe75b01 100644 --- a/chat/empathy-chat.chandler +++ b/src/empathy-chat.chandler diff --git a/contact-list/empathy-contact-list-main.c b/src/empathy-contact-list-main.c index fa8d91b2c..084649bab 100644 --- a/contact-list/empathy-contact-list-main.c +++ b/src/empathy-contact-list-main.c @@ -29,7 +29,6 @@ #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> @@ -39,7 +38,6 @@ destroy_cb (GtkWidget *window, gpointer user_data) { gossip_stock_finalize (); - empathy_session_finalize (); gtk_main_quit (); } diff --git a/src/empathy-main.c b/src/empathy-main.c index 94e29e2b5..2aea589f6 100644 --- a/src/empathy-main.c +++ b/src/empathy-main.c @@ -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/chat/org.gnome.Empathy.Chat.service.in b/src/org.gnome.Empathy.Chat.service.in index 6a794e4b8..6a794e4b8 100644 --- a/chat/org.gnome.Empathy.Chat.service.in +++ b/src/org.gnome.Empathy.Chat.service.in |