mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2025-02-06 05:34:57 +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->file_path = real_path;
|
||||||
document->basename = g_file_get_basename(file);
|
|
||||||
document->uri = g_strdup(uri);
|
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->password = password;
|
||||||
document->scale = 1.0;
|
document->scale = 1.0;
|
||||||
document->plugin = plugin;
|
document->plugin = plugin;
|
||||||
|
|
|
@ -636,7 +636,7 @@ get_formatted_filename(zathura_t* zathura, bool statusbar)
|
||||||
{
|
{
|
||||||
bool basename_only = false;
|
bool basename_only = false;
|
||||||
const char* file_path = zathura_document_get_uri(zathura->document);
|
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);
|
file_path = zathura_document_get_path(zathura->document);
|
||||||
}
|
}
|
||||||
if (statusbar == true) {
|
if (statusbar == true) {
|
||||||
|
@ -673,16 +673,8 @@ get_formatted_filename(zathura_t* zathura, bool statusbar)
|
||||||
return g_strdup(file_path);
|
return g_strdup(file_path);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
char *basename = NULL;
|
const char* basename = zathura_document_get_basename(zathura->document);
|
||||||
if(zathura_document_get_uri(zathura->document) == NULL) {
|
return g_strdup(basename);
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue