3 * input-msg.c: Input Message
5 * Copyright (C) 2002 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>
23 #include <glib/gi18n-lib.h>
25 #include <input-msg.h>
27 #include <gsf/gsf-impl-utils.h>
40 gnm_input_msg_finalize (GObject
*obj
)
42 GObjectClass
*parent_class
;
43 GnmInputMsg
*msg
= (GnmInputMsg
*)obj
;
45 go_string_unref (msg
->title
);
48 go_string_unref (msg
->msg
);
51 parent_class
= g_type_class_peek (G_TYPE_OBJECT
);
52 parent_class
->finalize (obj
);
56 gnm_input_msg_class_init (GObjectClass
*object_class
)
58 object_class
->finalize
= gnm_input_msg_finalize
;
61 gnm_input_msg_init (GObject
*obj
)
63 GnmInputMsg
*msg
= (GnmInputMsg
* )obj
;
68 GSF_CLASS (GnmInputMsg
, gnm_input_msg
,
69 gnm_input_msg_class_init
, gnm_input_msg_init
, G_TYPE_OBJECT
)
73 * @msg: (nullable): A message to show
74 * @title: (nullable): A title to show for the message
76 * Returns: a ref to new #GnmInputMsg.
79 gnm_input_msg_new (char const *msg
, char const *title
)
81 GnmInputMsg
*res
= g_object_new (GNM_INPUT_MSG_TYPE
, NULL
);
84 res
->msg
= go_string_new (msg
);
86 res
->title
= go_string_new (title
);
92 gnm_input_msg_equal (GnmInputMsg
const *a
,
95 g_return_val_if_fail (GNM_IS_INPUT_MSG (a
), FALSE
);
96 g_return_val_if_fail (GNM_IS_INPUT_MSG (b
), FALSE
);
98 return (g_strcmp0 (a
->title
? a
->title
->str
: NULL
,
99 b
->title
? b
->title
->str
: NULL
) == 0 &&
100 g_strcmp0 (a
->msg
? a
->msg
->str
: NULL
,
101 b
->msg
? b
->msg
->str
: NULL
) == 0);
106 * gnm_input_msg_get_msg:
109 * Returns: (transfer none): The message to show
112 gnm_input_msg_get_msg (GnmInputMsg
const *msg
)
114 return (msg
->msg
!= NULL
) ? msg
->msg
->str
: "";
118 * gnm_input_msg_get_title:
121 * Returns: (transfer none): The title of the message to show
124 gnm_input_msg_get_title (GnmInputMsg
const *msg
)
126 return (msg
->title
!= NULL
) ? msg
->title
->str
: "";