void create_mainwindow(void) { char *imagename; GtkWidget *vbox_gs; GtkWidget *menu; GtkWidget *hbox25; GtkWidget *tab_button_icon; GtkWidget *label; #ifndef USE_WEBKIT2 GtkWidget *scrolledwindow; #endif GtkWidget *box_book; GdkPixbuf *pixbuf; /* GTK_SHADOW_NONE GTK_SHADOW_IN GTK_SHADOW_OUT GTK_SHADOW_ETCHED_IN GTK_SHADOW_ETCHED_OUT */ settings.shadow_type = GTK_SHADOW_IN; XI_print(("%s xiphos-%s\n", "Starting", VERSION)); XI_print(("%s\n\n", "Building Xiphos interface")); widgets.studypad_dialog = NULL; /* A rough scektch of the main window (widgets.app) and it's children * widgets.app * | * vbox_gs * | * +--|----+ * | | * menu hbox25 * | * widgets.epaned * | * widgets.vboxMain * | | * widgets.hboxtb widgets.page * | | * widgets.hpaned nav_toolbar * | | * widgets.vpaned---+ +----------------------------widgets.vpaned2---------------+ * | | | | * widgets.vbox_previewer widgets.vbox_text widgets.notebook_comm_book widgets.box_dict * | | | * widgets.notebook_bible_parallel widgets.box_comm box_book * | * widgets.notebook_text * */ // The toplevel Xiphos window widgets.app = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_title(GTK_WINDOW(widgets.app), _("Xiphos - Bible Study Software")); g_object_set_data(G_OBJECT(widgets.app), "widgets.app", widgets.app); gtk_widget_set_size_request(widgets.app, 680, 425); gtk_widget_set_can_focus(widgets.app, 1); gtk_window_set_resizable(GTK_WINDOW(widgets.app), TRUE); // The app icon. // FIXME:: This should be a big copy of the logo because GTK does the scaling (GTK 3.16?) imagename = image_locator("gs2-48x48.png"); pixbuf = gdk_pixbuf_new_from_file(imagename, NULL); g_free(imagename); gtk_window_set_icon(GTK_WINDOW(widgets.app), pixbuf); // The main box for our toplevel window. UI_VBOX(vbox_gs, FALSE, 0); gtk_widget_show(vbox_gs); gtk_container_add(GTK_CONTAINER(widgets.app), vbox_gs); // Add the main menu. menu = gui_create_main_menu(); gtk_box_pack_start(GTK_BOX(vbox_gs), menu, FALSE, TRUE, 0); // Another box UI_HBOX(hbox25, FALSE, 0); gtk_widget_show(hbox25); gtk_box_pack_start(GTK_BOX(vbox_gs), hbox25, TRUE, TRUE, 0); // widgets.epaned widgets.epaned = UI_HPANE(); gtk_widget_show(widgets.epaned); #ifndef HAVE_GTK_314 gtk_container_set_border_width(GTK_CONTAINER(widgets.epaned), 4); #endif gtk_box_pack_start(GTK_BOX(hbox25), widgets.epaned, TRUE, TRUE, 0); // Another box UI_VBOX(widgets.vboxMain, FALSE, 0); gtk_widget_show(widgets.vboxMain); gtk_paned_pack2(GTK_PANED(widgets.epaned), widgets.vboxMain, TRUE, TRUE); #ifndef HAVE_GTK_314 gtk_container_set_border_width(GTK_CONTAINER(widgets.vboxMain), 2); #endif /* * Notebook to have separate passages opened at once the passages are not * actually open but are switched between similar to bookmarks */ UI_HBOX(widgets.hboxtb, FALSE, 0); if (settings.browsing) gtk_widget_show(widgets.hboxtb); gtk_box_pack_start(GTK_BOX(widgets.vboxMain), widgets.hboxtb, FALSE, FALSE, 0); widgets.button_new_tab = gtk_button_new(); // Don't show button here in case !settings.browsing #ifdef HAVE_GTK_310 tab_button_icon = gtk_image_new_from_icon_name("tab-new-symbolic", GTK_ICON_SIZE_SMALL_TOOLBAR); #else tab_button_icon = gtk_image_new_from_stock(GTK_STOCK_ADD, GTK_ICON_SIZE_SMALL_TOOLBAR); #endif gtk_widget_show(tab_button_icon); gtk_container_add(GTK_CONTAINER(widgets.button_new_tab), tab_button_icon); gtk_button_set_relief(GTK_BUTTON(widgets.button_new_tab), GTK_RELIEF_NONE); gtk_box_pack_start(GTK_BOX(widgets.hboxtb), widgets.button_new_tab, FALSE, FALSE, 0); gtk_widget_set_tooltip_text(widgets.button_new_tab, _("Open a new tab")); widgets.notebook_main = gtk_notebook_new(); gtk_widget_show(widgets.notebook_main); gtk_box_pack_start(GTK_BOX(widgets.hboxtb), widgets.notebook_main, TRUE, TRUE, 0); gtk_widget_set_size_request(widgets.notebook_main, -1, 25); gtk_notebook_set_scrollable(GTK_NOTEBOOK(widgets.notebook_main), TRUE); gtk_notebook_popup_enable(GTK_NOTEBOOK(widgets.notebook_main)); gtk_notebook_set_show_border(GTK_NOTEBOOK(widgets.notebook_main), FALSE); // Main passage tabbed notebook end // Another box UI_VBOX(widgets.page, FALSE, 0); gtk_widget_show(widgets.page); gtk_box_pack_start(GTK_BOX(widgets.vboxMain), widgets.page, TRUE, TRUE, 0); //nav toolbar nav_toolbar = gui_navbar_versekey_new(); gtk_box_pack_start(GTK_BOX(widgets.page), nav_toolbar, FALSE, FALSE, 0); // widgets.hpaned widgets.hpaned = UI_HPANE(); gtk_widget_show(widgets.hpaned); gtk_box_pack_start(GTK_BOX(widgets.page), widgets.hpaned, TRUE, TRUE, 0); // widgets.vpaned widgets.vpaned = UI_VPANE(); gtk_widget_show(widgets.vpaned); gtk_widget_set_size_request(widgets.vpaned, 50, -1); gtk_paned_pack1(GTK_PANED(widgets.hpaned), widgets.vpaned, TRUE, FALSE); // widgets.vpaned2 widgets.vpaned2 = UI_VPANE(); gtk_widget_show(widgets.vpaned2); gtk_widget_set_size_request(widgets.vpaned2, 50, -1); gtk_paned_pack2(GTK_PANED(widgets.hpaned), widgets.vpaned2, TRUE, FALSE); // widgets.vbox_text UI_VBOX(widgets.vbox_text, FALSE, 0); gtk_widget_show(widgets.vbox_text); gtk_paned_pack1(GTK_PANED(widgets.vpaned), widgets.vbox_text, TRUE, TRUE); // Bible/parallel notebook widgets.notebook_bible_parallel = gtk_notebook_new(); gtk_widget_show(widgets.notebook_bible_parallel); gtk_box_pack_start(GTK_BOX(widgets.vbox_text), widgets.notebook_bible_parallel, TRUE, TRUE, 0); gtk_notebook_set_tab_pos(GTK_NOTEBOOK(widgets.notebook_bible_parallel), GTK_POS_BOTTOM); gtk_notebook_set_show_tabs(GTK_NOTEBOOK(widgets.notebook_bible_parallel), TRUE); gtk_notebook_set_show_border(GTK_NOTEBOOK(widgets.notebook_bible_parallel), FALSE); gtk_container_set_border_width(GTK_CONTAINER(widgets.notebook_bible_parallel), 1); g_signal_connect(G_OBJECT(widgets.notebook_bible_parallel), "change-current-page", G_CALLBACK(on_notebook_bible_parallel_switch_page), NULL); // Text notebook (The bible text show in the standard view) widgets.notebook_text = gui_create_bible_pane(); gtk_container_add(GTK_CONTAINER(widgets.notebook_bible_parallel), widgets.notebook_text); label = gtk_label_new(_("Standard View")); gtk_widget_show(label); gtk_notebook_set_tab_label(GTK_NOTEBOOK(widgets.notebook_bible_parallel), gtk_notebook_get_nth_page(GTK_NOTEBOOK(widgets.notebook_bible_parallel), 0), label); // Another box (For the previewer?) UI_VBOX(widgets.vbox_previewer, FALSE, 0); gtk_widget_show(widgets.vbox_previewer); gtk_paned_pack2(GTK_PANED(widgets.vpaned), widgets.vbox_previewer, TRUE, TRUE); gtk_container_set_border_width(GTK_CONTAINER(widgets.vbox_previewer), 2); #ifndef USE_WEBKIT2 scrolledwindow = gtk_scrolled_window_new(NULL, NULL); gtk_widget_show(scrolledwindow); gtk_box_pack_start(GTK_BOX(widgets.vbox_previewer), scrolledwindow, TRUE, TRUE, 0); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolledwindow), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); gtk_scrolled_window_set_shadow_type((GtkScrolledWindow *) scrolledwindow, settings.shadow_type); #endif widgets.html_previewer_text = GTK_WIDGET(XIPHOS_HTML_NEW(NULL, FALSE, VIEWER_TYPE)); gtk_widget_show(widgets.html_previewer_text); #ifdef USE_WEBKIT2 gtk_box_pack_start(GTK_BOX(widgets.vbox_previewer), widgets.html_previewer_text, TRUE, TRUE, 0); #else gtk_container_add(GTK_CONTAINER(scrolledwindow), widgets.html_previewer_text); #endif // Commentary/book notebook widgets.notebook_comm_book = gtk_notebook_new(); gtk_widget_show(widgets.notebook_comm_book); gtk_paned_pack1(GTK_PANED(widgets.vpaned2), widgets.notebook_comm_book, TRUE, TRUE); gtk_container_set_border_width(GTK_CONTAINER(widgets.notebook_comm_book), 1); gtk_notebook_set_tab_pos(GTK_NOTEBOOK(widgets.notebook_comm_book), GTK_POS_BOTTOM); gtk_notebook_set_show_tabs(GTK_NOTEBOOK(widgets.notebook_comm_book), TRUE); gtk_notebook_set_show_border(GTK_NOTEBOOK(widgets.notebook_comm_book), FALSE); // Commentary pane widgets.box_comm = gui_create_commentary_pane(); gtk_container_add(GTK_CONTAINER(widgets.notebook_comm_book), widgets.box_comm); label = gtk_label_new(_("Commentary View")); gtk_widget_show(label); gtk_notebook_set_tab_label(GTK_NOTEBOOK(widgets.notebook_comm_book), gtk_notebook_get_nth_page(GTK_NOTEBOOK(widgets.notebook_comm_book), 0), label); // Book pane box_book = gui_create_book_pane(); gtk_container_add(GTK_CONTAINER(widgets.notebook_comm_book), box_book); label = gtk_label_new(_("Book View")); gtk_widget_show(label); gtk_notebook_set_tab_label(GTK_NOTEBOOK(widgets.notebook_comm_book), gtk_notebook_get_nth_page(GTK_NOTEBOOK(widgets.notebook_comm_book), 1), label); // Dict/lex widgets.box_dict = gui_create_dictionary_pane(); gtk_paned_pack2(GTK_PANED(widgets.vpaned2), widgets.box_dict, TRUE, TRUE); // Statusbar widgets.appbar = gtk_statusbar_new(); if (settings.statusbar) { gtk_widget_show(widgets.appbar); } #ifndef USE_GTK_3 gtk_statusbar_set_has_resize_grip(GTK_STATUSBAR(widgets.appbar), TRUE); #endif gtk_box_pack_start(GTK_BOX(vbox_gs), widgets.appbar, FALSE, TRUE, 0); gui_set_statusbar(_("Welcome to Xiphos")); g_signal_connect((gpointer)vbox_gs, "key_press_event", G_CALLBACK(on_vbox1_key_press_event), NULL); g_signal_connect((gpointer)vbox_gs, "key_release_event", G_CALLBACK(on_vbox1_key_release_event), NULL); g_signal_connect(G_OBJECT(widgets.notebook_comm_book), "switch_page", G_CALLBACK(on_notebook_comm_book_switch_page), NULL); g_signal_connect(G_OBJECT(widgets.app), "delete_event", G_CALLBACK(delete_event), NULL); g_signal_connect((gpointer)widgets.app, "configure_event", G_CALLBACK(on_configure_event), NULL); g_signal_connect(G_OBJECT(widgets.epaned), "button_release_event", G_CALLBACK(epaned_button_release_event), (gchar *)"epaned"); g_signal_connect(G_OBJECT(widgets.vpaned), "button_release_event", G_CALLBACK(epaned_button_release_event), (gchar *)"vpaned"); g_signal_connect(G_OBJECT(widgets.vpaned2), "button_release_event", G_CALLBACK(epaned_button_release_event), (gchar *)"vpaned2"); g_signal_connect(G_OBJECT(widgets.hpaned), "button_release_event", G_CALLBACK(epaned_button_release_event), (gchar *)"hpaned1"); gtk_widget_grab_focus(navbar_versekey.lookup_entry); gtk_window_set_default_size((GtkWindow *)widgets.app, settings.gs_width, settings.gs_height); main_window_created = TRUE; }
GtkWidget *gui_create_display_informtion_dialog(void) { GtkWidget *dialog_vbox23; GtkWidget *hbox; GtkWidget *dialog_action_area23; GtkWidget *hbuttonbox2; GtkWidget *button_close; GtkWidget *image; dialog_display_info = gtk_dialog_new(); gtk_container_set_border_width(GTK_CONTAINER(dialog_display_info), 6); g_object_set_data(G_OBJECT(dialog_display_info), "dialog_display_info", dialog_display_info); gtk_window_set_title(GTK_WINDOW(dialog_display_info), " "); //GTK_WINDOW(dialog_display_info)->type = GTK_WINDOW_TOPLEVEL; gtk_window_set_default_size(GTK_WINDOW(dialog_display_info), 350, 200); gtk_window_set_resizable(GTK_WINDOW(dialog_display_info), TRUE); #ifndef USE_GTK_3 gtk_dialog_set_has_separator(GTK_DIALOG(dialog_display_info), FALSE); #endif dialog_vbox23 = gtk_dialog_get_content_area(GTK_DIALOG(dialog_display_info)); //GTK_DIALOG(dialog_display_info)->vbox; g_object_set_data(G_OBJECT(dialog_display_info), "dialog_vbox23", dialog_vbox23); gtk_widget_show(dialog_vbox23); UI_HBOX(hbox, FALSE, 12); gtk_widget_show(hbox); gtk_box_pack_start(GTK_BOX(dialog_vbox23), hbox, TRUE, TRUE, 0); gtk_container_set_border_width(GTK_CONTAINER(hbox), 6); image = #ifdef HAVE_GTK_310 gtk_image_new_from_icon_name("dialog-information", GTK_ICON_SIZE_DIALOG); #else gtk_image_new_from_stock(GTK_STOCK_DIALOG_INFO, GTK_ICON_SIZE_DIALOG); #endif gtk_widget_show(image); gtk_box_pack_start(GTK_BOX(hbox), image, FALSE, TRUE, 0); #ifndef HAVE_GTK_310 gtk_misc_set_alignment(GTK_MISC(image), 0.5, 0); #endif html_widget = GTK_WIDGET(XIPHOS_HTML_NEW(NULL, FALSE, 30)); //gtk_html_new(); gtk_widget_show(html_widget); gtk_box_pack_start(GTK_BOX(hbox), html_widget, TRUE, TRUE, 0); //gtk_container_add(GTK_CONTAINER(scrolledwindow70), html_widget); dialog_action_area23 = #ifdef HAVE_GTK_312 gtk_dialog_get_content_area(GTK_DIALOG(dialog_display_info)); #else gtk_dialog_get_action_area(GTK_DIALOG(dialog_display_info)); #endif g_object_set_data(G_OBJECT(dialog_display_info), "dialog_action_area23", dialog_action_area23); gtk_widget_show(dialog_action_area23); gtk_container_set_border_width(GTK_CONTAINER(dialog_action_area23), 10); #ifdef USE_GTK_3 hbuttonbox2 = gtk_button_box_new(GTK_ORIENTATION_HORIZONTAL); #else hbuttonbox2 = gtk_hbutton_box_new(); #endif gtk_widget_show(hbuttonbox2); gtk_box_pack_start(GTK_BOX(dialog_action_area23), hbuttonbox2, TRUE, TRUE, 0); gtk_button_box_set_layout(GTK_BUTTON_BOX(hbuttonbox2), GTK_BUTTONBOX_END); button_close = #ifdef HAVE_GTK_310 gtk_button_new_from_icon_name("window-close", GTK_ICON_SIZE_BUTTON); #else gtk_button_new_from_stock(GTK_STOCK_CLOSE); #endif gtk_widget_show(button_close); gtk_container_add(GTK_CONTAINER(hbuttonbox2), button_close); gtk_widget_set_can_default(button_close, 1); g_signal_connect(G_OBJECT(button_close), "clicked", G_CALLBACK(button_close_clicked), NULL); g_signal_connect(G_OBJECT(dialog_display_info), "destroy", G_CALLBACK(on_dlgInformation_destroy), NULL); gtk_widget_show(dialog_display_info); gsI_isrunning = TRUE; return dialog_display_info; }
/****************************************************************************** * Name * create_parallel_dialog * * Synopsis * #include "parallel_dialog.h" * * GtkWidget *create_parallel_dialog(void) * * Description * * * * Return value * GtkWidget * */ static GtkWidget *create_parallel_dialog(void) { GtkWidget *box_parallel_labels; GtkWidget *dialog_vbox25; GtkWidget *toolbar29; GtkWidget *dialog_action_area25; GtkWidget *hbuttonbox4; GtkWidget *btnDockInt; #ifndef USE_WEBKIT2 GtkWidget *scrolled_window; #endif gchar title[256]; sprintf(title, "%s - %s", settings.program_title, _("Parallel")); dialog_parallel = gtk_dialog_new(); gtk_window_set_title(GTK_WINDOW(dialog_parallel), title); g_object_set_data(G_OBJECT(dialog_parallel), "dialog_parallel", dialog_parallel); gtk_window_resize(GTK_WINDOW(dialog_parallel), settings.parallel_width, settings.parallel_height); gtk_window_set_resizable(GTK_WINDOW(dialog_parallel), TRUE); dialog_vbox25 = gtk_dialog_get_content_area(GTK_DIALOG(dialog_parallel)); g_object_set_data(G_OBJECT(dialog_parallel), "dialog_vbox25", dialog_vbox25); gtk_widget_show(dialog_vbox25); UI_VBOX(vboxInt, FALSE, 0); gtk_widget_show(vboxInt); gtk_box_pack_start(GTK_BOX(dialog_vbox25), vboxInt, TRUE, TRUE, 0); toolbar29 = create_nav_toolbar(); gtk_widget_show(toolbar29); gtk_box_pack_start(GTK_BOX(vboxInt), toolbar29, FALSE, FALSE, 0); UI_HBOX(box_parallel_labels, TRUE, 2); gtk_widget_show(box_parallel_labels); gtk_box_pack_start(GTK_BOX(vboxInt), box_parallel_labels, FALSE, TRUE, 0); gtk_container_set_border_width(GTK_CONTAINER(box_parallel_labels), 2); #if 0 if (settings.parallel_list) { GtkWidget *plabel; gchar *label; gint modidx; for (modidx = 0; settings.parallel_list[modidx]; ++modidx) { plabel = gtk_label_new(NULL); gtk_widget_show(plabel); gtk_box_pack_start(GTK_BOX(box_parallel_labels), plabel, FALSE, FALSE, 0); gtk_label_set_use_markup(GTK_LABEL(plabel), TRUE); label = g_strdup_printf ("<span color='%s' weight='bold'>%s</span>", settings.bible_verse_num_color, settings.parallel_list[modidx]); gtk_label_set_markup(GTK_LABEL(plabel), label); g_free(label); } } #endif /* 0 */ #ifndef USE_WEBKIT2 scrolled_window = gtk_scrolled_window_new(NULL, NULL); gtk_widget_show(scrolled_window); gtk_box_pack_start(GTK_BOX(vboxInt), scrolled_window, TRUE, TRUE, 0); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled_window), GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); gtk_scrolled_window_set_shadow_type((GtkScrolledWindow *) scrolled_window, settings.shadow_type); #endif widgets.html_parallel_dialog = GTK_WIDGET(XIPHOS_HTML_NEW(NULL, FALSE, PARALLEL_TYPE)); gtk_widget_show(widgets.html_parallel_dialog); #ifdef USE_WEBKIT2 gtk_box_pack_start(GTK_BOX(vboxInt), widgets.html_parallel_dialog, TRUE, TRUE, 0); #else gtk_container_add(GTK_CONTAINER(scrolled_window), widgets.html_parallel_dialog); #endif g_signal_connect((gpointer)widgets.html_parallel_dialog, "popupmenu_requested", G_CALLBACK(_popupmenu_requested_cb), NULL); dialog_action_area25 = #ifdef HAVE_GTK_312 gtk_dialog_get_content_area(GTK_DIALOG(dialog_parallel)); #else gtk_dialog_get_action_area(GTK_DIALOG(dialog_parallel)); #endif g_object_set_data(G_OBJECT(dialog_parallel), "dialog_action_area25", dialog_action_area25); gtk_widget_show(dialog_action_area25); gtk_container_set_border_width(GTK_CONTAINER(dialog_action_area25), 10); #ifdef USE_GTK_3 hbuttonbox4 = gtk_button_box_new(GTK_ORIENTATION_HORIZONTAL); #else hbuttonbox4 = gtk_hbutton_box_new(); #endif gtk_widget_show(hbuttonbox4); #ifdef HAVE_GTK_312 gtk_box_pack_start(GTK_BOX(dialog_action_area25), hbuttonbox4, FALSE, TRUE, 3); #else gtk_box_pack_start(GTK_BOX(dialog_action_area25), hbuttonbox4, TRUE, TRUE, 0); #endif gtk_button_box_set_layout(GTK_BUTTON_BOX(hbuttonbox4), GTK_BUTTONBOX_END); btnDockInt = #ifdef HAVE_GTK_310 gtk_button_new_from_icon_name("window-close", GTK_ICON_SIZE_BUTTON); #else gtk_button_new_from_stock(GTK_STOCK_CLOSE); #endif gtk_widget_show(btnDockInt); gtk_container_add(GTK_CONTAINER(hbuttonbox4), btnDockInt); gtk_widget_set_can_default(btnDockInt, 1); g_signal_connect(G_OBJECT(dialog_parallel), "destroy", G_CALLBACK(on_dlgparallel_destroy), NULL); g_signal_connect(G_OBJECT(btnDockInt), "clicked", G_CALLBACK(gui_btnDockInt_clicked), NULL); g_signal_connect((gpointer)dialog_parallel, "configure_event", G_CALLBACK(on_parallel_configure_event), NULL); settings.display_parallel = 1; xml_set_value("Xiphos", "layout", "parallelopen", "1"); set_window_icon(GTK_WINDOW(dialog_parallel)); /* * (from xiphos.c) * a little paranoia: * clamp geometry values to a reasonable bound. * sometimes xiphos gets insane reconfig events as it dies, * especially if it's due to just shutting linux down. */ if ((settings.parallel_x < 0) || (settings.parallel_x > 2000)) settings.parallel_x = 40; if ((settings.parallel_y < 0) || (settings.parallel_y > 2000)) settings.parallel_y = 40; gtk_window_move(GTK_WINDOW(dialog_parallel), settings.parallel_x, settings.parallel_y); return dialog_parallel; }
GtkWidget *_create_parallel_tab(void) { GtkWidget *toolbar29; GtkWidget *box_parallel_labels; GtkWidget *scrolled_window; gtk_notebook_set_show_tabs(GTK_NOTEBOOK(widgets.notebook_bible_parallel), FALSE); gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets.notebook_bible_parallel), 0); gtk_notebook_set_show_border(GTK_NOTEBOOK(widgets.notebook_bible_parallel), TRUE); UI_VBOX(parallel_vbox, FALSE, 0); g_signal_connect(G_OBJECT(parallel_vbox), "destroy", G_CALLBACK(on_parallel_tab_destroy), NULL); gtk_widget_show(parallel_vbox); gtk_box_pack_start(GTK_BOX(widgets.page), parallel_vbox, TRUE, TRUE, 0); toolbar29 = create_nav_toolbar(); gtk_widget_show(toolbar29); gtk_box_pack_start(GTK_BOX(parallel_vbox), toolbar29, FALSE, FALSE, 0); UI_HBOX(box_parallel_labels, TRUE, 2); gtk_widget_show(box_parallel_labels); gtk_box_pack_start(GTK_BOX(parallel_vbox), box_parallel_labels, FALSE, TRUE, 0); gtk_container_set_border_width(GTK_CONTAINER(box_parallel_labels), 2); #if 0 if (settings.parallel_list) { GtkWidget *plabel; gchar *label; gint modidx; for (modidx = 0; settings.parallel_list[modidx]; ++modidx) { plabel = gtk_label_new(NULL); gtk_widget_show(plabel); gtk_box_pack_start(GTK_BOX(box_parallel_labels), plabel, FALSE, FALSE, 0); gtk_label_set_use_markup(GTK_LABEL(plabel), TRUE); label = g_strdup_printf ("<span color='%s' weight='bold'>%s</span>", settings.bible_verse_num_color, settings.parallel_list[modidx]); gtk_label_set_markup(GTK_LABEL(plabel), label); g_free(label); } } #endif /* 0 */ scrolled_window = gtk_scrolled_window_new(NULL, NULL); gtk_widget_show(scrolled_window); gtk_box_pack_start(GTK_BOX(parallel_vbox), scrolled_window, TRUE, TRUE, 0); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled_window), GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); gtk_scrolled_window_set_shadow_type((GtkScrolledWindow *) scrolled_window, settings.shadow_type); widgets.html_parallel_dialog = GTK_WIDGET(XIPHOS_HTML_NEW(NULL, FALSE, PARALLEL_TYPE)); gtk_widget_show(widgets.html_parallel_dialog); gtk_container_add(GTK_CONTAINER(scrolled_window), widgets.html_parallel_dialog); g_signal_connect((gpointer)widgets.html_parallel_dialog, "popupmenu_requested", G_CALLBACK(_popupmenu_requested_cb), NULL); gtk_widget_hide(widgets.hpaned); return parallel_vbox; }
GtkWidget *gui_navbar_book_new(void) { GtkWidget *vbox1; GtkWidget *hbox1; GtkWidget *image1; GtkWidget *arrow1; GtkWidget *image2; UI_VBOX(vbox1, FALSE, 0); gtk_widget_show(vbox1); UI_HBOX(hbox1, FALSE, 0); gtk_widget_show(hbox1); gtk_box_pack_start(GTK_BOX(vbox1), hbox1, FALSE, TRUE, 0); navbar_book.lookup_entry = gtk_entry_new(); gtk_widget_show(navbar_book.lookup_entry); gtk_box_pack_start(GTK_BOX(hbox1), navbar_book.lookup_entry, TRUE, TRUE, 0); gtk_editable_set_editable(GTK_EDITABLE(navbar_book.lookup_entry), TRUE); gtk_entry_set_invisible_char(GTK_ENTRY(navbar_book.lookup_entry), 9679); navbar_book.button_list = gtk_toggle_button_new(); gtk_widget_show(navbar_book.button_list); gtk_box_pack_start(GTK_BOX(hbox1), navbar_book.button_list, FALSE, FALSE, 0); #ifdef HAVE_GTK_314 arrow1 = gtk_image_new_from_icon_name("open-menu-symbolic", GTK_ICON_SIZE_BUTTON); #else arrow1 = gtk_arrow_new(GTK_ARROW_DOWN, GTK_SHADOW_OUT); #endif gtk_widget_show(arrow1); gtk_container_add(GTK_CONTAINER(navbar_book.button_list), arrow1); navbar_book.button_left = gtk_button_new(); gtk_widget_show(navbar_book.button_left); gtk_box_pack_start(GTK_BOX(hbox1), navbar_book.button_left, FALSE, FALSE, 0); gtk_widget_set_tooltip_text(navbar_book.button_left, _("Go outward, to the section containing this one")); gtk_button_set_relief(GTK_BUTTON(navbar_book.button_left), GTK_RELIEF_NONE); #ifdef HAVE_GTK_320 gtk_widget_set_focus_on_click(GTK_WIDGET(navbar_book.button_left), FALSE); #else gtk_button_set_focus_on_click(GTK_BUTTON(navbar_book.button_left), FALSE); #endif image1 = #ifdef HAVE_GTK_310 gtk_image_new_from_icon_name("go-previous-symbolic", GTK_ICON_SIZE_BUTTON); #else gtk_image_new_from_stock(GTK_STOCK_GO_BACK, GTK_ICON_SIZE_BUTTON); #endif gtk_widget_show(image1); gtk_container_add(GTK_CONTAINER(navbar_book.button_left), image1); navbar_book.button_up = gtk_button_new(); gtk_widget_show(navbar_book.button_up); gtk_box_pack_start(GTK_BOX(hbox1), navbar_book.button_up, FALSE, FALSE, 0); gtk_widget_set_tooltip_text(navbar_book.button_up, _("Go to previous item")); gtk_button_set_relief(GTK_BUTTON(navbar_book.button_up), GTK_RELIEF_NONE); #ifdef HAVE_GTK_320 gtk_widget_set_focus_on_click(GTK_WIDGET(navbar_book.button_up), FALSE); #else gtk_button_set_focus_on_click(GTK_BUTTON(navbar_book.button_up), FALSE); #endif image1 = #ifdef HAVE_GTK_310 gtk_image_new_from_icon_name("go-up-symbolic", GTK_ICON_SIZE_BUTTON); #else gtk_image_new_from_stock(GTK_STOCK_GO_UP, GTK_ICON_SIZE_BUTTON); #endif gtk_widget_show(image1); gtk_container_add(GTK_CONTAINER(navbar_book.button_up), image1); navbar_book.button_down = gtk_button_new(); gtk_widget_show(navbar_book.button_down); gtk_box_pack_start(GTK_BOX(hbox1), navbar_book.button_down, FALSE, FALSE, 0); gtk_widget_set_tooltip_text(navbar_book.button_down, _("Go to next item")); gtk_button_set_relief(GTK_BUTTON(navbar_book.button_down), GTK_RELIEF_NONE); #ifdef HAVE_GTK_320 gtk_widget_set_focus_on_click(GTK_WIDGET(navbar_book.button_down), FALSE); #else gtk_button_set_focus_on_click(GTK_BUTTON(navbar_book.button_down), FALSE); #endif image2 = #ifdef HAVE_GTK_310 gtk_image_new_from_icon_name("go-down-symbolic", GTK_ICON_SIZE_BUTTON); #else gtk_image_new_from_stock(GTK_STOCK_GO_DOWN, GTK_ICON_SIZE_BUTTON); #endif gtk_widget_show(image2); gtk_container_add(GTK_CONTAINER(navbar_book.button_down), image2); navbar_book.button_right = gtk_button_new(); gtk_widget_show(navbar_book.button_right); gtk_box_pack_start(GTK_BOX(hbox1), navbar_book.button_right, FALSE, FALSE, 0); gtk_widget_set_tooltip_text(navbar_book.button_right, _("Go inward, to the first subsection")); gtk_button_set_relief(GTK_BUTTON(navbar_book.button_right), GTK_RELIEF_NONE); #ifdef HAVE_GTK_320 gtk_widget_set_focus_on_click(GTK_WIDGET(navbar_book.button_right), FALSE); #else gtk_button_set_focus_on_click(GTK_BUTTON(navbar_book.button_right), FALSE); #endif image1 = #ifdef HAVE_GTK_310 gtk_image_new_from_icon_name("go-next-symbolic", GTK_ICON_SIZE_BUTTON); #else gtk_image_new_from_stock(GTK_STOCK_GO_FORWARD, GTK_ICON_SIZE_BUTTON); #endif gtk_widget_show(image1); gtk_container_add(GTK_CONTAINER(navbar_book.button_right), image1); g_signal_connect((gpointer)navbar_book.lookup_entry, "activate", G_CALLBACK(on_entry_activate), NULL); g_signal_connect((gpointer)navbar_book.button_up, "clicked", G_CALLBACK(on_button_prev_clicked), NULL); g_signal_connect((gpointer)navbar_book.button_down, "clicked", G_CALLBACK(on_button_next_clicked), NULL); g_signal_connect((gpointer)navbar_book.button_left, "clicked", G_CALLBACK(on_button_parent_clicked), NULL); g_signal_connect((gpointer)navbar_book.button_right, "clicked", G_CALLBACK(on_button_child_clicked), NULL); g_signal_connect((gpointer)navbar_book.button_list, "button_press_event", G_CALLBACK(select_button_press_callback), NULL); g_signal_connect((gpointer)navbar_book.lookup_entry, "key_press_event", G_CALLBACK(lookup_entry_press_callback), NULL); return vbox1; }
static GtkWidget *tab_widget_new(PASSAGE_TAB_INFO *tbinf, const gchar *label_text) { GtkWidget *box; #ifdef USE_GTK_3 // GdkRGBA color; #else GdkColor color; #endif g_return_val_if_fail(label_text != NULL, NULL); #ifdef HAVE_GTK_310 tbinf->button_close = gtk_button_new_from_icon_name("window-close-symbolic", GTK_ICON_SIZE_MENU); #else GtkWidget *tmp_toolbar_icon = gtk_image_new_from_stock(GTK_STOCK_CLOSE, GTK_ICON_SIZE_MENU); tbinf->button_close = gtk_button_new(); gtk_button_set_image(GTK_BUTTON(tbinf->button_close), tmp_toolbar_icon); gtk_button_set_relief(GTK_BUTTON(tbinf->button_close), GTK_RELIEF_NONE); #endif #ifndef USE_GTK_3 gtk_rc_parse_string("style \"tab-button-style\"\n" "{\n" " GtkWidget::focus-padding = 0\n" " GtkWidget::focus-line-width = 0\n" " xthickness = 0\n" " ythickness = 0\n" " GtkButton::internal-border = {0, 0, 0, 0}\n" " GtkButton::default-border = {0, 0, 0, 0}\n" " GtkButton::default-outside-border = {0, 0, 0, 0}\n" "}\n" "widget \"*.button-close\" style \"tab-button-style\""); gtk_widget_set_name(GTK_WIDGET(tbinf->button_close), "button-close"); #else gtk_widget_set_size_request(tbinf->button_close, 18, 16); #endif #ifndef USE_GTK_3 GtkRequisition r; gtk_widget_size_request(tbinf->button_close, &r); #endif gtk_widget_set_sensitive(tbinf->button_close, FALSE); gtk_widget_show(tbinf->button_close); tbinf->tab_label = GTK_LABEL(gtk_label_new(label_text)); gtk_widget_show(GTK_WIDGET(tbinf->tab_label)); #ifdef USE_GTK_3 #else color.red = 0; color.green = 0; color.blue = 0; gtk_widget_modify_fg(tbinf->button_close, GTK_STATE_NORMAL, &color); gtk_widget_modify_fg(tbinf->button_close, GTK_STATE_INSENSITIVE, &color); gtk_widget_modify_fg(tbinf->button_close, GTK_STATE_ACTIVE, &color); gtk_widget_modify_fg(tbinf->button_close, GTK_STATE_PRELIGHT, &color); gtk_widget_modify_fg(tbinf->button_close, GTK_STATE_SELECTED, &color); #endif UI_HBOX(box, FALSE, 0); gtk_box_pack_start(GTK_BOX(box), GTK_WIDGET(tbinf->tab_label), TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(box), tbinf->button_close, FALSE, FALSE, 0); gtk_widget_show(box); g_signal_connect(G_OBJECT(tbinf->button_close), "clicked", G_CALLBACK(on_notebook_main_close_page), tbinf); return box; }
static GtkWidget *gui_create_about_modules(void) { GtkWidget *dialog_about_mods; GtkWidget *dialog_vbox28; GtkWidget *vbox25; GtkWidget *hbox21; GtkWidget *pixmap; GtkWidget *frame73; #ifndef USE_WEBKIT2 GtkWidget *scrolledwindow30; #endif GtkWidget *dialog_action_area28; GtkWidget *hbuttonbox7; GtkWidget *button; dialog_about_mods = gtk_dialog_new(); g_object_set_data(G_OBJECT(dialog_about_mods), "dialog_about_mods", dialog_about_mods); gtk_window_set_title(GTK_WINDOW(dialog_about_mods), _("About Sword Module")); gtk_window_set_default_size(GTK_WINDOW(dialog_about_mods), 500, 400); gtk_window_set_resizable(GTK_WINDOW(dialog_about_mods), TRUE); dialog_vbox28 = gtk_dialog_get_content_area(GTK_DIALOG(dialog_about_mods)); g_object_set_data(G_OBJECT(dialog_about_mods), "dialog_vbox28", dialog_vbox28); gtk_widget_show(dialog_vbox28); UI_VBOX(vbox25, FALSE, 0); gtk_widget_show(vbox25); gtk_box_pack_start(GTK_BOX(dialog_vbox28), vbox25, TRUE, TRUE, 0); UI_HBOX(hbox21, FALSE, 0); gtk_widget_show(hbox21); gtk_box_pack_start(GTK_BOX(vbox25), hbox21, FALSE, TRUE, 0); pixmap = pixmap_finder("sword.png"); gtk_widget_show(pixmap); gtk_box_pack_start(GTK_BOX(hbox21), pixmap, TRUE, TRUE, 0); frame73 = gtk_frame_new(NULL); gtk_widget_show(frame73); gtk_box_pack_start(GTK_BOX(vbox25), frame73, TRUE, TRUE, 0); #ifndef USE_WEBKIT2 scrolledwindow30 = gtk_scrolled_window_new(NULL, NULL); gtk_widget_show(scrolledwindow30); gtk_container_add(GTK_CONTAINER(frame73), scrolledwindow30); gtk_widget_set_size_request(scrolledwindow30, 304, 183); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolledwindow30), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS); gtk_scrolled_window_set_shadow_type((GtkScrolledWindow *) scrolledwindow30, settings.shadow_type); #endif text_html = GTK_WIDGET(XIPHOS_HTML_NEW(NULL, FALSE, 12)); gtk_widget_show(text_html); g_signal_connect((gpointer)text_html, "popupmenu_requested", G_CALLBACK(_popupmenu_requested_cb), NULL); #ifdef USE_WEBKIT2 gtk_container_add(GTK_CONTAINER(frame73), text_html); #else gtk_container_add(GTK_CONTAINER(scrolledwindow30), text_html); #endif dialog_action_area28 = #ifdef HAVE_GTK_312 gtk_dialog_get_content_area(GTK_DIALOG(dialog_about_mods)); #else gtk_dialog_get_action_area(GTK_DIALOG(dialog_about_mods)); #endif g_object_set_data(G_OBJECT(dialog_about_mods), "dialog_action_area28", dialog_action_area28); gtk_widget_show(dialog_action_area28); gtk_container_set_border_width(GTK_CONTAINER(dialog_action_area28), 10); #ifdef USE_GTK_3 hbuttonbox7 = gtk_button_box_new(GTK_ORIENTATION_HORIZONTAL); #else hbuttonbox7 = gtk_hbutton_box_new(); #endif gtk_widget_show(hbuttonbox7); #ifdef HAVE_GTK_312 gtk_box_pack_start(GTK_BOX(dialog_action_area28), hbuttonbox7, FALSE, TRUE, 3); #else gtk_box_pack_start(GTK_BOX(dialog_action_area28), hbuttonbox7, TRUE, TRUE, 0); #endif gtk_button_box_set_layout(GTK_BUTTON_BOX(hbuttonbox7), GTK_BUTTONBOX_END); button = #ifdef HAVE_GTK_310 gtk_button_new_with_mnemonic(_("Close")); #else gtk_button_new_from_stock(GTK_STOCK_CLOSE); #endif gtk_widget_show(button); gtk_container_add(GTK_CONTAINER(hbuttonbox7), button); #ifdef HAVE_GTK_218 gtk_widget_set_can_default(button, TRUE); #else #ifdef USE_GTK_3 gtk_widget_set_can_default(button, 1); #else GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT); #endif #endif g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(about_modules_ok), NULL); return dialog_about_mods; }
static void create_find_dialog(GtkWidget *htmlwidget) { GtkWidget *dialog_vbox29; GtkWidget *vbox45; GtkWidget *label180; GtkWidget *hbox66; GtkWidget *dialog_action_area29; GtkWidget *hbuttonbox8; #ifndef HAVE_GTK_310 GtkWidget *alignment; #endif GtkWidget *hbox5; GtkWidget *image; GtkWidget *label12; //gchar title[80]; //sprintf(title, "%s - %s", settings.program_title, _("Find")); dialog = g_new(FIND_DIALOG, 1); /* must be freed */ dialog->regular = FALSE; dialog->htmlwidget = htmlwidget; dialog->dialog = gtk_dialog_new(); g_object_set_data(G_OBJECT(dialog->dialog), "dialog->dialog", dialog->dialog); gtk_window_set_title(GTK_WINDOW(dialog->dialog), _("Find")); //GTK_WINDOW(dialog->dialog)->type = GTK_WINDOW_TOPLEVEL; /*gtk_window_set_policy(GTK_WINDOW(dialog->dialog), TRUE, TRUE, FALSE); */ gtk_container_set_border_width(GTK_CONTAINER(dialog->dialog), 6); gtk_window_set_resizable(GTK_WINDOW(dialog->dialog), FALSE); #ifndef USE_GTK_3 gtk_dialog_set_has_separator(GTK_DIALOG(dialog->dialog), FALSE); #endif dialog_vbox29 = gtk_dialog_get_content_area(GTK_DIALOG(dialog->dialog)); g_object_set_data(G_OBJECT(dialog->dialog), "dialog_vbox29", dialog_vbox29); gtk_widget_show(dialog_vbox29); UI_VBOX(vbox45, FALSE, 12); gtk_widget_show(vbox45); gtk_box_pack_start(GTK_BOX(dialog_vbox29), vbox45, TRUE, TRUE, 0); label180 = gtk_label_new(_("Enter Word or Phrase")); gtk_widget_show(label180); gtk_box_pack_start(GTK_BOX(vbox45), label180, FALSE, FALSE, 0); dialog->entry = gtk_entry_new(); gtk_widget_show(dialog->entry); gtk_box_pack_start(GTK_BOX(vbox45), dialog->entry, FALSE, FALSE, 0); gtk_widget_set_size_request(dialog->entry, 291, -1); UI_HBOX(hbox66, FALSE, 0); gtk_widget_show(hbox66); gtk_box_pack_start(GTK_BOX(vbox45), hbox66, TRUE, TRUE, 0); dialog->backward = gtk_check_button_new_with_label(_("Search backwards")); gtk_widget_show(dialog->backward); gtk_box_pack_start(GTK_BOX(hbox66), dialog->backward, FALSE, FALSE, 0); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->backward), FALSE); dialog_action_area29 = #ifdef HAVE_GTK_312 gtk_dialog_get_content_area(GTK_DIALOG(dialog->dialog)); #else gtk_dialog_get_action_area(GTK_DIALOG(dialog->dialog)); #endif g_object_set_data(G_OBJECT(dialog->dialog), "dialog_action_area29", dialog_action_area29); gtk_widget_show(dialog_action_area29); gtk_container_set_border_width(GTK_CONTAINER(dialog_action_area29), 10); #ifdef USE_GTK_3 hbuttonbox8 = gtk_button_box_new(GTK_ORIENTATION_HORIZONTAL); #else hbuttonbox8 = gtk_hbutton_box_new(); #endif gtk_widget_show(hbuttonbox8); gtk_box_pack_start(GTK_BOX(dialog_action_area29), hbuttonbox8, TRUE, TRUE, 0); dialog->find = #ifdef HAVE_GTK_310 gtk_button_new_from_icon_name("edit-find", GTK_ICON_SIZE_BUTTON); #else gtk_button_new_from_stock(GTK_STOCK_FIND); //gtk_button_new_with_label(_("Find")); #endif gtk_widget_show(dialog->find); gtk_container_add(GTK_CONTAINER(hbuttonbox8), dialog->find); dialog->next = gtk_button_new(); gtk_widget_show(dialog->next); gtk_container_add(GTK_CONTAINER(hbuttonbox8), dialog->next); //GTK_WIDGET_SET_FLAGS(dialog->next, GTK_CAN_DEFAULT); #ifndef HAVE_GTK_310 alignment = gtk_alignment_new(0.5, 0.5, 0, 0); gtk_widget_show(alignment); gtk_container_add(GTK_CONTAINER(dialog->next), alignment); #endif UI_HBOX(hbox5, FALSE, 2); gtk_widget_show(hbox5); #ifndef HAVE_GTK_310 gtk_container_add(GTK_CONTAINER(alignment), hbox5); #endif image = #ifdef HAVE_GTK_310 gtk_image_new_from_icon_name("edit-find", GTK_ICON_SIZE_BUTTON); #else gtk_image_new_from_stock(GTK_STOCK_FIND, GTK_ICON_SIZE_BUTTON); #endif gtk_widget_show(image); gtk_box_pack_start(GTK_BOX(hbox5), image, FALSE, FALSE, 0); label12 = gtk_label_new_with_mnemonic(_("Find Next")); gtk_widget_show(label12); gtk_box_pack_start(GTK_BOX(hbox5), label12, FALSE, FALSE, 0); gtk_label_set_justify(GTK_LABEL(label12), GTK_JUSTIFY_LEFT); dialog->close = #ifdef HAVE_GTK_310 // Don't use an icon with GTK3 gtk_button_new_with_label(_("Close")); #else gtk_button_new_from_stock(GTK_STOCK_CLOSE); #endif gtk_widget_show(dialog->close); gtk_container_add(GTK_CONTAINER(hbuttonbox8), dialog->close); //GTK_WIDGET_SET_FLAGS(dialog->close, GTK_CAN_DEFAULT); gtk_widget_set_can_default(dialog->find, 1); g_signal_connect(G_OBJECT(dialog->dialog), "destroy", G_CALLBACK(dialog_destroy), dialog); g_signal_connect(G_OBJECT(dialog->find), "clicked", G_CALLBACK(find_clicked), dialog); g_signal_connect(G_OBJECT(dialog->next), "clicked", G_CALLBACK(next_clicked), dialog); g_signal_connect(G_OBJECT(dialog->close), "clicked", G_CALLBACK(close_clicked), dialog); }