summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefano Karapetsas <[email protected]>2013-09-11 01:01:44 -0700
committerStefano Karapetsas <[email protected]>2013-09-11 01:01:44 -0700
commit2a7238bee32de88d24b541acdc06a1d1b3b73b02 (patch)
treeb33ee3e6052a3eb4c9731c649bcdae95054f613e
parent48b2c97f8a0c7e8cc0d999d5c427c37daf5aabda (diff)
parent472993545c41fa1c77e672b3e4d0df205a6fa98f (diff)
downloadmate-user-share-2a7238bee32de88d24b541acdc06a1d1b3b73b02.tar.bz2
mate-user-share-2a7238bee32de88d24b541acdc06a1d1b3b73b02.tar.xz
Merge pull request #14 from NiceandGently/master
Add support for Apache HTTPD 2.4
-rw-r--r--configure.ac47
-rw-r--r--data/Makefile.am8
-rw-r--r--data/dav_user_2.2.conf2
-rw-r--r--data/dav_user_2.4.conf78
-rw-r--r--data/mate-user-share-obexftp.desktop.in.in11
-rw-r--r--data/mate-user-share-obexpush.desktop.in.in11
-rw-r--r--data/mate-user-share-webdav.desktop.in.in (renamed from data/mate-user-share.desktop.in.in)4
-rw-r--r--po/POTFILES.in4
-rw-r--r--po/POTFILES.skip4
-rw-r--r--src/http.c11
-rw-r--r--src/share-extension.c13
-rw-r--r--src/user_share.c178
12 files changed, 209 insertions, 162 deletions
diff --git a/configure.ac b/configure.ac
index de9b590..5b9b489 100644
--- a/configure.ac
+++ b/configure.ac
@@ -50,27 +50,21 @@ fi
AC_SUBST(HTTPD)
-PKG_CHECK_EXISTS(dbus-1 >= 1.1.1, have_dbus_1_1=true, have_dbus_1_1=false)
-if $have_dbus_1_1 ; then
- DBUS_MODULES=dbus-1
- AC_DEFINE(HAVE_DBUS_1_1, 1, [Set to true if we have D-BUS 1.1])
+BLUETOOTH_PKG="mate-bluetooth-1.0 >= 1.2.0"
+AC_ARG_ENABLE(bluetooth, AS_HELP_STRING([--disable-bluetooth],[compile without bluetooth support]),,enable_bluetooth=yes)
+if test "x$enable_bluetooth" = "xyes"; then
+ PKG_CHECK_MODULES(BLUETOOTH, $BLUETOOTH_PKG)
+ AC_DEFINE(HAVE_BLUETOOTH, 1, [Set to true if mate-bluetooth support is available])
+else
+ BLUETOOTH_PKG=""
+ AC_MSG_WARN([Bluetooth support is disabled.])
fi
+AM_CONDITIONAL(USE_BLUETOOTH, [test "$enable_bluetooth" = "yes"])
-PKG_CHECK_MODULES(USER_SHARE, glib-2.0 >= 2.15.2 gio-2.0 >= 2.25.0 gdk-x11-2.0 gtk+-2.0 dbus-glib-1 libnotify >= 0.7.0 libcanberra-gtk $DBUS_MODULES)
+PKG_CHECK_MODULES(USER_SHARE, glib-2.0 >= 2.15.2 gio-2.0 >= 2.26 gdk-x11-2.0 gtk+-2.0 dbus-1 >= 1.1.1 dbus-glib-1 libnotify >= 0.7.0 libcanberra-gtk $DBUS_MODULES $BLUETOOTH_PKG)
AC_SUBST(USER_SHARE_CFLAGS)
AC_SUBST(USER_SHARE_LIBS)
-PKG_CHECK_MODULES(BLUETOOTH, mate-bluetooth-1.0 >= 1.2.0,
- have_bluetooth=true, have_bluetooth=false)
-AC_SUBST(BLUETOOTH_CFLAGS)
-AC_SUBST(BLUETOOTH_LIBS)
-if $have_bluetooth; then
- AC_DEFINE(HAVE_BLUETOOTH, 1, [Set to true if mate-bluetooth support is available])
-else
- AC_MSG_WARN([Bluetooth support is disabled.])
-fi
-AM_CONDITIONAL(USE_BLUETOOTH, [test "$have_bluetooth" = "true"])
-
PKG_CHECK_MODULES(USER_SHARE_CONFIG, glib-2.0 >= 2.15.2 gio-2.0 >= 2.25.0 gtk+-2.0 >= 2.12.0 unique-1.0)
AC_SUBST(USER_SHARE_CONFIG_CFLAGS)
AC_SUBST(USER_SHARE_CONFIG_LIBS)
@@ -145,7 +139,7 @@ AC_ARG_WITH(cajadir,
[ac_with_cajadir=""])
PKG_CHECK_MODULES(EXTENSION,
- libcaja-extension mate-bluetooth-1.0)
+ libcaja-extension $BLUETOOTH_PKG)
if test "${ac_with_cajadir}" = ""; then
ac_with_cajadir=`pkg-config --variable=extensiondir libcaja-extension`
fi
@@ -197,7 +191,7 @@ else
AC_MSG_RESULT(no)
fi
-AC_OUTPUT([
+AC_CONFIG_FILES([
Makefile
data/Makefile
data/icons/Makefile
@@ -205,12 +199,27 @@ data/icons/16x16/Makefile
data/icons/22x22/Makefile
data/icons/32x32/Makefile
data/icons/48x48/Makefile
-data/mate-user-share.desktop.in
+data/mate-user-share-webdav.desktop.in
+data/mate-user-share-obexftp.desktop.in
+data/mate-user-share-obexpush.desktop.in
po/Makefile.in
src/Makefile
man/Makefile
])
+AC_OUTPUT
+
+if test "x$enable_bluetooth" = "xyes"; then
+ AC_MSG_NOTICE([** Bluetooth support enabled (ObexPush and ObexFTP)])
+else
+ AC_MSG_NOTICE([ Bluetooth support disabled])
+fi
+
+AC_MSG_NOTICE([mate-user-share was configured with the following options:])
+AC_MSG_NOTICE([** httpd location: $HTTP])
+AC_MSG_NOTICE([** httpd modules path: $MODULES_PATH])
+AC_MSG_NOTICE([** caja extension path: $ac_with_cajadir])
+
echo "
Do note Apache 2.2 and mod_dnssd 0.6 are required to use mate-user-share.
"
diff --git a/data/Makefile.am b/data/Makefile.am
index 953fa83..665cf93 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -7,10 +7,10 @@ desktop_in_files = mate-user-share-properties.desktop.in
autostartdir = $(sysconfdir)/xdg/autostart/
autostart_DATA = $(autostart_in_files:.desktop.in=.desktop)
-autostart_in_files = mate-user-share.desktop.in
+autostart_in_files = mate-user-share-obexftp.desktop.in mate-user-share-obexpush.desktop.in mate-user-share-webdav.desktop.in
appdir = $(datadir)/mate-user-share
-app_DATA=dav_user_2.0.conf dav_user_2.2.conf dav_groupfile file-share-properties.ui
+app_DATA=dav_user_2.0.conf dav_user_2.2.conf dav_user_2.4.conf dav_groupfile file-share-properties.ui
gsettings_SCHEMAS = org.mate.FileSharing.gschema.xml
@GSETTINGS_RULES@
@@ -21,7 +21,9 @@ convert_DATA = mate-user-share.convert
EXTRA_DIST = $(gsettings_SCHEMAS) \
$(app_DATA) \
$(desktop_in_files) \
- mate-user-share.desktop.in.in \
+ mate-user-share-obexftp.desktop.in.in \
+ mate-user-share-obexpush.desktop.in.in \
+ mate-user-share-webdav.desktop.in.in \
file-share-properties.ui
CLEANFILES = $(desktop_DATA) $(autostart_DATA)
diff --git a/data/dav_user_2.2.conf b/data/dav_user_2.2.conf
index f38d9ee..785aeab 100644
--- a/data/dav_user_2.2.conf
+++ b/data/dav_user_2.2.conf
@@ -31,7 +31,7 @@ DNSSDAutoRegisterUserDir Off
AuthDigestProvider file
AuthUserFile ${XDG_CONFIG_HOME}/user-share/passwd
- AuthGroupFile /usr/share/gnome-user-share/dav_groupfile
+ AuthGroupFile /usr/share/mate-user-share/dav_groupfile
<IfDefine RequirePasswordAlways>
Require user guest
diff --git a/data/dav_user_2.4.conf b/data/dav_user_2.4.conf
new file mode 100644
index 0000000..c7a88a1
--- /dev/null
+++ b/data/dav_user_2.4.conf
@@ -0,0 +1,78 @@
+ServerRoot ${XDG_CONFIG_HOME}/user-share
+DefaultRuntimeDir ${XDG_CONFIG_HOME}/user-share
+PidFile pid
+LogLevel crit
+#LogLevel info
+ErrorLog log
+DAVLockDB lock
+
+LimitXMLRequestBody 100000
+
+LoadModule unixd_module ${HTTP_MODULES_PATH}/mod_unixd.so
+LoadModule mpm_prefork_module ${HTTP_MODULES_PATH}/mod_mpm_prefork.so
+LoadModule dav_module ${HTTP_MODULES_PATH}/mod_dav.so
+LoadModule dav_fs_module ${HTTP_MODULES_PATH}/mod_dav_fs.so
+LoadModule authn_core_module ${HTTP_MODULES_PATH}/mod_authn_core.so
+LoadModule authn_file_module ${HTTP_MODULES_PATH}/mod_authn_file.so
+LoadModule auth_digest_module ${HTTP_MODULES_PATH}/mod_auth_digest.so
+LoadModule authz_core_module ${HTTP_MODULES_PATH}/mod_authz_core.so
+LoadModule authz_user_module ${HTTP_MODULES_PATH}/mod_authz_user.so
+LoadModule authz_groupfile_module ${HTTP_MODULES_PATH}/mod_authz_groupfile.so
+LoadModule dnssd_module ${HTTP_MODULES_PATH}/mod_dnssd.so
+
+DNSSDEnable on
+DNSSDAutoRegisterVHosts Off
+DNSSDAutoRegisterUserDir Off
+
+<VirtualHost *>
+ DocumentRoot ${XDG_PUBLICSHARE_DIR}
+
+ <Location />
+ DAV On
+
+ AuthType Digest
+ AuthName "${GUS_LOGIN_LABEL}"
+ AuthDigestDomain /
+
+ AuthDigestProvider file
+ AuthUserFile ${XDG_CONFIG_HOME}/user-share/passwd
+ AuthGroupFile /usr/share/mate-user-share/dav_groupfile
+
+ <IfDefine RequirePasswordAlways>
+ Require user guest
+ Require group guest
+ </IfDefine>
+
+ <IfDefine RequirePasswordOnWrite>
+ <LimitExcept GET OPTIONS PROPFIND>
+ Require user guest
+ Require group guest
+ </LimitExcept>
+ </IfDefine>
+
+ DNSSDServiceName "${GUS_SHARE_NAME}"
+ DNSSDServiceTypes _webdav._tcp
+ DNSSDServiceTxtRecord u=guest
+ </Location>
+</VirtualHost>
+
+StartServers 1
+MaxClients 3
+
+<IfModule mpm_prefork_module>
+ MinSpareServers 1
+ MaxSpareServers 1
+</IfModule>
+
+<IfModule mpm_worker_module>
+ MinSpareThreads 1
+ MaxSpareThreads 1
+ ThreadsPerChild 3
+</IfModule>
+
+<IfModule mpm_event_module>
+ MinSpareThreads 1
+ MaxSpareThreads 1
+ ThreadsPerChild 3
+</IfModule>
+
diff --git a/data/mate-user-share-obexftp.desktop.in.in b/data/mate-user-share-obexftp.desktop.in.in
new file mode 100644
index 0000000..d9be7e4
--- /dev/null
+++ b/data/mate-user-share-obexftp.desktop.in.in
@@ -0,0 +1,11 @@
+[Desktop Entry]
+_Name=Personal File Sharing obexftp
+_Comment=Launch Personal File Sharing if enabled
+_Keywords=share;files;bluetooth;obex;http;network;copy;send;
+AutostartCondition=GSettings org.mate.FileSharing bluetooth-enabled
+Icon=folder-remote
+Exec=@installdir@/mate-user-share
+Terminal=false
+Type=Application
+Categories=
+OnlyShowIn=MATE;
diff --git a/data/mate-user-share-obexpush.desktop.in.in b/data/mate-user-share-obexpush.desktop.in.in
new file mode 100644
index 0000000..19625e6
--- /dev/null
+++ b/data/mate-user-share-obexpush.desktop.in.in
@@ -0,0 +1,11 @@
+[Desktop Entry]
+_Name=Personal File Sharing obexpush
+_Comment=Launch Personal File Sharing if enabled
+_Keywords=share;files;bluetooth;obex;http;network;copy;send;
+AutostartCondition=GSettings org.mate.FileSharing bluetooth-obexpush-enabled
+Icon=folder-remote
+Exec=@installdir@/mate-user-share
+Terminal=false
+Type=Application
+Categories=
+OnlyShowIn=MATE;
diff --git a/data/mate-user-share.desktop.in.in b/data/mate-user-share-webdav.desktop.in.in
index 39fe98c..112140d 100644
--- a/data/mate-user-share.desktop.in.in
+++ b/data/mate-user-share-webdav.desktop.in.in
@@ -1,6 +1,8 @@
[Desktop Entry]
-_Name=Personal File Sharing
+_Name=Personal File Sharing webdav
_Comment=Launch Personal File Sharing if enabled
+_Keywords=share;files;bluetooth;obex;http;network;copy;send;
+AutostartCondition=GSettings org.mate.FileSharing enabled
Icon=folder-remote
Exec=@installdir@/mate-user-share
Terminal=false
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 32c02d6..fc6d9b6 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -3,7 +3,9 @@
data/desktop_mate_file_sharing.schemas.in
[type: gettext/glade]data/file-share-properties.ui
data/mate-user-share-properties.desktop.in
-data/mate-user-share.desktop.in.in
+data/mate-user-share-obexftp.desktop.in.in
+data/mate-user-share-obexpush.desktop.in.in
+data/mate-user-share-webdav.desktop.in.in
src/caja-share-bar.c
src/share-extension.c
src/file-share-properties.c
diff --git a/po/POTFILES.skip b/po/POTFILES.skip
index 3b9469f..a315670 100644
--- a/po/POTFILES.skip
+++ b/po/POTFILES.skip
@@ -1,4 +1,6 @@
# List of source files that should NOT be translated.
# Please keep this file sorted alphabetically.
data/file-share-properties.ui
-data/mate-user-share.desktop.in
+data/mate-user-share-obexftp.desktop.in.in
+data/mate-user-share-obexpush.desktop.in.in
+data/mate-user-share-webdav.desktop.in.in
diff --git a/src/http.c b/src/http.c
index c07a202..71161cd 100644
--- a/src/http.c
+++ b/src/http.c
@@ -26,10 +26,7 @@
#include <glib.h>
#include <glib/gi18n.h>
#include <X11/Xlib.h>
-
-#ifdef HAVE_DBUS_1_1
#include <dbus/dbus.h>
-#endif
#include <gio/gio.h>
@@ -57,9 +54,7 @@
#define GSETTINGS_SCHEMA "org.mate.FileSharing"
-#ifdef HAVE_DBUS_1_1
static char *dbus_session_id;
-#endif
static pid_t httpd_pid = 0;
@@ -94,7 +89,7 @@ get_port (void)
return -1;
}
-#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__APPLE__)
+#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__APPLE__) || defined(__OpenBSD__)
/* XXX This exposes a potential race condition, but without this,
* httpd will not start on the above listed platforms due to the fact
* that SO_REUSEADDR is also needed when Apache binds to the listening
@@ -155,7 +150,6 @@ get_share_name (void)
return name;
}
-#ifdef HAVE_DBUS_1_1
static void
init_dbus() {
/* The only use we make of D-BUS is to fetch the session BUS ID so we can export
@@ -190,7 +184,6 @@ init_dbus() {
dbus_connection_close(connection);
dbus_connection_unref(connection);
}
-#endif
static void
ensure_conf_dir (void)
@@ -470,9 +463,7 @@ http_down (void)
gboolean
http_init (void)
{
-#ifdef HAVE_DBUS_1_1
init_dbus();
-#endif
return TRUE;
}
diff --git a/src/share-extension.c b/src/share-extension.c
index 188c559..b3b2952 100644
--- a/src/share-extension.c
+++ b/src/share-extension.c
@@ -27,10 +27,13 @@
#include <string.h>
#include <glib/gi18n-lib.h>
#include <gtk/gtk.h>
-#include <bluetooth-client.h>
#include <libcaja-extension/caja-menu-provider.h>
#include <libcaja-extension/caja-location-widget-provider.h>
+#ifdef HAVE_BLUETOOTH
+#include <bluetooth-client.h>
+#endif
+
#include "caja-share-bar.h"
#include "user_share-common.h"
@@ -101,6 +104,7 @@ bar_response_cb (CajaShareBar *bar,
}
}
++#ifdef HAVE_BLUETOOTH
static void
downloads_bar_set_from_bluetooth_status (GtkWidget *bar)
{
@@ -121,6 +125,7 @@ default_adapter_powered_cb (GObject *gobject,
{
downloads_bar_set_from_bluetooth_status (bar);
}
+#endif /* HAVE_BLUETOOTH */
static GtkWidget *
caja_user_share_get_location_widget (CajaLocationWidgetProvider *iface,
@@ -163,8 +168,13 @@ caja_user_share_get_location_widget (CajaLocationWidgetProvider *iface,
if (is_dir[0] != FALSE && is_dir[1] != FALSE) {
bar = caja_share_bar_new (_("May be used to share or receive files"));
} else if (is_dir[0] != FALSE) {
+#ifndef HAVE_BLUETOOTH
bar = caja_share_bar_new (_("May be shared over the network or Bluetooth"));
+#else
+ bar = caja_share_bar_new (_("May be shared over the network"));
+#endif /* !HAVE_BLUETOOTH */
} else {
+#ifdef HAVE_BLUETOOTH
BluetoothClient *client;
bar = caja_share_bar_new (_("May be used to receive files over Bluetooth"));
@@ -175,6 +185,7 @@ caja_user_share_get_location_widget (CajaLocationWidgetProvider *iface,
g_signal_connect (G_OBJECT (client), "notify::default-adapter-powered",
G_CALLBACK (default_adapter_powered_cb), bar);
downloads_bar_set_from_bluetooth_status (bar);
+#endif /* HAVE_BLUETOOTH */
}
g_signal_connect (bar, "response",
diff --git a/src/user_share.c b/src/user_share.c
index 53ceec1..d33cd67 100644
--- a/src/user_share.c
+++ b/src/user_share.c
@@ -27,6 +27,7 @@
#include <gtk/gtk.h>
#include <glib/gi18n.h>
#include <glib/gstdio.h>
+#include <gio/gio.h>
#include <X11/Xlib.h>
#include "user_share.h"
@@ -61,14 +62,12 @@ static GSettings* settings;
#define GSETTINGS_KEY_FILE_SHARING_REQUIRE_PASSWORD "require-password"
#ifdef HAVE_BLUETOOTH
-/* ConsoleKit */
-#define CK_NAME "org.freedesktop.ConsoleKit"
-#define CK_INTERFACE "org.freedesktop.ConsoleKit"
-#define CK_MANAGER_PATH "/org/freedesktop/ConsoleKit/Manager"
-#define CK_MANAGER_INTERFACE "org.freedesktop.ConsoleKit.Manager"
-#define CK_SEAT_INTERFACE "org.freedesktop.ConsoleKit.Seat"
-#define CK_SESSION_INTERFACE "org.freedesktop.ConsoleKit.Session"
+/* MATE Session */
+#define MATE_SESSION_DBUS_NAME "org.mate.SessionManager"
+#define MATE_SESSION_DBUS_OBJECT "/org/mate/SessionManager"
+#define MATE_SESSION_DBUS_INTERFACE "org.mate.SessionManager"
+static GDBusProxy *session_proxy = NULL;
static gboolean has_console = TRUE;
static BluetoothClient *client = NULL;
@@ -113,136 +112,65 @@ obex_services_shutdown (void)
}
static void
-sessionchanged_cb (void)
+session_properties_changed_cb (GDBusProxy *session,
+ GVariant *changed,
+ char **invalidated,
+ gpointer user_data)
{
- DBusGConnection *dbus_connection;
- DBusGProxy *proxy_ck_manager;
- DBusGProxy *proxy_ck_session;
+ GVariant *v;
- gchar *ck_session_path;
- gboolean is_active = FALSE;
- GError *error = NULL;
+ v = g_variant_lookup_value (changed, "SessionIsActive", G_VARIANT_TYPE_BOOLEAN);
+ if (v) {
+ has_console = g_variant_get_boolean (v);
+ g_debug ("Received session is active change: now %s", has_console ? "active" : "inactive");
- g_message ("Active session changed");
+ if (has_console)
+ obex_services_start ();
+ else
+ obex_services_shutdown ();
- dbus_connection = dbus_g_bus_get (DBUS_BUS_SYSTEM, &error);
- if (!dbus_connection) {
- g_warning ("Unable to connect to dbus");
- dbus_g_connection_unref (dbus_connection);
- return;
- }
-
- proxy_ck_manager = dbus_g_proxy_new_for_name (dbus_connection,
- CK_NAME,
- CK_MANAGER_PATH,
- CK_MANAGER_INTERFACE);
- if (dbus_g_proxy_call (proxy_ck_manager, "GetCurrentSession",
- &error, G_TYPE_INVALID,
- DBUS_TYPE_G_OBJECT_PATH, &ck_session_path,
- G_TYPE_INVALID) == FALSE) {
- g_warning ("Couldn't request the name: %s", error->message);
- dbus_g_connection_unref (dbus_connection);
- g_object_unref (proxy_ck_manager);
- g_error_free (error);
- return;
- }
-
- proxy_ck_session = dbus_g_proxy_new_for_name (dbus_connection,
- CK_NAME,
- ck_session_path,
- CK_SESSION_INTERFACE);
-
- if (dbus_g_proxy_call (proxy_ck_session, "IsActive",
- &error, G_TYPE_INVALID,
- G_TYPE_BOOLEAN, &is_active,
- G_TYPE_INVALID) == FALSE) {
-
- g_warning ("Couldn't request the name: %s", error->message);
- dbus_g_connection_unref (dbus_connection);
- g_object_unref (proxy_ck_manager);
- g_object_unref (proxy_ck_session);
- g_error_free (error);
- return;
- }
-
- has_console = is_active;
- if (is_active) {
- obex_services_start ();
- } else {
- obex_services_shutdown ();
+ g_variant_unref (v);
}
+}
- dbus_g_connection_unref (dbus_connection);
- g_free (ck_session_path);
- g_object_unref (proxy_ck_manager);
- g_object_unref (proxy_ck_session);
- if (error != NULL) {
- g_error_free (error);
- }
+static gboolean
+is_session_active (void)
+{
+ GVariant *variant;
+ gboolean is_session_active = FALSE;
+
+ variant = g_dbus_proxy_get_cached_property (session_proxy,
+ "SessionIsActive");
+ if (variant) {
+ is_session_active = g_variant_get_boolean (variant);
+ g_variant_unref (variant);
+ }
+
+ return is_session_active;
}
static void
-consolekit_init (void)
+session_init (void)
{
- DBusGConnection *dbus_connection;
- DBusGProxy *proxy_ck_manager;
- DBusGProxy *proxy_ck_session;
- DBusGProxy *proxy_ck_seat;
- gchar *ck_session_path;
- gchar *ck_seat_path;
GError *error = NULL;
- dbus_connection = dbus_g_bus_get (DBUS_BUS_SYSTEM, NULL);
-
- if (!dbus_connection) {
- g_warning ("Unable to connect to dbus");
- dbus_g_connection_unref (dbus_connection);
- return;
- }
-
- proxy_ck_manager = dbus_g_proxy_new_for_name (dbus_connection,
- CK_NAME,
- CK_MANAGER_PATH,
- CK_MANAGER_INTERFACE);
- if (dbus_g_proxy_call (proxy_ck_manager, "GetCurrentSession",
- &error, G_TYPE_INVALID,
- DBUS_TYPE_G_OBJECT_PATH, &ck_session_path,
- G_TYPE_INVALID) == FALSE) {
-
- g_warning ("Couldn't request the name: %s", error->message);
- g_object_unref (proxy_ck_manager);
- return;
- }
-
- proxy_ck_session = dbus_g_proxy_new_for_name (dbus_connection,
- CK_NAME,
- ck_session_path,
- CK_SESSION_INTERFACE);
- if (dbus_g_proxy_call (proxy_ck_session, "GetSeatId",
- &error, G_TYPE_INVALID,
- DBUS_TYPE_G_OBJECT_PATH, &ck_seat_path,
- G_TYPE_INVALID) == FALSE) {
-
- g_warning ("Couldn't request the name: %s", error->message);
- g_object_unref (proxy_ck_session);
- return;
- }
-
- proxy_ck_seat = dbus_g_proxy_new_for_name (dbus_connection,
- CK_NAME,
- ck_seat_path,
- CK_SEAT_INTERFACE);
- dbus_g_proxy_add_signal (proxy_ck_seat, "ActiveSessionChanged",
- G_TYPE_STRING, G_TYPE_INVALID);
- dbus_g_proxy_connect_signal (proxy_ck_seat, "ActiveSessionChanged",
- G_CALLBACK (sessionchanged_cb), NULL, NULL);
- if (error != NULL) {
- g_error_free (error);
+ session_proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SESSION,
+ G_DBUS_PROXY_FLAGS_NONE,
+ NULL,
+ MATE_SESSION_DBUS_NAME,
+ MATE_SESSION_DBUS_OBJECT,
+ MATE_SESSION_DBUS_INTERFACE,
+ NULL,
+ &error);
+ if (session_proxy == NULL) {
+ g_warning ("Failed to get session proxy: %s", error->message);
+ g_error_free (error);
+ return;
}
- g_object_unref (proxy_ck_manager);
- g_object_unref (proxy_ck_session);
- g_free (ck_seat_path);
- dbus_g_connection_unref (dbus_connection);
+ g_signal_connect (session_proxy, "g-properties-changed",
+ G_CALLBACK (session_properties_changed_cb),
+ NULL);
+ has_console = is_session_active ();
}
static void
@@ -549,7 +477,7 @@ main (int argc, char **argv)
G_CALLBACK (file_sharing_bluetooth_obexpush_notify_changed), NULL);
bluez_init ();
- consolekit_init ();
+ session_init ();
#endif /* HAVE_BLUETOOTH */
/* Initial setting */