Commit 7dc30c9c authored by Lukas K.'s avatar Lukas K.

move uri basename handling to zathura_document_open

parent 33730545
......@@ -116,8 +116,15 @@ zathura_document_open(zathura_plugin_manager_t* plugin_manager, const char*
}
document->file_path = real_path;
document->basename = g_file_get_basename(file);
document->uri = g_strdup(uri);
if (document->uri == NULL) {
document->basename = g_file_get_basename(file);
}
else {
GFile *gf = g_file_new_for_uri(document->uri);
document->basename = g_file_get_basename(gf);
g_object_unref(gf);
}
document->password = password;
document->scale = 1.0;
document->plugin = plugin;
......
......@@ -636,7 +636,7 @@ get_formatted_filename(zathura_t* zathura, bool statusbar)
{
bool basename_only = false;
const char* file_path = zathura_document_get_uri(zathura->document);
if(file_path == NULL) {
if (file_path == NULL) {
file_path = zathura_document_get_path(zathura->document);
}
if (statusbar == true) {
......@@ -673,16 +673,8 @@ get_formatted_filename(zathura_t* zathura, bool statusbar)
return g_strdup(file_path);
}
} else {
char *basename = NULL;
if(zathura_document_get_uri(zathura->document) == NULL) {
basename = g_strdup(zathura_document_get_basename(zathura->document));
}
else {
GFile *gf = g_file_new_for_uri(zathura_document_get_uri(zathura->document));
basename = g_file_get_basename(gf);
g_object_unref(gf);
}
return basename;
const char* basename = zathura_document_get_basename(zathura->document);
return g_strdup(basename);
}
}
......
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