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); }