34 " <interface name='org.darktable.service.Remote'>"
35 " <method name='Quit' />"
36 " <method name='Open'>"
37 " <arg type='s' name='FileName' direction='in'/>"
38 " <arg type='i' name='id' direction='out' />"
40 " <property type='s' name='DataDir' access='read'/>"
41 " <property type='s' name='ConfigDir' access='read'/>"
42 " <property type='b' name='LuaEnabled' access='read'/>"
46static void _handle_method_call(GDBusConnection *connection,
const gchar *sender,
const gchar *object_path,
47 const gchar *interface_name,
const gchar *method_name, GVariant *parameters,
48 GDBusMethodInvocation *invocation, gpointer user_data)
50 if(!g_strcmp0(method_name,
"Quit"))
52 g_dbus_method_invocation_return_value(invocation, NULL);
55 else if(!g_strcmp0(method_name,
"Open"))
57 const gchar *filename;
58 g_variant_get(parameters,
"(&s)", &filename);
60 g_dbus_method_invocation_return_value(invocation, g_variant_new(
"(i)",
id));
67 const gchar *object_path,
const gchar *interface_name,
68 const gchar *property_name, GError **
error, gpointer user_data)
73 if(!g_strcmp0(property_name,
"DataDir"))
77 ret = g_variant_new_string(datadir);
79 else if(!g_strcmp0(property_name,
"ConfigDir"))
83 ret = g_variant_new_string(configdir);
85 else if(!g_strcmp0(property_name,
"LuaEnabled"))
87 ret = g_variant_new_boolean(
FALSE);
114 = g_dbus_connection_register_object(connection,
"/darktable", dbus->
introspection_data->interfaces[0],
145 dbus->
owner_id = g_bus_own_name(G_BUS_TYPE_SESSION,
146 "org.darktable.service",
150 dbus->
dbus_connection = g_bus_get_sync(G_BUS_TYPE_SESSION, NULL, NULL);
static void error(char *msg)
int dt_load_from_string(const gchar *input, gboolean open_image_in_dr, gboolean *single_image)
#define IS_NULL_PTR(p)
C is way too permissive with !=, == and if(var) checks, which can mean too many things depending on w...
static void _on_bus_acquired(GDBusConnection *connection, const gchar *name, gpointer user_data)
static void _on_name_acquired(GDBusConnection *connection, const gchar *name, gpointer user_data)
struct dt_dbus_t * dt_dbus_init()
static void _on_name_lost(GDBusConnection *connection, const gchar *name, gpointer user_data)
static void _handle_method_call(GDBusConnection *connection, const gchar *sender, const gchar *object_path, const gchar *interface_name, const gchar *method_name, GVariant *parameters, GDBusMethodInvocation *invocation, gpointer user_data)
static const gchar introspection_xml[]
static GVariant * _handle_get_property(GDBusConnection *connection, const gchar *sender, const gchar *object_path, const gchar *interface_name, const gchar *property_name, GError **error, gpointer user_data)
static const GDBusInterfaceVTable interface_vtable
void dt_dbus_destroy(const dt_dbus_t *dbus)
gboolean dt_dbus_connected(const dt_dbus_t *dbus)
void dt_loc_get_datadir(char *datadir, size_t bufsize)
void dt_loc_get_user_config_dir(char *configdir, size_t bufsize)
GDBusConnection * dbus_connection
GDBusNodeInfo * introspection_data