Lines 45-50
static gboolean always_call_mount = FALSE;
Link Here
|
45 |
|
45 |
|
46 |
static GVfsRemoteVolumeMonitor *monitor_daemon = NULL; |
46 |
static GVfsRemoteVolumeMonitor *monitor_daemon = NULL; |
47 |
|
47 |
|
|
|
48 |
static GDBusProxy *session_active_proxy = NULL; |
49 |
|
48 |
#define DEBUG_ENABLED |
50 |
#define DEBUG_ENABLED |
49 |
|
51 |
|
50 |
#ifdef DEBUG_ENABLED |
52 |
#ifdef DEBUG_ENABLED |
Lines 1750-1756
emit_signal (GVfsRemoteVolumeMonitor *instance, MonitorSignalFunc signal_func, v
Link Here
|
1750 |
{ |
1752 |
{ |
1751 |
char *id; |
1753 |
char *id; |
1752 |
GVariant *val; |
1754 |
GVariant *val; |
1753 |
|
1755 |
GVariant *res = NULL, *inner = NULL; |
|
|
1756 |
GError *error = NULL; |
1757 |
gchar *state; |
1758 |
|
1759 |
if (session_active_proxy != NULL) { |
1760 |
res = g_dbus_proxy_call_sync (session_active_proxy , "Get", |
1761 |
g_variant_new( "(ss)", |
1762 |
"org.freedesktop.login1.Session", |
1763 |
"State"), |
1764 |
G_DBUS_CALL_FLAGS_NONE, |
1765 |
-1, |
1766 |
NULL, |
1767 |
&error |
1768 |
); |
1769 |
|
1770 |
|
1771 |
if (error == NULL && res != NULL) { |
1772 |
g_variant_get(res, "(v)", &inner ); |
1773 |
state = g_variant_get_string(inner,NULL); |
1774 |
} else if (error != NULL ) { |
1775 |
print_debug ("Error in dbus - %s", error->message); |
1776 |
g_error_free (error); |
1777 |
} |
1778 |
} |
1779 |
if (session_active_proxy == NULL || g_strcmp0(state,"active") == 0) { |
1780 |
|
1754 |
print_debug ("emit_signal: %p", object); |
1781 |
print_debug ("emit_signal: %p", object); |
1755 |
|
1782 |
|
1756 |
id = g_strdup_printf ("%p", object); |
1783 |
id = g_strdup_printf ("%p", object); |
Lines 1759-1764
emit_signal (GVfsRemoteVolumeMonitor *instance, MonitorSignalFunc signal_func, v
Link Here
|
1759 |
signal_func (instance, the_dbus_name, id, val); |
1786 |
signal_func (instance, the_dbus_name, id, val); |
1760 |
|
1787 |
|
1761 |
g_free (id); |
1788 |
g_free (id); |
|
|
1789 |
} |
1790 |
else print_debug ("inactive session\n"); |
1791 |
|
1792 |
if (inner != NULL) |
1793 |
g_variant_unref (inner); |
1794 |
if (res != NULL) |
1795 |
g_variant_unref (res); |
1762 |
} |
1796 |
} |
1763 |
|
1797 |
|
1764 |
static void |
1798 |
static void |
Lines 1980-1985
g_vfs_proxy_volume_monitor_daemon_main (int argc,
Link Here
|
1980 |
GType volume_monitor_type) |
2014 |
GType volume_monitor_type) |
1981 |
{ |
2015 |
{ |
1982 |
guint name_owner_id; |
2016 |
guint name_owner_id; |
|
|
2017 |
GDBusProxy *logind_proxy; |
2018 |
GVariant *res; |
2019 |
GError *error = NULL; |
2020 |
gchar *session_obj_path; |
1983 |
|
2021 |
|
1984 |
name_owner_id = 0; |
2022 |
name_owner_id = 0; |
1985 |
|
2023 |
|
Lines 1994-1999
g_vfs_proxy_volume_monitor_daemon_main (int argc,
Link Here
|
1994 |
the_dbus_name = dbus_name; |
2032 |
the_dbus_name = dbus_name; |
1995 |
unique_names_being_watched = g_hash_table_new_full (g_str_hash, g_int_equal, g_free, NULL); |
2033 |
unique_names_being_watched = g_hash_table_new_full (g_str_hash, g_int_equal, g_free, NULL); |
1996 |
|
2034 |
|
|
|
2035 |
logind_proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM, |
2036 |
G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES, |
2037 |
NULL, |
2038 |
"org.freedesktop.login1", |
2039 |
"/org/freedesktop/login1", |
2040 |
"org.freedesktop.login1.Manager", |
2041 |
NULL, |
2042 |
&error ); |
2043 |
if (logind_proxy == NULL) { |
2044 |
print_debug("Error creating proxy - %s", error->message); |
2045 |
g_error_free (error); |
2046 |
} else { |
2047 |
res = g_dbus_proxy_call_sync (logind_proxy, "GetSessionByPID", |
2048 |
g_variant_new( "(u)", getpid() ), |
2049 |
G_DBUS_CALL_FLAGS_NONE, |
2050 |
-1, |
2051 |
NULL, |
2052 |
&error |
2053 |
); |
2054 |
|
2055 |
if (error == NULL && res != NULL) { |
2056 |
g_variant_get(res,"(o)", &session_obj_path); |
2057 |
} |
2058 |
else { |
2059 |
print_debug( "Error getting session - %s", error->message); |
2060 |
} |
2061 |
|
2062 |
g_object_unref(logind_proxy); |
2063 |
session_active_proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM, |
2064 |
G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES, |
2065 |
NULL, |
2066 |
"org.freedesktop.login1", |
2067 |
session_obj_path, |
2068 |
"org.freedesktop.DBus.Properties", |
2069 |
NULL, |
2070 |
&error ); |
2071 |
if (session_active_proxy == NULL) { |
2072 |
g_error_free (error); |
2073 |
} |
2074 |
} |
2075 |
|
1997 |
/* try and create the monitor */ |
2076 |
/* try and create the monitor */ |
1998 |
monitor_try_create (); |
2077 |
monitor_try_create (); |
1999 |
|
2078 |
|