diff options
author | infirit <[email protected]> | 2014-12-09 15:14:25 +0100 |
---|---|---|
committer | infirit <[email protected]> | 2014-12-09 23:02:28 +0100 |
commit | 510b42f68f3172ff24d4efc605a0527e0cd29e76 (patch) | |
tree | 49d158d5a6c2ccc85cbd9f945398c06ccc98f8c9 /shell | |
parent | ba7af404335a71a45dc0f39b20e496f32f7eb81d (diff) | |
download | atril-510b42f68f3172ff24d4efc605a0527e0cd29e76.tar.bz2 atril-510b42f68f3172ff24d4efc605a0527e0cd29e76.tar.xz |
[shell] Send the URI of the input file instead of the filename in SyncSource.
Taken from evince commit: 8b5db2c8c7120a7b4606729fea86247df0d8c462
From: José Aliste <[email protected]>
Gnome bug: https://bugzilla.gnome.org/show_bug.cgi?id=632317
Diffstat (limited to 'shell')
-rw-r--r-- | shell/ev-window.c | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/shell/ev-window.c b/shell/ev-window.c index b5d87e28..96f3ef76 100644 --- a/shell/ev-window.c +++ b/shell/ev-window.c @@ -6949,6 +6949,8 @@ ev_window_sync_source (EvWindow *window, GDBusConnection *connection; GError *error = NULL; guint32 timestamp; + gchar *uri_input; + GFile *input_gfile; if (window->priv->dbus_object_id <= 0) return; @@ -6958,17 +6960,40 @@ ev_window_sync_source (EvWindow *window, return; timestamp = gtk_get_current_event_time (); + if (g_path_is_absolute (link->filename)) { + input_gfile = g_file_new_for_path (link->filename); + } else { + GFile *gfile, *parent_gfile; + + gfile = g_file_new_for_uri (window->priv->uri); + parent_gfile = g_file_get_parent (gfile); + + /* parent_gfile should never be NULL */ + if (parent_gfile == NULL) { + g_printerr ("Document URI is '/'\n"); + return; + } + + input_gfile = g_file_get_child (parent_gfile, link->filename); + g_object_unref (parent_gfile); + g_object_unref (gfile); + } + + uri_input = g_file_get_uri (input_gfile); + g_object_unref (input_gfile); + g_dbus_connection_emit_signal (connection, NULL, window->priv->dbus_object_path, EV_WINDOW_DBUS_INTERFACE, "SyncSource", g_variant_new ("(s(ii)u)", - link->filename, + uri_input, link->line, link->col, timestamp), &error); + g_free (uri_input); if (error) { g_printerr ("Failed to emit DBus signal SyncSource: %s\n", error->message); |