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
22 #include <gnumeric-config.h>
24 #include <command-context.h>
27 #include <glib/gi18n-lib.h>
29 #define CC_CLASS(o) (G_TYPE_INSTANCE_GET_INTERFACE ((o), GO_TYPE_CMD_CONTEXT, GOCmdContextClass))
32 format_message (GQuark id
, char const *message
)
34 char const *msg
= message
? message
: "";
35 return g_error_new_literal (id
, 0, msg
);
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
);
47 gnm_cmd_context_error_splits_array (GOCmdContext
*context
,
48 G_GNUC_UNUSED
char const *cmd
,
49 GnmRange
const *array
)
54 err
= g_error_new (gnm_error_array(), 1,
55 _("Would split array %s"), range_as_string (array
));
57 err
= g_error_new (gnm_error_array(), 0,
58 _("Would split an array"));
59 go_cmd_context_error (context
, err
);
64 gnm_cmd_context_error_splits_merge (GOCmdContext
*context
,
65 GnmRange
const *merge
)
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
);
76 gnm_error_array (void)
80 quark
= g_quark_from_static_string ("gnm_error_array");
89 quark
= g_quark_from_static_string ("gnm_error_calc");