Use .gnome/capplet-archive rather than .gnome/control-center
2001-07-09 Bradford Hovinen <hovinen@ximian.com> * archive.c (archive_load): Use .gnome/capplet-archive rather than .gnome/control-center * sound-properties-capplet.c (create_control_cb): Implement (main): Use create_control_cb * Bonobo_Control_Capplet_sound_properties.oaf: Use PropertyControl interface * sound-properties-capplet.c (create_dialog_cb): Update signature for use as a BonoboPropertyControlGetControlFn * capplet-dir.c (capplet_control_launch): Create a control by first retrieving the PropertyControl and then extracting the control from it (capplet_control_launch): Connect button signals (capplet_cancel_cb): Implement. Just destroy the app widget (capplet_ok_cb): Ditto. (capplet_control_launch): Don't use a BonoboArg when setting the property
This commit is contained in:
parent
299c4ed6f4
commit
c09362e12a
7 changed files with 72 additions and 15 deletions
|
@ -1,5 +1,8 @@
|
|||
2001-07-09 Bradford Hovinen <hovinen@ximian.com>
|
||||
|
||||
* archive.c (archive_load): Use .gnome/capplet-archive rather than
|
||||
.gnome/control-center
|
||||
|
||||
* bonobo-config-archiver.c (bonobo_config_archiver_new): Try to
|
||||
load the defaults file if no rollback data can be found
|
||||
|
||||
|
|
|
@ -240,7 +240,7 @@ archive_load (gboolean is_global)
|
|||
prefix = "/var/ximian-setup-tools";
|
||||
else
|
||||
prefix = g_concat_dir_and_file (g_get_home_dir (),
|
||||
".gnome/control-center");
|
||||
".gnome/capplet-archive");
|
||||
|
||||
object = gtk_object_new (archive_get_type (),
|
||||
"prefix", prefix,
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
<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"/>
|
||||
<item value="IDL:GNOME/ObjectFactory:1.0"/>
|
||||
</oaf_attribute>
|
||||
|
||||
<oaf_attribute name="name" type="string" value="Sound properties capplet factory"/>
|
||||
|
@ -11,9 +11,10 @@
|
|||
<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/PropertyControl:1.0"/>
|
||||
<item value="IDL:Bonobo/Unknown:1.0"/>
|
||||
</oaf_attribute>
|
||||
|
||||
<oaf_attribute name="name" type="string" value="Sound properties capplet"/>
|
||||
</oaf_server>
|
||||
|
||||
|
|
|
@ -1,5 +1,13 @@
|
|||
2001-07-09 Bradford Hovinen <hovinen@ximian.com>
|
||||
|
||||
* sound-properties-capplet.c (create_control_cb): Implement
|
||||
(main): Use create_control_cb
|
||||
|
||||
* Bonobo_Control_Capplet_sound_properties.oaf: Use PropertyControl interface
|
||||
|
||||
* sound-properties-capplet.c (create_dialog_cb): Update signature
|
||||
for use as a BonoboPropertyControlGetControlFn
|
||||
|
||||
* Makefile.am (defaults_DATA): Add sound-properties.xml
|
||||
(EXTRA_DIST): Add defaults_DATA
|
||||
|
||||
|
|
|
@ -196,7 +196,7 @@ close_cb (void)
|
|||
* has the name "prefs_widget". */
|
||||
|
||||
static BonoboObject *
|
||||
create_dialog_cb (BonoboGenericFactory *factory, gpointer data)
|
||||
create_dialog_cb (BonoboPropertyControl *property_control, gint page_number, gpointer data)
|
||||
{
|
||||
BonoboPropertyBag *pb;
|
||||
GtkWidget *pf;
|
||||
|
@ -250,6 +250,20 @@ create_dialog_cb (BonoboGenericFactory *factory, gpointer data)
|
|||
return BONOBO_OBJECT (control);
|
||||
}
|
||||
|
||||
/* create_control_cb
|
||||
*
|
||||
* Small function to create the PropertyControl and return it. It may be copied
|
||||
* and pasted from capplet to capplet.
|
||||
*/
|
||||
|
||||
static BonoboObject *
|
||||
create_control_cb (BonoboGenericFactory *factory, gpointer data)
|
||||
{
|
||||
return BONOBO_OBJECT (bonobo_property_control_new
|
||||
((BonoboPropertyControlGetControlFn)
|
||||
create_dialog_cb, 1, NULL));
|
||||
}
|
||||
|
||||
/* main -- This function should not vary from capplet to capplet
|
||||
*
|
||||
* FIXME: Should there be this much code in main()? Seems a tad complicated;
|
||||
|
@ -302,7 +316,8 @@ main (int argc, char **argv)
|
|||
CORBA_exception_free (&ev);
|
||||
} else {
|
||||
factory = bonobo_generic_factory_new
|
||||
(FACTORY_IID, (BonoboGenericFactoryFn) create_dialog_cb, NULL);
|
||||
("OAFIID:Bonobo_Control_Capplet_sound_properties_Factory",
|
||||
(BonoboGenericFactoryFn) create_control_cb, NULL);
|
||||
bonobo_running_context_auto_exit_unref (BONOBO_OBJECT (factory));
|
||||
bonobo_main ();
|
||||
}
|
||||
|
|
|
@ -1,5 +1,14 @@
|
|||
2001-07-09 Bradford Hovinen <hovinen@ximian.com>
|
||||
|
||||
* capplet-dir.c (capplet_control_launch): Create a control by
|
||||
first retrieving the PropertyControl and then extracting the
|
||||
control from it
|
||||
(capplet_control_launch): Connect button signals
|
||||
(capplet_cancel_cb): Implement. Just destroy the app widget
|
||||
(capplet_ok_cb): Ditto.
|
||||
(capplet_control_launch): Don't use a BonoboArg when setting the
|
||||
property
|
||||
|
||||
* Makefile.am (INCLUDES): Update directory locations
|
||||
|
||||
* capplet-dir.c (capplet_control_launch): Terminate the list of
|
||||
|
|
|
@ -384,11 +384,13 @@ get_root_capplet_dir (void)
|
|||
static void
|
||||
capplet_ok_cb (GtkWidget *widget, GtkWidget *app)
|
||||
{
|
||||
gtk_widget_destroy (app);
|
||||
}
|
||||
|
||||
static void
|
||||
capplet_cancel_cb (GtkWidget *widget, GtkWidget *app)
|
||||
{
|
||||
gtk_widget_destroy (app);
|
||||
}
|
||||
|
||||
/* capplet_control_launch
|
||||
|
@ -405,7 +407,9 @@ capplet_control_launch (const gchar *capplet_name)
|
|||
|
||||
GtkWidget *app, *control;
|
||||
CORBA_Environment ev;
|
||||
BonoboArg *value;
|
||||
|
||||
Bonobo_PropertyControl property_control;
|
||||
Bonobo_Control control_ref;
|
||||
|
||||
g_return_val_if_fail (capplet_name != NULL, NULL);
|
||||
|
||||
|
@ -416,31 +420,48 @@ capplet_control_launch (const gchar *capplet_name)
|
|||
while ((tmp1 = strchr (tmp, '-'))) *tmp1 = '_';
|
||||
|
||||
oaf_iid = g_strconcat ("OAFIID:Bonobo_Control_Capplet_", tmp, NULL);
|
||||
moniker = g_strconcat ("archiver:", tmp, NULL);
|
||||
|
||||
property_control = bonobo_get_object (oaf_iid, "IDL:Bonobo/PropertyControl:1.0", &ev);
|
||||
g_free (oaf_iid);
|
||||
|
||||
if (BONOBO_EX (&ev) || property_control == CORBA_OBJECT_NIL) {
|
||||
g_critical ("Could not resolve PropertyControl");
|
||||
g_free (tmp);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
control_ref = Bonobo_PropertyControl_getControl (property_control, 0, &ev);
|
||||
|
||||
if (BONOBO_EX (&ev) || property_control == CORBA_OBJECT_NIL) {
|
||||
g_critical ("Could not extract control from PropertyControl");
|
||||
bonobo_object_release_unref (property_control, &ev);
|
||||
g_free (tmp);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* FIXME: Use a human-readable capplet name here */
|
||||
app = gnome_dialog_new (_("Capplet"), GNOME_STOCK_BUTTON_OK,
|
||||
GNOME_STOCK_BUTTON_CANCEL, NULL);
|
||||
control = bonobo_widget_new_control (oaf_iid, CORBA_OBJECT_NIL);
|
||||
control = bonobo_widget_new_control_from_objref (control_ref, CORBA_OBJECT_NIL);
|
||||
|
||||
if (control == NULL) {
|
||||
g_critical ("Could not create capplet control");
|
||||
g_critical ("Could not create widget from control");
|
||||
gtk_widget_destroy (app);
|
||||
app = NULL;
|
||||
} else {
|
||||
gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (app)->vbox), control, TRUE, TRUE, 0);
|
||||
|
||||
value = bonobo_arg_new (BONOBO_ARG_STRING);
|
||||
BONOBO_ARG_SET_STRING (value, moniker);
|
||||
bonobo_widget_set_property (BONOBO_WIDGET (control), "moniker", value, NULL);
|
||||
bonobo_arg_release (value);
|
||||
moniker = g_strconcat ("archiver:", tmp, NULL);
|
||||
bonobo_widget_set_property (BONOBO_WIDGET (control), "moniker", moniker, NULL);
|
||||
g_free (moniker);
|
||||
|
||||
gtk_widget_show_all (app);
|
||||
}
|
||||
|
||||
gnome_dialog_button_connect (GNOME_DIALOG (app), 0, GTK_SIGNAL_FUNC (capplet_ok_cb), app);
|
||||
gnome_dialog_button_connect (GNOME_DIALOG (app), 1, GTK_SIGNAL_FUNC (capplet_cancel_cb), app);
|
||||
|
||||
CORBA_exception_free (&ev);
|
||||
g_free (oaf_iid);
|
||||
g_free (moniker);
|
||||
g_free (tmp);
|
||||
|
||||
return app;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue