1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
4 * (GLABELS) Label and Business Card Creation program for GNOME
6 * ui-util.c: GLabels ui utilities module
8 * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>.
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28 #include <gtk/gtkaction.h>
29 #include <gtk/gtktoggleaction.h>
33 /*==========================================================================*/
34 /* Private macros and constants. */
35 /*==========================================================================*/
37 /*==========================================================================*/
39 /*==========================================================================*/
41 /*==========================================================================*/
43 /*==========================================================================*/
45 /*==========================================================================*/
46 /* Local function prototypes */
47 /*==========================================================================*/
51 /*****************************************************************************/
52 /** Set sensitivity of verb. */
53 /*****************************************************************************/
55 gl_ui_util_set_verb_sensitive (GtkUIManager *ui,
61 gl_debug (DEBUG_UI, "START");
63 g_return_if_fail (cname != NULL);
64 g_return_if_fail (GTK_IS_UI_MANAGER (ui));
66 action = gtk_ui_manager_get_action (ui, cname);
69 gl_debug (DEBUG_UI, "Set action \"%s\" sensitive = %d", cname, sensitive);
70 gtk_action_set_sensitive (action, sensitive);
73 gl_debug (DEBUG_UI, "END");
76 /*****************************************************************************/
77 /** Set sensitivity of a list of verbs. */
78 /*****************************************************************************/
80 gl_ui_util_set_verb_list_sensitive (GtkUIManager *ui,
86 gl_debug (DEBUG_UI, "START");
88 g_return_if_fail (vlist != NULL);
89 g_return_if_fail (GTK_IS_UI_MANAGER (ui));
91 for ( ; *vlist; ++vlist)
93 action = gtk_ui_manager_get_action (ui, *vlist);
96 gtk_action_set_sensitive (action, sensitive);
100 gl_debug (DEBUG_UI, "END");
103 /*****************************************************************************/
104 /** Set state of a verb. */
105 /*****************************************************************************/
107 gl_ui_util_set_verb_state (GtkUIManager *ui,
111 GtkToggleAction *action;
113 gl_debug (DEBUG_UI, "START");
115 g_return_if_fail (cname != NULL);
116 g_return_if_fail (GTK_IS_UI_MANAGER (ui));
118 action = GTK_TOGGLE_ACTION (gtk_ui_manager_get_action (ui, cname));
121 gtk_toggle_action_set_active (action, state);
124 gl_debug (DEBUG_UI, "END");