mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2025-01-27 17:57:51 +01:00
Add Edit signal
This commit is contained in:
parent
fd13cf5921
commit
c82bc2f0d4
3 changed files with 43 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue