1 /* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
4 * input-msg.c: Input Message
6 * Copyright (C) 2002 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
23 #include <gnumeric-config.h>
24 #include <glib/gi18n-lib.h>
26 #include "input-msg.h"
28 #include <gsf/gsf-impl-utils.h>
41 gnm_input_msg_finalize (GObject
*obj
)
43 GObjectClass
*parent_class
;
44 GnmInputMsg
*msg
= (GnmInputMsg
*)obj
;
46 if (msg
->title
!= NULL
) {
47 go_string_unref (msg
->title
);
50 if (msg
->msg
!= NULL
) {
51 go_string_unref (msg
->msg
);
55 parent_class
= g_type_class_peek (G_TYPE_OBJECT
);
56 parent_class
->finalize (obj
);
60 gnm_input_msg_class_init (GObjectClass
*object_class
)
62 object_class
->finalize
= gnm_input_msg_finalize
;
65 gnm_input_msg_init (GObject
*obj
)
67 GnmInputMsg
*msg
= (GnmInputMsg
* )obj
;
72 GSF_CLASS (GnmInputMsg
, gnm_input_msg
,
73 gnm_input_msg_class_init
, gnm_input_msg_init
, G_TYPE_OBJECT
)
80 * Returns: a ref to new #GnmInputMsg.
83 gnm_input_msg_new (char const *msg
, char const *title
)
85 GnmInputMsg
*res
= g_object_new (GNM_INPUT_MSG_TYPE
, NULL
);
88 res
->msg
= go_string_new (msg
);
90 res
->title
= go_string_new (title
);
96 gnm_input_msg_equal (GnmInputMsg
const *a
,
99 g_return_val_if_fail (GNM_IS_INPUT_MSG (a
), FALSE
);
100 g_return_val_if_fail (GNM_IS_INPUT_MSG (b
), FALSE
);
102 return (g_strcmp0 (a
->title
? a
->title
->str
: NULL
,
103 b
->title
? b
->title
->str
: NULL
) == 0 &&
104 g_strcmp0 (a
->msg
? a
->msg
->str
: NULL
,
105 b
->msg
? b
->msg
->str
: NULL
) == 0);
110 gnm_input_msg_get_msg (GnmInputMsg
const *imsg
)
112 return (imsg
->msg
!= NULL
) ? imsg
->msg
->str
: "";
116 gnm_input_msg_get_title (GnmInputMsg
const *imsg
)
118 return (imsg
->title
!= NULL
) ? imsg
->title
->str
: "";