[monkey-bubble: 377/753] New files.
- From: Sven Herzberg <herzi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [monkey-bubble: 377/753] New files.
- Date: Wed, 14 Jul 2010 22:27:21 +0000 (UTC)
commit 07d5e38f2c8c131fac7a522ab1d42b318325930b
Author: Martin Baulig <baulig suse de>
Date: Mon Jun 4 16:17:06 2001 +0000
New files.
2001-06-04 Martin Baulig <baulig suse de>
* gnome-selector-widget.[ch]: New files.
* gnome-selector-client.[ch]: Derive from BonoboObject, not BonoboWidget.
(gnome_selector_client_new_from_objref): Take a Bonobo_Unknown, not a GNOME_Selector.
(gnome_selector_client_construct_from_objref): Likewise.
* gnome-entry.[ch]: Derive from GnomeSelectorWidget, not GnomeSelectorClient.
(gnome_entry_new_from_selector, gnome_entry_construct): Removed.
* gnome-image-entry.[ch]: Derive from GnomeSelectorWidget, not GnomeSelectorClient.
(gnome_image_entry_new_from_selector): Removed.
* gnome-image-selector.[ch]: Derive from GnomeSelectorWidget, not GnomeSelectorClient.
(gnome_image_selector_new_from_selector, gnome_image_selector_construct): Removed.
libgnomeui/ChangeLog | 17 +
libgnomeui/Makefile.am | 2 +
libgnomeui/gnome-component-widget.c | 791 ++++++-----------------------------
libgnomeui/gnome-component-widget.h | 100 +----
libgnomeui/gnome-entry.c | 127 ++++---
libgnomeui/gnome-entry.h | 31 +-
libgnomeui/gnome-image-entry.c | 102 +++--
libgnomeui/gnome-image-entry.h | 17 +-
libgnomeui/gnome-image-selector.c | 81 +++--
libgnomeui/gnome-image-selector.h | 13 +-
10 files changed, 378 insertions(+), 903 deletions(-)
---
diff --git a/libgnomeui/ChangeLog b/libgnomeui/ChangeLog
index 9730086..2682de5 100644
--- a/libgnomeui/ChangeLog
+++ b/libgnomeui/ChangeLog
@@ -1,3 +1,20 @@
+2001-06-04 Martin Baulig <baulig suse de>
+
+ * gnome-selector-widget.[ch]: New files.
+
+ * gnome-selector-client.[ch]: Derive from BonoboObject, not BonoboWidget.
+ (gnome_selector_client_new_from_objref): Take a Bonobo_Unknown, not a GNOME_Selector.
+ (gnome_selector_client_construct_from_objref): Likewise.
+
+ * gnome-entry.[ch]: Derive from GnomeSelectorWidget, not GnomeSelectorClient.
+ (gnome_entry_new_from_selector, gnome_entry_construct): Removed.
+
+ * gnome-image-entry.[ch]: Derive from GnomeSelectorWidget, not GnomeSelectorClient.
+ (gnome_image_entry_new_from_selector): Removed.
+
+ * gnome-image-selector.[ch]: Derive from GnomeSelectorWidget, not GnomeSelectorClient.
+ (gnome_image_selector_new_from_selector, gnome_image_selector_construct): Removed.
+
2001-06-03 Martin Baulig <baulig suse de>
* gnome-selector-dialog-client.c
diff --git a/libgnomeui/Makefile.am b/libgnomeui/Makefile.am
index 9749b31..902e6d1 100644
--- a/libgnomeui/Makefile.am
+++ b/libgnomeui/Makefile.am
@@ -83,6 +83,7 @@ libgnomeui_2_la_SOURCES = \
gnome-selector-client.c \
gnome-selector-component.c \
gnome-selector-dialog-client.c \
+ gnome-selector-widget.c \
gnome-entry.c \
gnome-image-entry.c \
gnome-image-selector.c \
@@ -123,6 +124,7 @@ gnome_headers = \
gnome-selector-client.h \
gnome-selector-component.h \
gnome-selector-dialog-client.h \
+ gnome-selector-widget.h \
gnome-entry.h \
gnome-image-entry.h \
gnome-image-selector.h \
diff --git a/libgnomeui/gnome-component-widget.c b/libgnomeui/gnome-component-widget.c
index 1987108..46d03dc 100644
--- a/libgnomeui/gnome-component-widget.c
+++ b/libgnomeui/gnome-component-widget.c
@@ -25,189 +25,70 @@
*/
#include <config.h>
-#include <libgnomeui/gnome-entry.h>
+#include <libgnomeui/gnome-selector-widget.h>
#include <bonobo/bonobo-moniker-util.h>
#include <bonobo/bonobo-exception.h>
#include <bonobo/bonobo-async.h>
#include <bonobo/bonobo-main.h>
-struct _GnomeSelectorClientPrivate {
- GNOME_Selector selector;
- Bonobo_EventSource_ListenerId async_listener_id;
- Bonobo_EventSource_ListenerId notify_listener_id;
- GnomeAsyncContext *async_ctx;
+struct _GnomeSelectorWidgetPrivate {
+ gchar *moniker;
+ Bonobo_Unknown corba_objref;
+ Bonobo_UIContainer corba_ui_container;
- gchar *browse_dialog_moniker;
-
- GNOME_Tristate want_entry_widget;
- GNOME_Tristate want_preview_widget;
- GNOME_Tristate want_selector_widget;
- GNOME_Tristate want_browse_dialog;
- GNOME_Tristate want_browse_button;
- GNOME_Tristate want_clear_button;
- GNOME_Tristate want_default_button;
-
- guint32 constructed : 1;
-
- BonoboPropertyBag *pbag;
-
- GNOME_Selector_ClientID client_id;
-
- GHashTable *async_ops;
+ gboolean constructed;
};
-enum {
- ACTIVATE_ENTRY_SIGNAL,
- LAST_SIGNAL
-};
-
-static int gnome_selector_client_signals [LAST_SIGNAL] = {0};
-
-static void
-gnome_selector_client_async_event_cb (BonoboListener *listener,
- char *event_name,
- CORBA_any *any,
- CORBA_Environment *ev,
- gpointer user_data);
-
-static void
-gnome_selector_client_notify_event_cb (BonoboListener *listener,
- char *event_name,
- CORBA_any *any,
- CORBA_Environment *ev,
- gpointer user_data);
-
-static BonoboWidgetClass *gnome_selector_client_parent_class;
+static GObject*
+gnome_selector_widget_constructor (GType type,
+ guint n_construct_properties,
+ GObjectConstructParam *construct_properties);
-static GNOME_AsyncID last_async_id G_GNUC_UNUSED = 0;
+static BonoboWidgetClass *gnome_selector_widget_parent_class;
enum {
PROP_0,
/* Construction properties */
- PROP_WANT_ENTRY_WIDGET,
- PROP_WANT_PREVIEW_WIDGET,
- PROP_WANT_SELECTOR_WIDGET,
- PROP_WANT_BROWSE_DIALOG,
- PROP_WANT_BROWSE_BUTTON,
- PROP_WANT_CLEAR_BUTTON,
- PROP_WANT_DEFAULT_BUTTON,
- PROP_BROWSE_DIALOG_MONIKER
+ PROP_MONIKER,
+ PROP_CORBA_OBJREF,
+ PROP_CORBA_UI_CONTAINER,
};
static void
-gnome_selector_client_finalize (GObject *object)
+gnome_selector_widget_finalize (GObject *object)
{
- GnomeSelectorClient *client = GNOME_SELECTOR_CLIENT (object);
-
- g_free (client->_priv);
- client->_priv = NULL;
+ GnomeSelectorWidget *widget = GNOME_SELECTOR_WIDGET (object);
- G_OBJECT_CLASS (gnome_selector_client_parent_class)->finalize (object);
-}
+ g_free (widget->_priv);
+ widget->_priv = NULL;
-static void
-set_arg_tristate (BonoboArg *arg, GNOME_Tristate value, CORBA_Environment *ev)
-{
- switch (value) {
- case GNOME_TRISTATE_YES:
- BONOBO_ARG_SET_BOOLEAN (arg, TRUE);
- break;
- case GNOME_TRISTATE_NO:
- BONOBO_ARG_SET_BOOLEAN (arg, FALSE);
- break;
- default:
- bonobo_exception_set (ev, ex_Bonobo_PropertyBag_NotFound);
- break;
- }
+ G_OBJECT_CLASS (gnome_selector_widget_parent_class)->finalize (object);
}
static void
-gnome_selector_client_pbag_get_property (BonoboPropertyBag *bag, BonoboArg *arg,
- guint arg_id, CORBA_Environment *ev,
- gpointer user_data)
-{
- GnomeSelectorClient *client;
-
- g_return_if_fail (user_data != NULL);
- g_return_if_fail (GNOME_IS_SELECTOR_CLIENT (user_data));
-
- client = GNOME_SELECTOR_CLIENT (user_data);
-
- switch (arg_id) {
- case PROP_WANT_ENTRY_WIDGET:
- set_arg_tristate (arg, client->_priv->want_entry_widget, ev);
- break;
- case PROP_WANT_PREVIEW_WIDGET:
- set_arg_tristate (arg, client->_priv->want_preview_widget, ev);
- break;
- case PROP_WANT_SELECTOR_WIDGET:
- set_arg_tristate (arg, client->_priv->want_selector_widget, ev);
- break;
- case PROP_WANT_BROWSE_DIALOG:
- set_arg_tristate (arg, client->_priv->want_browse_dialog, ev);
- break;
- case PROP_WANT_BROWSE_BUTTON:
- set_arg_tristate (arg, client->_priv->want_browse_button, ev);
- break;
- case PROP_WANT_CLEAR_BUTTON:
- set_arg_tristate (arg, client->_priv->want_clear_button, ev);
- break;
- case PROP_WANT_DEFAULT_BUTTON:
- set_arg_tristate (arg, client->_priv->want_default_button, ev);
- break;
- case PROP_BROWSE_DIALOG_MONIKER:
- BONOBO_ARG_SET_STRING (arg, client->_priv->browse_dialog_moniker);
- break;
- default:
- g_warning (G_STRLOC ": unknown property id %d", arg_id);
- break;
- }
-}
-
-static void
-gnome_selector_client_set_property (GObject *object, guint param_id,
+gnome_selector_widget_set_property (GObject *object, guint param_id,
const GValue *value, GParamSpec *pspec)
{
- GnomeSelectorClient *client;
+ GnomeSelectorWidget *widget;
g_return_if_fail (object != NULL);
- g_return_if_fail (GNOME_IS_SELECTOR_CLIENT (object));
+ g_return_if_fail (GNOME_IS_SELECTOR_WIDGET (object));
- client = GNOME_SELECTOR_CLIENT (object);
+ widget = GNOME_SELECTOR_WIDGET (object);
switch (param_id) {
- case PROP_WANT_ENTRY_WIDGET:
- g_assert (!client->_priv->constructed);
- client->_priv->want_entry_widget = g_value_get_enum (value);
- break;
- case PROP_WANT_PREVIEW_WIDGET:
- g_assert (!client->_priv->constructed);
- client->_priv->want_preview_widget = g_value_get_enum (value);
- break;
- case PROP_WANT_SELECTOR_WIDGET:
- g_assert (!client->_priv->constructed);
- client->_priv->want_selector_widget = g_value_get_enum (value);
- break;
- case PROP_WANT_BROWSE_DIALOG:
- g_assert (!client->_priv->constructed);
- client->_priv->want_browse_button = g_value_get_enum (value);
+ case PROP_MONIKER:
+ g_assert (!widget->_priv->constructed);
+ widget->_priv->moniker = g_value_dup_string (value);
break;
- case PROP_WANT_BROWSE_BUTTON:
- g_assert (!client->_priv->constructed);
- client->_priv->want_browse_button = g_value_get_enum (value);
+ case PROP_CORBA_OBJREF:
+ g_assert (!widget->_priv->constructed);
+ widget->_priv->corba_objref = g_value_get_pointer (value);
break;
- case PROP_WANT_CLEAR_BUTTON:
- g_assert (!client->_priv->constructed);
- client->_priv->want_clear_button = g_value_get_enum (value);
- break;
- case PROP_WANT_DEFAULT_BUTTON:
- g_assert (!client->_priv->constructed);
- client->_priv->want_default_button = g_value_get_enum (value);
- break;
- case PROP_BROWSE_DIALOG_MONIKER:
- g_assert (!client->_priv->constructed);
- client->_priv->browse_dialog_moniker = g_value_dup_string (value);
+ case PROP_CORBA_UI_CONTAINER:
+ g_assert (!widget->_priv->constructed);
+ widget->_priv->corba_ui_container = g_value_get_pointer (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
@@ -216,40 +97,25 @@ gnome_selector_client_set_property (GObject *object, guint param_id,
}
static void
-gnome_selector_client_get_property (GObject *object, guint param_id, GValue *value,
+gnome_selector_widget_get_property (GObject *object, guint param_id, GValue *value,
GParamSpec *pspec)
{
- GnomeSelectorClient *client;
+ GnomeSelectorWidget *widget;
g_return_if_fail (object != NULL);
- g_return_if_fail (GNOME_IS_SELECTOR_CLIENT (object));
+ g_return_if_fail (GNOME_IS_SELECTOR_WIDGET (object));
- client = GNOME_SELECTOR_CLIENT (object);
+ widget = GNOME_SELECTOR_WIDGET (object);
switch (param_id) {
- case PROP_WANT_ENTRY_WIDGET:
- g_value_set_enum (value, client->_priv->want_entry_widget);
- break;
- case PROP_WANT_PREVIEW_WIDGET:
- g_value_set_enum (value, client->_priv->want_preview_widget);
- break;
- case PROP_WANT_SELECTOR_WIDGET:
- g_value_set_enum (value, client->_priv->want_selector_widget);
- break;
- case PROP_WANT_BROWSE_DIALOG:
- g_value_set_enum (value, client->_priv->want_browse_button);
- break;
- case PROP_WANT_BROWSE_BUTTON:
- g_value_set_enum (value, client->_priv->want_browse_button);
+ case PROP_MONIKER:
+ g_value_set_string (value, widget->_priv->moniker);
break;
- case PROP_WANT_CLEAR_BUTTON:
- g_value_set_enum (value, client->_priv->want_clear_button);
+ case PROP_CORBA_OBJREF:
+ g_value_set_pointer (value, widget->_priv->corba_objref);
break;
- case PROP_WANT_DEFAULT_BUTTON:
- g_value_set_enum (value, client->_priv->want_default_button);
- break;
- case PROP_BROWSE_DIALOG_MONIKER:
- g_value_set_string (value, client->_priv->browse_dialog_moniker);
+ case PROP_CORBA_UI_CONTAINER:
+ g_value_set_pointer (value, widget->_priv->corba_ui_container);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
@@ -258,123 +124,57 @@ gnome_selector_client_get_property (GObject *object, guint param_id, GValue *val
}
static void
-gnome_selector_client_class_init (GnomeSelectorClientClass *klass)
+gnome_selector_widget_class_init (GnomeSelectorWidgetClass *klass)
{
GObjectClass *object_class = (GObjectClass *) klass;
-#if 0
- CORBA_StructMemberSeq async_data_members;
- CORBA_Environment ev;
-#endif
-
- gnome_selector_client_parent_class = g_type_class_peek_parent (klass);
-
- object_class->finalize = gnome_selector_client_finalize;
- object_class->set_property = gnome_selector_client_set_property;
- object_class->get_property = gnome_selector_client_get_property;
-
- gnome_selector_client_signals [ACTIVATE_ENTRY_SIGNAL] =
- g_signal_newc ("activate_entry",
- G_TYPE_FROM_CLASS (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GnomeSelectorClientClass,
- activate_entry),
- NULL, NULL,
- g_cclosure_marshal_VOID__STRING,
- G_TYPE_NONE,
- 1, G_TYPE_STRING);
+
+ gnome_selector_widget_parent_class = g_type_class_peek_parent (klass);
+
+ object_class->constructor = gnome_selector_widget_constructor;
+ object_class->finalize = gnome_selector_widget_finalize;
+ object_class->set_property = gnome_selector_widget_set_property;
+ object_class->get_property = gnome_selector_widget_get_property;
/* Construction properties */
g_object_class_install_property
(object_class,
- PROP_WANT_ENTRY_WIDGET,
- g_param_spec_enum ("want-entry-widget", NULL, NULL,
- GNOME_TYPE_TRISTATE, GNOME_TRISTATE_DEFAULT,
- (G_PARAM_READABLE | G_PARAM_WRITABLE |
- G_PARAM_CONSTRUCT_ONLY)));
- g_object_class_install_property
- (object_class,
- PROP_WANT_PREVIEW_WIDGET,
- g_param_spec_enum ("want-preview-widget", NULL, NULL,
- GNOME_TYPE_TRISTATE, GNOME_TRISTATE_DEFAULT,
- (G_PARAM_READABLE | G_PARAM_WRITABLE |
- G_PARAM_CONSTRUCT_ONLY)));
- g_object_class_install_property
- (object_class,
- PROP_WANT_SELECTOR_WIDGET,
- g_param_spec_enum ("want-selector-widget", NULL, NULL,
- GNOME_TYPE_TRISTATE, GNOME_TRISTATE_DEFAULT,
- (G_PARAM_READABLE | G_PARAM_WRITABLE |
- G_PARAM_CONSTRUCT_ONLY)));
- g_object_class_install_property
- (object_class,
- PROP_WANT_BROWSE_DIALOG,
- g_param_spec_enum ("want-browse-dialog", NULL, NULL,
- GNOME_TYPE_TRISTATE, GNOME_TRISTATE_DEFAULT,
- (G_PARAM_READABLE | G_PARAM_WRITABLE |
- G_PARAM_CONSTRUCT_ONLY)));
- g_object_class_install_property
- (object_class,
- PROP_WANT_BROWSE_BUTTON,
- g_param_spec_enum ("want-browse-button", NULL, NULL,
- GNOME_TYPE_TRISTATE, GNOME_TRISTATE_DEFAULT,
- (G_PARAM_READABLE | G_PARAM_WRITABLE |
- G_PARAM_CONSTRUCT_ONLY)));
- g_object_class_install_property
- (object_class,
- PROP_WANT_CLEAR_BUTTON,
- g_param_spec_enum ("want-clear-button", NULL, NULL,
- GNOME_TYPE_TRISTATE, GNOME_TRISTATE_DEFAULT,
- (G_PARAM_READABLE | G_PARAM_WRITABLE |
- G_PARAM_CONSTRUCT_ONLY)));
+ PROP_MONIKER,
+ g_param_spec_string ("moniker", NULL, NULL,
+ NULL,
+ (G_PARAM_READABLE | G_PARAM_WRITABLE |
+ G_PARAM_CONSTRUCT_ONLY)));
g_object_class_install_property
(object_class,
- PROP_WANT_DEFAULT_BUTTON,
- g_param_spec_enum ("want-default-button", NULL, NULL,
- GNOME_TYPE_TRISTATE, GNOME_TRISTATE_DEFAULT,
- (G_PARAM_READABLE | G_PARAM_WRITABLE |
- G_PARAM_CONSTRUCT_ONLY)));
+ PROP_CORBA_OBJREF,
+ g_param_spec_pointer ("corba-objref", NULL, NULL,
+ (G_PARAM_READABLE | G_PARAM_WRITABLE |
+ G_PARAM_CONSTRUCT_ONLY)));
g_object_class_install_property
(object_class,
- PROP_BROWSE_DIALOG_MONIKER,
- g_param_spec_string ("browse-dialog-moniker", NULL, NULL,
- NULL,
- (G_PARAM_READABLE | G_PARAM_WRITABLE |
- G_PARAM_CONSTRUCT_ONLY)));
-
-#if 0
- async_data_members._length = async_data_members._maximum = 2;
- async_data_members._buffer = CORBA_sequence_CORBA_StructMember_allocbuf (async_data_members._maximum);
- async_data_members._release = FALSE;
-
- async_data_members._buffer[0].type = TC_GNOME_Selector_ClientID;
- async_data_members._buffer[1].type = TC_GNOME_AsyncID;
-
- CORBA_exception_init (&ev);
- klass->async_data_tc = CORBA_ORB_create_struct_tc (bonobo_orb (), NULL, NULL, async_data_members, &ev);
- CORBA_exception_free (&ev);
-
- CORBA_free (&async_data_members._buffer);
-#endif
+ PROP_CORBA_UI_CONTAINER,
+ g_param_spec_pointer ("corba-ui-container", NULL, NULL,
+ (G_PARAM_READABLE | G_PARAM_WRITABLE |
+ G_PARAM_CONSTRUCT_ONLY)));
}
static void
-gnome_selector_client_init (GnomeSelectorClient *client)
+gnome_selector_widget_init (GnomeSelectorWidget *widget)
{
- client->_priv = g_new0 (GnomeSelectorClientPrivate, 1);
+ widget->_priv = g_new0 (GnomeSelectorWidgetPrivate, 1);
}
GtkType
-gnome_selector_client_get_type (void)
+gnome_selector_widget_get_type (void)
{
static GtkType type = 0;
if (! type) {
static const GtkTypeInfo info = {
- "GnomeSelectorClient",
- sizeof (GnomeSelectorClient),
- sizeof (GnomeSelectorClientClass),
- (GtkClassInitFunc) gnome_selector_client_class_init,
- (GtkObjectInitFunc) gnome_selector_client_init,
+ "GnomeSelectorWidget",
+ sizeof (GnomeSelectorWidget),
+ sizeof (GnomeSelectorWidgetClass),
+ (GtkClassInitFunc) gnome_selector_widget_class_init,
+ (GtkObjectInitFunc) gnome_selector_widget_init,
NULL, /* reserved_1 */
NULL, /* reserved_2 */
(GtkClassInitFunc) NULL
@@ -386,419 +186,88 @@ gnome_selector_client_get_type (void)
return type;
}
-GnomeSelectorClient *
-gnome_selector_client_construct (GnomeSelectorClient *client, const gchar *moniker,
- Bonobo_UIContainer uic)
-{
- GNOME_SelectorFactory factory;
- GNOME_Selector selector;
- CORBA_Environment ev;
-
- g_return_val_if_fail (client != NULL, NULL);
- g_return_val_if_fail (GNOME_IS_SELECTOR_CLIENT (client), NULL);
- g_return_val_if_fail (moniker != NULL, NULL);
- g_return_val_if_fail (!client->_priv->constructed, NULL);
-
- CORBA_exception_init (&ev);
-
- g_message (G_STRLOC);
-
- client->_priv->pbag = bonobo_property_bag_new (gnome_selector_client_pbag_get_property,
- NULL, client);
-
- bonobo_property_bag_add (client->_priv->pbag,
- "browse-dialog-moniker", PROP_BROWSE_DIALOG_MONIKER,
- BONOBO_ARG_STRING, NULL, NULL, BONOBO_PROPERTY_READABLE);
- bonobo_property_bag_add (client->_priv->pbag,
- "want-entry-widget", PROP_WANT_ENTRY_WIDGET,
- BONOBO_ARG_BOOLEAN, NULL, NULL, BONOBO_PROPERTY_READABLE);
- bonobo_property_bag_add (client->_priv->pbag,
- "want-preview-widget", PROP_WANT_PREVIEW_WIDGET,
- BONOBO_ARG_BOOLEAN, NULL, NULL, BONOBO_PROPERTY_READABLE);
- bonobo_property_bag_add (client->_priv->pbag,
- "want-browse-dialog", PROP_WANT_BROWSE_DIALOG,
- BONOBO_ARG_BOOLEAN, NULL, NULL, BONOBO_PROPERTY_READABLE);
- bonobo_property_bag_add (client->_priv->pbag,
- "want-selector-widget", PROP_WANT_SELECTOR_WIDGET,
- BONOBO_ARG_BOOLEAN, NULL, NULL, BONOBO_PROPERTY_READABLE);
- bonobo_property_bag_add (client->_priv->pbag,
- "want-browse-button", PROP_WANT_BROWSE_BUTTON,
- BONOBO_ARG_BOOLEAN, NULL, NULL, BONOBO_PROPERTY_READABLE);
- bonobo_property_bag_add (client->_priv->pbag,
- "want-default-button", PROP_WANT_DEFAULT_BUTTON,
- BONOBO_ARG_BOOLEAN, NULL, NULL, BONOBO_PROPERTY_READABLE);
- bonobo_property_bag_add (client->_priv->pbag,
- "want-clear-button", PROP_WANT_CLEAR_BUTTON,
- BONOBO_ARG_BOOLEAN, NULL, NULL, BONOBO_PROPERTY_READABLE);
-
- if (G_OBJECT_TYPE (client) != GNOME_TYPE_SELECTOR_CLIENT)
- bonobo_property_bag_add_gtk_args (client->_priv->pbag, G_OBJECT (client));
-
- factory = bonobo_get_object (moniker, "GNOME/SelectorFactory", &ev);
- if (BONOBO_EX (&ev) || (factory == CORBA_OBJECT_NIL)) {
- g_object_unref (G_OBJECT (client));
- CORBA_exception_free (&ev);
- return NULL;
- }
+extern GnomeSelectorWidget *
+gnome_selector_widget_do_construct (GnomeSelectorWidget *);
- selector = GNOME_SelectorFactory_createSelector (factory, BONOBO_OBJREF (client->_priv->pbag), &ev);
-
- if (BONOBO_EX (&ev) || (selector == NULL)) {
- g_object_unref (G_OBJECT (client));
- CORBA_exception_free (&ev);
- return NULL;
- }
-
- CORBA_exception_free (&ev);
-
- return gnome_selector_client_construct_from_objref (client, selector, uic);
-}
-
-GnomeSelectorClient *
-gnome_selector_client_construct_from_objref (GnomeSelectorClient *client,
- GNOME_Selector corba_selector,
- Bonobo_UIContainer uic)
+GnomeSelectorWidget *
+gnome_selector_widget_do_construct (GnomeSelectorWidget *widget)
{
- Bonobo_Control corba_control;
- Bonobo_EventSource event_source;
- CORBA_Environment ev;
-
- g_return_val_if_fail (client != NULL, NULL);
- g_return_val_if_fail (GNOME_IS_SELECTOR_CLIENT (client), NULL);
- g_return_val_if_fail (corba_selector != NULL, NULL);
- g_return_val_if_fail (!client->_priv->constructed, NULL);
+ GnomeSelectorWidgetPrivate *priv;
- client->_priv->constructed = TRUE;
+ g_return_val_if_fail (widget != NULL, NULL);
+ g_return_val_if_fail (GNOME_IS_SELECTOR_WIDGET (widget), NULL);
- CORBA_exception_init (&ev);
+ priv = widget->_priv;
- client->_priv->async_ctx = gnome_async_context_new ();
-
- client->_priv->selector = bonobo_object_dup_ref (corba_selector, &ev);
- if (BONOBO_EX (&ev)) {
- g_object_unref (G_OBJECT (client));
- CORBA_exception_free (&ev);
- return NULL;
+ if ((priv->corba_objref != CORBA_OBJECT_NIL) && (priv->moniker != NULL)) {
+ g_warning (G_STRLOC ": Cannot specify both `moniker' and `corba-objref', using moniker!");
+ g_free (priv->moniker);
+ priv->moniker = NULL;
}
- corba_control = GNOME_Selector_getControl (client->_priv->selector, &ev);
- if (BONOBO_EX (&ev) || (corba_control == CORBA_OBJECT_NIL)) {
- g_object_unref (G_OBJECT (client));
+ if (priv->corba_objref) {
+ CORBA_Environment ev;
+ BonoboWidget *retval;
+ Bonobo_Control corba_control;
+
+ CORBA_exception_init (&ev);
+ corba_control = Bonobo_Unknown_queryInterface (priv->corba_objref, "IDL:Bonobo/Control:1.0", &ev);
+ if (BONOBO_EX (&ev) || (corba_control == CORBA_OBJECT_NIL)) {
+ CORBA_exception_free (&ev);
+ g_object_unref (G_OBJECT (widget));
+ return NULL;
+ }
CORBA_exception_free (&ev);
- return NULL;
- }
-
- if (!bonobo_widget_construct_control_from_objref (BONOBO_WIDGET (client), corba_control, uic)) {
- g_object_unref (G_OBJECT (client));
- CORBA_exception_free (&ev);
- return NULL;
- }
-
- client->_priv->client_id = GNOME_Selector_getClientID (client->_priv->selector, &ev);
- if (BONOBO_EX (&ev)) {
- g_object_unref (G_OBJECT (client));
- CORBA_exception_free (&ev);
- return NULL;
- }
-
- event_source = GNOME_Selector_getEventSource (client->_priv->selector, &ev);
- if (BONOBO_EX (&ev)) {
- g_object_unref (G_OBJECT (client));
- CORBA_exception_free (&ev);
- return NULL;
- }
-
- client->_priv->async_listener_id = bonobo_event_source_client_add_listener
- (event_source, gnome_selector_client_async_event_cb, "GNOME/Selector:async", &ev, client);
- if (BONOBO_EX (&ev)) {
- g_object_unref (G_OBJECT (client));
- CORBA_exception_free (&ev);
- return NULL;
- }
-
- client->_priv->notify_listener_id = bonobo_event_source_client_add_listener
- (event_source, gnome_selector_client_notify_event_cb, "GNOME/Selector:notify", &ev, client);
- if (BONOBO_EX (&ev)) {
- g_object_unref (G_OBJECT (client));
- CORBA_exception_free (&ev);
- return NULL;
- }
-
- client->_priv->async_ops = g_hash_table_new (NULL, NULL);
-
- CORBA_exception_free (&ev);
-
- return client;
-}
-
-GnomeSelectorClient *
-gnome_selector_client_new (const gchar *moniker, Bonobo_UIContainer uic)
-{
- GnomeSelectorClient *client;
-
- g_return_val_if_fail (moniker != NULL, NULL);
-
- client = g_object_new (gnome_selector_client_get_type (), NULL);
-
- return gnome_selector_client_construct (client, moniker, uic);
-}
-
-GnomeSelectorClient *
-gnome_selector_client_new_from_objref (GNOME_Selector corba_selector, Bonobo_UIContainer uic)
-{
- GnomeSelectorClient *client;
-
- g_return_val_if_fail (corba_selector != CORBA_OBJECT_NIL, NULL);
-
- client = g_object_new (gnome_selector_client_get_type (), NULL);
-
- return gnome_selector_client_construct_from_objref (client, corba_selector, uic);
-}
-
-static CORBA_any *
-gnome_selector_client_create_async_data (GnomeSelectorClient *client, const gchar *uri,
- GnomeAsyncHandle *async_handle)
-{
- GNOME_Selector_private_AsyncData *async_data;
- CORBA_any any;
-
- g_return_val_if_fail (client != NULL, NULL);
- g_return_val_if_fail (GNOME_IS_SELECTOR_CLIENT (client), NULL);
-
- async_data = GNOME_Selector_private_AsyncData__alloc ();
- async_data->client_id = client->_priv->client_id;
- async_data->async_id = ++last_async_id;
- async_data->user_data._type = TC_null;
-
- g_hash_table_insert (client->_priv->async_ops, GINT_TO_POINTER (async_data->async_id), async_handle);
-
- any._type = TC_GNOME_Selector_private_AsyncData;
- any._value = async_data;
- any._release = FALSE;
-
- return bonobo_arg_copy (&any);
-}
-
-void
-gnome_selector_client_activate_entry (GnomeSelectorClient *client)
-{
- CORBA_Environment ev;
- g_return_if_fail (client != NULL);
- g_return_if_fail (GNOME_IS_SELECTOR_CLIENT (client));
+ retval = bonobo_widget_construct_control_from_objref (BONOBO_WIDGET (widget),
+ corba_control, priv->corba_ui_container);
- g_assert (client->_priv->selector != CORBA_OBJECT_NIL);
+ if (retval == NULL) {
+ g_object_unref (G_OBJECT (widget));
+ return NULL;
+ }
- CORBA_exception_init (&ev);
- GNOME_Selector_activateEntry (client->_priv->selector, &ev);
- CORBA_exception_free (&ev);
-}
-
-static void
-gnome_selector_client_async_event_cb (BonoboListener *listener, char *event_name,
- CORBA_any *any, CORBA_Environment *ev, gpointer user_data)
-{
- GnomeSelectorClient *client;
- GNOME_Selector_AsyncEvent *async_reply;
- GNOME_Selector_private_AsyncData *async_data;
- GnomeAsyncHandle *async_handle;
-
- g_return_if_fail (user_data != NULL);
- g_return_if_fail (GNOME_IS_SELECTOR_CLIENT (user_data));
- g_return_if_fail (any != NULL);
- g_return_if_fail (CORBA_TypeCode_equal (any->_type, TC_GNOME_Selector_AsyncEvent, ev));
- g_return_if_fail (!BONOBO_EX (ev));
-
- client = GNOME_SELECTOR_CLIENT (user_data);
- async_reply = any->_value;
-
- /* Is the event for us ? */
- if (!CORBA_TypeCode_equal (async_reply->user_data._type, TC_GNOME_Selector_private_AsyncData, ev))
- return;
-
- async_data = async_reply->user_data._value;
-
- if (async_data->client_id != client->_priv->client_id)
- return;
-
- async_handle = g_hash_table_lookup (client->_priv->async_ops,
- GINT_TO_POINTER (async_data->async_id));
-
- g_message (G_STRLOC ": %p - `%s' - (%d,%d) - `%s' - %d - %p", client, event_name,
- async_data->client_id, async_data->async_id,
- async_reply->uri, async_reply->success, async_handle);
-
- if (!async_handle)
- return;
-
- gnome_async_handle_completed (async_handle, async_reply->success);
-}
-
-static void
-gnome_selector_client_notify_event_cb (BonoboListener *listener, char *event_name,
- CORBA_any *any, CORBA_Environment *ev, gpointer user_data)
-{
- GnomeSelectorClient *client;
-
- g_return_if_fail (user_data != NULL);
- g_return_if_fail (GNOME_IS_SELECTOR_CLIENT (user_data));
-
- client = GNOME_SELECTOR_CLIENT (user_data);
-
- g_message (G_STRLOC ": %p - `%s'", client, event_name);
-
- if (!strcmp (event_name, "GNOME/Selector:notify:activate-entry"))
- if (any && CORBA_TypeCode_equal (any->_type, TC_string, ev))
- g_signal_emit (G_OBJECT (client), gnome_selector_client_signals [ACTIVATE_ENTRY_SIGNAL], 0,
- BONOBO_ARG_GET_STRING (any));
-}
-
-gchar *
-gnome_selector_client_get_uri (GnomeSelectorClient *client)
-{
- gchar *retval = NULL;
- CORBA_Environment ev;
-
- g_return_val_if_fail (client != NULL, NULL);
- g_return_val_if_fail (GNOME_IS_SELECTOR_CLIENT (client), NULL);
-
- g_assert (client->_priv->selector != CORBA_OBJECT_NIL);
-
- CORBA_exception_init (&ev);
- retval = GNOME_Selector_getURI (client->_priv->selector, &ev);
- CORBA_exception_free (&ev);
+ priv->corba_objref = bonobo_widget_get_objref (retval);
+ priv->constructed = TRUE;
- return retval;
-}
-
-void
-gnome_selector_client_check_uri (GnomeSelectorClient *client,
- GnomeAsyncHandle **async_handle_return,
- const gchar *uri,
- gboolean directory_ok,
- guint timeout_msec,
- GnomeAsyncFunc async_func,
- gpointer user_data)
-{
- CORBA_Environment ev;
- GnomeAsyncHandle *async_handle;
- CORBA_any *async_data;
-
- g_return_if_fail (client != NULL);
- g_return_if_fail (GNOME_IS_SELECTOR_CLIENT (client));
-
- async_handle = gnome_async_context_get (client->_priv->async_ctx, GNOME_ASYNC_TYPE_CHECK_URI,
- async_func, G_OBJECT (client), uri, user_data,
- NULL);
- if (async_handle_return) {
- *async_handle_return = async_handle;
- gnome_async_handle_ref (async_handle);
+ return widget;
}
- async_data = gnome_selector_client_create_async_data (client, uri, async_handle);
+ if (priv->moniker) {
+ BonoboWidget *retval;
- CORBA_exception_init (&ev);
- GNOME_Selector_checkURI (client->_priv->selector, uri, directory_ok, async_data, &ev);
- CORBA_exception_free (&ev);
-}
+ retval = bonobo_widget_construct_control (BONOBO_WIDGET (widget), priv->moniker,
+ priv->corba_ui_container);
-void
-gnome_selector_client_scan_directory (GnomeSelectorClient *client,
- GnomeAsyncHandle **async_handle_return,
- const gchar *uri,
- guint timeout_msec,
- GnomeAsyncFunc async_func,
- gpointer user_data)
-{
- CORBA_Environment ev;
- GnomeAsyncHandle *async_handle;
- CORBA_any *async_data;
-
- g_return_if_fail (client != NULL);
- g_return_if_fail (GNOME_IS_SELECTOR_CLIENT (client));
-
- async_handle = gnome_async_context_get (client->_priv->async_ctx, GNOME_ASYNC_TYPE_SCAN_DIRECTORY,
- async_func, G_OBJECT (client), uri, user_data,
- NULL);
- if (async_handle_return) {
- *async_handle_return = async_handle;
- gnome_async_handle_ref (async_handle);
- }
-
- async_data = gnome_selector_client_create_async_data (client, uri, async_handle);
+ if (retval == NULL) {
+ g_object_unref (G_OBJECT (widget));
+ return NULL;
+ }
- CORBA_exception_init (&ev);
- GNOME_Selector_scanDirectory (client->_priv->selector, uri, async_data, &ev);
- CORBA_exception_free (&ev);
-}
+ priv->corba_objref = bonobo_widget_get_objref (retval);
+ priv->constructed = TRUE;
-void
-gnome_selector_client_set_uri (GnomeSelectorClient *client,
- GnomeAsyncHandle **async_handle_return,
- const gchar *uri,
- guint timeout_msec,
- GnomeAsyncFunc async_func,
- gpointer user_data)
-{
- CORBA_Environment ev;
- GnomeAsyncHandle *async_handle;
- CORBA_any *async_data;
-
- g_return_if_fail (client != NULL);
- g_return_if_fail (GNOME_IS_SELECTOR_CLIENT (client));
-
- async_handle = gnome_async_context_get (client->_priv->async_ctx, GNOME_ASYNC_TYPE_SET_URI,
- async_func, G_OBJECT (client), uri, user_data,
- NULL);
- if (async_handle_return) {
- *async_handle_return = async_handle;
- gnome_async_handle_ref (async_handle);
+ return widget;
}
- async_data = gnome_selector_client_create_async_data (client, uri, async_handle);
-
- CORBA_exception_init (&ev);
- GNOME_Selector_setURI (client->_priv->selector, uri, async_data, &ev);
- CORBA_exception_free (&ev);
-}
+ g_warning (G_STRLOC ": Must use either the `moniker' or the `corba-objref' property!");
+ g_object_unref (G_OBJECT (widget));
-void
-gnome_selector_client_add_uri (GnomeSelectorClient *client,
- GnomeAsyncHandle **async_handle_return,
- const gchar *uri,
- glong position,
- guint list_id,
- guint timeout_msec,
- GnomeAsyncFunc async_func,
- gpointer user_data)
-{
- CORBA_Environment ev;
- GnomeAsyncHandle *async_handle;
- CORBA_any *async_data;
-
- g_return_if_fail (client != NULL);
- g_return_if_fail (GNOME_IS_SELECTOR_CLIENT (client));
-
- async_handle = gnome_async_context_get (client->_priv->async_ctx, GNOME_ASYNC_TYPE_ADD_URI,
- async_func, G_OBJECT (client), uri, user_data,
- NULL);
- if (async_handle_return) {
- *async_handle_return = async_handle;
- gnome_async_handle_ref (async_handle);
- }
+ return NULL;
- async_data = gnome_selector_client_create_async_data (client, uri, async_handle);
-
- CORBA_exception_init (&ev);
- GNOME_Selector_addURI (client->_priv->selector, uri, position, list_id, async_data, &ev);
- CORBA_exception_free (&ev);
}
-GNOME_Selector
-gnome_selector_client_get_selector (GnomeSelectorClient *client)
+static GObject*
+gnome_selector_widget_constructor (GType type,
+ guint n_construct_properties,
+ GObjectConstructParam *construct_properties)
{
- g_return_val_if_fail (client != NULL, CORBA_OBJECT_NIL);
- g_return_val_if_fail (GNOME_IS_SELECTOR_CLIENT (client), CORBA_OBJECT_NIL);
-
- return client->_priv->selector;
+ GObject *object = G_OBJECT_CLASS (gnome_selector_widget_parent_class)->
+ constructor (type, n_construct_properties, construct_properties);
+ GnomeSelectorWidget *widget = GNOME_SELECTOR_WIDGET (object);
+
+ if (type == GNOME_TYPE_SELECTOR_WIDGET)
+ return (GObject *) gnome_selector_widget_do_construct (widget);
+ else
+ return object;
}
diff --git a/libgnomeui/gnome-component-widget.h b/libgnomeui/gnome-component-widget.h
index d7446d8..a160458 100644
--- a/libgnomeui/gnome-component-widget.h
+++ b/libgnomeui/gnome-component-widget.h
@@ -24,116 +24,46 @@
@NOTATION@
*/
-/* GnomeSelector client
+/* GnomeSelector widget
*
* Author: Martin Baulig <baulig suse de>
*/
-#ifndef GNOME_SELECTOR_CLIENT_H
-#define GNOME_SELECTOR_CLIENT_H
+#ifndef GNOME_SELECTOR_WIDGET_H
+#define GNOME_SELECTOR_WIDGET_H
#include <bonobo/bonobo-widget.h>
-#include <libgnome/gnome-async-context.h>
#include <libgnome/Gnome.h>
G_BEGIN_DECLS
-#define GNOME_TYPE_SELECTOR_CLIENT (gnome_selector_client_get_type ())
-#define GNOME_SELECTOR_CLIENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNOME_TYPE_SELECTOR_CLIENT, GnomeSelectorClient))
-#define GNOME_SELECTOR_CLIENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GNOME_TYPE_SELECTOR_CLIENT, GnomeSelectorClientClass))
-#define GNOME_IS_SELECTOR_CLIENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GNOME_TYPE_SELECTOR_CLIENT))
-#define GNOME_IS_SELECTOR_CLIENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GNOME_TYPE_SELECTOR_CLIENT))
+#define GNOME_TYPE_SELECTOR_WIDGET (gnome_selector_widget_get_type ())
+#define GNOME_SELECTOR_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNOME_TYPE_SELECTOR_WIDGET, GnomeSelectorWidget))
+#define GNOME_SELECTOR_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GNOME_TYPE_SELECTOR_WIDGET, GnomeSelectorWidgetClass))
+#define GNOME_IS_SELECTOR_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GNOME_TYPE_SELECTOR_WIDGET))
+#define GNOME_IS_SELECTOR_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GNOME_TYPE_SELECTOR_WIDGET))
-typedef struct _GnomeSelectorClient GnomeSelectorClient;
-typedef struct _GnomeSelectorClientPrivate GnomeSelectorClientPrivate;
-typedef struct _GnomeSelectorClientClass GnomeSelectorClientClass;
+typedef struct _GnomeSelectorWidget GnomeSelectorWidget;
+typedef struct _GnomeSelectorWidgetPrivate GnomeSelectorWidgetPrivate;
+typedef struct _GnomeSelectorWidgetClass GnomeSelectorWidgetClass;
-struct _GnomeSelectorClient {
+struct _GnomeSelectorWidget {
BonoboWidget widget;
/*< private >*/
- GnomeSelectorClientPrivate *_priv;
+ GnomeSelectorWidgetPrivate *_priv;
};
-struct _GnomeSelectorClientClass {
+struct _GnomeSelectorWidgetClass {
BonoboWidgetClass parent_class;
-
- void (*activate_entry) (GnomeSelectorClient *client,
- const gchar *entry_text);
};
GtkType
-gnome_selector_client_get_type (void) G_GNUC_CONST;
-
-GnomeSelectorClient *
-gnome_selector_client_new (const gchar *moniker,
- Bonobo_UIContainer uic);
-
-GnomeSelectorClient *
-gnome_selector_client_new_from_objref (GNOME_Selector corba_selector,
- Bonobo_UIContainer uic);
-
-GnomeSelectorClient *
-gnome_selector_client_construct (GnomeSelectorClient *client,
- const gchar *moniker,
- Bonobo_UIContainer uic);
-
-GnomeSelectorClient *
-gnome_selector_client_construct_from_objref (GnomeSelectorClient *client,
- GNOME_Selector corba_selector,
- Bonobo_UIContainer uic);
-
-GNOME_Selector
-gnome_selector_client_get_selector (GnomeSelectorClient *client);
-
-/* If the entry widget is derived from GtkEditable, then we can use this
- * function to send an "activate" signal to it. */
-void
-gnome_selector_client_activate_entry (GnomeSelectorClient *client);
-
-void
-gnome_selector_client_check_uri (GnomeSelectorClient *client,
- GnomeAsyncHandle **handle_return,
- const gchar *uri,
- gboolean directory_ok,
- guint timeout_msec,
- GnomeAsyncFunc async_func,
- gpointer user_data);
-
-void
-gnome_selector_client_scan_directory (GnomeSelectorClient *client,
- GnomeAsyncHandle **handle_return,
- const gchar *uri,
- guint timeout_msec,
- GnomeAsyncFunc async_func,
- gpointer user_data);
-
-/* Get/set URI. */
-
-gchar *
-gnome_selector_client_get_uri (GnomeSelectorClient *client);
-
-void
-gnome_selector_client_set_uri (GnomeSelectorClient *client,
- GnomeAsyncHandle **handle_return,
- const gchar *uri,
- guint timeout_msec,
- GnomeAsyncFunc async_func,
- gpointer user_data);
-
-void
-gnome_selector_client_add_uri (GnomeSelectorClient *client,
- GnomeAsyncHandle **handle_return,
- const gchar *uri,
- glong position,
- guint list_id,
- guint timeout_msec,
- GnomeAsyncFunc async_func,
- gpointer user_data);
+gnome_selector_widget_get_type (void) G_GNUC_CONST;
G_END_DECLS
diff --git a/libgnomeui/gnome-entry.c b/libgnomeui/gnome-entry.c
index c1dd875..6f00f81 100644
--- a/libgnomeui/gnome-entry.c
+++ b/libgnomeui/gnome-entry.c
@@ -40,10 +40,13 @@
#include <gtk/gtksignal.h>
#include <libgnome/gnome-i18n.h>
#include <libgnome/gnome-selector.h>
+#include <bonobo/bonobo-exception.h>
#include "gnome-macros.h"
#include "gnome-entry.h"
struct _GnomeEntryPrivate {
+ Bonobo_PropertyBag pbag;
+
gboolean constructed;
gboolean is_file_entry;
@@ -54,7 +57,12 @@ static void gnome_entry_class_init (GnomeEntryClass *class);
static void gnome_entry_init (GnomeEntry *gentry);
static void gnome_entry_finalize (GObject *object);
-static GnomeSelectorClientClass *parent_class;
+static GObject*
+gnome_entry_constructor (GType type,
+ guint n_construct_properties,
+ GObjectConstructParam *construct_properties);
+
+static GnomeSelectorWidget *parent_class;
enum {
PROP_0,
@@ -80,7 +88,7 @@ gnome_entry_get_type (void)
NULL
};
- entry_type = gtk_type_unique (gnome_selector_client_get_type (), &entry_info);
+ entry_type = gtk_type_unique (gnome_selector_widget_get_type (), &entry_info);
}
return entry_type;
@@ -138,7 +146,7 @@ gnome_entry_class_init (GnomeEntryClass *class)
object_class = (GtkObjectClass *) class;
gobject_class = (GObjectClass *) class;
- parent_class = gtk_type_class (gnome_selector_client_get_type ());
+ parent_class = gtk_type_class (gnome_selector_widget_get_type ());
gobject_class->get_property = gnome_entry_get_property;
gobject_class->set_property = gnome_entry_set_property;
@@ -152,6 +160,7 @@ gnome_entry_class_init (GnomeEntryClass *class)
(G_PARAM_READABLE | G_PARAM_WRITABLE |
G_PARAM_CONSTRUCT_ONLY)));
+ gobject_class->constructor = gnome_entry_constructor;
gobject_class->finalize = gnome_entry_finalize;
}
@@ -161,61 +170,74 @@ gnome_entry_init (GnomeEntry *gentry)
gentry->_priv = g_new0 (GnomeEntryPrivate, 1);
}
-GtkWidget *
-gnome_entry_construct (GnomeEntry *gentry,
- GNOME_Selector corba_selector,
- Bonobo_UIContainer uic)
-{
- g_return_val_if_fail (gentry != NULL, NULL);
- g_return_val_if_fail (GNOME_IS_ENTRY (gentry), NULL);
- g_return_val_if_fail (corba_selector != CORBA_OBJECT_NIL, NULL);
+extern GnomeSelectorWidget *gnome_selector_widget_do_construct (GnomeSelectorWidget *);
- return (GtkWidget *) gnome_selector_client_construct_from_objref
- (GNOME_SELECTOR_CLIENT (gentry), corba_selector, uic);
-}
-
-GtkWidget *
-gnome_entry_new (void)
+static GObject*
+gnome_entry_constructor (GType type,
+ guint n_construct_properties,
+ GObjectConstructParam *construct_properties)
{
- GnomeEntry *entry;
+ GObject *object = G_OBJECT_CLASS (parent_class)->constructor
+ (type, n_construct_properties, construct_properties);
+ GnomeEntry *gentry = GNOME_ENTRY (object);
+ GnomeEntryPrivate *priv = gentry->_priv;
+ Bonobo_Unknown corba_objref = CORBA_OBJECT_NIL;
+ gchar *moniker = NULL;
+ GValue value = { 0, };
+ CORBA_Environment ev;
+
+ if (type != GNOME_TYPE_ENTRY)
+ return object;
+
+ g_value_init (&value, G_TYPE_POINTER);
+ g_object_get_property (object, "corba-objref", &value);
+ corba_objref = g_value_get_pointer (&value);
+ g_value_unset (&value);
+
+ if (corba_objref != CORBA_OBJECT_NIL)
+ goto out;
+
+ g_value_init (&value, G_TYPE_STRING);
+ g_object_get_property (object, "moniker", &value);
+ moniker = g_value_dup_string (&value);
+ g_value_unset (&value);
+
+ if (moniker != NULL)
+ goto out;
+
+ if (priv->is_file_entry)
+ g_object_set (object, "moniker", "OAFIID:GNOME_UI_Component_FileEntry", NULL);
+ else
+ g_object_set (object, "moniker", "OAFIID:GNOME_UI_Component_Entry", NULL);
+
+ out:
+ g_free (moniker);
+ if (!gnome_selector_widget_do_construct (GNOME_SELECTOR_WIDGET (gentry)))
+ return NULL;
+
+ corba_objref = bonobo_widget_get_objref (BONOBO_WIDGET (gentry));
+ if (corba_objref == CORBA_OBJECT_NIL) {
+ g_object_unref (object);
+ return NULL;
+ }
- entry = g_object_new (gnome_entry_get_type (),
- "is-file-entry", FALSE,
- NULL);
+ CORBA_exception_init (&ev);
+ priv->pbag = Bonobo_Unknown_queryInterface (corba_objref, "IDL:Bonobo/PropertyBag:1.0", &ev);
+ CORBA_exception_free (&ev);
- return (GtkWidget *) gnome_selector_client_construct
- (GNOME_SELECTOR_CLIENT (entry),
- "OAFIID:GNOME_UI_Component_Entry",
- CORBA_OBJECT_NIL);
+ return object;
}
GtkWidget *
-gnome_file_entry_new (void)
+gnome_entry_new (void)
{
- GnomeEntry *entry;
-
- entry = g_object_new (gnome_entry_get_type (),
- "is-file-entry", TRUE,
- NULL);
-
- return (GtkWidget *) gnome_selector_client_construct
- (GNOME_SELECTOR_CLIENT (entry),
- "OAFIID:GNOME_UI_Component_Entry",
- CORBA_OBJECT_NIL);
+ return g_object_new (gnome_entry_get_type (), "is-file-entry", FALSE, NULL);
}
GtkWidget *
-gnome_entry_new_from_selector (GNOME_Selector corba_selector,
- Bonobo_UIContainer uic)
+gnome_file_entry_new (void)
{
- GnomeEntry *entry;
-
- g_return_val_if_fail (corba_selector != CORBA_OBJECT_NIL, NULL);
-
- entry = g_object_new (gnome_entry_get_type (), NULL);
-
- return (GtkWidget *) gnome_selector_client_construct_from_objref
- (GNOME_SELECTOR_CLIENT (entry), corba_selector, uic);
+ return g_object_new (gnome_entry_get_type (), "is-file-entry", TRUE, NULL);
}
static void
@@ -240,12 +262,9 @@ gnome_entry_get_text (GnomeEntry *gentry)
{
g_return_val_if_fail (gentry != NULL, NULL);
g_return_val_if_fail (GNOME_IS_ENTRY (gentry), NULL);
+ g_return_val_if_fail (gentry->_priv->pbag != CORBA_OBJECT_NIL, NULL);
-#ifdef FIXME
- return gnome_selector_client_get_entry_text (GNOME_SELECTOR_CLIENT (gentry));
-#else
- return NULL;
-#endif
+ return bonobo_pbclient_get_string (gentry->_priv->pbag, "entry-text", NULL);
}
void
@@ -253,10 +272,8 @@ gnome_entry_set_text (GnomeEntry *gentry, const gchar *text)
{
g_return_if_fail (gentry != NULL);
g_return_if_fail (GNOME_IS_ENTRY (gentry));
+ g_return_if_fail (gentry->_priv->pbag != CORBA_OBJECT_NIL);
-#ifdef FIXME
- gnome_selector_client_set_entry_text (GNOME_SELECTOR_CLIENT (gentry),
- text);
-#endif
+ bonobo_pbclient_set_string (gentry->_priv->pbag, "entry-text", text, NULL);
}
diff --git a/libgnomeui/gnome-entry.h b/libgnomeui/gnome-entry.h
index b7c2481..e6e33b7 100644
--- a/libgnomeui/gnome-entry.h
+++ b/libgnomeui/gnome-entry.h
@@ -1,4 +1,4 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */
/*
* Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation
* All rights reserved.
@@ -34,7 +34,7 @@
#include <libgnome/gnome-selector.h>
-#include <libgnomeui/gnome-selector-client.h>
+#include <libgnomeui/gnome-selector-widget.h>
G_BEGIN_DECLS
@@ -53,34 +53,27 @@ typedef struct _GnomeEntryPrivate GnomeEntryPrivate;
typedef struct _GnomeEntryClass GnomeEntryClass;
struct _GnomeEntry {
- GnomeSelectorClient selector_client;
+ GnomeSelectorWidget widget;
- /*< private >*/
- GnomeEntryPrivate *_priv;
+ /*< private >*/
+ GnomeEntryPrivate *_priv;
};
struct _GnomeEntryClass {
- GnomeSelectorClientClass parent_class;
+ GnomeSelectorWidgetClass parent_class;
};
-GType gnome_entry_get_type (void) G_GNUC_CONST;
+GType gnome_entry_get_type (void) G_GNUC_CONST;
-GtkWidget *gnome_entry_new (void);
+GtkWidget *gnome_entry_new (void);
-GtkWidget *gnome_file_entry_new (void);
+GtkWidget *gnome_file_entry_new (void);
-GtkWidget *gnome_entry_new_from_selector (GNOME_Selector corba_selector,
- Bonobo_UIContainer uic);
+gchar *gnome_entry_get_text (GnomeEntry *gentry);
-GtkWidget *gnome_entry_construct (GnomeEntry *gentry,
- GNOME_Selector corba_selector,
- Bonobo_UIContainer uic);
-
-gchar *gnome_entry_get_text (GnomeEntry *gentry);
-
-void gnome_entry_set_text (GnomeEntry *gentry,
- const gchar *text);
+void gnome_entry_set_text (GnomeEntry *gentry,
+ const gchar *text);
G_END_DECLS
diff --git a/libgnomeui/gnome-image-entry.c b/libgnomeui/gnome-image-entry.c
index 7ec5f2a..81a9d04 100644
--- a/libgnomeui/gnome-image-entry.c
+++ b/libgnomeui/gnome-image-entry.c
@@ -40,6 +40,7 @@
#include <gtk/gtksignal.h>
#include <libgnome/gnome-i18n.h>
#include <bonobo/bonobo-moniker-util.h>
+#include <bonobo/bonobo-exception.h>
#include "gnome-image-entry.h"
#define ICON_SIZE 48
@@ -64,9 +65,14 @@ enum {
static void gnome_image_entry_class_init (GnomeImageEntryClass *class);
static void gnome_image_entry_init (GnomeImageEntry *gentry);
-static void gnome_image_entry_finalize (GObject *object);
+static void gnome_image_entry_finalize (GObject *object);
-static GnomeSelectorClientClass *parent_class;
+static GObject*
+gnome_image_entry_constructor (GType type,
+ guint n_construct_properties,
+ GObjectConstructParam *construct_properties);
+
+static GnomeSelectorWidgetClass *parent_class;
GType
gnome_image_entry_get_type (void)
@@ -85,7 +91,7 @@ gnome_image_entry_get_type (void)
NULL
};
- entry_type = gtk_type_unique (gnome_selector_client_get_type (), &entry_info);
+ entry_type = gtk_type_unique (gnome_selector_widget_get_type (), &entry_info);
}
return entry_type;
@@ -153,8 +159,9 @@ gnome_image_entry_class_init (GnomeImageEntryClass *class)
object_class = (GObjectClass *) class;
- parent_class = gtk_type_class (gnome_selector_client_get_type ());
+ parent_class = gtk_type_class (bonobo_widget_get_type ());
+ object_class->constructor = gnome_image_entry_constructor;
object_class->finalize = gnome_image_entry_finalize;
object_class->get_property = gnome_image_entry_get_property;
@@ -192,47 +199,70 @@ gnome_image_entry_init (GnomeImageEntry *gentry)
gentry->_priv = g_new0 (GnomeImageEntryPrivate, 1);
}
-GtkWidget *
-gnome_image_entry_new_icon_entry (void)
-{
- GnomeImageEntry *ientry;
+extern GnomeSelectorWidget *gnome_selector_widget_do_construct (GnomeSelectorWidget *);
- ientry = g_object_new (gnome_image_entry_get_type (),
- "is-pixmap-entry", FALSE, NULL);
-
- return (GtkWidget *) gnome_selector_client_construct
- (GNOME_SELECTOR_CLIENT (ientry),
- "OAFIID:GNOME_UI_Component_ImageEntry",
- CORBA_OBJECT_NIL);
+static GObject*
+gnome_image_entry_constructor (GType type,
+ guint n_construct_properties,
+ GObjectConstructParam *construct_properties)
+{
+ GObject *object = G_OBJECT_CLASS (parent_class)->constructor
+ (type, n_construct_properties, construct_properties);
+ GnomeImageEntry *ientry = GNOME_IMAGE_ENTRY (object);
+ GnomeImageEntryPrivate *priv = ientry->_priv;
+ Bonobo_Unknown corba_objref = CORBA_OBJECT_NIL;
+ gchar *moniker = NULL;
+ GValue value = { 0, };
+
+ if (type != GNOME_TYPE_IMAGE_ENTRY)
+ return object;
+
+ g_value_init (&value, G_TYPE_POINTER);
+ g_object_get_property (object, "corba-objref", &value);
+ corba_objref = g_value_get_pointer (&value);
+ g_value_unset (&value);
+
+ if (corba_objref != CORBA_OBJECT_NIL)
+ goto out;
+
+ g_value_init (&value, G_TYPE_STRING);
+ g_object_get_property (object, "moniker", &value);
+ moniker = g_value_dup_string (&value);
+ g_value_unset (&value);
+
+ if (moniker != NULL)
+ goto out;
+
+ if (priv->is_pixmap_entry)
+ moniker = g_strdup_printf ("%s!type=pixmap;preview-x=%d;preview-y=%d",
+ "OAFIID:GNOME_UI_Component_ImageEntry_Item",
+ priv->preview_x, priv->preview_y);
+ else
+ moniker = g_strdup_printf ("%s!type=icon", "OAFIID:GNOME_UI_Component_ImageEntry_Item");
+
+ g_object_set (object, "moniker", moniker, NULL);
+
+ out:
+ g_free (moniker);
+ if (!gnome_selector_widget_do_construct (GNOME_SELECTOR_WIDGET (ientry)))
+ return NULL;
+
+ return object;
}
GtkWidget *
-gnome_image_entry_new_pixmap_entry (guint preview_x, guint preview_y)
+gnome_image_entry_new_icon_entry (void)
{
- GnomeImageEntry *ientry;
-
- ientry = g_object_new (gnome_image_entry_get_type (),
- "preview-x", preview_x, "preview-y", preview_y,
- "is-pixmap-entry", TRUE, NULL);
-
- return (GtkWidget *) gnome_selector_client_construct
- (GNOME_SELECTOR_CLIENT (ientry),
- "OAFIID:GNOME_UI_Component_ImageEntry",
- CORBA_OBJECT_NIL);
+ return g_object_new (gnome_image_entry_get_type (),
+ "is-pixmap-entry", FALSE, NULL);
}
GtkWidget *
-gnome_image_entry_new_from_selector (GNOME_Selector corba_selector,
- Bonobo_UIContainer uic)
+gnome_image_entry_new_pixmap_entry (guint preview_x, guint preview_y)
{
- GnomeImageEntry *ientry;
-
- g_return_val_if_fail (corba_selector != CORBA_OBJECT_NIL, NULL);
-
- ientry = g_object_new (gnome_image_entry_get_type (), NULL);
-
- return (GtkWidget *) gnome_selector_client_construct_from_objref
- (GNOME_SELECTOR_CLIENT (ientry), corba_selector, uic);
+ return g_object_new (gnome_image_entry_get_type (),
+ "preview-x", preview_x, "preview-y", preview_y,
+ "is-pixmap-entry", TRUE, NULL);
}
static void
diff --git a/libgnomeui/gnome-image-entry.h b/libgnomeui/gnome-image-entry.h
index 8a1a794..438f665 100644
--- a/libgnomeui/gnome-image-entry.h
+++ b/libgnomeui/gnome-image-entry.h
@@ -34,7 +34,7 @@
#include <libgnome/gnome-selector.h>
-#include <libgnomeui/gnome-selector-client.h>
+#include <libgnomeui/gnome-selector-widget.h>
G_BEGIN_DECLS
@@ -52,26 +52,23 @@ typedef struct _GnomeImageEntryPrivate GnomeImageEntryPrivate;
typedef struct _GnomeImageEntryClass GnomeImageEntryClass;
struct _GnomeImageEntry {
- GnomeSelectorClient client;
+ GnomeSelectorWidget widget;
/*< private >*/
GnomeImageEntryPrivate *_priv;
};
struct _GnomeImageEntryClass {
- GnomeSelectorClientClass parent_class;
+ GnomeSelectorWidgetClass parent_class;
};
-GType gnome_image_entry_get_type (void) G_GNUC_CONST;
+GType gnome_image_entry_get_type (void) G_GNUC_CONST;
-GtkWidget *gnome_image_entry_new_icon_entry (void);
+GtkWidget *gnome_image_entry_new_icon_entry (void);
-GtkWidget *gnome_image_entry_new_pixmap_entry (guint preview_x,
- guint preview_y);
-
-GtkWidget *gnome_image_entry_new_from_selector (GNOME_Selector corba_selector,
- Bonobo_UIContainer uic);
+GtkWidget *gnome_image_entry_new_pixmap_entry (guint preview_x,
+ guint preview_y);
G_END_DECLS
diff --git a/libgnomeui/gnome-image-selector.c b/libgnomeui/gnome-image-selector.c
index a66bd37..245696a 100644
--- a/libgnomeui/gnome-image-selector.c
+++ b/libgnomeui/gnome-image-selector.c
@@ -51,7 +51,12 @@ static void gnome_image_selector_class_init (GnomeImageSelectorClass *class)
static void gnome_image_selector_init (GnomeImageSelector *gselector);
static void gnome_image_selector_finalize (GObject *object);
-static GnomeSelectorClientClass *parent_class;
+static GObject*
+gnome_image_selector_constructor (GType type,
+ guint n_construct_properties,
+ GObjectConstructParam *construct_properties);
+
+static GnomeSelectorWidgetClass *parent_class;
GType
gnome_image_selector_get_type (void)
@@ -70,7 +75,7 @@ gnome_image_selector_get_type (void)
NULL
};
- selector_type = gtk_type_unique (gnome_selector_client_get_type (), &selector_info);
+ selector_type = gtk_type_unique (gnome_selector_widget_get_type (), &selector_info);
}
return selector_type;
@@ -79,15 +84,14 @@ gnome_image_selector_get_type (void)
static void
gnome_image_selector_class_init (GnomeImageSelectorClass *class)
{
- GtkObjectClass *object_class;
- GObjectClass *gobject_class;
+ GObjectClass *object_class;
- object_class = (GtkObjectClass *) class;
- gobject_class = (GObjectClass *) class;
+ object_class = (GObjectClass *) class;
- parent_class = gtk_type_class (gnome_selector_client_get_type ());
+ parent_class = gtk_type_class (gnome_selector_widget_get_type ());
- gobject_class->finalize = gnome_image_selector_finalize;
+ object_class->constructor = gnome_image_selector_constructor;
+ object_class->finalize = gnome_image_selector_finalize;
}
static void
@@ -96,32 +100,55 @@ gnome_image_selector_init (GnomeImageSelector *gselector)
gselector->_priv = g_new0 (GnomeImageSelectorPrivate, 1);
}
-GtkWidget *
-gnome_image_selector_new (void)
+extern GnomeSelectorWidget *gnome_selector_widget_do_construct (GnomeSelectorWidget *);
+
+static GObject*
+gnome_image_selector_constructor (GType type,
+ guint n_construct_properties,
+ GObjectConstructParam *construct_properties)
{
- GnomeImageSelector *iselector;
+ GObject *object = G_OBJECT_CLASS (parent_class)->constructor
+ (type, n_construct_properties, construct_properties);
+ GnomeImageSelector *iselector = GNOME_IMAGE_SELECTOR (object);
+ Bonobo_Unknown corba_objref = CORBA_OBJECT_NIL;
+ gchar *moniker = NULL;
+ GValue value = { 0, };
- iselector = g_object_new (gnome_image_selector_get_type (),
- NULL);
+ if (type != GNOME_TYPE_IMAGE_SELECTOR)
+ return object;
- return (GtkWidget *) gnome_selector_client_construct
- (GNOME_SELECTOR_CLIENT (iselector),
- "OAFIID:GNOME_UI_Component_IconSelector",
- CORBA_OBJECT_NIL);
-}
+ g_value_init (&value, G_TYPE_POINTER);
+ g_object_get_property (object, "corba-objref", &value);
+ corba_objref = g_value_get_pointer (&value);
+ g_value_unset (&value);
-GtkWidget *
-gnome_image_selector_new_from_selector (GNOME_Selector corba_selector,
- Bonobo_UIContainer uic)
-{
- GnomeImageSelector *iselector;
+ if (corba_objref != CORBA_OBJECT_NIL)
+ goto out;
- g_return_val_if_fail (corba_selector != CORBA_OBJECT_NIL, NULL);
+ g_value_init (&value, G_TYPE_STRING);
+ g_object_get_property (object, "moniker", &value);
+ moniker = g_value_dup_string (&value);
+ g_value_unset (&value);
- iselector = g_object_new (gnome_image_selector_get_type (), NULL);
+ if (moniker != NULL)
+ goto out;
- return (GtkWidget *) gnome_selector_client_construct_from_objref
- (GNOME_SELECTOR_CLIENT (iselector), corba_selector, uic);
+ moniker = g_strdup_printf ("OAFIID:GNOME_UI_Component_IconSelector");
+
+ g_object_set (object, "moniker", moniker, NULL);
+
+ out:
+ g_free (moniker);
+ if (!gnome_selector_widget_do_construct (GNOME_SELECTOR_WIDGET (iselector)))
+ return NULL;
+
+ return object;
+}
+
+GtkWidget *
+gnome_image_selector_new (void)
+{
+ return g_object_new (gnome_image_selector_get_type (), NULL);
}
static void
diff --git a/libgnomeui/gnome-image-selector.h b/libgnomeui/gnome-image-selector.h
index f5614b6..5e8f012 100644
--- a/libgnomeui/gnome-image-selector.h
+++ b/libgnomeui/gnome-image-selector.h
@@ -34,7 +34,7 @@
#include <libgnome/gnome-selector.h>
-#include <libgnomeui/gnome-selector-client.h>
+#include <libgnomeui/gnome-selector-widget.h>
G_BEGIN_DECLS
@@ -52,14 +52,14 @@ typedef struct _GnomeImageSelectorPrivate GnomeImageSelectorPrivate;
typedef struct _GnomeImageSelectorClass GnomeImageSelectorClass;
struct _GnomeImageSelector {
- GnomeSelectorClient client;
+ GnomeSelectorWidget widget;
/*< private >*/
GnomeImageSelectorPrivate *_priv;
};
struct _GnomeImageSelectorClass {
- GnomeSelectorClientClass parent_class;
+ GnomeSelectorWidgetClass parent_class;
};
@@ -67,13 +67,6 @@ GType gnome_image_selector_get_type (void) G_GNUC_CONST;
GtkWidget *gnome_image_selector_new (void);
-GtkWidget *gnome_image_selector_new_from_selector (GNOME_Selector corba_selector,
- Bonobo_UIContainer uic);
-
-GtkWidget *gnome_image_selector_construct (GnomeImageSelector *iselector,
- GNOME_Selector corba_selector,
- Bonobo_UIContainer uic);
-
G_END_DECLS
#endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]