Update Spanish translation
[gnumeric.git] / src / command-context.c
blob6c3fa079e236365c0a8965f90dc64dc1423ffccc
2 /*
3 * command-context.c: Gnumeric specific extensions to GOCmdContext
5 * Copyright (C) 1999-2005 Jody Goldberg (jody@gnome.org)
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License as
9 * published by the Free Software Foundation; either version 2 of the
10 * License, or (at your option) version 3.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
20 * USA
22 #include <gnumeric-config.h>
23 #include <gnumeric.h>
24 #include <command-context.h>
25 #include <ranges.h>
27 #include <glib/gi18n-lib.h>
29 #define CC_CLASS(o) (G_TYPE_INSTANCE_GET_INTERFACE ((o), GO_TYPE_CMD_CONTEXT, GOCmdContextClass))
31 static GError *
32 format_message (GQuark id, char const *message)
34 char const *msg = message ? message : "";
35 return g_error_new_literal (id, 0, msg);
38 void
39 gnm_cmd_context_error_calc (GOCmdContext *context, char const *msg)
41 GError *err = format_message (gnm_error_calc (), msg);
42 go_cmd_context_error (context, err);
43 g_error_free (err);
46 void
47 gnm_cmd_context_error_splits_array (GOCmdContext *context,
48 G_GNUC_UNUSED char const *cmd,
49 GnmRange const *array)
51 GError *err;
53 if (array != NULL)
54 err = g_error_new (gnm_error_array(), 1,
55 _("Would split array %s"), range_as_string (array));
56 else
57 err = g_error_new (gnm_error_array(), 0,
58 _("Would split an array"));
59 go_cmd_context_error (context, err);
60 g_error_free (err);
63 void
64 gnm_cmd_context_error_splits_merge (GOCmdContext *context,
65 GnmRange const *merge)
67 GError *err =
68 g_error_new (gnm_error_array(), 1,
69 _("Would split merge %s"),
70 range_as_string (merge));
71 go_cmd_context_error (context, err);
72 g_error_free (err);
75 GQuark
76 gnm_error_array (void)
78 static GQuark quark;
79 if (!quark)
80 quark = g_quark_from_static_string ("gnm_error_array");
81 return quark;
84 GQuark
85 gnm_error_calc (void)
87 static GQuark quark;
88 if (!quark)
89 quark = g_quark_from_static_string ("gnm_error_calc");
90 return quark;