summaryrefslogtreecommitdiff
path: root/libnautilus/nautilus-bonobo-extensions.c
blob: 2fbfb20517d7740b6002d8c6e17f984e848c9817 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */

/* nautilus-bonobo-extensions.c - implementation of new functions that conceptually
                                  belong in bonobo. Perhaps some of these will be
                                  actually rolled into bonobo someday.

   Copyright (C) 2000 Eazel, Inc.

   The Gnome Library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Library General Public License as
   published by the Free Software Foundation; either version 2 of the
   License, or (at your option) any later version.

   The Gnome Library is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   Library General Public License for more details.

   You should have received a copy of the GNU Library General Public
   License along with the Gnome Library; see the file COPYING.LIB.  If not,
   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
   Boston, MA 02111-1307, USA.

   Author: John Sullivan <sullivan@eazel.com>
*/

#include "nautilus-bonobo-extensions.h"


/**
 * nautilus_bonobo_ui_handler_menu_toggle_appearance
 * 
 * Changes a toggleable bonobo menu item's apparent state
 * without invoking its callback.
 * 
 * @uih: The BonoboUIHandler for this menu item.
 * @path: The standard bonobo-style path specifier for this menu item.
 * @new_value: TRUE if item should appear checked (on), FALSE otherwise.
 */
void 
nautilus_bonobo_ui_handler_menu_set_toggle_appearance (BonoboUIHandler *uih,
				      	   		    const char *path,
				      	   		    gboolean new_value)
{
	BonoboUIHandlerCallbackFunc saved_callback;
	gpointer saved_callback_data;

	/* Temporarily clear out callback and data so when we
	 * set the toggle state the callback isn't called. 
	 */
	bonobo_ui_handler_menu_get_callback (uih, path, &saved_callback, &saved_callback_data);
	bonobo_ui_handler_menu_set_callback (uih, path, NULL, NULL);
        bonobo_ui_handler_menu_set_toggle_state (uih, path, new_value);
	bonobo_ui_handler_menu_set_callback (uih, path, saved_callback, saved_callback_data);		
}