mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2025-01-30 17:24:55 +01:00
readd tabbed support
This commit is contained in:
parent
b2fc17207e
commit
298c9d2c7a
1 changed files with 54 additions and 52 deletions
108
zathura.c
108
zathura.c
|
@ -36,63 +36,12 @@ zathura_init(int argc, char* argv[])
|
|||
zathura->plugins.path = girara_list_new();
|
||||
girara_list_set_free_function(zathura->plugins.path, g_free);
|
||||
|
||||
/* UI */
|
||||
if ((zathura->ui.session = girara_session_create()) == NULL) {
|
||||
goto error_out;
|
||||
}
|
||||
|
||||
if (girara_session_init(zathura->ui.session) == false) {
|
||||
goto error_out;
|
||||
}
|
||||
|
||||
zathura->ui.session->global.data = zathura;
|
||||
zathura->ui.statusbar.file = NULL;
|
||||
zathura->ui.statusbar.buffer = NULL;
|
||||
zathura->ui.statusbar.page_number = NULL;
|
||||
zathura->ui.page_view = NULL;
|
||||
zathura->ui.index = NULL;
|
||||
|
||||
/* page view */
|
||||
zathura->ui.page_view = gtk_vbox_new(FALSE, 0);
|
||||
if (!zathura->ui.page_view) {
|
||||
goto error_free;
|
||||
}
|
||||
|
||||
gtk_widget_show(zathura->ui.page_view);
|
||||
gtk_box_set_spacing(GTK_BOX(zathura->ui.page_view), 0);
|
||||
|
||||
/* statusbar */
|
||||
zathura->ui.statusbar.file = girara_statusbar_item_add(zathura->ui.session, TRUE, TRUE, TRUE, NULL);
|
||||
if (zathura->ui.statusbar.file == NULL) {
|
||||
goto error_free;
|
||||
}
|
||||
|
||||
zathura->ui.statusbar.buffer = girara_statusbar_item_add(zathura->ui.session, FALSE, FALSE, FALSE, NULL);
|
||||
if (zathura->ui.statusbar.buffer == NULL) {
|
||||
goto error_free;
|
||||
}
|
||||
|
||||
zathura->ui.statusbar.page_number = girara_statusbar_item_add(zathura->ui.session, FALSE, FALSE, FALSE, NULL);
|
||||
if (!zathura->ui.statusbar.page_number) {
|
||||
goto error_free;
|
||||
}
|
||||
|
||||
girara_statusbar_item_set_text(zathura->ui.session, zathura->ui.statusbar.file, "[No Name]");
|
||||
|
||||
/* signals */
|
||||
g_signal_connect(G_OBJECT(zathura->ui.session->gtk.window), "destroy", G_CALLBACK(cb_destroy), NULL);
|
||||
|
||||
GtkAdjustment* view_vadjustment = gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(zathura->ui.session->gtk.view));
|
||||
g_signal_connect(G_OBJECT(view_vadjustment), "value-changed", G_CALLBACK(cb_view_vadjustment_value_changed), zathura);
|
||||
|
||||
/* girara events */
|
||||
zathura->ui.session->events.buffer_changed = buffer_changed;
|
||||
|
||||
/* parse command line options */
|
||||
GdkNativeWindow embed = 0;
|
||||
gchar* config_dir = NULL, *data_dir = NULL, *plugin_path = NULL;
|
||||
GOptionEntry entries[] =
|
||||
{
|
||||
/* { "reparent", 'e', 0, G_OPTION_ARG_INT, &Zathura.UI.embed, "Reparents to window specified by xid", "xid" }, */
|
||||
{ "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" },
|
||||
{ "plugins-dir", 'p', 0, G_OPTION_ARG_STRING, &plugin_path, "Path to the directories containing plugins", "path" },
|
||||
|
@ -140,6 +89,59 @@ zathura_init(int argc, char* argv[])
|
|||
girara_list_append(zathura->plugins.path, g_strdup("/usr/lib/zathura"));
|
||||
}
|
||||
|
||||
/* UI */
|
||||
if ((zathura->ui.session = girara_session_create()) == NULL) {
|
||||
goto error_out;
|
||||
}
|
||||
|
||||
zathura->ui.session->gtk.embed = embed;
|
||||
if (girara_session_init(zathura->ui.session) == false) {
|
||||
goto error_out;
|
||||
}
|
||||
|
||||
zathura->ui.session->global.data = zathura;
|
||||
zathura->ui.statusbar.file = NULL;
|
||||
zathura->ui.statusbar.buffer = NULL;
|
||||
zathura->ui.statusbar.page_number = NULL;
|
||||
zathura->ui.page_view = NULL;
|
||||
zathura->ui.index = NULL;
|
||||
|
||||
/* page view */
|
||||
zathura->ui.page_view = gtk_vbox_new(FALSE, 0);
|
||||
if (!zathura->ui.page_view) {
|
||||
goto error_free;
|
||||
}
|
||||
|
||||
gtk_widget_show(zathura->ui.page_view);
|
||||
gtk_box_set_spacing(GTK_BOX(zathura->ui.page_view), 0);
|
||||
|
||||
/* statusbar */
|
||||
zathura->ui.statusbar.file = girara_statusbar_item_add(zathura->ui.session, TRUE, TRUE, TRUE, NULL);
|
||||
if (zathura->ui.statusbar.file == NULL) {
|
||||
goto error_free;
|
||||
}
|
||||
|
||||
zathura->ui.statusbar.buffer = girara_statusbar_item_add(zathura->ui.session, FALSE, FALSE, FALSE, NULL);
|
||||
if (zathura->ui.statusbar.buffer == NULL) {
|
||||
goto error_free;
|
||||
}
|
||||
|
||||
zathura->ui.statusbar.page_number = girara_statusbar_item_add(zathura->ui.session, FALSE, FALSE, FALSE, NULL);
|
||||
if (!zathura->ui.statusbar.page_number) {
|
||||
goto error_free;
|
||||
}
|
||||
|
||||
girara_statusbar_item_set_text(zathura->ui.session, zathura->ui.statusbar.file, "[No Name]");
|
||||
|
||||
/* signals */
|
||||
g_signal_connect(G_OBJECT(zathura->ui.session->gtk.window), "destroy", G_CALLBACK(cb_destroy), NULL);
|
||||
|
||||
GtkAdjustment* view_vadjustment = gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(zathura->ui.session->gtk.view));
|
||||
g_signal_connect(G_OBJECT(view_vadjustment), "value-changed", G_CALLBACK(cb_view_vadjustment_value_changed), zathura);
|
||||
|
||||
/* girara events */
|
||||
zathura->ui.session->events.buffer_changed = buffer_changed;
|
||||
|
||||
/* load plugins */
|
||||
zathura_document_plugins_load(zathura);
|
||||
|
||||
|
|
Loading…
Reference in a new issue