From cd2f26923d1973067c216b2787aeaca4857f89d9 Mon Sep 17 00:00:00 2001 From: Bradford Hovinen Date: Mon, 2 Jul 2001 14:46:26 +0000 Subject: [PATCH] Use bonobo_arg_... functions 2001-07-02 Bradford Hovinen * capplet-dir.c (capplet_control_launch): Use bonobo_arg_... functions * main.c (main): Call capplet_control_launch if capplet was specified on CLI Use bonobo_main rather than gtk_main * capplet-dir.c (capplet_control_launch): Fix to use Bonobo_Property_setValue (capplet_activate): Support capplet_control_launch; use strlen(...) rather than hardcoding length (capplet_control_launch): Replace '-' characters with underscores Added OAF info file for experimental sound properties capplet --- ...onobo_Control_Capplet_sound_properties.oaf | 20 ++++++++ capplets/Makefile.am | 12 ++++- capplets/ui-properties/prefs-widget-app.c | 2 +- control-center/ChangeLog | 13 +++++- control-center/capplet-dir.c | 46 +++++++++++++++++-- control-center/capplet-dir.h | 2 +- control-center/main.c | 4 +- 7 files changed, 87 insertions(+), 12 deletions(-) create mode 100644 capplets/Bonobo_Control_Capplet_sound_properties.oaf diff --git a/capplets/Bonobo_Control_Capplet_sound_properties.oaf b/capplets/Bonobo_Control_Capplet_sound_properties.oaf new file mode 100644 index 000000000..e0bebaeab --- /dev/null +++ b/capplets/Bonobo_Control_Capplet_sound_properties.oaf @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + diff --git a/capplets/Makefile.am b/capplets/Makefile.am index 312d863b6..1647a0335 100644 --- a/capplets/Makefile.am +++ b/capplets/Makefile.am @@ -11,7 +11,7 @@ INCLUDES = \ -DGNOMELOCALEDIR=\""$(datadir)/locale"\" \ -DGNOME_ICONDIR=\""${prefix}/share/pixmaps"\" \ -DGLADE_DATADIR=\""$(Gladedir)"\" \ - $(CAPPLET_CFLAGS) \ + @CAPPLET_CFLAGS@ \ -I$(top_srcdir) \ -I$(top_srcdir)/intl @@ -19,4 +19,12 @@ bin_PROGRAMS = sound-properties-capplet sound_properties_capplet_SOURCES = sound-properties-capplet.c -sound_properties_capplet_LDADD = $(CAPPLET_LIBS) \ No newline at end of file +sound_properties_capplet_LDADD = @CAPPLET_LIBS@ + +OAF_FILES = \ + Bonobo_Control_Capplet_sound_properties.oaf + +oafdir = $(datadir)/oaf +oaf_DATA = $(OAF_FILES) + +EXTRA_DIST = $(OAF_FILES) diff --git a/capplets/ui-properties/prefs-widget-app.c b/capplets/ui-properties/prefs-widget-app.c index 099b8eb83..53bb107f6 100644 --- a/capplets/ui-properties/prefs-widget-app.c +++ b/capplets/ui-properties/prefs-widget-app.c @@ -42,7 +42,7 @@ static widget_desc_t widget_desc[] = { WD_CHECK (toolbar_relief, "toolbar_relief"), WD_CHECK (toolbar_relief_btn, "toolbar_relief_btn"), WD_CHECK (toolbar_lines, "toolbar_lines"), - WD_CHECK (toolbar_labels, "toolbar_labels"), +/* WD_CHECK (toolbar_labels, "toolbar_labels"), */ WD_END }; diff --git a/control-center/ChangeLog b/control-center/ChangeLog index a8f95e045..397434343 100644 --- a/control-center/ChangeLog +++ b/control-center/ChangeLog @@ -1,8 +1,19 @@ +2001-07-02 Bradford Hovinen + + * capplet-dir.c (capplet_control_launch): Use bonobo_arg_... functions + + * main.c (main): Call capplet_control_launch if capplet was specified on CLI + Use bonobo_main rather than gtk_main + + * capplet-dir.c (capplet_control_launch): Fix to use Bonobo_Property_setValue + (capplet_activate): Support capplet_control_launch; use strlen(...) rather than hardcoding length + (capplet_control_launch): Replace '-' characters with underscores + 2001-06-29 Bradford Hovinen * main.c (main): Support --run-capplet argument on the command line - * capplet-dir.c (capplet_launch): Implement. Currently not called, + * capplet-dir.c (capplet_control_launch): Implement. Currently not called, but will be used to launch capplets * main.c (main): Added OAF and bonobo intialization diff --git a/control-center/capplet-dir.c b/control-center/capplet-dir.c index 74c9ae2de..8e90a393f 100644 --- a/control-center/capplet-dir.c +++ b/control-center/capplet-dir.c @@ -198,7 +198,9 @@ capplet_activate (Capplet *capplet) entry = CAPPLET_DIR_ENTRY (capplet)->entry; #warning FIXME: this should probably be root-manager-helper - if (!strncmp (entry->exec[0], "root-manager", 12)) + if (!strncmp (entry->exec[0], "gnomecc", strlen ("gnomecc"))) + capplet_control_launch (entry->exec[1]); + else if (!strncmp (entry->exec[0], "root-manager", strlen ("root-manager"))) start_capplet_through_root_manager (entry); else gnome_desktop_entry_launch (entry); @@ -389,8 +391,13 @@ capplet_cancel_cb (GtkWidget *widget, GtkWidget *app) { } +/* capplet_control_launch + * + * Launch a capplet as a Bonobo control + */ + void -capplet_launch (const gchar *capplet_name) +capplet_control_launch (const gchar *capplet_name) { gchar *oaf_iid, *moniker; gchar *tmp, *tmp1; @@ -399,8 +406,9 @@ capplet_launch (const gchar *capplet_name) BonoboUIContainer *uic; BonoboControlFrame *frame; Bonobo_PropertyBag bag; + Bonobo_Property property; CORBA_Environment ev; - CORBA_any value; + BonoboArg *value; g_return_if_fail (capplet_name != NULL); @@ -408,6 +416,7 @@ capplet_launch (const gchar *capplet_name) tmp = g_strdup (capplet_name); if ((tmp1 = strstr (tmp, "-capplet")) != NULL) *tmp1 = '\0'; + while ((tmp1 = strchr (tmp, '-'))) *tmp1 = '_'; oaf_iid = g_strconcat ("OAFIID:Bonobo_Control_Capplet_", tmp, NULL); moniker = g_strconcat ("archiver:", tmp, NULL); @@ -421,6 +430,16 @@ capplet_launch (const gchar *capplet_name) bonobo_window_set_contents (BONOBO_WINDOW (app), box); control = bonobo_widget_new_control (oaf_iid, BONOBO_OBJREF (uic)); + + if (control == NULL) { + g_critical ("Could not create capplet control"); + gtk_widget_destroy (app); + g_free (oaf_iid); + g_free (moniker); + g_free (tmp); + return; + } + gtk_box_pack_start (GTK_BOX (box), control, TRUE, TRUE, 0); buttons = gtk_hbutton_box_new (); @@ -437,9 +456,26 @@ capplet_launch (const gchar *capplet_name) frame = bonobo_widget_get_control_frame (BONOBO_WIDGET (control)); bag = bonobo_control_frame_get_control_property_bag (frame, &ev); -/* BONOBO_ARG_SET_STRING (&value, moniker); */ -/* Bonobo_PropertyBag_setValue (bag, "moniker", &value, &ev); */ + property = Bonobo_PropertyBag_getPropertyByName (bag, "moniker", &ev); + + if (BONOBO_EX (&ev)) { + g_critical ("Could not get moniker property"); + } else { + value = bonobo_arg_new (BONOBO_ARG_STRING); + BONOBO_ARG_SET_STRING (value, moniker); + + Bonobo_Property_setValue (property, value, &ev); + + if (BONOBO_EX (&ev)) + g_critical ("Could not set moniker property"); + + bonobo_arg_release (value); + } + + gtk_widget_show_all (app); CORBA_exception_free (&ev); + g_free (oaf_iid); + g_free (moniker); g_free (tmp); } diff --git a/control-center/capplet-dir.h b/control-center/capplet-dir.h index ba79996c4..a1e043c51 100644 --- a/control-center/capplet-dir.h +++ b/control-center/capplet-dir.h @@ -90,6 +90,6 @@ void capplet_dir_init (CappletDirView *(*cb) CappletDir *get_root_capplet_dir (void); -void capplet_launch (const gchar *capplet_name); +void capplet_control_launch (const gchar *capplet_name); #endif /* __CAPPLET_DIR_H */ diff --git a/control-center/main.c b/control-center/main.c index 1512e9a37..dd4856636 100644 --- a/control-center/main.c +++ b/control-center/main.c @@ -61,10 +61,10 @@ main (int argc, char **argv) capplet_dir_entry_activate (CAPPLET_DIR_ENTRY (get_root_capplet_dir ()), NULL); } else { - + capplet_control_launch (capplet); } - gtk_main (); + bonobo_main (); return 0; }