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 go_string_unref (msg
->title
);
49 go_string_unref (msg
->msg
);
52 parent_class
= g_type_class_peek (G_TYPE_OBJECT
);
53 parent_class
->finalize (obj
);
57 gnm_input_msg_class_init (GObjectClass
*object_class
)
59 object_class
->finalize
= gnm_input_msg_finalize
;
62 gnm_input_msg_init (GObject
*obj
)
64 GnmInputMsg
*msg
= (GnmInputMsg
* )obj
;
69 GSF_CLASS (GnmInputMsg
, gnm_input_msg
,
70 gnm_input_msg_class_init
, gnm_input_msg_init
, G_TYPE_OBJECT
)
74 * @msg: (nullable): A message to show
75 * @title: (nullable): A title to show for the message
77 * Returns: a ref to new #GnmInputMsg.
80 gnm_input_msg_new (char const *msg
, char const *title
)
82 GnmInputMsg
*res
= g_object_new (GNM_INPUT_MSG_TYPE
, NULL
);
85 res
->msg
= go_string_new (msg
);
87 res
->title
= go_string_new (title
);
93 gnm_input_msg_equal (GnmInputMsg
const *a
,
96 g_return_val_if_fail (GNM_IS_INPUT_MSG (a
), FALSE
);
97 g_return_val_if_fail (GNM_IS_INPUT_MSG (b
), FALSE
);
99 return (g_strcmp0 (a
->title
? a
->title
->str
: NULL
,
100 b
->title
? b
->title
->str
: NULL
) == 0 &&
101 g_strcmp0 (a
->msg
? a
->msg
->str
: NULL
,
102 b
->msg
? b
->msg
->str
: NULL
) == 0);
107 * gnm_input_msg_get_msg:
110 * Returns: (transfer none): The message to show
113 gnm_input_msg_get_msg (GnmInputMsg
const *msg
)
115 return (msg
->msg
!= NULL
) ? msg
->msg
->str
: "";
119 * gnm_input_msg_get_title:
122 * Returns: (transfer none): The title of the message to show
125 gnm_input_msg_get_title (GnmInputMsg
const *msg
)
127 return (msg
->title
!= NULL
) ? msg
->title
->str
: "";