Removed -DGLADE_DATADIR
2001-07-17 Bradford Hovinen <hovinen@ximian.com> * Makefile.am (INCLUDES): Removed -DGLADE_DATADIR * capplet-util.c (create_dialog_cb): Use create_widget_cb rather than loading from Glade (capplet_init): Accept CreateDialogFn and initialize create_dialog_cb (close_cb): Don't call gtk_object_destroy (dialog) (get_control_cb): Rename from create_dialog_cb * sound-properties-capplet.c (create_dialog): Implement (main): Call glade_gnome_init; pass create_dialog to capplet_init (setup_dialog): Retrieve the Glade data from the widget passed to this function (create_dialog): Make sure dialog is destroyed when widget is * Makefile.am (EXTRA_DIST): Changed Applications_DATA to Applications_in_files (INCLUDES): Add -DGLADE_DATADIR
This commit is contained in:
parent
63fbbec13b
commit
43d56c8e68
7 changed files with 70 additions and 56 deletions
|
@ -1,3 +1,14 @@
|
|||
2001-07-17 Bradford Hovinen <hovinen@ximian.com>
|
||||
|
||||
* Makefile.am (INCLUDES): Removed -DGLADE_DATADIR
|
||||
|
||||
* capplet-util.c (create_dialog_cb): Use create_widget_cb rather
|
||||
than loading from Glade
|
||||
(capplet_init): Accept CreateDialogFn and initialize
|
||||
create_dialog_cb
|
||||
(close_cb): Don't call gtk_object_destroy (dialog)
|
||||
(get_control_cb): Rename from create_dialog_cb
|
||||
|
||||
2001-07-14 Carlos Perelló Marín <carlos@gnome-db.org>
|
||||
|
||||
* .cvsignore: ssshhhh
|
||||
|
|
|
@ -4,7 +4,6 @@ INCLUDES = \
|
|||
-DGNOMELOCALEDIR=\""$(datadir)/locale"\" \
|
||||
-DGNOME_ICONDIR=\""${prefix}/share/pixmaps"\" \
|
||||
-DG_LOG_DOMAIN=\"capplet-common\" \
|
||||
-DGLADE_DATADIR=\""$(datadir)/control-center/interfaces"\" \
|
||||
-I$(top_srcdir)/ \
|
||||
-I$(top_srcdir)/intl \
|
||||
@CAPPLET_CFLAGS@
|
||||
|
|
|
@ -27,15 +27,13 @@
|
|||
|
||||
#include "capplet-util.h"
|
||||
|
||||
static CreateDialogFn create_dialog_cb = NULL;
|
||||
static ApplySettingsFn apply_settings_cb = NULL;
|
||||
static SetupPropertyEditorsFn setup_cb = NULL;
|
||||
|
||||
static BonoboControl *control = NULL;
|
||||
static GladeXML *dialog;
|
||||
static GtkWidget *widget;
|
||||
|
||||
static gchar *glade_filename;
|
||||
|
||||
/* apply_cb
|
||||
*
|
||||
* Callback issued when the user clicks "Apply" or "Ok". This function is
|
||||
|
@ -102,7 +100,6 @@ set_moniker_cb (BonoboPropertyBag *bag, BonoboArg *arg, guint arg_id,
|
|||
gchar *full_moniker;
|
||||
BonoboPropertyFrame *pf;
|
||||
Bonobo_PropertyBag proxy;
|
||||
GladeXML *dialog;
|
||||
Bonobo_ConfigDatabase db;
|
||||
|
||||
if (arg_id != 1) return;
|
||||
|
@ -113,7 +110,6 @@ set_moniker_cb (BonoboPropertyBag *bag, BonoboArg *arg, guint arg_id,
|
|||
pf = BONOBO_PROPERTY_FRAME (bonobo_control_get_widget (control));
|
||||
bonobo_property_frame_set_moniker (pf, full_moniker);
|
||||
proxy = BONOBO_OBJREF (pf->proxy);
|
||||
dialog = gtk_object_get_data (GTK_OBJECT (control), "dialog");
|
||||
|
||||
db = bonobo_get_object (moniker, "IDL:Bonobo/ConfigDatabase:1.0", ev);
|
||||
|
||||
|
@ -123,7 +119,7 @@ set_moniker_cb (BonoboPropertyBag *bag, BonoboArg *arg, guint arg_id,
|
|||
gtk_object_set_data (GTK_OBJECT (pf), "config-database", db);
|
||||
|
||||
if (setup_cb != NULL)
|
||||
setup_cb (dialog, proxy);
|
||||
setup_cb (bonobo_control_get_widget (control), proxy);
|
||||
}
|
||||
|
||||
/* close_cb
|
||||
|
@ -136,11 +132,10 @@ set_moniker_cb (BonoboPropertyBag *bag, BonoboArg *arg, guint arg_id,
|
|||
static void
|
||||
close_cb (void)
|
||||
{
|
||||
gtk_object_destroy (GTK_OBJECT (dialog));
|
||||
control = NULL;
|
||||
}
|
||||
|
||||
/* create_dialog_cb
|
||||
/* get_control_cb
|
||||
*
|
||||
* Callback to construct the main dialog box for this capplet; invoked by Bonobo
|
||||
* whenever capplet activation is requested. Returns a BonoboObject representing
|
||||
|
@ -148,25 +143,16 @@ close_cb (void)
|
|||
*/
|
||||
|
||||
static BonoboObject *
|
||||
create_dialog_cb (BonoboPropertyControl *property_control, gint page_number)
|
||||
get_control_cb (BonoboPropertyControl *property_control, gint page_number)
|
||||
{
|
||||
BonoboPropertyBag *pb;
|
||||
GtkWidget *pf;
|
||||
|
||||
if (control == NULL) {
|
||||
dialog = glade_xml_new (glade_filename, "prefs_widget");
|
||||
widget = create_dialog_cb ();
|
||||
|
||||
if (dialog == NULL) {
|
||||
g_critical ("Could not load glade file %s", glade_filename);
|
||||
if (widget == NULL)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
widget = glade_xml_get_widget (dialog, "prefs_widget");
|
||||
|
||||
if (widget == NULL) {
|
||||
g_critical ("Could not find preferences widget");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
pf = bonobo_property_frame_new (NULL, NULL);
|
||||
gtk_object_set_data (GTK_OBJECT (property_control),
|
||||
|
@ -175,7 +161,6 @@ create_dialog_cb (BonoboPropertyControl *property_control, gint page_number)
|
|||
gtk_widget_show_all (pf);
|
||||
|
||||
control = bonobo_control_new (pf);
|
||||
gtk_object_set_data (GTK_OBJECT (control), "dialog", dialog);
|
||||
|
||||
pb = bonobo_property_bag_new ((BonoboPropertyGetFn) get_moniker_cb,
|
||||
(BonoboPropertySetFn) set_moniker_cb,
|
||||
|
@ -214,7 +199,7 @@ create_control_cb (BonoboGenericFactory *factory, Bonobo_ConfigDatabase db)
|
|||
CORBA_exception_init (&ev);
|
||||
|
||||
property_control = bonobo_property_control_new
|
||||
((BonoboPropertyControlGetControlFn) create_dialog_cb, 1, NULL);
|
||||
((BonoboPropertyControlGetControlFn) get_control_cb, 1, NULL);
|
||||
gtk_signal_connect (GTK_OBJECT (property_control), "action",
|
||||
GTK_SIGNAL_FUNC (apply_cb), NULL);
|
||||
|
||||
|
@ -246,23 +231,6 @@ get_factory_name (const gchar *binary)
|
|||
return res;
|
||||
}
|
||||
|
||||
/* get_glade_filename
|
||||
*
|
||||
* Construct the filename of the Glade file from the binary name
|
||||
*/
|
||||
|
||||
static gchar *get_glade_filename (const gchar *binary)
|
||||
{
|
||||
gchar *tmp, *tmp1, *res;
|
||||
|
||||
tmp = g_strdup (binary);
|
||||
if ((tmp1 = strstr (tmp, "-capplet")) != NULL) *tmp1 = '\0';
|
||||
|
||||
res = g_strconcat (GLADE_DATADIR, "/", tmp, ".glade", NULL);
|
||||
g_free (tmp);
|
||||
return res;
|
||||
}
|
||||
|
||||
/* get_default_moniker
|
||||
*
|
||||
* Construct the default moniker for configuration from the binary name
|
||||
|
@ -288,6 +256,7 @@ void
|
|||
capplet_init (int argc,
|
||||
char **argv,
|
||||
ApplySettingsFn apply_fn,
|
||||
CreateDialogFn create_dialog_fn,
|
||||
SetupPropertyEditorsFn setup_fn,
|
||||
GetLegacySettingsFn get_legacy_fn)
|
||||
{
|
||||
|
@ -313,7 +282,6 @@ capplet_init (int argc,
|
|||
|
||||
CORBA_exception_init (&ev);
|
||||
|
||||
glade_gnome_init ();
|
||||
gnomelib_register_popt_table (cap_options, _("Capplet options"));
|
||||
gnome_init_with_popt_table (argv[0], VERSION, argc, argv,
|
||||
oaf_popt_options, 0, NULL);
|
||||
|
@ -338,10 +306,10 @@ capplet_init (int argc,
|
|||
get_legacy_fn (db);
|
||||
Bonobo_ConfigDatabase_sync (db, &ev);
|
||||
} else {
|
||||
create_dialog_cb = create_dialog_fn;
|
||||
apply_settings_cb = apply_fn;
|
||||
setup_cb = setup_fn;
|
||||
factory_iid = get_factory_name (argv[0]);
|
||||
glade_filename = get_glade_filename (argv[0]);
|
||||
factory = bonobo_generic_factory_new
|
||||
(factory_iid, (BonoboGenericFactoryFn) create_control_cb, db);
|
||||
g_free (factory_iid);
|
||||
|
|
|
@ -27,8 +27,6 @@
|
|||
#include <gnome.h>
|
||||
#include <bonobo.h>
|
||||
|
||||
#include <glade/glade.h>
|
||||
|
||||
/* FIXME: We should really have a single bonobo-conf.h header */
|
||||
|
||||
#include <bonobo-conf/bonobo-config-database.h>
|
||||
|
@ -67,8 +65,11 @@
|
|||
/* Callback to apply the settings in the given database */
|
||||
typedef void (*ApplySettingsFn) (Bonobo_ConfigDatabase db);
|
||||
|
||||
/* Callback to set up the dialog proper */
|
||||
typedef GtkWidget *(*CreateDialogFn) (void);
|
||||
|
||||
/* Callback to set up property editors for the dialog */
|
||||
typedef void (*SetupPropertyEditorsFn) (GladeXML *dialog, Bonobo_PropertyBag bag);
|
||||
typedef void (*SetupPropertyEditorsFn) (GtkWidget *dialog, Bonobo_PropertyBag bag);
|
||||
|
||||
/* Callback to retrieve legacy settings and store them in the new configuration
|
||||
* database */
|
||||
|
@ -82,9 +83,6 @@ typedef void (*GetLegacySettingsFn) (Bonobo_ConfigDatabase db);
|
|||
* particular convention. In particular, suppose the name of the capplet binary
|
||||
* is foo-properties-capplet. Then:
|
||||
*
|
||||
* - The glade file is named foo-properties.glade. It is located in
|
||||
* $(datadir)/control-center/interfaces. The widget containing the property
|
||||
* information is called prefs_widget.
|
||||
* - The factory IID is Bonobo_Control_Capplet_foo_properties_Factory
|
||||
* - The default configuration moniker is archiver:foo-properties
|
||||
*
|
||||
|
@ -96,6 +94,7 @@ typedef void (*GetLegacySettingsFn) (Bonobo_ConfigDatabase db);
|
|||
void capplet_init (int argc,
|
||||
gchar **argv,
|
||||
ApplySettingsFn apply_fn,
|
||||
CreateDialogFn create_dialog_fn,
|
||||
SetupPropertyEditorsFn setup_property_editors_fn,
|
||||
GetLegacySettingsFn get_legacy_settings_fn);
|
||||
|
||||
|
|
|
@ -1,7 +1,14 @@
|
|||
2001-07-17 Bradford Hovinen <hovinen@ximian.com>
|
||||
|
||||
* sound-properties-capplet.c (create_dialog): Implement
|
||||
(main): Call glade_gnome_init; pass create_dialog to capplet_init
|
||||
(setup_dialog): Retrieve the Glade data from the widget passed to
|
||||
this function
|
||||
(create_dialog): Make sure dialog is destroyed when widget is
|
||||
|
||||
* Makefile.am (EXTRA_DIST): Changed Applications_DATA to
|
||||
Applications_in_files
|
||||
(INCLUDES): Add -DGLADE_DATADIR
|
||||
|
||||
* sound-properties-capplet.c (setup_dialog): Sensitize events
|
||||
check box only if ESD is already enabled
|
||||
|
|
|
@ -20,12 +20,13 @@ oaf_DATA = \
|
|||
|
||||
EXTRA_DIST = ChangeLog $(Applications_in_files) $(Glade_DATA) $(oaf_DATA) $(defaults_DATA)
|
||||
|
||||
INCLUDES = \
|
||||
-DGNOMELOCALEDIR=\""$(datadir)/locale"\" \
|
||||
-DG_LOG_DOMAIN=\"sound-properties\" \
|
||||
-I$(top_srcdir)/ \
|
||||
-I$(top_srcdir)/intl \
|
||||
-I$(top_srcdir)/capplets/common \
|
||||
INCLUDES = \
|
||||
-DGNOMELOCALEDIR=\""$(datadir)/locale"\" \
|
||||
-DG_LOG_DOMAIN=\"sound-properties\" \
|
||||
-DGLADE_DATADIR=\""$(datadir)/control-center/interfaces"\" \
|
||||
-I$(top_srcdir)/ \
|
||||
-I$(top_srcdir)/intl \
|
||||
-I$(top_srcdir)/capplets/common \
|
||||
@CAPPLET_CFLAGS@
|
||||
|
||||
bin_PROGRAMS = sound-properties-capplet
|
||||
|
|
|
@ -27,6 +27,8 @@
|
|||
|
||||
#include "capplet-util.h"
|
||||
|
||||
#include <glade/glade.h>
|
||||
|
||||
/* Needed only for the sound capplet */
|
||||
|
||||
#include <stdlib.h>
|
||||
|
@ -97,14 +99,40 @@ start_esd (void)
|
|||
#endif
|
||||
}
|
||||
|
||||
/* create_dialog
|
||||
*
|
||||
* Create the dialog box and return it as a GtkWidget
|
||||
*/
|
||||
|
||||
static GtkWidget *
|
||||
create_dialog (void)
|
||||
{
|
||||
GladeXML *data;
|
||||
GtkWidget *widget;
|
||||
|
||||
data = glade_xml_new (GLADE_DATADIR "/sound-properties.glade", "prefs_widget");
|
||||
widget = glade_xml_get_widget (data, "prefs_widget");
|
||||
gtk_object_set_data (GTK_OBJECT (widget), "glade-data", data);
|
||||
|
||||
gtk_signal_connect_object (GTK_OBJECT (widget), "destroy",
|
||||
GTK_SIGNAL_FUNC (gtk_object_destroy),
|
||||
GTK_OBJECT (data));
|
||||
|
||||
return widget;
|
||||
}
|
||||
|
||||
/* setup_dialog
|
||||
*
|
||||
* Set up the property editors for our dialog
|
||||
*/
|
||||
|
||||
static void
|
||||
setup_dialog (GladeXML *dialog, Bonobo_PropertyBag bag)
|
||||
setup_dialog (GtkWidget *widget, Bonobo_PropertyBag bag)
|
||||
{
|
||||
GladeXML *dialog;
|
||||
|
||||
dialog = gtk_object_get_data (GTK_OBJECT (widget), "glade-data");
|
||||
|
||||
CREATE_PEDITOR (boolean, "enable_esd", "enable_toggle");
|
||||
CREATE_PEDITOR (boolean, "event_sounds", "events_toggle");
|
||||
|
||||
|
@ -132,7 +160,8 @@ get_legacy_settings (Bonobo_ConfigDatabase db)
|
|||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
capplet_init (argc, argv, apply_settings, setup_dialog, get_legacy_settings);
|
||||
glade_gnome_init ();
|
||||
capplet_init (argc, argv, apply_settings, create_dialog, setup_dialog, get_legacy_settings);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue