Esempio n. 1
0
G_MODULE_EXPORT void
on_open_in_dialog_activate(GtkMenuItem *menuitem, gpointer user_data)
{
	int mod_type = main_get_mod_type(buf_module);

	if ((mod_type == PERCOM_TYPE) || (mod_type == PRAYERLIST_TYPE)) {
		gchar *dialog_text =
		    g_strdup_printf("<span weight=\"bold\">%s</span>\n\n%s",
				    _("Open module in editor?"),
				    _("If no, it will open for display only."));

		if (gui_yes_no_dialog(dialog_text, NULL)) {
			if (mod_type == PERCOM_TYPE)
				editor_create_new((gchar *)buf_module,
						  (gchar *)
						  settings.currentverse,
						  NOTE_EDITOR);
			else
				editor_create_new((gchar *)buf_module,
						  "0", BOOK_EDITOR);
		} else {
			if (mod_type == PERCOM_TYPE)
				main_dialogs_open(buf_module, (gchar *)
							      settings.currentverse);
			else
				main_dialogs_open(buf_module, NULL);
		}
		g_free(dialog_text);
	} else
		main_dialogs_open(buf_module, NULL);

	g_free(buf_module);
	buf_module = NULL;
}
Esempio n. 2
0
gboolean gui_verselist_button_release_event(GtkWidget *widget,
					    GdkEventButton *event,
					    gpointer user_data)
{
	GtkTreeSelection *selection;
	GtkTreeModel *model;
	GtkTreeIter selected;
	gchar *key = NULL;
	gchar *text = NULL;

	selection = gtk_tree_view_get_selection((GtkTreeView *)
						sidebar.results_list);
	model =
	    gtk_tree_view_get_model(GTK_TREE_VIEW(sidebar.results_list));

	if (!gtk_tree_selection_get_selected(selection, NULL, &selected))
		return FALSE;

	gtk_tree_model_get(GTK_TREE_MODEL(model), &selected, 0, &key, -1);
	if (!key)
		return FALSE;

	if (event) {
		switch (event->button) {
		case 2:
			gui_open_passage_in_new_tab(key);
		/* fall through... */

		case 3: /* button 3 is no-op */
			return FALSE;

		default: /* button 1 handled below */
			break;
		}
	}
	// UTF-8 workaround (domcox)
	// main_get_search_results_text (renderText) doesn't render
	// non-ascii chars saved in numeric character reference format
	// in personal notes.
	// Notes are now saved in utf8 encoding (Xiphos > 2.2.2.1)
	if (main_get_mod_type(settings.sb_search_mod) == PERCOM_TYPE)
		text = main_get_raw_text(settings.sb_search_mod, key);
	else
		text =
		    main_get_search_results_text(settings.sb_search_mod,
						 key);

	if (text) {
		settings.displaySearchResults = TRUE;
		main_entry_display(settings.show_previewer_in_sidebar ? sidebar.html_viewer_widget : widgets.html_previewer_text, //sidebar.html_widget,
				   settings.sb_search_mod, text, key,
				   TRUE);
		settings.displaySearchResults = FALSE;
		g_free(text);
		gtk_widget_grab_focus(sidebar.results_list);
	}

	g_free(key);
	return FALSE;
}
Esempio n. 3
0
gint _get_type_mod_list(void)
{
	switch (main_get_mod_type(menu_mod_name)) {
	case TEXT_TYPE:
		return TEXT_DESC_LIST;
		break;
	case COMMENTARY_TYPE:
	case PERCOM_TYPE:
		return COMM_DESC_LIST;
		break;
	case DICTIONARY_TYPE:
		return DICT_DESC_LIST;
		break;
	case BOOK_TYPE:
		return GBS_DESC_LIST;
		break;
	default:
		return -1;
		break;
	}
}
Esempio n. 4
0
GtkWidget *_get_html(void)
{
	if (is_dialog)
		return dialog->html;
	else
		switch (main_get_mod_type(menu_mod_name)) {
		case TEXT_TYPE:
			return widgets.html_text;
			break;
		case COMMENTARY_TYPE:
		case PERCOM_TYPE:
			return widgets.html_comm;
			break;
		case DICTIONARY_TYPE:
			return widgets.html_dict;
			break;
		case BOOK_TYPE:
		case PRAYERLIST_TYPE:
			return widgets.html_book;
			break;
		}
	return NULL;
}
Esempio n. 5
0
gchar *_get_key(gchar *mod_name)
{
	gchar *key = NULL;

	if (is_dialog)
		return g_strdup(dialog->key);

	switch (main_get_mod_type(mod_name)) {
	case TEXT_TYPE:
	case COMMENTARY_TYPE:
	case PERCOM_TYPE:
		key = g_strdup(settings.currentverse);
		break;
	case DICTIONARY_TYPE:
		key = g_strdup(settings.dictkey);
		break;
	case BOOK_TYPE:
	case PRAYERLIST_TYPE:
		key = g_strdup(settings.book_key);
		break;
	}
	return key;
}
Esempio n. 6
0
static GtkWidget *_create_popup_menu(XiphosHtml *html, const gchar *mod_name,
				     DIALOG_DATA *d)
{
	gchar *glade_file;
#ifdef USE_GTKBUILDER
	GtkBuilder *gxml;
#else
	GladeXML *gxml;
#endif
	const gchar *mname = (is_dialog ? d->mod_name : mod_name);
	XI_message(("_create_popup_menu mod_name:%s", mod_name));
	if (!mname || !*mname)
		return NULL;

#ifdef USE_GTKBUILDER
#ifdef HAVE_GTK_314
	glade_file =
	    gui_general_user_file("xi-menus-popup.gtkbuilder", FALSE);
#else
	glade_file =
	    gui_general_user_file("xi-menus-popup_old.gtkbuilder", FALSE);
#endif
#else
	glade_file = gui_general_user_file("xi-menus.glade", FALSE);
#endif
	g_return_val_if_fail((glade_file != NULL), NULL);

#ifdef USE_GTKBUILDER
	gxml = gtk_builder_new();
	gtk_builder_add_from_file(gxml, glade_file, NULL);
#else
	gxml = glade_xml_new(glade_file, "menu_popup", NULL);
#endif
	g_free(glade_file);
	g_return_val_if_fail((gxml != NULL), NULL);

	GtkWidget *menu = UI_GET_ITEM(gxml, "menu_popup");
	GtkWidget *bookmark = UI_GET_ITEM(gxml, "bookmark");
	GtkWidget *open = UI_GET_ITEM(gxml, "open_module2");
	GtkWidget *export_ = UI_GET_ITEM(gxml, "export_passage");
	GtkWidget *close = UI_GET_ITEM(gxml, "close");
	GtkWidget *note = UI_GET_ITEM(gxml, "note");
	GtkWidget *mark_verse = UI_GET_ITEM(gxml, "mark_verse");
	GtkWidget *open_edit = UI_GET_ITEM(gxml, "open_in_editor");
	GtkWidget *mod_opt_sub = UI_GET_ITEM(gxml, "module_options1_menu");
	GtkWidget *lookup = UI_GET_ITEM(gxml, "lookup_selection1");
	GtkWidget *lookup_sub =
	    UI_GET_ITEM(gxml, "lookup_selection1_menu");
	GtkWidget *unlock = UI_GET_ITEM(gxml, "unlock_this_module");
	GtkWidget *book_heading =
	    UI_GET_ITEM(gxml, "display_book_heading");
	GtkWidget *chapter_heading =
	    UI_GET_ITEM(gxml, "display_chapter_heading");
	GtkWidget *rename_percomm = UI_GET_ITEM(gxml, "rename_perscomm");
	GtkWidget *dump_percomm = UI_GET_ITEM(gxml, "dump_perscomm");

	GtkWidget *open_sub = gtk_menu_new();
	GtkWidget *note_sub = gtk_menu_new();

	gtk_widget_hide(unlock);
	gtk_widget_hide(book_heading);
	gtk_widget_hide(export_);
	gtk_widget_hide(chapter_heading);
	gtk_widget_hide(rename_percomm);
	gtk_widget_hide(dump_percomm);
	gtk_widget_hide(note);
	gtk_widget_hide(open_edit);
	gtk_widget_hide(mark_verse);
	gtk_widget_hide(close); /* FIXME: hide until connected to dialog close */

	if (is_dialog) {
		gtk_widget_hide(open);
		gtk_widget_hide(bookmark);
		gtk_widget_hide(export_);
	} else {
		gtk_widget_hide(close);
		gtk_menu_item_set_submenu(GTK_MENU_ITEM(open), open_sub);
		gui_add_mods_2_gtk_menu(_get_type_mod_list(), open_sub,
					(GCallback)on_view_mod_activate);

		/* unlock from main window only */
		if (main_has_cipher_tag((gchar *)mod_name))
			gtk_widget_show(unlock);
	}

	switch (main_get_mod_type((gchar *)mname)) {
	case TEXT_TYPE:
		gtk_widget_show(export_);
		if (is_dialog)
			break;
		gtk_widget_show(note);
		gtk_widget_show(mark_verse);
		gtk_menu_item_set_submenu(GTK_MENU_ITEM(note), note_sub);
		gui_add_mods_2_gtk_menu(PERCOMM_LIST, note_sub, (GCallback)
					on_edit_percomm_activate);
		break;

	case COMMENTARY_TYPE:
		gtk_widget_show(export_);
		gtk_widget_show(book_heading);
		gtk_widget_show(chapter_heading);
		break;

	case PERCOM_TYPE:
		gtk_widget_show(export_);
		gtk_widget_show(open_edit);
		g_signal_connect(G_OBJECT(open_edit),
				 "activate",
				 G_CALLBACK(on_edit_percomm_activate),
				 (gchar *)(is_dialog ? d->mod_name : mod_name));

		gtk_widget_show(rename_percomm);
		gtk_widget_show(dump_percomm);
		break;

	case DICTIONARY_TYPE:
		break;

	case BOOK_TYPE:
		break;

	case PRAYERLIST_TYPE:
		gtk_widget_show(open_edit);
		g_signal_connect(G_OBJECT(open_edit),
				 "activate",
				 G_CALLBACK(on_edit_prayerlist_activate),
				 (gchar *)(is_dialog ? d->mod_name : mod_name));
		break;
	}

	gtk_menu_item_set_submenu(GTK_MENU_ITEM(lookup), lookup_sub);

	gui_add_mods_2_gtk_menu(DICT_DESC_LIST, lookup_sub,
				(GCallback)_lookup_selection);

	/* = glade_xml_get_widget (gxml, ""); */
	_add_and_check_global_opts(gxml,
				   (char *)(is_dialog ? d->mod_name : mod_name), mod_opt_sub, d);
/* connect signals and data */
#ifdef USE_GTKBUILDER
	gtk_builder_connect_signals(gxml, html);
/*gtk_builder_connect_signals_full
	   (gxml, (GtkBuilderConnectFunc)gui_glade_signal_connect_func, html); */
#else
	glade_xml_signal_autoconnect_full(gxml, (GladeXMLConnectFunc)gui_glade_signal_connect_func,
					  html);
#endif

	return menu;
}
Esempio n. 7
0
G_MODULE_EXPORT void _add_and_check_global_opts(GladeXML *gxml,
#endif
						const gchar *mod_name,
						GtkWidget *submenu,
						DIALOG_DATA *d)
{
	GtkWidget *item;
	GLOBAL_OPS *ops = NULL;
	gint modtype =
	    main_get_mod_type((gchar *)(is_dialog ? d->mod_name : mod_name));

	ops = main_new_globals((gchar *)mod_name);

	item = UI_GET_ITEM(gxml, "verse_per_line");

	if (mod_name && (modtype == TEXT_TYPE)) {
		gtk_widget_show(item);
		gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item),
					       ops->verse_per_line);
	}

	item = UI_GET_ITEM(gxml, "words_of_christ_in_red");

	if ((main_check_for_global_option((gchar *)mod_name, "GBFRedLetterWords")) ||
	    (main_check_for_global_option((gchar *)mod_name, "OSISRedLetterWords"))) {
		gtk_widget_show(item);
		gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item),
					       ops->words_in_red);
	}

	item = UI_GET_ITEM(gxml, "strongs_numbers");

	if ((main_check_for_global_option((gchar *)mod_name, "GBFStrongs")) ||
	    (main_check_for_global_option((gchar *)mod_name, "ThMLStrongs")) ||
	    (main_check_for_global_option((gchar *)mod_name, "OSISStrongs"))) {
		gtk_widget_show(item);
		gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item),
					       ops->strongs);
	}

	item = UI_GET_ITEM(gxml, "morphological_tags");

	if (main_check_for_global_option((gchar *)mod_name, "GBFMorph") ||
	    main_check_for_global_option((gchar *)mod_name, "ThMLMorph") || main_check_for_global_option((gchar *)mod_name,
													 "OSISMorph")) {
		gtk_widget_show(item);
		gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item),
					       ops->morphs);
	}

	item = UI_GET_ITEM(gxml, "footnotes");

	if (main_check_for_global_option((gchar *)mod_name, "GBFFootnotes") || main_check_for_global_option((gchar *)mod_name,
													    "ThMLFootnotes") ||
	    main_check_for_global_option((gchar *)mod_name,
					 "OSISFootnotes")) {
		gtk_widget_show(item);
		gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item),
					       ops->footnotes);
	}

	item = UI_GET_ITEM(gxml, "greek_accents");

	if (main_check_for_global_option((gchar *)mod_name, "UTF8GreekAccents")) {
		gtk_widget_show(item);
		gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item),
					       ops->greekaccents);
	}

	item = UI_GET_ITEM(gxml, "lemmas");

	if (main_check_for_global_option((gchar *)mod_name, "ThMLLemma") || main_check_for_global_option((gchar *)mod_name,
													 "OSISLemma")) {
		gtk_widget_show(item);
		gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item),
					       ops->lemmas);
	}

	item = UI_GET_ITEM(gxml, "cross-references");

	if (main_check_for_global_option((gchar *)mod_name, "ThMLScripref") || main_check_for_global_option((gchar *)mod_name,
													    "OSISScripref")) {
		gtk_widget_show(item);
		gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item),
					       ops->scripturerefs);
	}

	item = UI_GET_ITEM(gxml, "hebrew_vowel_points");

	if (main_check_for_global_option((gchar *)mod_name, "UTF8HebrewPoints")) {
		gtk_widget_show(item);
		gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item),
					       ops->hebrewpoints);
	}

	item = UI_GET_ITEM(gxml, "hebrew_cantillation");

	if (main_check_for_global_option((gchar *)mod_name, "UTF8Cantillation")) {
		gtk_widget_show(item);
		gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item),
					       ops->hebrewcant);
	}

	item = UI_GET_ITEM(gxml, "headings");

	if (main_check_for_global_option((gchar *)mod_name, "ThMLHeadings") || main_check_for_global_option((gchar *)mod_name,
													    "OSISHeadings")) {
		gtk_widget_show(item);
		gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item),
					       ops->headings);
	}

	item = UI_GET_ITEM(gxml, "transliteration");
	gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item),
				       ops->transliteration);

	item = UI_GET_ITEM(gxml, "variants");

	if (main_check_for_global_option((gchar *)mod_name, "ThMLVariants") || main_check_for_global_option((gchar *)mod_name,
													    "OSISVariants")) {
		gtk_widget_show(item);

		item = UI_GET_ITEM(gxml, "primary_reading");
		gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item),
					       ops->variants_primary);

		item = UI_GET_ITEM(gxml, "secondary_reading");
		gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item),
					       ops->variants_secondary);

		item = UI_GET_ITEM(gxml, "all_readings");
		gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item),
					       ops->variants_all);
	}

	item = UI_GET_ITEM(gxml, "xlit");

	if (main_check_for_global_option((gchar *)mod_name, "OSISXlit")) {
		gtk_widget_show(item);
		gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item),
					       ops->xlit);
	}

	item = UI_GET_ITEM(gxml, "enumerated");

	if (main_check_for_global_option((gchar *)mod_name, "OSISEnum")) {
		gtk_widget_show(item);
		gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item),
					       ops->enumerated);
	}

	item = UI_GET_ITEM(gxml, "glosses");

	if (main_check_for_global_option((gchar *)mod_name, "OSISGlosses") || main_check_for_global_option((gchar *)mod_name,
													   "OSISRuby")) {
		gtk_widget_show(item);
		gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item),
					       ops->glosses);
	}

	item = UI_GET_ITEM(gxml, "morphseg");

	if (main_check_for_global_option((gchar *)mod_name, "OSISMorphSegmentation")) {
		gtk_widget_show(item);
		gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item),
					       ops->morphseg);
	}

	item = UI_GET_ITEM(gxml, "image_content");

	if (ops->image_content != -1) {
		gtk_widget_show(item);
		gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item),
					       ops->image_content);
	}

	item = UI_GET_ITEM(gxml, "respect_font_faces");

	if (ops->respect_font_faces != -1) {
		gtk_widget_show(item);
		gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item),
					       ops->respect_font_faces);
	}

	item = UI_GET_ITEM(gxml, "commentary_by_chapter");

	if ((modtype == COMMENTARY_TYPE) || (modtype == PERCOM_TYPE)) {
		gtk_widget_show(item);
		gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item),
					       ops->commentary_by_chapter);
	}

	item = UI_GET_ITEM(gxml, "doublespace");
#ifdef USE_GTK_3
	gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item),
				       ops->doublespace);
#else
	GTK_CHECK_MENU_ITEM(item)->active = ops->doublespace;
#endif

	item = UI_GET_ITEM(gxml, "xrefnotenumbers");

	if ((ops->scripturerefs &&
	     (main_check_for_global_option((gchar *)mod_name, "ThMLScripref") || main_check_for_global_option((gchar *)mod_name,
													      "OSISScripref"))) ||
	    (ops->footnotes &&
	     (main_check_for_global_option((gchar *)mod_name, "ThMLFootnotes") || main_check_for_global_option((gchar *)mod_name,
													       "OSISFootnotes") ||
	      main_check_for_global_option((gchar *)mod_name,
					   "GBFFootnotes")))) {
		gtk_widget_show(item);
		gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item),
					       ops->xrefnotenumbers);
	} else {
		gtk_widget_hide(item);
	}

	g_free(ops);
}
Esempio n. 8
0
void gui_open_module_in_new_tab(gchar *module)
{
	PASSAGE_TAB_INFO *pt;
	gint module_type;

	if (stop_refresh)
		return;

	if (!settings.browsing)
		return;

	if ((pt = g_new0(PASSAGE_TAB_INFO, 1)) == NULL) {
		gui_generic_warning("Could not allocate a new tab");
		return;
	}
	module_type = main_get_mod_type(module);

	pt->showtexts = FALSE;
	pt->showpreview = settings.showpreview;
	pt->showcomms = FALSE;
	pt->showdicts = FALSE;
	pt->showparallel = FALSE;
	pt->paratab = NULL;

	switch (module_type) {
	case -1:
		return;
		break;
	case TEXT_TYPE:
		pt->text_mod = g_strdup(module);
		pt->commentary_mod = g_strdup(settings.CommWindowModule);
		pt->dictlex_mod = g_strdup(settings.DictWindowModule);
		pt->book_mod = g_strdup(settings.book_mod);
		pt->showtexts = TRUE;
		break;
	case COMMENTARY_TYPE:
		pt->text_mod = g_strdup(settings.MainWindowModule);
		pt->commentary_mod = g_strdup(module);
		pt->dictlex_mod = g_strdup(settings.DictWindowModule);
		pt->book_mod = g_strdup(settings.book_mod);
		pt->showcomms = TRUE;
		pt->comm_showing = 1;
		break;
	case DICTIONARY_TYPE:
		pt->text_mod = g_strdup(settings.MainWindowModule);
		pt->commentary_mod = g_strdup(settings.CommWindowModule);
		pt->dictlex_mod = g_strdup(module);
		pt->book_mod = g_strdup(settings.book_mod);
		pt->showdicts = TRUE;
		break;
	case BOOK_TYPE:
		pt->text_mod = g_strdup(settings.MainWindowModule);
		pt->commentary_mod = g_strdup(settings.CommWindowModule);
		pt->dictlex_mod = g_strdup(settings.DictWindowModule);
		pt->book_mod = g_strdup(module);
		pt->showcomms = TRUE;
		pt->comm_showing = 0;
		break;
	case PRAYERLIST_TYPE:
		pt->text_mod = g_strdup(settings.MainWindowModule);
		pt->commentary_mod = g_strdup(settings.CommWindowModule);
		pt->dictlex_mod = g_strdup(settings.DictWindowModule);
		pt->book_mod = g_strdup(module);
		pt->showcomms = TRUE;
		pt->comm_showing = 0;
		break;
	}

	pt->text_commentary_key = g_strdup(settings.currentverse);
	pt->dictlex_key = g_strdup(settings.dictkey);
	pt->book_offset = g_strdup_printf("%ld", settings.book_offset);

	passage_list =
	    g_list_append(passage_list, (PASSAGE_TAB_INFO *)pt);
	//set_current_tab(pt);
	notebook_main_add_page(pt);

	gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets.notebook_main),
				      gtk_notebook_page_num(GTK_NOTEBOOK(widgets.notebook_main),
							    pt->page_widget));
}
Esempio n. 9
0
void gui_display_about_module_dialog(gchar *modname)
{
	const gchar *desc;
	gchar *about;
	const gchar *version, *language, *abbreviation,
	    *size, *promo, *dist, *langtoken, *companion,
	    *category, *feature;
	int feature_count = 0;
	GString *info = g_string_new("");

	desc = main_get_mod_config_entry(modname, "Description");
	about = main_get_mod_config_entry(modname, "About");
	version = main_get_mod_config_entry(modname, "Version");
	size = main_get_mod_config_entry(modname, "InstallSize");
	promo = main_get_mod_config_entry(modname, "ShortPromo");
	dist = main_get_mod_config_entry(modname, "DistributionLicense");
	companion = main_get_mod_config_entry(modname, "Companion");
	category = main_get_mod_config_entry(modname, "Category");
	feature = main_get_mod_config_entry(modname, "Feature");
	langtoken = main_get_mod_config_entry(modname, "Lang");
	language = main_get_module_language(modname);
	abbreviation = main_get_abbreviation(modname);

	info = g_string_append(info,
			       "<center><table border=\"0\" cellpadding=\"5\" cellspacing=\"0\">");
	info = g_string_append(info, "<tr><td valign=\"top\">");

	info = g_string_append(info, _("<b>Module name:</b> "));
	info = g_string_append(info, modname);
	info = g_string_append(info, "<br/>");

	if (abbreviation && *abbreviation) {
		info =
		    g_string_append(info,
				    _("<b>Module abbreviation:</b> "));
		info = g_string_append(info, abbreviation);
		info = g_string_append(info, "<br/>");
	}

	info = g_string_append(info, _("<b>Version:</b> "));
	info = g_string_append(info, ((version && *version)
					  ? version
					  : _("No version stamp found")));
	info = g_string_append(info, "<br/>");

	info = g_string_append(info, _("<b>Type:</b> "));
	if (feature && !strcmp(feature, "DailyDevotion"))
		info = g_string_append(info, _("Daily Devotion"));
	else if (category && !strcmp(category, "Maps"))
		info = g_string_append(info, _("Maps"));
	else if (category && !strcmp(category, "Images"))
		info = g_string_append(info, _("Images"));
	else if (category && !strcmp(category, "Glossaries"))
		info = g_string_append(info, _("Glossary"));
	else if (category &&
		 !strcmp(category,
			 "Cults / Unorthodox / Questionable Material"))
		info = g_string_append(info, _("Cult"));
	else {
		switch (main_get_mod_type(modname)) {
		case TEXT_TYPE:
			info = g_string_append(info, _("Bible"));
			break;
		case COMMENTARY_TYPE:
			info = g_string_append(info, _("Commentary"));
			break;
		case DICTIONARY_TYPE:
			info = g_string_append(info, _("Dictionary"));
			break;
		case BOOK_TYPE:
			info = g_string_append(info, _("General Book"));
			break;
		case PERCOM_TYPE:
			info =
			    g_string_append(info,
					    _("Personal Commentary"));
			break;
		case PRAYERLIST_TYPE:
			info = g_string_append(info, _("Journal"));
			break;
		default:
			info = g_string_append(info, _("Unknown type"));
			break;
		}
	}
	info = g_string_append(info, "<br/>");

	info = g_string_append(info, _("<b>Language:</b> "));
	info = g_string_append(info, ((language && *language)
					  ? language
					  : _("Not specified")));
	info = g_string_append(info, "&nbsp;(");
	info = g_string_append(info, ((langtoken && *langtoken)
					  ? langtoken
					  : "?"));
	info = g_string_append(info, ")");
	info = g_string_append(info, "<br/>");

	if (size && *size) {
		info = g_string_append(info, _("<b>Installed size:</b> "));
		info = g_string_append(info, size);
		info = g_string_append(info, "<br/>");
	}

	if (companion && *companion) {
		info =
		    g_string_append(info,
				    _("<b>Companion module(s):</b></br>"));
		info = g_string_append(info, companion);
		info = g_string_append(info, "<br/>");
	}

	info = g_string_append(info,
			       "</td>"
			       "<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>"
			       "<td valign=\"top\">");

	info = g_string_append(info, _("<b>Features:</b>"));
	info = g_string_append(info, "<br/>");
	if (main_check_for_global_option((gchar *)modname, "ThMLHeadings") || main_check_for_global_option((gchar *)modname,
													   "OSISHeadings")) {
		info = g_string_append(info, _("*&nbsp;Headings"));
		info = g_string_append(info, "<br/>");
		feature_count++;
	}
	if (main_check_for_global_option((gchar *)modname, "GBFFootnotes") || main_check_for_global_option((gchar *)modname,
													   "ThMLFootnotes") ||
	    main_check_for_global_option((gchar *)modname,
					 "OSISFootnotes")) {
		info = g_string_append(info, _("*&nbsp;Footnotes"));
		info = g_string_append(info, "<br/>");
		feature_count++;
	}
	if (main_check_for_global_option((gchar *)modname, "ThMLScripref") || main_check_for_global_option((gchar *)modname,
													   "OSISScripref")) {
		info = g_string_append(info, _("*&nbsp;Cross references"));
		info = g_string_append(info, "<br/>");
		feature_count++;
	}
	if ((main_check_for_global_option((gchar *)modname, "GBFStrongs")) ||
	    (main_check_for_global_option((gchar *)modname, "ThMLStrongs")) ||
	    (main_check_for_global_option((gchar *)modname, "OSISStrongs"))) {
		info = g_string_append(info, _("*&nbsp;Strong's numbers"));
		info = g_string_append(info, "<br/>");
		feature_count++;
	}
	if (main_check_for_global_option((gchar *)modname, "GBFMorph") ||
	    main_check_for_global_option((gchar *)modname, "ThMLMorph") ||
	    main_check_for_global_option((gchar *)modname, "OSISMorph")) {
		info =
		    g_string_append(info, _("*&nbsp;Morphological tags"));
		info = g_string_append(info, "<br/>");
		feature_count++;
	}
	if (main_check_for_global_option((gchar *)modname, "ThMLLemma") ||
	    main_check_for_global_option((gchar *)modname, "OSISLemma")) {
		info = g_string_append(info, _("*&nbsp;Lemmas"));
		info = g_string_append(info, "<br/>");
		feature_count++;
	}
	if ((main_check_for_global_option((gchar *)modname, "GBFRedLetterWords")) ||
	    (main_check_for_global_option((gchar *)modname, "OSISRedLetterWords"))) {
		info =
		    g_string_append(info,
				    _("*&nbsp;Words of Christ in red"));
		info = g_string_append(info, "<br/>");
		feature_count++;
	}
	if (main_check_for_global_option((gchar *)modname, "UTF8GreekAccents")) {
		info = g_string_append(info, _("*&nbsp;Greek accents"));
		info = g_string_append(info, "<br/>");
		feature_count++;
	}
	if (main_check_for_global_option((gchar *)modname, "UTF8HebrewPoints")) {
		info =
		    g_string_append(info, _("*&nbsp;Hebrew Vowel Points"));
		info = g_string_append(info, "<br/>");
		feature_count++;
	}
	if (main_check_for_global_option((gchar *)modname, "UTF8Cantillation")) {
		info =
		    g_string_append(info, _("*&nbsp;Hebrew Cantillation"));
		info = g_string_append(info, "<br/>");
		feature_count++;
	}
	if (main_check_for_global_option((gchar *)modname, "ThMLVariants") || main_check_for_global_option((gchar *)modname,
													   "OSISVariants")) {
		info = g_string_append(info, _("*&nbsp;Variant readings"));
		info = g_string_append(info, "<br/>");
		feature_count++;
	}
	if (main_check_for_global_option((gchar *)modname, "OSISXlit")) {
		info =
		    g_string_append(info,
				    _("*&nbsp;Transliteration forms"));
		info = g_string_append(info, "<br/>");
		feature_count++;
	}
	if (main_check_for_global_option((gchar *)modname, "OSISEnum")) {
		info = g_string_append(info, _("*&nbsp;Enumerations"));
		info = g_string_append(info, "<br/>");
		feature_count++;
	}
	if (main_check_for_global_option((gchar *)modname, "OSISGlosses") || main_check_for_global_option((gchar *)modname, "OSISRuby")) {
		info = g_string_append(info, _("*&nbsp;Glosses"));
		info = g_string_append(info, "<br/>");
		feature_count++;
	}
	if (main_check_for_global_option((gchar *)modname, "OSISMorphSegmentation")) {
		info =
		    g_string_append(info,
				    _("*&nbsp;Morpheme Segmentation"));
		info = g_string_append(info, "<br/>");
		feature_count++;
	}
	if (feature_count == 0) {
		info =
		    g_string_append(info,
				    _("*&nbsp;<i>No features found</i>"));
		info = g_string_append(info, "<br/>");
	}

	info = g_string_append(info, "</td></tr></table></center>");

	if (dist && *dist) {
		info = g_string_append(info, "<br/><center>");
		info =
		    g_string_append(info,
				    _("<b>Distribution license:</b>"));
		info = g_string_append(info, "<br/>");
		info = g_string_append(info, dist);
		info = g_string_append(info, "</a></center>");
	}

	if (promo) {
		/* if promo looks like just an undecorated url, hotlink it. */
		gboolean just_url = (((strncmp(promo, "http", 4) == 0) ||
				      (strncmp(promo, "www.", 4) == 0)) &&
				     (strchr(promo, ' ') == 0));

		info = g_string_append(info, "<br/><center>");
		info = g_string_append(info, _("<b>Promotional:</b> "));
		info = g_string_append(info, "<br/>");
		if (just_url) {
			g_string_append(info, "<a href=\"");
			if (*promo == 'w')
				info = g_string_append(info, "http://");
			info = g_string_append(info, promo);
			g_string_append(info, "\">");
		}
		info = g_string_append(info, promo);
		if (just_url)
			g_string_append(info, "</a>");
		info = g_string_append(info, "</center>");
	}

	info = g_string_append(info, "<br/><hr width=\"80%%\"/><br/>");
	info = g_string_append(info, about);

	gui_core_display_about_dialog(desc, info->str, modname);
}
Esempio n. 10
0
static gboolean on_modules_list_button_release(GtkWidget *widget,
					       GdkEventButton *event,
					       gpointer user_data)
{
	GtkTreeSelection *selection;
	GtkTreeIter selected;
	GtkTreeModel *model;
	gchar *mod = NULL;
	gchar *caption = NULL;

	selection =
	    gtk_tree_view_get_selection(GTK_TREE_VIEW(sidebar.module_list));

	if (!gtk_tree_selection_get_selected(selection, &model, &selected))
		return FALSE;

	gtk_tree_model_get(GTK_TREE_MODEL(model), &selected, 2, &caption,
			   3, &mod, -1);

	//uncomment the following two lines if you want to see how it looks without
	//triangls or plus symbols
	//gtk_tree_view_set_show_expanders(sidebar.module_list, FALSE);
	//gtk_tree_view_set_level_indentation(sidebar.module_list, 12);
	GtkTreePath *path = gtk_tree_model_get_path(model, &selected);
	if (gtk_tree_view_row_expanded(GTK_TREE_VIEW(sidebar.module_list), path))
		gtk_tree_view_collapse_row(GTK_TREE_VIEW(sidebar.module_list), path);
	else
		gtk_tree_view_expand_row(GTK_TREE_VIEW(sidebar.module_list), path,
					 FALSE);
	gtk_tree_path_free(path);

	switch (event->button) {
	case 1:
		main_mod_treeview_button_one(model, selected);
		break;

	case 2:
		if (mod && (g_utf8_collate(mod, _("Parallel View"))) && (g_utf8_collate(mod, _("Standard View"))))
			gui_open_module_in_new_tab(mod);
		break;

	case 3:
		if (mod && (g_utf8_collate(mod, _("Parallel View"))) && (g_utf8_collate(mod, _("Standard View"))) //) {
		    && (main_get_mod_type(mod) != PRAYERLIST_TYPE)) {
			buf_module = mod;
			create_menu_modules();
			/*gtk_menu_popup(GTK_MENU(sidebar.menu_modules),
			   NULL, NULL, NULL, NULL,
			   0, gtk_get_current_event_time()); */
			g_free(caption);
			return FALSE;
		}
		if (caption &&
		    (!g_utf8_collate(caption, _("Prayer List/Journal")))) {
			gui_menu_prayerlist_popup(NULL, NULL);
			g_free(mod);
			return FALSE;
		}
		if (mod && (main_get_mod_type(mod) == PRAYERLIST_TYPE)) {
			buf_module = mod;
			gtk_menu_popup(GTK_MENU(sidebar.menu_prayerlist_mod), NULL,
				       NULL, NULL, NULL, 0,
				       gtk_get_current_event_time());
			g_free(caption);
			return FALSE;
		}

		break;
	}
	g_free(caption);
	g_free(mod);
	return FALSE;
}