2
* arch-tag: Implementation of various utility functions for using Bonobo
4
* Copyright (C) 2002 Jorn Baayen
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; either version 2, or (at your option)
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24
#include "rb-bonobo-helpers.h"
25
#include <bonobo/bonobo-ui-util.h>
26
#include <bonobo/bonobo-ui-component.h>
27
#include <bonobo/bonobo-window.h>
31
rb_bonobo_set_label (BonoboUIComponent *component,
35
bonobo_ui_component_set_prop (component, path, "label", label, NULL);
39
rb_bonobo_set_tip (BonoboUIComponent *component,
43
bonobo_ui_component_set_prop (component, path, "tip", tip, NULL);
47
rb_bonobo_set_icon (BonoboUIComponent *component,
49
const char *stock_icon)
51
bonobo_ui_component_set_prop (component, path, "pixname", stock_icon, NULL);
55
rb_bonobo_set_verb (BonoboUIComponent *component,
59
bonobo_ui_component_set_prop (component, path, "verb", verb, NULL);
63
rb_bonobo_set_sensitive (BonoboUIComponent *component,
67
bonobo_ui_component_set_prop (component, path, "sensitive",
68
sensitive ? "1" : "0", NULL);
72
rb_bonobo_get_sensitive (BonoboUIComponent *component,
78
prop = bonobo_ui_component_get_prop (component, path, "sensitive", NULL);
87
rb_bonobo_set_active (BonoboUIComponent *component,
91
bonobo_ui_component_set_prop (component, path, "state",
92
active ? "1" : "0", NULL);
96
rb_bonobo_get_active (BonoboUIComponent *component,
102
prop = bonobo_ui_component_get_prop (component, path, "state", NULL);
111
rb_bonobo_set_visible (BonoboUIComponent *component,
115
bonobo_ui_component_set_prop (component, path, "hidden",
116
visible ? "0" : "1", NULL);
120
rb_bonobo_get_visible (BonoboUIComponent *component,
123
gboolean ret = FALSE;
126
prop = bonobo_ui_component_get_prop (component, path, "hidden", NULL);
135
rb_bonobo_set_look (BonoboUIComponent *component,
139
bonobo_ui_component_set_prop (component, path, "look",
144
rb_bonobo_add_listener_list_with_data (BonoboUIComponent *component,
145
const RBBonoboUIListener *list,
148
const RBBonoboUIListener *l;
150
g_return_if_fail (list != NULL);
151
g_return_if_fail (BONOBO_IS_UI_COMPONENT (component));
153
bonobo_object_ref (BONOBO_OBJECT (component));
155
for (l = list; l != NULL && l->cname != NULL; l++)
157
bonobo_ui_component_add_listener (component,
163
bonobo_object_unref (BONOBO_OBJECT (component));
168
rb_bonobo_show_popup (GtkWidget *source, const char *path)
173
window = gtk_widget_get_ancestor (GTK_WIDGET (source),
175
menu = gtk_menu_new ();
176
gtk_widget_show (menu);
178
bonobo_window_add_popup (BONOBO_WINDOW (window), GTK_MENU (menu),
181
gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL,
182
3, gtk_get_current_event_time ());
184
gtk_object_sink (GTK_OBJECT (menu));