コード例 #1
0
static void
lsv_show_message(const char *message, LibBalsaSourceViewerInfo * lsvi,
                 gboolean escape)
{
    GtkTextBuffer *buffer;
    GtkTextIter start;
    gchar *tmp;

    buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(lsvi->text));
    gtk_text_buffer_set_text(buffer, "", 0);

    if (escape)
	tmp = g_strescape(message, "\n“");
    else {
	tmp = g_strdup(message);
	libbalsa_utf8_sanitize(&tmp, FALSE, NULL);
    }
    if (tmp) {
	gtk_text_buffer_insert_at_cursor(buffer, tmp, -1);
	g_free(tmp);
    }

    gtk_text_buffer_get_start_iter(buffer, &start);
    gtk_text_buffer_place_cursor(buffer, &start);
}
コード例 #2
0
ファイル: information-dialog.c プロジェクト: GNOME/balsa
void
balsa_information_real(GtkWindow *parent, LibBalsaInformationType type,
                       const char *msg)
{
    BalsaInformationShow show;
    gchar *show_msg;

    if (!balsa_app.main_window)
        return;

    show_msg = g_strdup(msg);
    libbalsa_utf8_sanitize(&show_msg, balsa_app.convert_unknown_8bit, NULL);
    switch (type) {
    case LIBBALSA_INFORMATION_MESSAGE:
	show = balsa_app.information_message;
	break;
    case LIBBALSA_INFORMATION_WARNING:
	show = balsa_app.warning_message;
	break;
    case LIBBALSA_INFORMATION_ERROR:
	show = balsa_app.error_message;
	break;
    case LIBBALSA_INFORMATION_DEBUG:
	show = balsa_app.debug_message;
	break;
    case LIBBALSA_INFORMATION_FATAL:
    default:
	show = balsa_app.fatal_message;
	break;
    }

    switch (show) {
    case BALSA_INFORMATION_SHOW_NONE:
	break;
    case BALSA_INFORMATION_SHOW_DIALOG:
	balsa_information_dialog(parent, type, show_msg);
	break;
    case BALSA_INFORMATION_SHOW_LIST:
	balsa_information_list(parent, type, show_msg);
	break;
    case BALSA_INFORMATION_SHOW_BAR:
	balsa_information_bar(parent, type, show_msg);
	break;
    case BALSA_INFORMATION_SHOW_STDERR:
	balsa_information_stderr(type, show_msg);
	break;
    }
    g_free(show_msg);

    if (type == LIBBALSA_INFORMATION_FATAL)
	gtk_main_quit();
}