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
d3203905
Commit
d3203905
authored
Jun 13, 2012
by
Moritz Lipp
Browse files
Implement :version command
parent
5ad33504
Changes
3
Hide whitespace changes
Inline
Side-by-side
commands.c
View file @
d3203905
...
...
@@ -15,6 +15,7 @@
#include "utils.h"
#include "page-widget.h"
#include "page.h"
#include "plugin.h"
#include "internal.h"
#include "render.h"
...
...
@@ -518,3 +519,43 @@ cmd_offset(girara_session_t* session, girara_list_t* argument_list)
return
true
;
}
bool
cmd_version
(
girara_session_t
*
session
,
girara_list_t
*
UNUSED
(
argument_list
))
{
g_return_val_if_fail
(
session
!=
NULL
,
false
);
g_return_val_if_fail
(
session
->
global
.
data
!=
NULL
,
false
);
zathura_t
*
zathura
=
session
->
global
.
data
;
GString
*
string
=
g_string_new
(
NULL
);
/* zathura version */
char
*
zathura_version
=
g_strdup_printf
(
"zathura %d.%d.%d"
,
ZATHURA_VERSION_MAJOR
,
ZATHURA_VERSION_MINOR
,
ZATHURA_VERSION_REV
);
g_string_append
(
string
,
zathura_version
);
g_free
(
zathura_version
);
/* plugin information */
girara_list_t
*
plugins
=
zathura_plugin_manager_get_plugins
(
zathura
->
plugins
.
manager
);
if
(
plugins
!=
NULL
)
{
GIRARA_LIST_FOREACH
(
plugins
,
zathura_plugin_t
*
,
iter
,
plugin
)
char
*
name
=
zathura_plugin_get_name
(
plugin
);
zathura_plugin_version_t
version
=
zathura_plugin_get_version
(
plugin
);
char
*
text
=
g_strdup_printf
(
"
\n
<i>(plugin)</i> %s (%d.%d.%d) <i>(%s)</i>"
,
(
name
==
NULL
)
?
"-"
:
name
,
version
.
major
,
version
.
minor
,
version
.
rev
,
zathura_plugin_get_path
(
plugin
)
);
g_string_append
(
string
,
text
);
g_free
(
text
);
GIRARA_LIST_FOREACH_END
(
plugins
,
zathura_plugin_t
*
,
iter
,
plugin
);
}
/* display information */
girara_notify
(
session
,
GIRARA_INFO
,
"%s"
,
string
->
str
);
g_string_free
(
string
,
TRUE
);
return
true
;
}
commands.h
View file @
d3203905
...
...
@@ -151,4 +151,13 @@ bool cmd_export(girara_session_t* session, girara_list_t* argument_list);
*/
bool
cmd_offset
(
girara_session_t
*
session
,
girara_list_t
*
argument_list
);
/**
* Shows version information
*
* @param session The used girara session
* @param argument_list List of passed arguments
* @return true if no error occured
*/
bool
cmd_version
(
girara_session_t
*
session
,
girara_list_t
*
argument_list
);
#endif // COMMANDS_H
config.c
View file @
d3203905
...
...
@@ -282,6 +282,7 @@ config_load_default(zathura_t* zathura)
girara_inputbar_command_add
(
gsession
,
"delmarks"
,
"delm"
,
cmd_marks_delete
,
NULL
,
_
(
"Delete the specified marks"
));
girara_inputbar_command_add
(
gsession
,
"nohlsearch"
,
"nohl"
,
cmd_nohlsearch
,
NULL
,
_
(
"Don't highlight current search results"
));
girara_inputbar_command_add
(
gsession
,
"hlsearch"
,
NULL
,
cmd_hlsearch
,
NULL
,
_
(
"Highlight current search results"
));
girara_inputbar_command_add
(
gsession
,
"version"
,
NULL
,
cmd_version
,
NULL
,
_
(
"Show version information"
));
girara_special_command_add
(
gsession
,
'/'
,
cmd_search
,
true
,
FORWARD
,
NULL
);
girara_special_command_add
(
gsession
,
'?'
,
cmd_search
,
true
,
BACKWARD
,
NULL
);
...
...
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