Re: unexpected async reply gnome_dialog Hell



On Wed, 29 May 2002, Ian Frawley wrote:

Yeah this is just an OK dialog. Would I just call this idle callback as
if it was a function?

My ugly code (please someone tell me if this is completely stupid):

static gboolean error_idle_func(gpointer data)
{
        GtkWidget *dialog;
        gchar *msg = (gchar *) data;

        gdk_threads_enter();

        dialog = gnome_message_box_new(msg,
                                       GNOME_MESSAGE_BOX_ERROR,
                                       GNOME_STOCK_BUTTON_OK,
                                       NULL);

        gnome_dialog_run(GNOME_DIALOG(dialog));

        g_free(data);

        gdk_threads_leave();
        return FALSE;
}

void errmsg(const gchar *fmt, ...)
{
        va_list args;
        gchar *msg;

        va_start(args, fmt);
        msg = g_strdup_vprintf(fmt, args);
        va_end(args);

        g_idle_add(error_idle_func, (gpointer) msg);
}

-- 
Tomi Manninen           Internet:  oh2bns sral fi
OH2BNS                  AX.25:     oh2bns oh2rbi fin eu
KP20ME04                Amprnet:   oh2bns oh2rbi ampr org




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]