Set show_inputbar/statusbar

This commit is contained in:
Moritz Lipp 2010-06-21 21:00:59 +02:00
parent 22fd1c1ace
commit 2f1f105f73
2 changed files with 36 additions and 7 deletions

View file

@ -211,6 +211,8 @@ Setting settings[] = {
{"recolor_lightcolor", &(recolor_lightcolor), 's', FALSE, TRUE, "Recoloring (light color)"}, {"recolor_lightcolor", &(recolor_lightcolor), 's', FALSE, TRUE, "Recoloring (light color)"},
{"scroll_step", &(scroll_step), 'f', FALSE, FALSE, "Scroll step"}, {"scroll_step", &(scroll_step), 'f', FALSE, FALSE, "Scroll step"},
{"scrollbars", &(show_scrollbars), 'b', FALSE, TRUE, "Show scrollbars"}, {"scrollbars", &(show_scrollbars), 'b', FALSE, TRUE, "Show scrollbars"},
{"show_statusbar", &(Zathura.Global.show_statusbar), 'b', FALSE, TRUE, "Show statusbar"},
{"show_inputbar", &(Zathura.Global.show_inputbar), 'b', FALSE, TRUE, "Show inputbar"},
{"search_highlight", &(search_highlight), 's', FALSE, TRUE, "Highlighted results"}, {"search_highlight", &(search_highlight), 's', FALSE, TRUE, "Highlighted results"},
{"select_text", &(select_text), 's', FALSE, TRUE, "Rectangle of the selected text"}, {"select_text", &(select_text), 's', FALSE, TRUE, "Rectangle of the selected text"},
{"statusbar_bgcolor", &(statusbar_bgcolor), 's', FALSE, TRUE, "Statusbar background color"}, {"statusbar_bgcolor", &(statusbar_bgcolor), 's', FALSE, TRUE, "Statusbar background color"},

View file

@ -242,6 +242,8 @@ struct
int goto_mode; int goto_mode;
int adjust_mode; int adjust_mode;
gboolean show_index; gboolean show_index;
gboolean show_statusbar;
gboolean show_inputbar;
} Global; } Global;
struct struct
@ -487,6 +489,18 @@ init_look()
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(Zathura.UI.view), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(Zathura.UI.view), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
else else
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(Zathura.UI.view), GTK_POLICY_NEVER, GTK_POLICY_NEVER); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(Zathura.UI.view), GTK_POLICY_NEVER, GTK_POLICY_NEVER);
/* inputbar */
if(Zathura.Global.show_inputbar)
gtk_widget_show(GTK_WIDGET(Zathura.UI.inputbar));
else
gtk_widget_hide(GTK_WIDGET(Zathura.UI.inputbar));
/* statusbar */
if(Zathura.Global.show_statusbar)
gtk_widget_show(GTK_WIDGET(Zathura.UI.statusbar));
else
gtk_widget_hide(GTK_WIDGET(Zathura.UI.statusbar));
} }
void void
@ -565,11 +579,13 @@ init_zathura()
g_static_mutex_init(&(Zathura.Lock.select_lock)); g_static_mutex_init(&(Zathura.Lock.select_lock));
/* other */ /* other */
Zathura.Global.mode = NORMAL; Zathura.Global.mode = NORMAL;
Zathura.Global.viewing_mode = NORMAL; Zathura.Global.viewing_mode = NORMAL;
Zathura.Global.recolor = 0; Zathura.Global.recolor = 0;
Zathura.Global.goto_mode = GOTO_MODE; Zathura.Global.goto_mode = GOTO_MODE;
Zathura.Global.show_index = FALSE; Zathura.Global.show_index = FALSE;
Zathura.Global.show_inputbar = TRUE;
Zathura.Global.show_statusbar = TRUE;
Zathura.State.pages = g_strdup_printf(""); Zathura.State.pages = g_strdup_printf("");
Zathura.State.scroll_percentage = 0; Zathura.State.scroll_percentage = 0;
@ -1701,6 +1717,9 @@ sc_change_mode(Argument* argument)
void void
sc_focus_inputbar(Argument* argument) sc_focus_inputbar(Argument* argument)
{ {
if(!(GTK_WIDGET_VISIBLE(GTK_WIDGET(Zathura.UI.inputbar))))
gtk_widget_show(GTK_WIDGET(Zathura.UI.inputbar));
if(argument->data) if(argument->data)
{ {
notify(DEFAULT, argument->data); notify(DEFAULT, argument->data);
@ -2173,6 +2192,9 @@ isc_abort(Argument* argument)
notify(DEFAULT, ""); notify(DEFAULT, "");
gtk_widget_grab_focus(GTK_WIDGET(Zathura.UI.view)); gtk_widget_grab_focus(GTK_WIDGET(Zathura.UI.view));
if(!Zathura.Global.show_inputbar)
gtk_widget_hide(GTK_WIDGET(Zathura.UI.inputbar));
} }
void void
@ -2985,7 +3007,7 @@ gboolean
cmd_open(int argc, char** argv) cmd_open(int argc, char** argv)
{ {
if(argc == 0 || strlen(argv[0]) == 0) if(argc == 0 || strlen(argv[0]) == 0)
return FALSE; return TRUE;
/* assembly the arguments back to one string */ /* assembly the arguments back to one string */
int i = 0; int i = 0;
@ -4148,7 +4170,6 @@ int main(int argc, char* argv[])
gtk_init(&argc, &argv); gtk_init(&argc, &argv);
init_zathura(); init_zathura();
init_keylist(); init_keylist();
read_configuration(); read_configuration();
@ -4165,6 +4186,12 @@ int main(int argc, char* argv[])
gtk_widget_show_all(GTK_WIDGET(Zathura.UI.window)); gtk_widget_show_all(GTK_WIDGET(Zathura.UI.window));
gtk_widget_grab_focus(GTK_WIDGET(Zathura.UI.view)); gtk_widget_grab_focus(GTK_WIDGET(Zathura.UI.view));
if(!Zathura.Global.show_inputbar)
gtk_widget_hide(GTK_WIDGET(Zathura.UI.inputbar));
if(!Zathura.Global.show_statusbar)
gtk_widget_hide(GTK_WIDGET(Zathura.UI.statusbar));
gdk_threads_enter(); gdk_threads_enter();
gtk_main(); gtk_main();
gdk_threads_leave(); gdk_threads_leave();