Commit c82bc2f0 authored by Sebastian Ramacher's avatar Sebastian Ramacher

Add Edit signal

parent fd13cf59
......@@ -28,5 +28,11 @@
<property type='s' name='filename' access='read' />
<property type='u' name='pagenumber' access='read' />
<property type='u' name='numberofpages' access='read' />
<!-- Open editor with given input file at line and column. -->
<signal name='Edit'>
<arg type='s' name='input' direction='out' />
<arg type='u' name='line' direction='out' />
<arg type='u' name='column' direction='out' />
</signal>
</interface>
</node>
......@@ -163,6 +163,33 @@ zathura_dbus_new(zathura_t* zathura)
return dbus;
}
void
zathura_dbus_edit(ZathuraDbus* edit, unsigned int page, unsigned int x, unsigned int y) {
private_t* priv = GET_PRIVATE(edit);
const char* filename = zathura_document_get_path(priv->zathura->document);
char* input_file = NULL;
unsigned int line = 0;
unsigned int column = 0;
if (synctex_get_input_line_column(filename, page, x, y, &input_file, &line,
&column) == false) {
return;
}
GError* error = NULL;
g_dbus_connection_emit_signal(priv->connection, NULL, DBUS_OBJPATH,
DBUS_INTERFACE, "Edit", g_variant_new("(suu)", input_file, x, y), &error);
g_free(input_file);
if (error != NULL) {
girara_debug("Failed to emit 'Edit' signal: %s", error->message);
g_error_free(error);
}
}
/* D-Bus handler */
static void
......
......@@ -41,6 +41,16 @@ GType zathura_dbus_get_type(void);
ZathuraDbus* zathura_dbus_new(zathura_t* zathura);
/**
* Emit the 'Edit' signal on the D-Bus connection.
*
* @param dbus ZathuraDbus instance
* @param page page
* @param x x coordinate
* @param y y coordinate
*/
void zathura_dbus_edit(ZathuraDbus* dbus, unsigned int page, unsigned int x, unsigned int y);
/**
* Look for zathura instance having filename open and cause it to open give page
* and highlight rectangles on the given page
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment