Use bonobo_arg_... functions

2001-07-02  Bradford Hovinen  <hovinen@ximian.com>

	* 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
This commit is contained in:
Bradford Hovinen 2001-07-02 14:46:26 +00:00 committed by Bradford Hovinen (Gdict maintainer)
parent a72197926a
commit cd2f26923d
7 changed files with 87 additions and 12 deletions

View file

@ -0,0 +1,20 @@
<oaf_info>
<oaf_server iid="OAFIID:Bonobo_Control_Capplet_sound_properties_Factory" type="exe" location="sound-properties-capplet">
<oaf_attribute name="repo_ids" type="stringv">
<item value="IDL:GNOME/GenericFactory:1.0"/>
</oaf_attribute>
<oaf_attribute name="name" type="string" value="Sound properties capplet factory"/>
</oaf_server>
<oaf_server iid="OAFIID:Bonobo_Control_Capplet_sound_properties" type="factory"
location="OAFIID:Bonobo_Control_Capplet_sound_properties_Factory">
<oaf_attribute name="repo_ids" type="stringv">
<item value="IDL:Bonobo/Control:1.0"/>
<item value="IDL:Bonobo/Unknown:1.0"/>
</oaf_attribute>
<oaf_attribute name="name" type="string" value="Sound properties capplet"/>
</oaf_server>
</oaf_info>

View file

@ -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)
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)

View file

@ -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
};

View file

@ -1,8 +1,19 @@
2001-07-02 Bradford Hovinen <hovinen@ximian.com>
* 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 <hovinen@ximian.com>
* 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

View file

@ -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);
}

View file

@ -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 */

View file

@ -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;
}