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
Marius
zathura
Commits
8f61583a
Commit
8f61583a
authored
Apr 26, 2014
by
Sebastian Ramacher
Browse files
Style index mode with CSS
Signed-off-by:
Sebastian Ramacher
<
sebastian+dev@ramacher.at
>
parent
9a0ff4b7
Changes
6
Hide whitespace changes
Inline
Side-by-side
Makefile
View file @
8f61583a
...
...
@@ -77,7 +77,7 @@ dbus-interface-definitions.c: data/org.pwmt.zathura.xml
css-definitions.c
:
data/zathura.css_t
$(QUIET)
echo
'#include "css-definitions.h"'
>
$@
.tmp
$(QUIET)
echo
'const char* CSS_TEMPLATE ='
>>
$@
.tmp
$(QUIET)
echo
'const char* CSS_TEMPLATE
_INDEX
='
>>
$@
.tmp
$(QUIET)
sed
's/^\(.*\)$$/"\1\\n"/'
$<
>>
$@
.tmp
$(QUIET)
echo
';'
>>
$@
.tmp
$(QUIET)
mv
$@
.tmp
$@
...
...
config.c
View file @
8f61583a
...
...
@@ -174,6 +174,11 @@ config_load_default(zathura_t* zathura)
girara_setting_add
(
gsession
,
"render-loading-fg"
,
NULL
,
STRING
,
false
,
_
(
"'Loading ...' foreground color"
),
cb_color_change
,
NULL
);
girara_setting_set
(
gsession
,
"render-loading-fg"
,
"#000000"
);
girara_setting_add
(
gsession
,
"index-fg"
,
"#DDDDDD"
,
STRING
,
true
,
_
(
"Index mode foreground color"
),
NULL
,
NULL
);
girara_setting_add
(
gsession
,
"index-bg"
,
"#232323"
,
STRING
,
true
,
_
(
"Index mode background color"
),
NULL
,
NULL
);
girara_setting_add
(
gsession
,
"index-active-fg"
,
"#232323"
,
STRING
,
true
,
_
(
"Index mode foreground color (active element)"
),
NULL
,
NULL
);
girara_setting_add
(
gsession
,
"index-active-bg"
,
"#9FBC00"
,
STRING
,
true
,
_
(
"Index mode background color (active element)"
),
NULL
,
NULL
);
bool_value
=
false
;
girara_setting_add
(
gsession
,
"recolor"
,
&
bool_value
,
BOOLEAN
,
false
,
_
(
"Recolor pages"
),
cb_setting_recolor_change
,
NULL
);
bool_value
=
false
;
...
...
css-definitions.h
View file @
8f61583a
...
...
@@ -3,6 +3,6 @@
#ifndef GIRARA_CSS_DEFINITIONS_H
#define GIRARA_CSS_DEFINITIONS_H
extern
const
char
*
CSS_TEMPLATE
;
extern
const
char
*
CSS_TEMPLATE
_INDEX
;
#endif
data/zathura.css_t
View file @
8f61583a
/* Index mode colors */
#@session@ .indexmode {
color: @index-fg@;
background-color: @index-bg@;
...
...
shortcuts.c
View file @
8f61583a
...
...
@@ -1128,6 +1128,9 @@ sc_toggle_index(girara_session_t* session, girara_argument_t* UNUSED(argument),
goto
error_free
;
}
gtk_style_context_add_class
(
gtk_widget_get_style_context
(
treeview
),
"indexmode"
);
g_object_unref
(
model
);
renderer
=
gtk_cell_renderer_text_new
();
...
...
zathura.c
View file @
8f61583a
...
...
@@ -14,6 +14,7 @@
#include <girara/statusbar.h>
#include <girara/settings.h>
#include <girara/shortcuts.h>
#include <girara/template.h>
#include <glib/gstdio.h>
#include <glib/gi18n.h>
...
...
@@ -39,6 +40,7 @@
#include "plugin.h"
#include "adjustment.h"
#include "dbus-interface.h"
#include "css-definitions.h"
typedef
struct
zathura_document_info_s
{
zathura_t
*
zathura
;
...
...
@@ -245,6 +247,37 @@ zathura_init(zathura_t* zathura)
zathura
->
jumplist
.
size
=
0
;
zathura
->
jumplist
.
cur
=
NULL
;
/* CSS for index mode */
GiraraTemplate
*
csstemplate
=
girara_session_get_template
(
zathura
->
ui
.
session
);
static
const
char
*
index_settings
[]
=
{
"index-fg"
,
"index-bg"
,
"index-active-fg"
,
"index-active-bg"
};
for
(
size_t
s
=
0
;
s
<
LENGTH
(
index_settings
);
++
s
)
{
girara_template_add_variable
(
csstemplate
,
index_settings
[
s
]);
char
*
tmp_value
=
NULL
;
GdkRGBA
rgba
=
{
0
,
0
,
0
,
0
};
girara_setting_get
(
zathura
->
ui
.
session
,
index_settings
[
s
],
&
tmp_value
);
if
(
tmp_value
!=
NULL
)
{
gdk_rgba_parse
(
&
rgba
,
tmp_value
);
g_free
(
tmp_value
);
}
char
*
color
=
gdk_rgba_to_string
(
&
rgba
);
girara_template_set_variable_value
(
csstemplate
,
index_settings
[
s
],
color
);
g_free
(
color
);
}
char
*
css
=
g_strdup_printf
(
"%s
\n
%s"
,
girara_template_get_base
(
csstemplate
),
CSS_TEMPLATE_INDEX
);
girara_template_set_base
(
csstemplate
,
css
);
g_free
(
css
);
/* Start D-Bus service */
bool
dbus
=
true
;
girara_setting_get
(
zathura
->
ui
.
session
,
"dbus-service"
,
&
dbus
);
...
...
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