ekiga r7624 - in trunk/lib/engine/components: . gnome-session
- From: jpuydt svn gnome org
- To: svn-commits-list gnome org
- Subject: ekiga r7624 - in trunk/lib/engine/components: . gnome-session
- Date: Thu, 29 Jan 2009 14:40:52 +0000 (UTC)
Author: jpuydt
Date: Thu Jan 29 14:40:51 2009
New Revision: 7624
URL: http://svn.gnome.org/viewvc/ekiga?rev=7624&view=rev
Log:
Made the gnome session code do something useful
Modified:
trunk/lib/engine/components/Makefile.am
trunk/lib/engine/components/gnome-session/Makefile.am
trunk/lib/engine/components/gnome-session/gnome-session-main.cpp
Modified: trunk/lib/engine/components/Makefile.am
==============================================================================
--- trunk/lib/engine/components/Makefile.am (original)
+++ trunk/lib/engine/components/Makefile.am Thu Jan 29 14:40:51 2009
@@ -1,5 +1,10 @@
if HAVE_DBUS
DBUS_DIR = hal-dbus
+
+if HAVE_GNOME
+GNOME_SESSION_DIR = gnome-session
+endif
+
endif
if HAVE_LDAP
@@ -42,10 +47,6 @@
AVAHI_DIR += avahi
endif
-if HAVE_GNOME
-GNOME_SESSION_DIR = gnome-session
-endif
-
SUBDIRS = \
call-history \
echo \
Modified: trunk/lib/engine/components/gnome-session/Makefile.am
==============================================================================
--- trunk/lib/engine/components/gnome-session/Makefile.am (original)
+++ trunk/lib/engine/components/gnome-session/Makefile.am Thu Jan 29 14:40:51 2009
@@ -2,7 +2,7 @@
gnomesession_dir = $(top_srcdir)/lib/engine/components/gnome-session
-AM_CPPFLAGS = $(SIGC_CFLAGS) $(GLIB_CFLAGS) $(XML_CFLAGS)
+AM_CPPFLAGS = $(SIGC_CFLAGS) $(GLIB_CFLAGS) $(DBUS_CFLAGS)
INCLUDES = \
-I$(top_srcdir)/lib/engine/framework \
@@ -15,4 +15,4 @@
libgmgnomesession_la_LIBADD = \
$(top_builddir)/lib/engine/protocol/libgmprotocol.la
-libgmgnomesession_la_LDFLAGS = -export-dynamic -no-undefined $(LDAP_LIBS) $(SIGC_LIBS) $(GLIB_LIBS) $(XML_LIBS)
+libgmgnomesession_la_LDFLAGS = -export-dynamic -no-undefined $(LDAP_LIBS) $(SIGC_LIBS) $(GLIB_LIBS) $(DBUS_LIBS)
Modified: trunk/lib/engine/components/gnome-session/gnome-session-main.cpp
==============================================================================
--- trunk/lib/engine/components/gnome-session/gnome-session-main.cpp (original)
+++ trunk/lib/engine/components/gnome-session/gnome-session-main.cpp Thu Jan 29 14:40:51 2009
@@ -35,8 +35,13 @@
*
*/
+#include "config.h"
+
#include <iostream>
#include <map>
+#include <glib.h>
+#include <dbus/dbus.h>
+#include <dbus/dbus-glib.h>
#include "services.h"
#include "call-core.h"
@@ -47,6 +52,8 @@
{
GNOMESESSIONService (gmref_ptr<Ekiga::CallCore> call_core);
+ ~GNOMESESSIONService ();
+
const std::string get_name () const
{ return "gnome-session"; }
@@ -61,7 +68,8 @@
void on_cleared_call (gmref_ptr<Ekiga::CallManager> manager,
gmref_ptr<Ekiga::Call> call);
- std::map<gmref_ptr<Ekiga::Call>, std::string> cookies;
+ DBusGProxy* proxy;
+ std::map<gmref_ptr<Ekiga::Call>, guint> cookies;
};
struct GNOMESESSIONSpark: public Ekiga::Spark
@@ -103,26 +111,71 @@
GNOMESESSIONService::GNOMESESSIONService (gmref_ptr<Ekiga::CallCore> call_core)
{
- call_core->established_call.connect (sigc::mem_fun (this, &GNOMESESSIONService::on_established_call));
- call_core->setup_call.connect (sigc::mem_fun (this, &GNOMESESSIONService::on_cleared_call));
+ GError* error = NULL;
+
+ DBusGConnection* connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
+
+ if (error == NULL) {
+
+ proxy = dbus_g_proxy_new_for_name_owner (connection,
+ "org.gnome.SessionManager",
+ "/org/gnome/SessionManager",
+ "org.gnome.SessionManager",
+ &error);
+
+ if (error == NULL) {
+
+ call_core->established_call.connect (sigc::mem_fun (this, &GNOMESESSIONService::on_established_call));
+ call_core->setup_call.connect (sigc::mem_fun (this, &GNOMESESSIONService::on_cleared_call));
+ } else {
+
+ proxy = NULL;
+ g_error_free (error);
+ }
+ } else {
+
+ proxy = NULL;
+ g_error_free (error);
+ }
+}
+
+GNOMESESSIONService::~GNOMESESSIONService ()
+{
+ if (proxy != NULL)
+ g_object_unref (proxy);
}
void
GNOMESESSIONService::on_established_call (gmref_ptr<Ekiga::CallManager> /*manager*/,
- gmref_ptr<Ekiga::Call> /*call*/)
+ gmref_ptr<Ekiga::Call> call)
{
- std::cout << "Should Inhibit and store a cookie" << std::endl;
+ guint cookie;
+
+ gboolean ret = dbus_g_proxy_call (proxy, "Inhibit", NULL,
+ G_TYPE_STRING, PACKAGE_NAME,
+ G_TYPE_UINT, 0,
+ G_TYPE_STRING, "Call in progress",
+ G_TYPE_UINT, 8,
+ G_TYPE_INVALID,
+ G_TYPE_UINT, &cookie,
+ G_TYPE_INVALID);
+ if (ret) {
+
+ cookies[call] = cookie;
+ }
}
void
GNOMESESSIONService::on_cleared_call (gmref_ptr<Ekiga::CallManager> /*manager*/,
gmref_ptr<Ekiga::Call> call)
{
- std::map<gmref_ptr<Ekiga::Call>, std::string>::iterator iter = cookies.find (call);
+ std::map<gmref_ptr<Ekiga::Call>, guint>::iterator iter = cookies.find (call);
if (iter != cookies.end ()) {
- std::cout << "Should Uninhibit cookie " << iter->second << std::endl;
+ dbus_g_proxy_call (proxy, "Uninhibit", NULL,
+ G_TYPE_UINT, iter->second,
+ G_TYPE_INVALID, G_TYPE_INVALID);
cookies.erase (iter);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]