aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook
diff options
context:
space:
mode:
Diffstat (limited to 'addressbook')
-rw-r--r--addressbook/demo/addressbook.c88
1 files changed, 88 insertions, 0 deletions
diff --git a/addressbook/demo/addressbook.c b/addressbook/demo/addressbook.c
index 7350e0cd0c..38cb6c7121 100644
--- a/addressbook/demo/addressbook.c
+++ b/addressbook/demo/addressbook.c
@@ -26,6 +26,8 @@
#include "addressbook-widget.h"
#include "addressbook.h"
+
+
#if 0
static void
bonobo_clock_control_prop_value_changed_cb (BonoboPropertyBag *pb, char *name, char *type,
@@ -55,6 +57,89 @@ release_data (GtkObject *object, void *data)
}
#endif
+
+static void
+control_deactivate (BonoboControl *control, BonoboUIHandler *uih)
+{
+ /* how to remove a menu item */
+ bonobo_ui_handler_menu_remove (uih, "/Actions/New Contact");
+
+ /* remove our toolbar */
+ bonobo_ui_handler_dock_remove (uih, "/Toolbar");
+}
+
+static void
+do_nothing_cb (BonoboUIHandler *uih, void *user_data, const char *path)
+{
+ printf ("Yow! I am called back!\n");
+}
+
+static GnomeUIInfo gnome_toolbar [] = {
+ GNOMEUIINFO_ITEM_STOCK (N_("New"), N_("Create a new contact"), do_nothing_cb, GNOME_STOCK_PIXMAP_NEW),
+
+ GNOMEUIINFO_SEPARATOR,
+
+ GNOMEUIINFO_ITEM_STOCK (N_("Find"), N_("Find a contact"), do_nothing_cb, GNOME_STOCK_PIXMAP_SEARCH),
+ GNOMEUIINFO_ITEM_STOCK (N_("Print"), N_("Print contacts"), do_nothing_cb, GNOME_STOCK_PIXMAP_PRINT),
+ GNOMEUIINFO_ITEM_STOCK (N_("Delete"), N_("Delete a contact"), do_nothing_cb, GNOME_STOCK_PIXMAP_TRASH),
+
+ GNOMEUIINFO_END
+};
+
+
+
+
+static void
+control_activate (BonoboControl *control, BonoboUIHandler *uih)
+{
+ Bonobo_UIHandler remote_uih;
+ GtkWidget *toolbar;
+ BonoboControl *toolbar_control;
+
+ remote_uih = bonobo_control_get_remote_ui_handler (control);
+ bonobo_ui_handler_set_container (uih, remote_uih);
+
+ bonobo_ui_handler_menu_new_item (uih, "/Actions/New Contact", N_("_New Contact"),
+ NULL, -1,
+ BONOBO_UI_HANDLER_PIXMAP_NONE, NULL,
+ 0, 0, do_nothing_cb, NULL);
+
+ toolbar = gtk_toolbar_new (GTK_ORIENTATION_HORIZONTAL,
+ GTK_TOOLBAR_BOTH);
+
+ gnome_app_fill_toolbar (GTK_TOOLBAR (toolbar),
+ gnome_toolbar,
+ NULL);
+
+ gtk_widget_show_all (toolbar);
+
+ toolbar_control = bonobo_control_new (toolbar);
+ bonobo_ui_handler_dock_add (
+ uih, "/Toolbar",
+ bonobo_object_corba_objref (BONOBO_OBJECT (toolbar_control)),
+ GNOME_DOCK_ITEM_BEH_LOCKED |
+ GNOME_DOCK_ITEM_BEH_EXCLUSIVE,
+ GNOME_DOCK_TOP,
+ 1, 1, 0);
+}
+
+static void
+control_activate_cb (BonoboControl *control,
+ gboolean activate,
+ gpointer user_data)
+{
+ BonoboUIHandler *uih;
+
+ uih = bonobo_control_get_ui_handler (control);
+ g_assert (uih);
+
+ if (activate)
+ control_activate (control, uih);
+ else
+ control_deactivate (control, uih);
+}
+
+
static BonoboObject *
addressbook_factory (BonoboGenericFactory *Factory, void *closure)
{
@@ -68,6 +153,9 @@ addressbook_factory (BonoboGenericFactory *Factory, void *closure)
/* Create the control. */
view = create_view();
control = bonobo_control_new (view->widget);
+
+ gtk_signal_connect (GTK_OBJECT (control), "activate",
+ control_activate_cb, NULL);
#if 0
/* Create the properties. */
pb = bonobo_property_bag_new ();
commit/editors/jed?h=mate-1.18&id=0e27a1ea75d81f40365a81bb1f77f6b7cf839188'>Mark all my ports as MAKE_JOBS_SAFE and MAKE_JOBS_UNSAFEgarga2009-03-291-0/+1 * - devel/libslang2 has completely replaced devel/libslang which has not beenpgollucci2009-02-081-7/+4 * Update CONFIGURE_ARGS for how we pass CONFIGURE_TARGET to configure script.rafan2008-08-211-1/+0 * - Fix installation when NOPORTDOCS is set, preventing it to create doc dirs.garga2008-06-021-1/+6 * - Remove unneeded dependency from gtk12/gtk20 [1]miwi2008-04-201-2/+2 * - Add more MASTER_SITESgarga2007-09-011-0/+1 * - Welcome X.org 7.2 \o/.flz2007-05-201-0/+1 * Add one new master site and remove an old one that's not working anymore.garga2006-05-311-1/+1 * Update to 0.99.18garga2006-04-034-20/+43 * - Fix PLISTgarga2005-11-091-0/+1 * - Add SHA256garga2005-11-081-0/+1 * - info files are really old and out of date, so, do not install it anymoregarga2005-11-075-65/+2 * - Respect CFLAGS/LDFLAGSgarga2005-10-281-3/+1 * - Remove some patches and use REINPLACE_CMD, *_ARGS and *_ENV insteadgarga2005-10-286-194/+33 * - Add more MASTER_SITESgarga2005-10-281-1/+5 * - Register CONFLICTS with jed-develgarga2005-10-271-10/+16 * Change MAINTAINER to my @FreeBSD.org accountgarga2005-07-121-1/+1 * - Sort the packing listjylefort2005-05-1610-107/+239 * - Fix losing setuid/setgid bits on files when savingpav2004-11-023-1/+33 * Trim whitespace.trevor2004-04-111-1/+1 * SIZEify (maintainer timeout)trevor2004-03-311-0/+1 * Make portlint(1) happy by changing strip to ${STRIP_CMD}osa2003-09-241-4/+4 * Maintainer update: editors/jed to 0.99.16edwin2003-02-235-19/+43