mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2025-01-29 01:04:56 +01:00
move uri basename handling to zathura_document_open
This commit is contained in:
parent
337305457f
commit
7dc30c9c14
2 changed files with 11 additions and 12 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue