G_MODULE_EXPORT void on_remove_activate(GtkMenuItem *menuitem, gpointer user_data) { INFO *info; EDITOR *editor = (EDITOR *)user_data; GtkWidget *tree = GTK_WIDGET(editor->treeview); gchar *str; gchar *icon_name; info = _get_info(tree); str = g_strdup_printf("<span weight=\"bold\">%s</span>\n\n%s/%s", _("Remove the selected item"), info->book, info->local_name); #ifdef HAVE_GTK_310 icon_name = g_strdup("dialog-warning"); #else icon_name = g_strdup(GTK_STOCK_DIALOG_WARNING); #endif if (gui_yes_no_dialog(str, icon_name)) { gtk_tree_store_remove(GTK_TREE_STORE(info->model), &info->iter); main_treekey_remove(info->book, info->local_name, info->offset); } g_free(info->book); g_free(info->local_name); g_free(info->offset); g_free(info); g_free(str); g_free(icon_name); }
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; }
G_MODULE_EXPORT void action_delete_item_activate_cb(GtkWidget *widget, EDITOR *e) { if (e->studypad) return; gchar *buf = g_strdup_printf("<span weight=\"bold\" size=\"larger\">%s %s?</span>", _("Are you sure you want to delete the note for"), e->key); if (gui_yes_no_dialog(buf, #ifdef HAVE_GTK_310 "dialog-warning" #else GTK_STOCK_DIALOG_WARNING #endif )) { main_delete_note(e->module, e->key); /* new empty document from template */ gchar *fname = g_build_filename(settings.gSwordDir, "studypad.spt", NULL); XI_message(("action delete item [%s]", fname)); gchar *text = inhale_text_from_file(fname); g_free(fname); if (text && strlen(text)) { webkit_web_view_load_string((WebKitWebView *) e->html_widget, text, "text/html", "utf_8", "file://"); } if (text) g_free(text); } g_free(buf); e->is_changed = FALSE; }
static void action_delete_cb(GtkAction *action, EDITOR *e) { /* for note only */ gchar *buf; if (e->studypad) return; buf = g_strdup_printf("<span weight=\"bold\" size=\"larger\">%s %s?</span>", _("Are you sure you want to delete the note for"), e->key); if (gui_yes_no_dialog(buf, #ifdef HAVE_GTK_310 "dialog-warning" #else GTK_STOCK_DIALOG_WARNING #endif )) { main_delete_note(e->module, e->key); gtkhtml_editor_set_text_html(GTKHTML_EDITOR(e->window), "", strlen("")); } g_free(buf); }