/* * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with the program; if not, see * * * Authors: * Michael Zucchi * * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) * */ #include #include #include #include #include #include #include #include #include "e-util.h" #include "e-util-private.h" #include "e-error.h" #define d(x) struct _e_error_button { struct _e_error_button *next; const gchar *stock; const gchar *label; gint response; }; struct _e_error { guint32 flags; const gchar *id; gint type; gint default_response; const gchar *title; const gchar *primary; const gchar *secondary; const gchar *help_uri; gboolean scroll; struct _e_error_button *buttons; }; struct _e_error_table { const gchar *domain; const gchar *translation_domain; GHashTable *errors; }; static GHashTable *error_table; static GSList *ee_parent_list; /* ********************************************************************** */ static struct _e_error_button default_ok_button = { NULL, "gtk-ok", NULL, GTK_RESPONSE_OK }; static struct _e_error default_errors[] = { { GTK_DIALOG_MODAL, "error", 3, GTK_RESPONSE_OK, N_("Evolution Error"), "{0}", "{1}", NULL, FALSE, &default_ok_button }, { GTK_DIALOG_MODAL, "error-primary", 3, GTK_RESPONSE_OK, N_("Evolution Error"), "{0}", NULL, NULL, FALSE, &default_ok_button }, { GTK_DIALOG_MODAL, "warning", 1, GTK_RESPONSE_OK, N_("Evolution Warning"), "{0}", "{1}", NULL, FALSE, &default_ok_button }, { GTK_DIALOG_MODAL, "warning-primary", 1, GTK_RESPONSE_OK, N_("Evolution Warning"), "{0}", NULL, NULL, FALSE, &default_ok_button }, }; /* ********************************************************************** */ static struct { const gchar *name; gint id; } response_map[] = { { "GTK_RESPONSE_REJECT", GTK_RESPONSE_REJECT }, { "GTK_RESPONSE_ACCEPT", GTK_RESPONSE_ACCEPT }, { "GTK_RESPONSE_OK", GTK_RESPONSE_OK }, { "GTK_RESPONSE_CANCEL", GTK_RESPONSE_CANCEL }, { "GTK_RESPONSE_CLOSE", GTK_RESPONSE_CLOSE }, { "GTK_RESPONSE_YES", GTK_RESPONSE_YES }, { "GTK_RESPONSE_NO", GTK_RESPONSE_NO }, { "GTK_RESPONSE_APPLY", GTK_RESPONSE_APPLY }, { "GTK_RESPONSE_HELP", GTK_RESPONSE_HELP }, }; static gint map_response(const gchar *name) { gint i; for (i=0;i Window Title? Primary error text.? Secondary error text.? ?