Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
pwmt
zathura
Commits
bbe174ac
Commit
bbe174ac
authored
Aug 15, 2014
by
Sebastian Ramacher
Browse files
Add cache directory
Signed-off-by:
Sebastian Ramacher
<
sebastian+dev@ramacher.at
>
parent
f4b7bd0c
Changes
3
Hide whitespace changes
Inline
Side-by-side
main.c
View file @
bbe174ac
...
...
@@ -41,6 +41,7 @@ main(int argc, char* argv[])
/* parse command line arguments */
gchar
*
config_dir
=
NULL
;
gchar
*
data_dir
=
NULL
;
gchar
*
cache_dir
=
NULL
;
gchar
*
plugin_path
=
NULL
;
gchar
*
loglevel
=
NULL
;
gchar
*
password
=
NULL
;
...
...
@@ -57,6 +58,7 @@ main(int argc, char* argv[])
{
"reparent"
,
'e'
,
0
,
G_OPTION_ARG_INT
,
&
embed
,
_
(
"Reparents to window specified by xid"
),
"xid"
},
{
"config-dir"
,
'c'
,
0
,
G_OPTION_ARG_FILENAME
,
&
config_dir
,
_
(
"Path to the config directory"
),
"path"
},
{
"data-dir"
,
'd'
,
0
,
G_OPTION_ARG_FILENAME
,
&
data_dir
,
_
(
"Path to the data directory"
),
"path"
},
{
"cache-dir"
,
'\0'
,
0
,
G_OPTION_ARG_FILENAME
,
&
cache_dir
,
_
(
"Path to the cache directory"
),
"path"
},
{
"plugins-dir"
,
'p'
,
0
,
G_OPTION_ARG_STRING
,
&
plugin_path
,
_
(
"Path to the directories containing plugins"
),
"path"
},
{
"fork"
,
'\0'
,
0
,
G_OPTION_ARG_NONE
,
&
forkback
,
_
(
"Fork into the background"
),
NULL
},
{
"password"
,
'w'
,
0
,
G_OPTION_ARG_STRING
,
&
password
,
_
(
"Document password"
),
"password"
},
...
...
@@ -156,6 +158,7 @@ main(int argc, char* argv[])
zathura_set_xid
(
zathura
,
embed
);
zathura_set_config_dir
(
zathura
,
config_dir
);
zathura_set_data_dir
(
zathura
,
data_dir
);
zathura_set_cache_dir
(
zathura
,
cache_dir
);
zathura_set_plugin_dir
(
zathura
,
plugin_path
);
zathura_set_argv
(
zathura
,
argv
);
...
...
zathura.c
View file @
bbe174ac
...
...
@@ -348,6 +348,7 @@ zathura_free(zathura_t* zathura)
/* free config variables */
g_free
(
zathura
->
config
.
config_dir
);
g_free
(
zathura
->
config
.
data_dir
);
g_free
(
zathura
->
config
.
cache_dir
);
/* free jumplist */
if
(
zathura
->
jumplist
.
list
!=
NULL
)
{
...
...
@@ -386,6 +387,8 @@ zathura_set_config_dir(zathura_t* zathura, const char* dir)
void
zathura_set_data_dir
(
zathura_t
*
zathura
,
const
char
*
dir
)
{
g_return_if_fail
(
zathura
!=
NULL
);
if
(
dir
!=
NULL
)
{
zathura
->
config
.
data_dir
=
g_strdup
(
dir
);
}
else
{
...
...
@@ -393,8 +396,20 @@ zathura_set_data_dir(zathura_t* zathura, const char* dir)
zathura
->
config
.
data_dir
=
g_build_filename
(
path
,
"zathura"
,
NULL
);
g_free
(
path
);
}
}
void
zathura_set_cache_dir
(
zathura_t
*
zathura
,
const
char
*
dir
)
{
g_return_if_fail
(
zathura
!=
NULL
);
if
(
dir
!=
NULL
)
{
zathura
->
config
.
cache_dir
=
g_strdup
(
dir
);
}
else
{
gchar
*
path
=
girara_get_xdg_path
(
XDG_CACHE
);
zathura
->
config
.
cache_dir
=
g_build_filename
(
path
,
"zathura"
,
NULL
);
g_free
(
path
);
}
}
void
...
...
zathura.h
View file @
bbe174ac
...
...
@@ -127,6 +127,7 @@ struct zathura_s
{
gchar
*
config_dir
;
/**< Path to the configuration directory */
gchar
*
data_dir
;
/**< Path to the data directory */
gchar
*
cache_dir
;
/**< Path to the cache directory */
}
config
;
struct
...
...
@@ -249,6 +250,14 @@ void zathura_set_config_dir(zathura_t* zathura, const char* dir);
*/
void
zathura_set_data_dir
(
zathura_t
*
zathura
,
const
char
*
dir
);
/**
* Set the path to the cache directory.
*
* @param zathura The Zathura session
* @param dir Directory path
*/
void
zathura_set_cache_dir
(
zathura_t
*
zathura
,
const
char
*
dir
);
/**
* Set the path to the plugin directory
*
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment