mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2024-11-10 23:03:48 +01:00
Expose more properties via D-Bus
Thanks to Ork for the initial patch. Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
This commit is contained in:
parent
935964bbf5
commit
76e456ef4c
@ -26,5 +26,7 @@
|
|||||||
<arg type='b' name='return' direction='out' />
|
<arg type='b' name='return' direction='out' />
|
||||||
</method>
|
</method>
|
||||||
<property type='s' name='filename' access='read' />
|
<property type='s' name='filename' access='read' />
|
||||||
|
<property type='u' name='pagenumber' access='read' />
|
||||||
|
<property type='u' name='numberofpages' access='read' />
|
||||||
</interface>
|
</interface>
|
||||||
</node>
|
</node>
|
||||||
|
@ -379,12 +379,17 @@ handle_get_property(GDBusConnection* UNUSED(connection),
|
|||||||
ZathuraDbus* dbus = data;
|
ZathuraDbus* dbus = data;
|
||||||
private_t* priv = GET_PRIVATE(dbus);
|
private_t* priv = GET_PRIVATE(dbus);
|
||||||
|
|
||||||
if (g_strcmp0(property_name, "filename") == 0) {
|
|
||||||
if (priv->zathura->document == NULL) {
|
if (priv->zathura->document == NULL) {
|
||||||
g_set_error(error, G_IO_ERROR, G_IO_ERROR_FAILED, "No document open.");
|
g_set_error(error, G_IO_ERROR, G_IO_ERROR_FAILED, "No document open.");
|
||||||
} else {
|
return NULL;
|
||||||
return g_variant_new_string(zathura_document_get_path(priv->zathura->document));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (g_strcmp0(property_name, "filename") == 0) {
|
||||||
|
return g_variant_new_string(zathura_document_get_path(priv->zathura->document));
|
||||||
|
} else if (g_strcmp0(property_name, "pagenumber") == 0) {
|
||||||
|
return g_variant_new_uint32(zathura_document_get_current_page_number(priv->zathura->document));
|
||||||
|
} else if (g_strcmp0(property_name, "numberofpages") == 0) {
|
||||||
|
return g_variant_new_uint32(zathura_document_get_number_of_pages(priv->zathura->document));
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
Loading…
Reference in New Issue
Block a user