Introspection non-fixes.
[gnumeric.git] / src / command-context.c
blobf4d85220972a1d2eb1ae85fb293cb8415109caa7
1 /* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
3 /*
4 * command-context.c: Gnumeric specific extensions to GOCmdContext
6 * Copyright (C) 1999-2005 Jody Goldberg (jody@gnome.org)
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of the
11 * License, or (at your option) version 3.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
21 * USA
23 #include <gnumeric-config.h>
24 #include "gnumeric.h"
25 #include "command-context.h"
26 #include "ranges.h"
28 #include <glib/gi18n-lib.h>
30 #define CC_CLASS(o) (G_TYPE_INSTANCE_GET_INTERFACE ((o), GO_TYPE_CMD_CONTEXT, GOCmdContextClass))
32 static GError *
33 format_message (GQuark id, char const *message)
35 char const *msg = message ? message : "";
36 return g_error_new_literal (id, 0, msg);
39 void
40 gnm_cmd_context_error_calc (GOCmdContext *context, char const *msg)
42 GError *err = format_message (gnm_error_calc (), msg);
43 go_cmd_context_error (context, err);
44 g_error_free (err);
47 void
48 gnm_cmd_context_error_splits_array (GOCmdContext *context,
49 G_GNUC_UNUSED char const *cmd,
50 GnmRange const *array)
52 GError *err;
54 if (array != NULL)
55 err = g_error_new (gnm_error_array(), 1,
56 _("Would split array %s"), range_as_string (array));
57 else
58 err = g_error_new (gnm_error_array(), 0,
59 _("Would split an array"));
60 go_cmd_context_error (context, err);
61 g_error_free (err);
64 void
65 gnm_cmd_context_error_splits_merge (GOCmdContext *context,
66 GnmRange const *merge)
68 GError *err =
69 g_error_new (gnm_error_array(), 1,
70 _("Would split merge %s"),
71 range_as_string (merge));
72 go_cmd_context_error (context, err);
73 g_error_free (err);
76 GQuark
77 gnm_error_array (void)
79 static GQuark quark;
80 if (!quark)
81 quark = g_quark_from_static_string ("gnm_error_array");
82 return quark;
85 GQuark
86 gnm_error_calc (void)
88 static GQuark quark;
89 if (!quark)
90 quark = g_quark_from_static_string ("gnm_error_calc");
91 return quark;