Port from glib-dbus usage to the new awesome D-Bus APIs in gio (2.26).
GUPNP_AV_REQUIRED=0.5.9
GUPNP_DLNA_REQUIRED=0.3.0
GUPNP_VALA_REQUIRED=0.6.11
-DBUS_GLIB_REQUIRED=0.74
GSTREAMER_REQUIRED=0.10.23
GSTREAMER_TAG_REQUIRED=0.10.28
GSTREAMER_APP_REQUIRED=0.10.28
PKG_CHECK_MODULES(LIBGUPNP, gupnp-1.0 >= $GUPNP_REQUIRED)
PKG_CHECK_MODULES(LIBGUPNP_AV, gupnp-av-1.0 >= $GUPNP_AV_REQUIRED)
PKG_CHECK_MODULES(LIBGUPNP_DLNA, gupnp-dlna-1.0 >= $GUPNP_DLNA_REQUIRED)
-PKG_CHECK_MODULES(LIBDBUS_GLIB, dbus-glib-1 >= $DBUS_GLIB_REQUIRED)
PKG_CHECK_MODULES(LIBGSTREAMER, gstreamer-0.10 >= $GSTREAMER_REQUIRED)
PKG_CHECK_MODULES(LIBGIO, gio-2.0 >= $GIO_REQUIRED)
PKG_CHECK_MODULES(GEE, gee-1.0 >= $GEE_REQUIRED)
VALA_CHECK_PACKAGES([gupnp-1.0
gupnp-av-1.0
gupnp-dlna-1.0
- dbus-glib-1
gstreamer-0.10
gstreamer-discoverer-gupnp-dlna-0.10
gio-2.0
AM_CFLAGS = $(LIBGUPNP_CFLAGS) \
$(LIBGUPNP_AV_CFLAGS) \
- $(LIBDBUS_GLIB_CFLAGS) \
$(GEE_CFLAGS) \
$(LIBGSTREAMER_CFLAGS) \
$(UUID_FLAGS) \
rygel-external.stamp: $(librygel_external_la_VALASOURCES)
librygel_external_la_VALAFLAGS = --vapidir=$(top_srcdir)/src/rygel \
--pkg rygel-1.0 --pkg gupnp-1.0 \
- --pkg gupnp-av-1.0 --pkg dbus-glib-1 \
- --pkg gee-1.0 --pkg gstreamer-0.10 \
- --pkg gconf-2.0 -g
+ --pkg gupnp-av-1.0 --pkg gee-1.0 \
+ --pkg gstreamer-0.10 --pkg gconf-2.0 -g
librygel_external_la_LIBADD = $(LIBGUPNP_LIBS) \
$(LIBGUPNP_AV_LIBS) \
- $(LIBDBUS_GLIB_LIBS) \
$(LIBGSTREAMER_LIBS) \
$(GEE_LIBS) \
$(UUID_LIBS)
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-using DBus;
using FreeDesktop;
/**
public class Rygel.External.AlbumArtFactory {
public async Thumbnail create (string service_name,
string object_path,
- string host_ip)
- throws GLib.Error {
- DBus.Connection connection = DBus.Bus.get (DBus.BusType.SESSION);
-
- var props = connection.get_object (service_name,
- object_path)
- as Properties;
+ string host_ip) throws IOError {
+ Properties props = Bus.get_proxy_sync (BusType.SESSION,
+ service_name,
+ object_path);
var item_props = yield props.get_all (MediaItemProxy.IFACE);
+ return this.create_from_props (item_props, host_ip);
+ }
+
+ private Thumbnail create_from_props (HashTable<string,Variant> props,
+ string host_ip) {
var thumbnail = new AlbumArt ();
- var value = item_props.lookup ("MIMEType");
+ var value = props.lookup ("MIMEType");
thumbnail.mime_type = (string) value;
- value = item_props.lookup ("URLs");
+ value = props.lookup ("URLs");
var uris = (string[]) value;
if (uris != null && uris[0] != null) {
thumbnail.uri = uris[0].replace ("@ADDRESS@", host_ip);
}
- value = item_props.lookup ("Size");
+ value = props.lookup ("Size");
if (value != null) {
thumbnail.size = (int64) value;
}
*/
using GUPnP;
-using DBus;
using Gee;
using FreeDesktop;
private ItemFactory item_factory;
private ArrayList<Container> containers;
- private Connection connection;
private bool searchable;
string service_name,
string path,
string host_ip,
- Container? parent = null) {
+ Container? parent = null) throws IOError {
base (id, parent, title, (int) child_count);
this.service_name = service_name;
this.item_factory = new ItemFactory ();
this.containers = new ArrayList<Container> ();
- try {
- this.connection = DBus.Bus.get (DBus.BusType.SESSION);
- } catch (GLib.Error err) {
- critical ("Failed to connect to session bus: %s", err.message);
- }
-
// Create proxy to MediaContainer iface
- this.actual_container = this.connection.get_object (this.service_name,
- path)
- as MediaContainerProxy;
+ this.actual_container = Bus.get_proxy_sync (BusType.SESSION,
+ this.service_name,
+ path);
this.update_container.begin (true);
}
MediaObject media_object = null;
// Create proxy to MediaObject iface
- var actual_object = this.connection.get_object (this.service_name, id)
- as MediaObjectProxy;
+ MediaObjectProxy actual_object = Bus.get_proxy_sync (BusType.SESSION,
+ this.service_name,
+ id);
if (actual_object.object_type == "container") {
media_object = this.find_container_by_id (id);
0,
null);
- var props_iface = this.connection.get_object (this.service_name, id)
- as Properties;
+ Properties props_iface = Bus.get_proxy_sync (BusType.SESSION,
+ this.service_name,
+ id);
var props = yield props_iface.get_all (MediaItemProxy.IFACE);
}
private async MediaObjects create_media_objects (
- HashTable<string,Value?>[] all_props,
- MediaContainer? parent
+ HashTable<string,Variant>[] all_props,
+ MediaContainer? parent
= null) throws GLib.Error {
var media_objects = new MediaObjects ();
yield this.refresh_child_containers ();
} catch (GLib.Error err) {
warning ("Failed to update information about container '%s': %s",
- this.actual_container.get_path (),
+ this.actual_container.get_object_path (),
err.message);
}
public class Rygel.External.IconFactory {
private static string ITEM_IFACE = "org.gnome.UPnP.MediaItem1";
- DBus.Connection connection;
-
- public IconFactory (DBus.Connection connection) {
- this.connection = connection;
- }
-
- public async IconInfo? create (string service_name,
- HashTable<string,Value?> container_props) {
+ public async IconInfo? create (string service_name,
+ HashTable<string,Variant> container_props)
+ throws IOError {
var value = container_props.lookup ("Icon");
if (value == null) {
// Seems no icon is provided, nevermind
}
var icon_path = (string) value;
- var props = this.connection.get_object (service_name,
- icon_path)
- as Properties;
+ Properties props = Bus.get_proxy_sync (BusType.SESSION,
+ service_name,
+ icon_path);
- HashTable<string,Value?> item_props;
- try {
- item_props = yield props.get_all (ITEM_IFACE);
- } catch (DBus.Error err) {
- warning ("Error fetching icon properties from %s", service_name);
+ var item_props = yield props.get_all (ITEM_IFACE);
- return null;
- }
+ return this.create_from_props (item_props);
+ }
- value = item_props.lookup ("MIMEType");
- var mime_type = (string) value;
+ private IconInfo? create_from_props (HashTable<string,Variant> props) {
+ var mime_type = (string) props.lookup ("MIMEType");
var icon = new IconInfo (mime_type, this.get_ext_for_mime (mime_type));
- value = item_props.lookup ("URLs");
- var uris = (string[]) value;
+ var uris = (string[]) props.lookup ("URLs");
if (uris != null && uris[0] != null) {
icon.uri = uris[0];
}
- value = item_props.lookup ("Size");
+ var value = props.lookup ("Size");
if (value != null) {
icon.size = (int64) value;
}
- icon.width = this.get_int (item_props, "Width");
- icon.height = this.get_int (item_props, "Height");
- icon.depth = this.get_int (item_props, "ColorDepth");
+ icon.width = this.get_int (props, "Width");
+ icon.height = this.get_int (props, "Height");
+ icon.depth = this.get_int (props, "ColorDepth");
return icon;
}
}
}
- private int get_int (HashTable<string,Value?> props, string prop) {
+ private int get_int (HashTable<string,Variant> props, string prop) {
var value = props.lookup (prop);
if (value != null) {
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-using DBus;
-
[DBus (name = "org.gnome.UPnP.MediaObject2")]
-public interface Rygel.External.MediaObjectProxy : DBus.Object {
+public interface Rygel.External.MediaObjectProxy : DBusProxy {
public static const string IFACE = "org.gnome.UPnP.MediaObject2";
public static const string[] PROPERTIES = { "Parent",
"Type",
}
[DBus (name = "org.gnome.UPnP.MediaContainer2")]
-public interface Rygel.External.MediaContainerProxy : DBus.Object,
+public interface Rygel.External.MediaContainerProxy : DBusProxy,
MediaObjectProxy {
public static const string IFACE = "org.gnome.UPnP.MediaContainer2";
public static const string[] PROPERTIES = { "ChildCount", "Searchable" };
public abstract uint container_count { get; set; }
public abstract bool searchable { get; set; }
- public abstract async HashTable<string,Value?>[] list_children (
+ public abstract async HashTable<string,Variant>[] list_children (
uint offset,
uint max_count,
- string[] filter) throws DBus.Error;
- public abstract async HashTable<string,Value?>[] list_containers (
+ string[] filter) throws IOError;
+ public abstract async HashTable<string,Variant>[] list_containers (
uint offset,
uint max_count,
- string[] filter) throws DBus.Error;
- public abstract async HashTable<string,Value?>[] list_items (
+ string[] filter) throws IOError;
+ public abstract async HashTable<string,Variant>[] list_items (
uint offset,
uint max_count,
- string[] filter) throws DBus.Error;
+ string[] filter) throws IOError;
// Optional API
- public abstract async HashTable<string,Value?>[] search_objects (
+ public abstract async HashTable<string,Variant>[] search_objects (
string query,
uint offset,
uint max_count,
- string[] filter) throws DBus.Error;
+ string[] filter) throws IOError;
public abstract ObjectPath icon { owned get; set; }
}
[DBus (name = "org.gnome.UPnP.MediaItem2")]
-public interface Rygel.External.MediaItemProxy : DBus.Object, MediaObjectProxy {
+public interface Rygel.External.MediaItemProxy : DBusProxy, MediaObjectProxy {
public static const string IFACE = "org.gnome.UPnP.MediaItem2";
public static const string[] PROPERTIES = { "URLs",
"MIMEType",
*/
using GUPnP;
-using DBus;
using FreeDesktop;
/**
* Creates item for external plugins.
*/
public class Rygel.External.ItemFactory {
- public async MediaItem create (string id,
- string type,
- string title,
- HashTable<string,Value?> props,
- string service_name,
- string host_ip,
- MediaContainer parent)
+ public async MediaItem create (string id,
+ string type,
+ string title,
+ HashTable<string,Variant> props,
+ string service_name,
+ string host_ip,
+ MediaContainer parent)
throws GLib.Error {
MediaItem item;
host_ip);
}
+ this.set_generic_metadata (item, props, service_name, host_ip);
+
if (parent is DummyContainer) {
item.parent_ref = parent;
}
- item.mime_type = this.get_string (props, "MIMEType");
-
- var value = props.lookup ("URLs");
- var uris = (string[]) value;
-
- for (var i = 0; uris[i] != null; i++) {
- var tmp = uris[i].replace ("@ADDRESS@", host_ip);
-
- item.add_uri (tmp);
- }
-
- // Optional properties
-
- item.dlna_profile = this.get_string (props, "DLNAProfile");
-
- value = props.lookup ("Size");
- if (value != null) {
- item.size = (int64) value;
- }
-
- item.date = this.get_string (props, "Date");
-
return item;
}
private async void set_music_metadata (
- MusicItem music,
- HashTable<string,Value?> props,
- string service_name,
- string host_ip)
+ MusicItem music,
+ HashTable<string,Variant> props,
+ string service_name,
+ string host_ip)
throws GLib.Error {
music.artist = this.get_string (props, "Artist");
music.album = this.get_string (props, "Album");
this.set_audio_metadata (music, props, service_name, host_ip);
}
- private void set_audio_metadata (AudioItem audio,
- HashTable<string,Value?> props,
- string service_name,
- string host_ip)
+ private void set_audio_metadata (AudioItem audio,
+ HashTable<string,Variant> props,
+ string service_name,
+ string host_ip)
throws GLib.Error {
audio.duration = this.get_int (props, "Duration");
audio.bitrate = this.get_int (props, "Bitrate");
}
private async void set_visual_metadata (
- VisualItem visual,
- HashTable<string,Value?> props,
- string service_name,
- string host_ip)
+ VisualItem visual,
+ HashTable<string,Variant> props,
+ string service_name,
+ string host_ip)
throws GLib.Error {
visual.width = this.get_int (props, "Width");
visual.height = this.get_int (props, "Height");
}
private async void set_video_metadata (
- VideoItem video,
- HashTable<string,Value?> props,
- string service_name,
- string host_ip)
+ VideoItem video,
+ HashTable<string,Variant> props,
+ string service_name,
+ string host_ip)
throws GLib.Error {
yield this.set_visual_metadata (video, props, service_name, host_ip);
this.set_audio_metadata (video, props, service_name, host_ip);
}
- private string? get_string (HashTable<string,Value?> props, string prop) {
+ private void set_generic_metadata (MediaItem item,
+ HashTable<string,Variant> props,
+ string service_name,
+ string host_ip) {
+ item.mime_type = this.get_string (props, "MIMEType");
+
+ var uris = (string[]) props.lookup ("URLs");
+ if (uris != null) {
+ for (var i = 0; uris[i] != null; i++) {
+ item.add_uri (uris[i].replace ("@ADDRESS@", host_ip));
+ }
+ }
+
+ // Optional properties
+
+ item.dlna_profile = this.get_string (props, "DLNAProfile");
+
+ var value = props.lookup ("Size");
+ if (value != null) {
+ item.size = (int64) value;
+ }
+
+ item.date = this.get_string (props, "Date");
+ }
+
+ private string? get_string (HashTable<string,Variant> props, string prop) {
var value = props.lookup (prop);
if (value != null) {
}
}
- private int get_int (HashTable<string,Value?> props, string prop) {
+ private int get_int (HashTable<string,Variant> props, string prop) {
var value = props.lookup (prop);
if (value != null) {
public void module_init (PluginLoader loader) {
try {
plugin_factory = new External.PluginFactory (loader);
- } catch (DBus.Error error) {
+ } catch (IOError error) {
critical ("Failed to fetch list of external services: %s\n",
error.message);
}
}
public class Rygel.External.PluginFactory {
- private const string DBUS_SERVICE = "org.freedesktop.DBus";
- private const string DBUS_OBJECT = "/org/freedesktop/DBus";
-
private const string SERVICE_PREFIX = "org.gnome.UPnP.MediaServer2.";
private const string GRILO_UPNP_PREFIX = SERVICE_PREFIX + "grl_upnp";
- DBusObject dbus_obj;
- DBus.Connection connection;
- PluginLoader loader;
- IconFactory icon_factory;
+ DBusObject dbus_obj;
+ PluginLoader loader;
+ IconFactory icon_factory;
- public PluginFactory (PluginLoader loader) throws DBus.Error {
- this.connection = DBus.Bus.get (DBus.BusType.SESSION);
- this.icon_factory = new IconFactory (this.connection);
+ public PluginFactory (PluginLoader loader) throws IOError {
+ this.icon_factory = new IconFactory ();
- this.dbus_obj = this.connection.get_object (DBUS_SERVICE, DBUS_OBJECT)
- as DBusObject;
+ this.dbus_obj = Bus.get_proxy_sync (BusType.SESSION,
+ DBUS_SERVICE,
+ DBUS_OBJECT);
this.loader = loader;
this.load_plugins.begin ();
}
- private async void load_plugins () throws DBus.Error {
+ private async void load_plugins () throws IOError {
var services = yield this.dbus_obj.list_names ();
foreach (var service in services) {
if (service.has_prefix (SERVICE_PREFIX) &&
this.loader.get_plugin_by_name (service) == null) {
- yield this.load_plugin (service);
+ yield this.load_plugin_n_handle_error (service);
}
}
yield this.load_activatable_plugins ();
}
- private async void load_activatable_plugins () throws DBus.Error {
+ private async void load_activatable_plugins () throws IOError {
var services = yield this.dbus_obj.list_activatable_names ();
foreach (var service in services) {
if (service.has_prefix (SERVICE_PREFIX) &&
this.loader.get_plugin_by_name (service) == null) {
- yield this.load_plugin (service);
+ yield this.load_plugin_n_handle_error (service);
}
}
plugin.available = true;
}
} else if (name.has_prefix (SERVICE_PREFIX)) {
- // Ah, new plugin available, lets use it
- this.load_plugin.begin (name);
+ // Ah, new plugin available, lets use it
+ this.load_plugin_n_handle_error.begin (name);
+ }
+ }
+
+ private async void load_plugin_n_handle_error (string service_name) {
+ try {
+ yield this.load_plugin (service_name);
+ } catch (IOError error) {
+ warning ("Failed to load external plugin '%s': %s",
+ service_name,
+ error.message);
}
}
- private async void load_plugin (string service_name) {
+ private async void load_plugin (string service_name) throws IOError {
if (service_name.has_prefix (GRILO_UPNP_PREFIX)) {
// We don't entertain UPnP sources
return;
var root_object = "/" + service_name.replace (".", "/");
// Create proxy to MediaObject iface to get the display name through
- var props = this.connection.get_object (service_name, root_object)
- as Properties;
+ Properties props = Bus.get_proxy_sync (BusType.SESSION,
+ service_name,
+ root_object);
- HashTable<string,Value?> object_props;
- HashTable<string,Value?> container_props;
+ HashTable<string,Variant> object_props;
+ HashTable<string,Variant> container_props;
- try {
- object_props = yield props.get_all (MediaObjectProxy.IFACE);
- container_props = yield props.get_all (MediaContainerProxy.IFACE);
- } catch (DBus.Error err) {
- warning ("Failed to fetch properties of plugin %s: %s.",
- service_name,
- err.message);
-
- return;
- }
+ object_props = yield props.get_all (MediaObjectProxy.IFACE);
+ container_props = yield props.get_all (MediaContainerProxy.IFACE);
var icon = yield this.icon_factory.create (service_name,
container_props);
title = service_name;
}
- var child_count = container_props.lookup ("ChildCount").get_uint ();
- var searchable = container_props.lookup ("Searchable").get_boolean ();
+ var child_count = (uint) container_props.lookup ("ChildCount");
+ var searchable = (bool) container_props.lookup ("Searchable");
var plugin = new External.Plugin (service_name,
title,
}
public override MediaContainer? get_root_container (GUPnP.Context context) {
- return new Container ("0",
- this.title,
- this.child_count,
- this.searchable,
- this.service_name,
- this.root_object,
- context.host_ip,
- null);
+ Container root_container = null;
+
+ try {
+ root_container = new Container ("0",
+ this.title,
+ this.child_count,
+ this.searchable,
+ this.service_name,
+ this.root_object,
+ context.host_ip,
+ null);
+ } catch (IOError err) {
+ critical ("Failed to connect to session bus: %s", err.message);
+ }
+
+ return root_container;
}
}
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-using DBus;
using FreeDesktop;
/**
string object_path,
string host_ip)
throws GLib.Error {
- DBus.Connection connection = DBus.Bus.get (DBus.BusType.SESSION);
-
- var props = connection.get_object (service_name,
- object_path)
- as Properties;
+ Properties props = Bus.get_proxy_sync (BusType.SESSION,
+ service_name,
+ object_path);
var item_props = yield props.get_all (MediaItemProxy.IFACE);
+ return this.create_from_props (item_props, host_ip);
+ }
+
+ private Thumbnail create_from_props (HashTable<string,Variant> props,
+ string host_ip) {
var thumbnail = new Thumbnail ();
- thumbnail.mime_type = this.get_string (item_props, "MIMEType");
- thumbnail.dlna_profile = this.get_string (item_props, "DLNAProfile");
- thumbnail.width = this.get_int (item_props, "Width");
- thumbnail.height = this.get_int (item_props, "Height");
- thumbnail.depth = this.get_int (item_props, "ColorDepth");
+ thumbnail.mime_type = this.get_string (props, "MIMEType");
+ thumbnail.dlna_profile = this.get_string (props, "DLNAProfile");
+ thumbnail.width = this.get_int (props, "Width");
+ thumbnail.height = this.get_int (props, "Height");
+ thumbnail.depth = this.get_int (props, "ColorDepth");
- var value = item_props.lookup ("URLs");
+ var value = props.lookup ("URLs");
var uris = (string[]) value;
if (uris != null && uris[0] != null) {
thumbnail.uri = uris[0].replace ("@ADDRESS@", host_ip);
}
- value = item_props.lookup ("Size");
+ value = props.lookup ("Size");
if (value != null) {
thumbnail.size = (int64) value;
}
return thumbnail;
}
- private string? get_string (HashTable<string,Value?> props, string prop) {
+ private string? get_string (HashTable<string,Variant> props, string prop) {
var value = props.lookup (prop);
if (value != null) {
}
}
- private int get_int (HashTable<string,Value?> props, string prop) {
+ private int get_int (HashTable<string,Variant> props, string prop) {
var value = props.lookup (prop);
if (value != null) {
AM_CFLAGS = $(LIBGUPNP_CFLAGS) \
$(LIBGUPNP_AV_CFLAGS) \
- $(LIBDBUS_GLIB_CFLAGS) \
$(GEE_CFLAGS) \
$(LIBGSTREAMER_CFLAGS) \
$(UUID_FLAGS) \
librygel_gst_launch_la_VALAFLAGS = --vapidir=$(top_srcdir)/src/rygel \
--pkg rygel-1.0 --pkg gconf-2.0 \
--pkg gupnp-1.0 --pkg gupnp-av-1.0 \
- --pkg dbus-glib-1 --pkg gee-1.0 \
- --pkg gstreamer-0.10 -g
+ --pkg gee-1.0 --pkg gstreamer-0.10 -g
librygel_gst_launch_la_LIBADD = $(LIBGUPNP_LIBS) \
$(LIBGUPNP_AV_LIBS) \
- $(LIBDBUS_GLIB_LIBS) \
$(LIBGSTREAMER_LIBS) \
$(GEE_LIBS) \
$(UUID_LIBS)
AM_CFLAGS = $(LIBGUPNP_CFLAGS) \
$(LIBGUPNP_AV_CFLAGS) \
$(LIBGUPNP_DLNA_CFLAGS) \
- $(LIBDBUS_GLIB_CFLAGS) \
$(LIBSQLITE3_CFLAGS) \
$(GEE_CFLAGS) \
$(UUID_CFLAGS) \
rygel-media-export-object-factory.vala
librygel_media_export_la_VALAFLAGS = --vapidir=$(top_srcdir)/src/rygel \
- --pkg dbus-glib-1 \
--pkg rygel-1.0 \
--pkg gupnp-1.0 \
--pkg gupnp-av-1.0 \
librygel_media_export_la_LIBADD = $(LIBGUPNP_LIBS) \
$(LIBGUPNP_AV_LIBS) \
$(LIBGUPNP_DLNA_LIBS) \
- $(LIBDBUS_GLIB_LIBS) \
$(LIBGSTREAMER_LIBS) \
$(GSTREAMER_TAG_LIBS) \
$(GSTREAMER_APP_LIBS) \
this.root_container = root_container;
try {
- var connection = DBus.Bus.get (DBus.BusType. SESSION);
- if (connection != null) {
+ var connection = Bus.get_sync (BusType.SESSION);
+
+ if (likely (connection != null)) {
connection.register_object (RYGEL_MEDIA_EXPORT_PATH, this);
}
- } catch (DBus.Error err) {
+ } catch (IOError err) {
warning (_("Failed to attach to D-Bus session bus: %s"),
err.message);
}
$(LIBGUPNP_AV_CFLAGS) \
$(GEE_CFLAGS) \
$(LIBGSTREAMER_CFLAGS) \
- $(LIBDBUS_GLIB_CFLAGS) \
$(UUID_CFLAGS) \
-I$(top_srcdir)/src/rygel -DDATA_DIR='"$(shareddir)"' \
-include config.h
librygel_mpris_la_LIBADD = $(LIBGUPNP_LIBS) \
$(LIBGUPNP_AV_LIBS) \
- $(LIBDBUS_GLIB_LIBS) \
$(GEE_LIBS) \
$(LIBGSTREAMER_LIBS) \
$(UUID_LIBS)
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-using DBus;
-
[DBus (name = "org.mpris.MediaPlayer2")]
-public interface Rygel.MPRIS.MediaPlayerProxy : DBus.Object {
+public interface Rygel.MPRIS.MediaPlayerProxy : Object {
public const string IFACE = "org.mpris.MediaPlayer2";
public abstract string identity { owned get; }
}
[DBus (name = "org.mpris.MediaPlayer2.Player")]
-public interface Rygel.MPRIS.MediaPlayer.PlayerProxy : DBus.Object {
+public interface Rygel.MPRIS.MediaPlayer.PlayerProxy : Object {
public const string IFACE = "org.mpris.MediaPlayer2.Player";
public abstract string playback_status { owned get; }
public abstract double volume { get; set; }
public abstract int64 position { get; }
- public abstract HashTable<string,Value?> metadata { owned get; }
+ public abstract HashTable<string,Variant> metadata { owned get; }
- public abstract void pause () throws DBus.Error;
- public abstract void play_pause () throws DBus.Error;
- public abstract void stop () throws DBus.Error;
- public abstract void play () throws DBus.Error;
- public abstract void seek (int64 offset) throws DBus.Error;
- public abstract void open_uri (string uri) throws DBus.Error;
+ public abstract void pause () throws IOError;
+ public abstract void play_pause () throws IOError;
+ public abstract void stop () throws IOError;
+ public abstract void play () throws IOError;
+ public abstract void seek (int64 offset) throws IOError;
+ public abstract void open_uri (string uri) throws IOError;
}
}
}
- private void on_properties_changed (string iface,
- HashTable<string,Value?> changed,
- string[] invalidated) {
+ private void on_properties_changed (string iface,
+ HashTable<string,Variant> changed,
+ string[] invalidated) {
if (changed.lookup ("PlaybackStatus") != null) {
this.notify_property ("playback-state");
}
public void module_init (PluginLoader loader) {
try {
plugin_factory = new MPRIS.PluginFactory (loader);
- } catch (DBus.Error error) {
+ } catch (IOError error) {
critical ("Failed to fetch list of MPRIS services: %s\n",
error.message);
}
private const string SERVICE_PREFIX = "org.mpris.MediaPlayer2.";
private const string MEDIA_PLAYER_PATH = "/org/mpris/MediaPlayer2";
- DBusObject dbus_obj;
- DBus.Connection connection;
- PluginLoader loader;
+ DBusObject dbus_obj;
+ PluginLoader loader;
- public PluginFactory (PluginLoader loader) throws DBus.Error {
- this.connection = DBus.Bus.get (DBus.BusType.SESSION);
-
- this.dbus_obj = this.connection.get_object (DBUS_SERVICE, DBUS_OBJECT)
- as DBusObject;
+ public PluginFactory (PluginLoader loader) throws IOError {
+ this.dbus_obj = Bus.get_proxy_sync (BusType.SESSION,
+ DBUS_SERVICE,
+ DBUS_OBJECT);
this.loader = loader;
this.load_plugins.begin ();
}
- private async void load_plugins () throws DBus.Error {
+ private async void load_plugins () throws IOError {
var services = yield this.dbus_obj.list_names ();
foreach (var service in services) {
if (service.has_prefix (SERVICE_PREFIX) &&
this.loader.get_plugin_by_name (service) == null) {
- yield this.load_plugin (service);
+ yield this.load_plugin_n_handle_error (service);
}
}
yield this.load_activatable_plugins ();
}
- private async void load_activatable_plugins () throws DBus.Error {
+ private async void load_activatable_plugins () throws IOError {
var services = yield this.dbus_obj.list_activatable_names ();
foreach (var service in services) {
if (service.has_prefix (SERVICE_PREFIX) &&
this.loader.get_plugin_by_name (service) == null) {
- yield this.load_plugin (service);
+ yield this.load_plugin_n_handle_error (service);
}
}
plugin.available = true;
}
} else if (name.has_prefix (SERVICE_PREFIX)) {
- // Ah, new plugin available, lets use it
- this.load_plugin.begin (name);
+ // Ah, new plugin available, lets use it
+ this.load_plugin_n_handle_error.begin (name);
}
}
- private async void load_plugin (string service_name) {
- // Create proxy to MediaObject iface to get the display name through
- var props = this.connection.get_object (service_name, MEDIA_PLAYER_PATH)
- as Properties;
-
- HashTable<string,Value?> props_hash;
-
+ private async void load_plugin_n_handle_error (string service_name) {
try {
- props_hash = yield props.get_all (MediaPlayerProxy.IFACE);
- } catch (DBus.Error err) {
- warning ("Failed to fetch properties of plugin %s: %s.",
+ yield this.load_plugin (service_name);
+ } catch (IOError error) {
+ warning ("Failed to load MPRIS2 plugin '%s': %s",
service_name,
- err.message);
-
- return;
+ error.message);
}
+ }
+
+ private async void load_plugin (string service_name) throws IOError {
+ // Create proxy to MediaObject iface to get the display name through
+ Properties props = Bus.get_proxy_sync (BusType.SESSION,
+ service_name,
+ MEDIA_PLAYER_PATH);
+
+ var props_hash = yield props.get_all (MediaPlayerProxy.IFACE);
+
+ this.load_plugin_from_props (service_name, props_hash);
+ }
+ private void load_plugin_from_props (string service_name,
+ HashTable<string,Variant> props_hash) {
var title = (string) props_hash.lookup ("Identity");
if (title == null) {
title = service_name;
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-using DBus;
using Rygel.MPRIS;
using Rygel.MPRIS.MediaPlayer;
+using FreeDesktop;
public class Rygel.MPRIS.Plugin : Rygel.MediaRendererPlugin {
private const string MEDIA_PLAYER_PATH = "/org/mpris/MediaPlayer2";
this.protocols = this.schemes_to_protocols (schemes);
try {
- var connection = DBus.Bus.get (DBus.BusType.SESSION);
-
// Create proxy to MediaPlayer.Player iface
- this.actual_player = connection.get_object (service_name,
- MEDIA_PLAYER_PATH)
- as PlayerProxy;
+ this.actual_player = Bus.get_proxy_sync (BusType.SESSION,
+ DBUS_SERVICE,
+ MEDIA_PLAYER_PATH);
// Create proxy to FreeDesktop.Properties iface
- this.properties = connection.get_object (service_name,
- MEDIA_PLAYER_PATH)
- as FreeDesktop.Properties;
+ this.properties = Bus.get_proxy_sync (BusType.SESSION,
+ service_name,
+ MEDIA_PLAYER_PATH);
} catch (GLib.Error err) {
critical ("Failed to connect to session bus: %s", err.message);
}
AM_CFLAGS = $(LIBGUPNP_CFLAGS) \
$(LIBGUPNP_AV_CFLAGS) \
$(GEE_CFLAGS) \
- $(LIBDBUS_GLIB_CFLAGS) \
$(LIBGSTREAMER_CFLAGS) \
$(UUID_CFLAGS) \
-I$(top_srcdir)/src/rygel -DDATA_DIR='"$(shareddir)"' \
librygel_playbin_la_LIBADD = $(LIBGUPNP_LIBS) \
$(LIBGUPNP_AV_LIBS) \
$(LIBGSTREAMER_LIBS) \
- $(LIBDBUS_GLIB_LIBS) \
$(GEE_LIBS) \
$(UUID_LIBS)
librygel_playbin_la_LDFLAGS = -shared -fPIC -module -avoid-version
AM_CFLAGS = $(LIBGUPNP_CFLAGS) \
$(LIBGUPNP_AV_CFLAGS) \
- $(LIBDBUS_GLIB_CFLAGS) \
$(GEE_CFLAGS) \
$(LIBGSTREAMER_CFLAGS) \
$(UUID_CFLAGS) \
librygel_test_la_VALAFLAGS = --vapidir=$(top_srcdir)/src/rygel \
--pkg rygel-1.0 --pkg gconf-2.0 \
--pkg gupnp-1.0 --pkg gupnp-av-1.0 \
- --pkg dbus-glib-1 --pkg gee-1.0 \
- --pkg gstreamer-0.10 -g
+ --pkg gee-1.0 --pkg gstreamer-0.10 -g
librygel_test_la_LIBADD = $(LIBGUPNP_LIBS) \
$(LIBGUPNP_AV_LIBS) \
- $(LIBDBUS_GLIB_LIBS) \
$(LIBGSTREAMER_LIBS) \
$(UUID_LIBS) \
$(GEE_LIBS)
librygel_media_tracker_la_VALAFLAGS = \
--vapidir=$(top_srcdir)/src/rygel \
- --pkg rygel-1.0 --pkg rygel-build-config --pkg gconf-2.0 \
- --pkg gupnp-1.0 --pkg gupnp-av-1.0 --pkg posix \
- --pkg dbus-glib-1 --pkg gee-1.0 --pkg gstreamer-0.10 -g
+ --pkg rygel-1.0 --pkg rygel-build-config --pkg gupnp-1.0 \
+ --pkg gupnp-av-1.0 --pkg posix --pkg gee-1.0 --pkg gstreamer-0.10 -g
librygel_media_tracker_la_LIBADD = $(LIBGUPNP_LIBS) \
$(LIBGUPNP_AV_LIBS) \
- $(LIBDBUS_GLIB_LIBS) \
$(LIBGSTREAMER_LIBS) \
$(GEE_LIBS) \
$(UUID_LIBS)
}
public override async void execute (ResourcesIface resources)
- throws DBus.Error {
+ throws IOError {
var str = this.to_string ();
debug ("Executing SPARQL query: %s", str);
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-using DBus;
-
[DBus (name = "org.freedesktop.Tracker1.Statistics")]
-public interface Rygel.Tracker.StatsIface : DBus.Object {
- public abstract async string[,] get_statistics () throws DBus.Error;
+public interface Rygel.Tracker.StatsIface : DBusProxy {
+ public abstract async string[,] get_statistics () throws IOError;
}
[DBus (name = "org.freedesktop.Tracker1.Resources")]
-public interface Rygel.Tracker.ResourcesIface: DBus.Object {
+public interface Rygel.Tracker.ResourcesIface: DBusProxy {
public abstract async string[,] sparql_query (string query)
- throws DBus.Error;
+ throws IOError;
public abstract async HashTable<string,string>[,] sparql_update_blank (
- string query) throws DBus.Error;
+ string query) throws IOError;
}
[DBus (name = "org.freedesktop.Tracker1.Resources.Class")]
-public interface Rygel.Tracker.ResourcesClassIface: DBus.Object {
+public interface Rygel.Tracker.ResourcesClassIface: DBusProxy {
public abstract signal void subjects_added (string[] subjects);
public abstract signal void subjects_removed (string[] subjects);
public abstract signal void subjects_changed (string[] before,
}
[DBus (name = "org.freedesktop.Tracker1.Miner")]
-public interface Rygel.Tracker.MinerIface : DBus.Object {
+public interface Rygel.Tracker.MinerIface : DBusProxy {
public abstract async void ignore_next_update (string[] urls)
- throws DBus.Error;
+ throws IOError;
}
namespace Rygel {
return query.id;
}
- private void create_proxies () throws DBus.Error {
- DBus.Connection connection = DBus.Bus.get (DBus.BusType.SESSION);
-
- this.resources = connection.get_object (TRACKER_SERVICE, RESOURCES_PATH)
- as ResourcesIface;
- this.miner = connection.get_object (MINER_SERVICE, MINER_PATH)
- as MinerIface;
+ private void create_proxies () throws IOError {
+ this.resources = Bus.get_proxy_sync (BusType.SESSION,
+ TRACKER_SERVICE,
+ RESOURCES_PATH);
+ this.miner = Bus.get_proxy_sync (BusType.SESSION,
+ MINER_SERVICE,
+ MINER_PATH);
}
}
*/
using GUPnP;
-using DBus;
using Gee;
/**
try {
this.create_proxies ();
- } catch (DBus.Error error) {
+ } catch (IOError error) {
critical (_("Failed to connect to session bus: %s"), error.message);
return;
try {
yield query.execute (this.resources);
- } catch (DBus.Error error) {
+ } catch (IOError error) {
critical (_("Error getting all values for '%s': %s"),
string.joinv (" -> ", this.key_chain),
error.message);
return id.has_prefix (this.id + ":");
}
- private void create_proxies () throws DBus.Error {
- DBus.Connection connection = DBus.Bus.get (DBus.BusType.SESSION);
-
- this.resources = connection.get_object (TRACKER_SERVICE, RESOURCES_PATH)
- as ResourcesIface;
- this.resources_class = connection.get_object (
+ private void create_proxies () throws IOError {
+ this.resources = Bus.get_proxy_sync (BusType.SESSION,
+ TRACKER_SERVICE,
+ RESOURCES_PATH);
+ this.resources_class = Bus.get_proxy_sync (
+ BusType.SESSION,
TRACKER_SERVICE,
- this.item_factory.resources_class_path)
- as ResourcesClassIface;
+ this.item_factory.resources_class_path);
}
private void hook_to_changes () {
public void module_init (PluginLoader loader) {
try {
plugin_factory = new Tracker.PluginFactory (loader);
- } catch (DBus.Error err) {
+ } catch (IOError err) {
warning (_("Failed to start Tracker service: %s. Plugin disabled.") +
err.message);
}
StatsIface stats;
PluginLoader loader;
- public PluginFactory (PluginLoader loader) throws DBus.Error {
- var connection = DBus.Bus.get (DBus.BusType.SESSION);
-
- this.stats = connection.get_object (TRACKER_SERVICE, STATISTICS_OBJECT)
- as StatsIface;
+ public PluginFactory (PluginLoader loader) throws IOError {
+ this.stats = Bus.get_proxy_sync (BusType.SESSION,
+ TRACKER_SERVICE,
+ STATISTICS_OBJECT);
this.loader = loader;
this.stats.get_statistics ();
}
public abstract async void execute (ResourcesIface resources)
- throws DBus.Error;
+ throws IOError;
// Deriving classes should override this method and complete it by
// adding the first part of the query
*/
using GUPnP;
-using DBus;
using Gee;
/**
*/
using GUPnP;
-using DBus;
using Gee;
/**
MODIFIED_VARIABLE);
try {
- this.create_proxies ();
+ this.resources = Bus.get_proxy_sync (BusType.SESSION,
+ TRACKER_SERVICE,
+ RESOURCES_PATH);
this.get_children_count.begin ();
- } catch (DBus.Error error) {
+ } catch (IOError error) {
critical (_("Failed to connect to session bus: %s"), error.message);
}
}
}
}
- private void create_proxies () throws DBus.Error {
- DBus.Connection connection = DBus.Bus.get (DBus.BusType.SESSION);
-
- this.resources = connection.get_object (TRACKER_SERVICE, RESOURCES_PATH)
- as ResourcesIface;
- }
-
/**
* Chops the tail of a particular row in a 2-dimensional string array.
*
}
public override async void execute (ResourcesIface resources)
- throws DBus.Error {
+ throws IOError {
var str = this.to_string ();
debug ("Executing SPARQL query: %s", str);
*/
using GUPnP;
-using DBus;
using Gee;
/**
$(GEE_CFLAGS) \
$(UUID_CFLAGS) \
$(LIBSOUP_CFLAGS) \
- $(LIBDBUS_GLIB_CFLAGS) \
-I$(top_srcdir) \
-DDATA_DIR='"$(shareddir)"' -DSYS_CONFIG_DIR='"$(sysconfdir)"'\
-DPLUGIN_DIR='"$(plugindir)"' -DDESKTOP_DIR='"$(desktopdir)"'\
rygel-media-player.vala \
rygel-changelog.vala \
rygel-volume.vala \
- rygel-free-desktop-interfaces.vala
+ rygel-free-desktop-interfaces.vala \
+ rygel-dbus-interface.vala
rygel_VALAFLAGS = \
-H rygel.h -C --library=rygel-1.0 --vapidir=$(srcdir) --thread \
--pkg rygel-build-config --pkg rygel-misc --pkg gupnp-1.0 \
- --pkg gupnp-av-1.0 --pkg gupnp-dlna-1.0 --pkg dbus-glib-1 \
- --pkg gstreamer-0.10 --pkg gio-2.0 --pkg gee-1.0 --pkg posix -g
+ --pkg gupnp-av-1.0 --pkg gupnp-dlna-1.0 --pkg gstreamer-0.10 \
+ --pkg gio-2.0 --pkg gee-1.0 --pkg posix -g
# Note: `-- the -g needs to be at the end of VALAFLAGS to not break make dist
rygel_LDADD = librygel-configuration.a \
$(GIO_LIBS) \
$(GEE_LIBS) \
$(UUID_LIBS) \
- $(LIBSOUP_LIBS) \
- $(LIBDBUS_GLIB_LIBS)
+ $(LIBSOUP_LIBS)
rygel_LDFLAGS = -export-dynamic
rygel-user-config.c \
rygel-meta-config.c \
rygel-cmdline-config.c \
- rygel-environment-config.c
+ rygel-environment-config.c \
+ rygel-dbus-interface.c
MAINTAINERCLEANFILES = Makefile.in $(BUILT_SOURCES)
EXTRA_DIST = rygel-build-config.vapi \
gupnp-av-1.0
gstreamer-0.10
gee-1.0
-dbus-glib-1
--- /dev/null
+/*
+ * Copyright (C) 2008,2010 Nokia Corporation.
+ * Copyright (C) 2008 Zeeshan Ali (Khattak) <zeeshanak@gnome.org>.
+ *
+ * Author: Zeeshan Ali (Khattak) <zeeshanak@gnome.org>
+ *
+ * This file is part of Rygel.
+ *
+ * Rygel is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Rygel 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 Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+[DBus (name = "org.gnome.Rygel1")]
+public interface Rygel.DBusInterface : DBusProxy {
+ public const string SERVICE_NAME = "org.gnome.Rygel1";
+ public const string OBJECT_PATH = "/org/gnome/Rygel1";
+
+ public abstract void shutdown () throws IOError;
+}
+
/*
- * Copyright (C) 2008 Nokia Corporation.
+ * Copyright (C) 2008,2010 Nokia Corporation.
* Copyright (C) 2008 Zeeshan Ali (Khattak) <zeeshanak@gnome.org>.
*
* Author: Zeeshan Ali (Khattak) <zeeshanak@gnome.org>
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+using FreeDesktop;
+
+// FIXME: Declare that we implement DBusInterface once bug#631044 is fixed.
[DBus (name = "org.gnome.Rygel1")]
public class Rygel.DBusService : Object {
- private static string RYGEL_SERVICE = "org.gnome.Rygel1";
- private static string RYGEL_PATH = "/org/gnome/Rygel1";
-
private Main main;
- public DBusService (Main main) throws DBus.Error {
+ public DBusService (Main main) throws IOError {
this.main = main;
- var conn = DBus.Bus.get (DBus.BusType. SESSION);
-
- dynamic DBus.Object bus = conn.get_object ("org.freedesktop.DBus",
- "/org/freedesktop/DBus",
- "org.freedesktop.DBus");
+ DBusObject bus = Bus.get_proxy_sync (BusType.SESSION,
+ DBUS_SERVICE,
+ DBUS_OBJECT);
// try to register service in session bus
- uint request_name_result = bus.request_name (RYGEL_SERVICE,
- (uint) 0);
-
- if (request_name_result != DBus.RequestNameReply.PRIMARY_OWNER) {
+ if (bus.request_name (DBusInterface.SERVICE_NAME, 0) !=
+ DBusRequestNameReply.PRIMARY_OWNER) {
warning ("Failed to start D-Bus service name '%s' already taken",
- RYGEL_SERVICE);
+ DBusInterface.SERVICE_NAME);
} else {
- conn.register_object (RYGEL_PATH, this);
+ var conn = Bus.get_sync (BusType.SESSION);
+
+ conn.register_object (DBusInterface.OBJECT_PATH, this);
}
}
- public void Shutdown () {
+ public void shutdown () throws IOError {
this.main.exit (0);
}
}
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-using DBus;
+namespace FreeDesktop {
+ public const string DBUS_SERVICE = "org.freedesktop.DBus";
+ public const string DBUS_OBJECT = "/org/freedesktop/DBus";
+}
+
+public enum FreeDesktop.DBusRequestNameReply {
+ PRIMARY_OWNER = 1,
+ IN_QUEUE,
+ EXISTS,
+ ALREADY_OWNER
+}
[DBus (name = "org.freedesktop.DBus")]
-public interface FreeDesktop.DBusObject: DBus.Object {
+public interface FreeDesktop.DBusObject: Object {
public abstract signal void name_owner_changed (string name,
string old_owner,
string new_owner);
- public abstract async string[] list_names () throws DBus.Error;
- public abstract async string[] list_activatable_names () throws DBus.Error;
+ // FIXME: This method should be async
+ public abstract uint32 request_name (string name, uint32 flags)
+ throws IOError;
+ public abstract async string[] list_names () throws IOError;
+ public abstract async string[] list_activatable_names () throws IOError;
}
[DBus (name = "org.freedesktop.DBus.Properties")]
-public interface FreeDesktop.Properties: DBus.Object {
- public abstract async HashTable<string,Value?> get_all (string iface)
- throws DBus.Error;
+public interface FreeDesktop.Properties: Object {
+ public abstract async HashTable<string,Variant> get_all (string iface)
+ throws IOError;
public abstract signal void properties_changed
- (string iface,
- HashTable<string,Value?> changed,
- string[] invalidated);
+ (string iface,
+ HashTable<string,Variant> changed,
+ string[]
+ invalidated);
}
main = new Main ();
service = new DBusService (main);
- } catch (DBus.Error err) {
+ } catch (IOError err) {
warning (_("Failed to start D-Bus service: %s"), err.message);
} catch (CmdlineConfigError.VERSION_ONLY err) {
return 0;
protected static const string LOG_LEVEL_KEY = "log-level";
protected static const string PLUGIN_PATH_KEY = "plugin-path";
- private const string DBUS_SERVICE = "org.freedesktop.DBus";
- private const string DBUS_PATH = "/org/freedesktop/DBus";
- private const string DBUS_INTERFACE = "org.freedesktop.DBus";
-
private const string RYGEL_SERVICE = "org.gnome.Rygel1";
private const string RYGEL_PATH = "/org/gnome/Rygel1";
private const string RYGEL_INTERFACE = "org.gnome.Rygel1";
protected KeyFile key_file;
private bool read_only;
- private dynamic DBus.Object dbus_obj;
- private dynamic DBus.Object rygel_obj;
-
public bool get_upnp_enabled () throws GLib.Error {
return this.get_bool ("general", ENABLED_KEY);
}
KeyFileFlags.KEEP_COMMENTS |
KeyFileFlags.KEEP_TRANSLATIONS);
debug ("Loaded user configuration from file '%s'", path);
-
- try {
- DBus.Connection connection = DBus.Bus.get (DBus.BusType.SESSION);
-
- // Create proxy to Rygel
- this.rygel_obj = connection.get_object (RYGEL_SERVICE,
- RYGEL_PATH,
- RYGEL_INTERFACE);
- // and DBus
- this.dbus_obj = connection.get_object (DBUS_SERVICE,
- DBUS_PATH,
- DBUS_INTERFACE);
- } catch (DBus.Error err) {
- debug ("Failed to connect to session bus: %s", err.message);
- }
}
public void save () {
var dest = File.new_for_path (dest_path);
if (enable) {
- uint32 res;
-
- // Start service first
- if (this.dbus_obj != null) {
- this.dbus_obj.StartServiceByName (RYGEL_SERVICE,
- (uint32) 0,
- out res);
- }
+ // Creating the proxy starts the service
+ DBusInterface rygel_proxy = Bus.get_proxy_sync
+ (BusType.SESSION,
+ DBusInterface.SERVICE_NAME,
+ DBusInterface.OBJECT_PATH);
+ // Just to satisfy valac
+ rygel_proxy.get_object_path ();
// Then symlink the desktop file to user's autostart dir
var source_path = Path.build_filename (BuildConfig.DESKTOP_DIR,
this.set_bool ("general", ENABLED_KEY, true);
} else {
- // Stop service first
- if (this.rygel_obj != null) {
- this.rygel_obj.Shutdown ();
+ // Stop service only if already running
+ if (this.get_enabled ("general")) {
+ // Create proxy to Rygel
+ DBusInterface rygel_proxy = Bus.get_proxy_sync
+ (BusType.SESSION,
+ DBusInterface.SERVICE_NAME,
+ DBusInterface.OBJECT_PATH);
+
+ rygel_proxy.shutdown ();
}
// Then delete the symlink from user's autostart dir
$(GEE_CFLAGS) \
$(UUID_CFLAGS) \
$(LIBSOUP_CFLAGS) \
- $(LIBDBUS_GLIB_CFLAGS) \
-I$(top_srcdir) -I$(rygeldir) -DDATA_DIR='"$(shareddir)"' \
-DSMALL_ICON_DIR='"$(icondir)"' -include config.h \
-DLOCALEDIR=\""$(datadir)/locale"\"
rygel_preferences_VALAFLAGS = \
--vapidir=$(rygeldir) --thread \
--pkg rygel-1.0 --pkg rygel-build-config --pkg gupnp-1.0 \
- --pkg gupnp-av-1.0 --pkg dbus-glib-1 --pkg gconf-2.0 \
- --pkg gstreamer-0.10 --pkg gio-2.0 --pkg gee-1.0 \
- --pkg gtk+-$(GTK_VAPI_VERSION) -g
+ --pkg gupnp-av-1.0 --pkg gconf-2.0 --pkg gstreamer-0.10 --pkg gio-2.0 \
+ --pkg gee-1.0 --pkg gtk+-$(GTK_VAPI_VERSION) -g
rygel_preferences_LDADD = \
$(abs_top_builddir)/src/rygel/librygel-configuration.a \
$(GEE_LIBS) \
$(UUID_LIBS) \
$(LIBSOUP_LIBS) \
- $(GTK_LIBS) \
- $(LIBDBUS_GLIB_LIBS)
+ $(GTK_LIBS)
rygel_preferences_LDFLAGS = -export-dynamic
MAINTAINERCLEANFILES = Makefile.in