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
488fb4ae
Commit
488fb4ae
authored
Dec 26, 2009
by
Moritz Lipp
Browse files
Set page and update status
parent
0f2e9508
Changes
2
Hide whitespace changes
Inline
Side-by-side
config.def.h
View file @
488fb4ae
...
...
@@ -42,7 +42,7 @@ Shortcut shortcuts[] = {
{
0
,
GDK_i
,
sc_change_mode
,
NORMAL
,
{
INSERT
}
},
{
0
,
GDK_v
,
sc_change_mode
,
NORMAL
,
{
VISUAL
}
},
{
0
,
GDK_colon
,
sc_focus_inputbar
,
-
1
,
{
.
data
=
":"
}
},
{
0
,
GDK_o
,
sc_focus_inputbar
,
-
1
,
{
.
data
=
":open"
}
},
{
0
,
GDK_o
,
sc_focus_inputbar
,
-
1
,
{
.
data
=
":open
"
}
},
{
0
,
GDK_r
,
sc_rotate
,
-
1
,
{
0
}
},
{
0
,
GDK_h
,
sc_scroll
,
-
1
,
{
LEFT
}
},
{
0
,
GDK_j
,
sc_scroll
,
-
1
,
{
UP
}
},
...
...
zathura.c
View file @
488fb4ae
...
...
@@ -155,6 +155,12 @@ struct
GtkLabel
*
status_state
;
}
Global
;
struct
{
char
*
filename
;
char
*
pages
;
}
State
;
struct
{
PopplerDocument
*
document
;
...
...
@@ -170,8 +176,9 @@ struct
void
init_zathura
();
void
change_mode
(
int
);
void
notify
(
int
,
char
*
);
void
update_status
(
char
*
,
char
*
);
void
update_status
();
void
setCompletionRowColor
(
GtkBox
*
,
int
,
int
);
void
set_page
(
int
);
GtkEventBox
*
createCompletionRow
(
GtkBox
*
,
char
*
,
char
*
,
gboolean
);
/* shortcut declarations */
...
...
@@ -246,6 +253,9 @@ init_zathura()
/* other */
Zathura
.
Global
.
mode
=
NORMAL
;
Zathura
.
State
.
filename
=
"[No Name]"
;
Zathura
.
State
.
pages
=
""
;
/* UI */
Zathura
.
UI
.
window
=
GTK_WINDOW
(
gtk_window_new
(
GTK_WINDOW_TOPLEVEL
));
Zathura
.
UI
.
box
=
GTK_BOX
(
gtk_vbox_new
(
FALSE
,
0
));
...
...
@@ -370,15 +380,13 @@ void notify(int level, char* message)
}
void
update_status
(
char
*
text
,
char
*
state
)
update_status
()
{
/* update text */
if
(
text
)
gtk_label_set_markup
((
GtkLabel
*
)
Zathura
.
Global
.
status_text
,
text
);
gtk_label_set_markup
((
GtkLabel
*
)
Zathura
.
Global
.
status_text
,
Zathura
.
State
.
filename
);
/* update state */
if
(
state
)
gtk_label_set_markup
((
GtkLabel
*
)
Zathura
.
Global
.
status_state
,
state
);
gtk_label_set_markup
((
GtkLabel
*
)
Zathura
.
Global
.
status_state
,
Zathura
.
State
.
pages
);
}
GtkEventBox
*
...
...
@@ -462,6 +470,19 @@ setCompletionRowColor(GtkBox* results, int mode, int id)
}
}
void
set_page
(
int
page
)
{
if
(
page
>
Zathura
.
PDF
.
number_of_pages
||
page
<
1
)
{
notify
(
WARNING
,
"Could not open page"
);
return
;
}
Zathura
.
PDF
.
page_number
=
page
;
Zathura
.
State
.
pages
=
g_strdup_printf
(
"[%i/%i]"
,
page
,
Zathura
.
PDF
.
number_of_pages
);
}
/* shortcut implementation */
void
sc_abort
(
Argument
*
argument
)
...
...
@@ -901,10 +922,11 @@ cmd_open(int argc, char** argv)
return
FALSE
;
}
Zathura
.
PDF
.
page_number
=
0
;
Zathura
.
PDF
.
number_of_pages
=
poppler_document_get_n_pages
(
Zathura
.
PDF
.
document
);
Zathura
.
PDF
.
file
=
file
;
set_page
(
1
);
return
TRUE
;
}
...
...
@@ -1156,7 +1178,7 @@ int main(int argc, char* argv[])
gtk_init
(
&
argc
,
&
argv
);
init_zathura
();
update_status
(
"Text"
,
"State"
);
update_status
();
gtk_widget_show_all
(
GTK_WIDGET
(
Zathura
.
UI
.
window
));
gtk_main
();
...
...
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