Ejemplo n.º 1
0
/******************************************************************************
 * Name
 *  gui_notebook_main_setup
 *
 * Synopsis
 *   #include "tabbed_browser.h"
 *
 *   void gui_notebook_main_setup(int tabs)
 *
 * Description
 *   set up notebook for browsing multiple passages
 *
 * Return value
 *   void
 */
void gui_notebook_main_setup(int tabs, const char *tabsfile)
{
	if (stop_refresh)
		return;

	removed_page = 1;
	cur_passage_tab = NULL;
	passage_list = NULL;

	gui_load_tabs(tabsfile ? tabsfile
			       : (tabs ? default_tab_filename : no_tab_filename));

	g_signal_connect(G_OBJECT(widgets.notebook_main),
			 "switch-page",
			 G_CALLBACK(gui_notebook_main_switch_page),
			 &passage_list);

	g_signal_connect(G_OBJECT(widgets.button_new_tab), "clicked",
			 G_CALLBACK(on_notebook_main_new_tab_clicked),
			 NULL);

	//show the new tab button here instead of in main_window.c so it
	//doesn't get shown if !settings.browsing
	gtk_widget_show(widgets.button_new_tab);
	gui_notebook_main_switch_page(GTK_NOTEBOOK(widgets.notebook_main),
				      NULL,
				      settings.tab_page, &passage_list);
}
Ejemplo n.º 2
0
static void _tabs_on(void)
{
	xml_set_value("Xiphos", "tabs", "browsing", "1");
	settings.browsing = TRUE;
	gui_close_all_tabs();
	gui_load_tabs(default_tab_filename);
	gtk_widget_show(widgets.hboxtb);
	gtk_widget_show(widgets.hpaned);
}
Ejemplo n.º 3
0
/******************************************************************************
 * Name
 *  gui_open_tabs
 *
 * Synopsis
 *   #include "tabbed_browser.h"
 *
 *   void gui_open_tabs(void)
 *
 * Description
 *   called from preferences dialog when enable browsing is chosen
 *
 * Return value
 *   void
 */
void gui_open_tabs(void)
{
	if (stop_refresh)
		return;

	removed_page = 1;
	cur_passage_tab = NULL;
	passage_list = NULL;

	gui_load_tabs(default_tab_filename);

	gtk_widget_show(widgets.button_new_tab);
}
Ejemplo n.º 4
0
static void _tabs_off(void)
{
	int page = _is_paratab_showing();
	xml_set_value("Xiphos", "tabs", "browsing", "0");
	gui_save_tabs(default_tab_filename);
	if (settings.showparatab) {
		gui_close_passage_tab(gtk_notebook_page_num(GTK_NOTEBOOK(widgets.notebook_main),
							    widgets.parallel_tab));
		settings.showparatab = FALSE;
	}
	gui_close_all_tabs();
	settings.browsing = FALSE;
	gui_load_tabs(no_tab_filename);
	gtk_widget_hide(widgets.hboxtb);
	gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets.notebook_bible_parallel),
				      page);
}
Ejemplo n.º 5
0
/******************************************************************************
 * Name
 *  on_open_session_activate
 *
 * Synopsis
 *   #include "gui/main_menu.h"
 *
 *   void on_open_session_activate(GtkMenuItem * menuitem, gpointer user_data)
 *
 * Description
 *   ask for file name (with file-chooser) and load tabs from that file
 *
 * Return value
 *   void
 */
G_MODULE_EXPORT void
on_open_session_activate(GtkMenuItem *menuitem, gpointer user_data)
{
	GtkWidget *dialog;
	gchar *tabs_dir;

	tabs_dir = g_strdup_printf("%s/tabs/", settings.gSwordDir);

	if (g_access(tabs_dir, F_OK) == -1) {
		if ((g_mkdir(tabs_dir, S_IRWXU)) == -1) {
			fprintf(stderr, "can't create tabs dir");
			return;
		}
	}

	dialog = gtk_file_chooser_dialog_new("Open Session",
					     NULL,
					     GTK_FILE_CHOOSER_ACTION_OPEN,
#ifdef HAVE_GTK_310
					     "_Cancel",
					     GTK_RESPONSE_CANCEL, "_Open",
					     GTK_RESPONSE_ACCEPT,
#else
					     GTK_STOCK_CANCEL,
					     GTK_RESPONSE_CANCEL,
					     GTK_STOCK_OPEN,
					     GTK_RESPONSE_ACCEPT,
#endif
					     NULL);

	gtk_file_chooser_set_current_folder((GtkFileChooser *)dialog,
					    tabs_dir);
	if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) {
		char *filename;

		filename =
		    gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog));
		filename = g_path_get_basename(filename);
		gui_close_all_tabs();
		gui_load_tabs(filename);
		redisplay_to_realign();
		g_free(filename);
	}

	gtk_widget_destroy(dialog);
}