[Libreoffice-commits] .: 4 commits - autodoc/Module_autodoc.mk cosv/Module_cosv.mk sc/source solenv/gbuild tubes/Executable_liboapprover.mk tubes/inc tubes/Library_tubes.mk tubes/source udm/Module_udm.mk

Matus Kukan mkukan at kemper.freedesktop.org
Tue Aug 14 10:40:32 PDT 2012


 autodoc/Module_autodoc.mk               |    2 -
 cosv/Module_cosv.mk                     |    4 ++
 sc/source/ui/collab/sccollaboration.cxx |    3 -
 sc/source/ui/inc/sccollaboration.hxx    |    2 -
 solenv/gbuild/Executable.mk             |    1 
 tubes/Executable_liboapprover.mk        |   12 ++----
 tubes/Library_tubes.mk                  |    1 
 tubes/inc/tubes/collaboration.hxx       |    2 -
 tubes/inc/tubes/manager.hxx             |    1 
 tubes/source/conference.cxx             |   32 ++++++++++++++++-
 tubes/source/contact-list.cxx           |    9 +---
 tubes/source/manager.cxx                |   60 +++-----------------------------
 udm/Module_udm.mk                       |    4 ++
 13 files changed, 57 insertions(+), 76 deletions(-)

New commits:
commit e9ed269c9ec985e1f4046addfab05c1c3795da68
Author: Matúš Kukan <matus.kukan at gmail.com>
Date:   Mon Aug 13 13:03:08 2012 +0200

    tubes: clean this makefile
    
    Change-Id: Iaae75640e2daac0edce609a99f20056e12756ffc

diff --git a/tubes/Executable_liboapprover.mk b/tubes/Executable_liboapprover.mk
index 63f8177..feb9bca 100644
--- a/tubes/Executable_liboapprover.mk
+++ b/tubes/Executable_liboapprover.mk
@@ -26,18 +26,14 @@
 
 $(eval $(call gb_Executable_Executable,liboapprover))
 
-$(eval $(call gb_Executable_set_targettype_gui,liboapprover,YES))
-
 $(eval $(call gb_Executable_set_include,liboapprover,\
+    -I$(SRCDIR)/tubes/inc \
     $$(INCLUDE) \
-    $(GTK_CFLAGS) \
-    $(TELEPATHY_CFLAGS) \
-    -I$(realpath $(SRCDIR)/tubes/inc) \
 ))
 
-$(eval $(call gb_Executable_add_libs,liboapprover,\
-    $(GTK_LIBS) \
-    $(TELEPATHY_LIBS) \
+$(eval $(call gb_Executable_use_externals,liboapprover,\
+    gtk \
+    telepathy \
 ))
 
 $(eval $(call gb_Executable_add_cobjects,liboapprover,\
commit 62f5fc1d2f14f8164c3dd6eca5494a8c1b01301b
Author: Matúš Kukan <matus.kukan at gmail.com>
Date:   Mon Aug 13 12:56:50 2012 +0200

    this line is wrong; removing
    
    Change-Id: I5159f3f41c3e0d6ec775a7d1700cbe1272cdb059

diff --git a/solenv/gbuild/Executable.mk b/solenv/gbuild/Executable.mk
index 9f56296..90dfc68 100644
--- a/solenv/gbuild/Executable.mk
+++ b/solenv/gbuild/Executable.mk
@@ -52,7 +52,6 @@ $(call gb_Executable__Executable_impl,$(1),Executable/$(1)$(gb_Executable_EXT))
 endef
 
 define gb_Executable__Executable_impl
-$(call gb_Executable_set_targettype_gui,$(2))
 $(call gb_LinkTarget_LinkTarget,$(2))
 $(call gb_LinkTarget_set_targettype,$(2),Executable)
 $(call gb_Executable_get_target,$(1)) : $(call gb_LinkTarget_get_target,$(2)) \
commit 540ac996fb1441f69a59c9e8bfacca64418b8b4f
Author: Matúš Kukan <matus.kukan at gmail.com>
Date:   Mon Aug 13 19:46:54 2012 +0200

    these are needed only for odk
    
    Change-Id: I6d9ccf819f7f887fa17a2de72f39a456a56ace24

diff --git a/autodoc/Module_autodoc.mk b/autodoc/Module_autodoc.mk
index d10c946..80d6ce6 100644
--- a/autodoc/Module_autodoc.mk
+++ b/autodoc/Module_autodoc.mk
@@ -8,7 +8,7 @@
 #
 $(eval $(call gb_Module_Module,autodoc))
 
-ifneq (,$(filter DESKTOP,$(BUILD_TYPE)))
+ifneq (,$(filter ODK,$(BUILD_TYPE)))
 
 $(eval $(call gb_Module_add_targets,autodoc,\
     Executable_autodoc \
diff --git a/cosv/Module_cosv.mk b/cosv/Module_cosv.mk
index 729185a..333594a 100644
--- a/cosv/Module_cosv.mk
+++ b/cosv/Module_cosv.mk
@@ -8,9 +8,13 @@
 #
 $(eval $(call gb_Module_Module,cosv))
 
+ifneq (,$(filter ODK,$(BUILD_TYPE)))
+
 $(eval $(call gb_Module_add_targets,cosv,\
     Package_inc \
     StaticLibrary_cosv \
 ))
 
+endif
+
 # vim:set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/udm/Module_udm.mk b/udm/Module_udm.mk
index e346c87..fc85a2c 100644
--- a/udm/Module_udm.mk
+++ b/udm/Module_udm.mk
@@ -8,9 +8,13 @@
 #
 $(eval $(call gb_Module_Module,udm))
 
+ifneq (,$(filter ODK,$(BUILD_TYPE)))
+
 $(eval $(call gb_Module_add_targets,udm,\
     Package_inc \
     StaticLibrary_udm \
 ))
 
+endif
+
 # vim:set shiftwidth=4 softtabstop=4 expandtab:
commit 7f6b2321a5adbf63fdd50989e58418db93e90454
Author: Matúš Kukan <matus.kukan at gmail.com>
Date:   Thu Aug 9 23:37:32 2012 +0200

    tubes: use channel's signal closed to know when end the collaboration
    
    Change-Id: I11e0aa2db3b41a166e23c85fd040f883e0d3be08

diff --git a/sc/source/ui/collab/sccollaboration.cxx b/sc/source/ui/collab/sccollaboration.cxx
index 74c067c..5dc527d 100644
--- a/sc/source/ui/collab/sccollaboration.cxx
+++ b/sc/source/ui/collab/sccollaboration.cxx
@@ -27,9 +27,8 @@ ScCollaboration::~ScCollaboration()
 {
 }
 
-void ScCollaboration::ContactLeft() const
+void ScCollaboration::EndCollaboration() const
 {
-    SAL_INFO( "sc.tubes", "Contact has left the collaboration" );
     ScDocFuncSend* pSender = GetScDocFuncSend();
     if (pSender)
     {
diff --git a/sc/source/ui/inc/sccollaboration.hxx b/sc/source/ui/inc/sccollaboration.hxx
index ece2604..1303847 100644
--- a/sc/source/ui/inc/sccollaboration.hxx
+++ b/sc/source/ui/inc/sccollaboration.hxx
@@ -23,7 +23,7 @@ public:
             ScCollaboration( ScDocShell* pScDocShell );
     virtual ~ScCollaboration();
 
-    virtual void  ContactLeft() const;
+    virtual void  EndCollaboration() const;
     virtual void  PacketReceived( const OString& rPacket ) const;
     virtual void  SaveAndSendFile( TpContact* pContact ) const;
     virtual void  StartCollaboration( TeleConference* pConference );
diff --git a/tubes/Library_tubes.mk b/tubes/Library_tubes.mk
index b9edab9..2cdac5f 100644
--- a/tubes/Library_tubes.mk
+++ b/tubes/Library_tubes.mk
@@ -51,6 +51,7 @@ $(eval $(call gb_Library_use_libraries,tubes,\
 ))
 
 $(eval $(call gb_Library_use_externals,tubes,\
+	gtk \
 	telepathy \
 ))
 
diff --git a/tubes/inc/tubes/collaboration.hxx b/tubes/inc/tubes/collaboration.hxx
index 8aef937..e3f765c 100644
--- a/tubes/inc/tubes/collaboration.hxx
+++ b/tubes/inc/tubes/collaboration.hxx
@@ -27,7 +27,7 @@ public:
             Collaboration();
     virtual ~Collaboration();
 
-    virtual void ContactLeft() const = 0;
+    virtual void EndCollaboration() const = 0;
     virtual void PacketReceived( const OString& rPacket ) const = 0;
     virtual void SaveAndSendFile( TpContact* pContact ) const = 0;
     virtual void StartCollaboration( TeleConference* pConference ) = 0;
diff --git a/tubes/inc/tubes/manager.hxx b/tubes/inc/tubes/manager.hxx
index b0825a3..38e5d8c 100644
--- a/tubes/inc/tubes/manager.hxx
+++ b/tubes/inc/tubes/manager.hxx
@@ -135,6 +135,7 @@ public:
 
     static void             registerCollaboration( Collaboration* pCollaboration );
     static void             unregisterCollaboration( Collaboration* pCollaboration );
+    static bool             existsCollaboration( Collaboration* pCollaboration );
     /** Display contact list dialog for all documents. */
     static void             displayAllContacts();
 
diff --git a/tubes/source/conference.cxx b/tubes/source/conference.cxx
index 8be9cab..ce46cdc 100644
--- a/tubes/source/conference.cxx
+++ b/tubes/source/conference.cxx
@@ -33,6 +33,7 @@
 #include <tubes/file-transfer-helper.h>
 #include <tubes/manager.hxx>
 
+#include <gtk/gtk.h>
 #include <telepathy-glib/telepathy-glib.h>
 
 #if defined SAL_LOG_INFO
@@ -246,6 +247,23 @@ TeleConference::~TeleConference()
     delete pImpl;
 }
 
+static void channel_closed_cb( TpChannel *channel, gpointer user_data, GObject * /* weak_object */ )
+{
+    Collaboration* pCollaboration = reinterpret_cast<Collaboration*> (user_data);
+    if (TeleManager::existsCollaboration( pCollaboration ))
+    {
+        GtkWidget *dialog = gtk_message_dialog_new( NULL, static_cast<GtkDialogFlags> (0),
+                GTK_MESSAGE_WARNING, GTK_BUTTONS_CLOSE,
+                "Contact %s lost, you'll now be working locally.",
+                tp_contact_get_alias (tp_channel_get_target_contact (channel)) );
+        g_signal_connect_swapped (dialog, "response",
+                G_CALLBACK (gtk_widget_destroy), dialog);
+        gtk_widget_show_all (dialog);
+
+        pCollaboration->EndCollaboration();
+    }
+}
+
 
 void TeleConference::setChannel( TpAccount *pAccount, TpDBusTubeChannel* pChannel )
 {
@@ -373,8 +391,6 @@ void TeleConference::close()
 {
     INFO_LOGGER( "TeleConference::close");
 
-    TeleManager::unregisterDemoConference( this );
-
     if (mpChannel)
         tp_cli_channel_call_close( TP_CHANNEL( mpChannel), 5000, TeleConference_ChannelCloseHandler, this, NULL, NULL);
     else
@@ -386,6 +402,8 @@ void TeleConference::finalize()
 {
     INFO_LOGGER( "TeleConference::finalize");
 
+    TeleManager::unregisterDemoConference( this );
+
     if (mpChannel)
     {
         g_object_unref( mpChannel);
@@ -463,6 +481,16 @@ Collaboration* TeleConference::getCollaboration() const
 void TeleConference::setCollaboration( Collaboration* pCollaboration )
 {
     mpCollaboration = pCollaboration;
+    if (mpChannel)
+    {
+        GError *error = NULL;
+        if (!tp_cli_channel_connect_to_closed( TP_CHANNEL (mpChannel),
+                    channel_closed_cb, mpCollaboration, NULL, NULL, &error ))
+        {
+            SAL_WARN( "tubes", "Error when connecting to signal closed: " << error->message );
+            g_error_free (error);
+        }
+    }
 }
 
 void TeleConference::invite( TpContact *pContact )
diff --git a/tubes/source/contact-list.cxx b/tubes/source/contact-list.cxx
index 163f4e0..03fc3b1 100644
--- a/tubes/source/contact-list.cxx
+++ b/tubes/source/contact-list.cxx
@@ -71,7 +71,7 @@ ContactList::~ContactList()
     mpAccountManager = NULL;
 }
 
-bool tb_presence_is_online( const TpConnectionPresenceType& presence )
+static bool tb_presence_is_online( const TpConnectionPresenceType& presence )
 {
     switch (presence)
     {
@@ -91,12 +91,7 @@ bool tb_presence_is_online( const TpConnectionPresenceType& presence )
     }
 }
 
-bool tb_account_is_online( TpAccount *account )
-{
-    return tb_presence_is_online (tp_account_get_current_presence (account, NULL, NULL));
-}
-
-bool tb_contact_is_online( TpContact *contact )
+static bool tb_contact_is_online( TpContact *contact )
 {
     return tb_presence_is_online (tp_contact_get_presence_type (contact));
 }
diff --git a/tubes/source/manager.cxx b/tubes/source/manager.cxx
index 340c002..d900cb6 100644
--- a/tubes/source/manager.cxx
+++ b/tubes/source/manager.cxx
@@ -106,41 +106,6 @@ public:
 
 TeleManagerImpl* TeleManager::pImpl = new TeleManagerImpl();
 
-bool tb_account_is_online( TpAccount* pAccount );
-bool tb_contact_is_online( TpContact* pContact );
-
-static void account_presence_changed_cb( TpAccount* pAccount,
-                                         guint      /* type */,
-                                         gchar*     /* status */,
-                                         gchar*     /* message */,
-                                         gpointer   pUserData )
-{
-    if (!tb_account_is_online( pAccount ))
-    {
-        TeleConference* pConference = reinterpret_cast<TeleConference*> (pUserData);
-        pConference->close();
-        Collaboration* pCollaboration = pConference->getCollaboration();
-        if (pCollaboration)
-            pCollaboration->ContactLeft();
-    }
-}
-
-static void contact_presence_changed_cb( TpContact* pContact,
-                                         guint      /* type */,
-                                         gchar*     /* status */,
-                                         gchar*     /* message */,
-                                         gpointer   pUserData )
-{
-    if (!tb_contact_is_online( pContact ))
-    {
-        TeleConference* pConference = reinterpret_cast<TeleConference*> (pUserData);
-        pConference->close();
-        Collaboration* pCollaboration = pConference->getCollaboration();
-        if (pCollaboration)
-            pCollaboration->ContactLeft();
-    }
-}
-
 static void TeleManager_DBusChannelHandler(
         TpSimpleHandler*            /*handler*/,
         TpAccount*                  pAccount,
@@ -171,14 +136,6 @@ static void TeleManager_DBusChannelHandler(
             TeleConference* pConference = new TeleConference( pAccount, TP_DBUS_TUBE_CHANNEL( pChannel ) );
             pConference->acceptTube();
             TeleManager::addConference( pConference );
-
-            g_signal_connect( pAccount, "presence-changed",
-                    G_CALLBACK (account_presence_changed_cb), pConference );
-
-            TpContact* pContact = tp_channel_get_target_contact( pChannel );
-            if (pContact)
-                g_signal_connect( pContact, "presence-changed",
-                        G_CALLBACK (contact_presence_changed_cb), pConference );
         }
         else
         {
@@ -236,6 +193,13 @@ void TeleManager::unregisterCollaboration( Collaboration* pCollaboration )
     pImpl->maCollaborations.erase( pCollaboration );
 }
 
+bool TeleManager::existsCollaboration( Collaboration* pCollaboration )
+{
+    MutexGuard aGuard( GetMutex());
+
+    return pImpl->maCollaborations.find( pCollaboration ) != pImpl->maCollaborations.end();
+}
+
 void TeleManager::displayAllContacts()
 {
     MutexGuard aGuard( GetMutex());
@@ -447,7 +411,6 @@ static void TeleManager_ChannelReadyHandler(
         g_error_free( pError);
         return;
     }
-
     pConference->setChannel( tp_account_channel_request_get_account( pChannelRequest),
             TP_DBUS_TUBE_CHANNEL (pChannel));
     pConference->offerTube();
@@ -690,9 +653,6 @@ TeleConference* TeleManager::startGroupSession( TpAccount *pAccount,
     if (!pConference->isReady())
         return NULL;
 
-    g_signal_connect( pAccount, "presence-changed",
-            G_CALLBACK (account_presence_changed_cb), pConference );
-
     return pConference;
 }
 
@@ -768,12 +728,6 @@ TeleConference* TeleManager::startBuddySession( TpAccount *pAccount, TpContact *
     if (!pConference->isReady())
         return NULL;
 
-    g_signal_connect( pAccount, "presence-changed",
-            G_CALLBACK (account_presence_changed_cb), pConference );
-
-    g_signal_connect( pBuddy, "presence-changed",
-            G_CALLBACK (contact_presence_changed_cb), pConference );
-
     return pConference;
 }
 


More information about the Libreoffice-commits mailing list