[monkey-bubble: 248/753] New files. (GnomeSelectorClient): This is derived from BonoboWidget and is
- From: Sven Herzberg <herzi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [monkey-bubble: 248/753] New files. (GnomeSelectorClient): This is derived from BonoboWidget and is
- Date: Wed, 14 Jul 2010 22:16:30 +0000 (UTC)
commit 3a813b91cb61a77b6ac3d17e8ef67e7ce0e89c7f
Author: Martin Baulig <baulig suse de>
Date: Mon Apr 30 16:47:35 2001 +0000
New files. (GnomeSelectorClient): This is derived from BonoboWidget and is
2001-04-30 Martin Baulig <baulig suse de>
* gnome-selector-client.[ch]: New files.
(GnomeSelectorClient): This is derived from BonoboWidget and
is the client side wrapper for a GNOME::Selector CORBA object.
* gnome-entry.h (GnomeEntry): Derive this from GnomeSelectorClient.
(gnome_entry_construct_from_selector): New function.
* gnome-boxed.defs (GnomeSelectorAsyncHandle): Removed.
libgnomeui/ChangeLog | 11 ++
libgnomeui/Makefile.am | 3 +-
libgnomeui/gnome-boxed.defs | 6 -
libgnomeui/gnome-component-widget.c | 187 ++++++++++++++++++++++++++
libgnomeui/gnome-component-widget.h | 92 +++++++++++++
libgnomeui/gnome-entry.c | 251 ++++++++++++-----------------------
libgnomeui/gnome-entry.h | 24 ++--
7 files changed, 389 insertions(+), 185 deletions(-)
---
diff --git a/libgnomeui/ChangeLog b/libgnomeui/ChangeLog
index fe4710a..29c0aac 100644
--- a/libgnomeui/ChangeLog
+++ b/libgnomeui/ChangeLog
@@ -1,5 +1,16 @@
2001-04-30 Martin Baulig <baulig suse de>
+ * gnome-selector-client.[ch]: New files.
+ (GnomeSelectorClient): This is derived from BonoboWidget and
+ is the client side wrapper for a GNOME::Selector CORBA object.
+
+ * gnome-entry.h (GnomeEntry): Derive this from GnomeSelectorClient.
+ (gnome_entry_construct_from_selector): New function.
+
+ * gnome-boxed.defs (GnomeSelectorAsyncHandle): Removed.
+
+2001-04-30 Martin Baulig <baulig suse de>
+
* gnomemarshal.list, gnomemarshal-main.c: Moved to libgnome.
2001-04-29 Martin Baulig <baulig suse de>
diff --git a/libgnomeui/Makefile.am b/libgnomeui/Makefile.am
index ebef8d8..7a3ee19 100644
--- a/libgnomeui/Makefile.am
+++ b/libgnomeui/Makefile.am
@@ -81,9 +81,8 @@ libgnomeui_2_la_SOURCES = \
gnome-druid-page-edge.c \
gnome-druid-page-standard.c \
gnome-geometry.c \
+ gnome-selector-client.c \
gnome-entry.c \
- gnome-selector.c \
- gnome-selectorP.h \
gnome-icon-selector.c \
gnome-file-selector.c \
gnome-font-picker.c \
diff --git a/libgnomeui/gnome-boxed.defs b/libgnomeui/gnome-boxed.defs
index 7d7ca3c..f6fc839 100644
--- a/libgnomeui/gnome-boxed.defs
+++ b/libgnomeui/gnome-boxed.defs
@@ -4,9 +4,3 @@
; The code doesn't benefit most C programs directly, but is very useful
; for language bindings.
-(define-boxed GnomeSelectorAsyncHandle
- #f
- gnome_selector_async_handle_ref
- gnome_selector_async_handle_unref
- #t
-)
diff --git a/libgnomeui/gnome-component-widget.c b/libgnomeui/gnome-component-widget.c
new file mode 100644
index 0000000..5fb3313
--- /dev/null
+++ b/libgnomeui/gnome-component-widget.c
@@ -0,0 +1,187 @@
+/* -*- Mode: C; c-set-style: gnu indent-tabs-mode: t; c-basic-offset: 4; tab-width: 8 -*- */
+/*
+ * Copyright (C) 2000 SuSE GmbH
+ * Author: Martin Baulig <baulig suse de>
+ *
+ * This file is part of the Gnome Library.
+ *
+ * The Gnome Library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * The Gnome Library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with the Gnome Library; see the file COPYING.LIB. If not,
+ * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+/*
+ @NOTATION@
+ */
+
+#include <config.h>
+#include <libgnomeui/gnome-entry.h>
+#include <bonobo/bonobo-exception.h>
+
+struct _GnomeSelectorClientPrivate {
+ GNOME_Selector selector;
+};
+
+static BonoboWidgetClass *gnome_selector_client_parent_class;
+
+static void
+gnome_selector_client_finalize (GObject *object)
+{
+ GnomeSelectorClient *client = GNOME_SELECTOR_CLIENT (object);
+
+ g_free (client->_priv);
+ client->_priv = NULL;
+
+ G_OBJECT_CLASS (gnome_selector_client_parent_class)->finalize (object);
+}
+
+static void
+gnome_selector_client_class_init (GnomeSelectorClientClass *klass)
+{
+ GObjectClass *object_class = (GObjectClass *) klass;
+
+ gnome_selector_client_parent_class = g_type_class_peek_parent (klass);
+
+ object_class->finalize = gnome_selector_client_finalize;
+}
+
+static void
+gnome_selector_client_init (GnomeSelectorClient *client)
+{
+ client->_priv = g_new0 (GnomeSelectorClientPrivate, 1);
+}
+
+GtkType
+gnome_selector_client_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,
+ NULL, /* reserved_1 */
+ NULL, /* reserved_2 */
+ (GtkClassInitFunc) NULL
+ };
+
+ type = gtk_type_unique (bonobo_widget_get_type (), &info);
+ }
+
+ return type;
+}
+
+GnomeSelectorClient *
+gnome_selector_client_construct (GnomeSelectorClient *client, GNOME_Selector corba_selector,
+ Bonobo_UIContainer uic)
+{
+ Bonobo_Control corba_control;
+ 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 != CORBA_OBJECT_NIL, NULL);
+
+ CORBA_exception_init (&ev);
+
+ corba_control = GNOME_Selector_getControl (corba_selector, &ev);
+ if (BONOBO_EX (&ev) || (corba_control == CORBA_OBJECT_NIL)) {
+ g_object_unref (G_OBJECT (client));
+ 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->selector = bonobo_object_dup_ref (corba_selector, &ev);
+ if (BONOBO_EX (&ev)) {
+ g_object_unref (G_OBJECT (client));
+ CORBA_exception_free (&ev);
+ return NULL;
+ }
+
+ CORBA_exception_free (&ev);
+
+ return client;
+}
+
+GnomeSelectorClient *
+gnome_selector_client_new (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 (client, corba_selector, uic);
+}
+
+gchar *
+gnome_selector_client_get_entry_text (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_getEntryText (client->_priv->selector, &ev);
+ CORBA_exception_free (&ev);
+
+ return retval;
+}
+
+void
+gnome_selector_client_set_entry_text (GnomeSelectorClient *client,
+ const gchar *text)
+{
+ CORBA_Environment ev;
+
+ g_return_if_fail (client != NULL);
+ g_return_if_fail (GNOME_IS_SELECTOR_CLIENT (client));
+
+ g_assert (client->_priv->selector != CORBA_OBJECT_NIL);
+
+ CORBA_exception_init (&ev);
+ GNOME_Selector_setEntryText (client->_priv->selector, text, &ev);
+ CORBA_exception_free (&ev);
+
+
+}
+
+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));
+
+ g_assert (client->_priv->selector != CORBA_OBJECT_NIL);
+
+ CORBA_exception_init (&ev);
+ GNOME_Selector_activateEntry (client->_priv->selector, &ev);
+ CORBA_exception_free (&ev);
+}
+
diff --git a/libgnomeui/gnome-component-widget.h b/libgnomeui/gnome-component-widget.h
new file mode 100644
index 0000000..494af6b
--- /dev/null
+++ b/libgnomeui/gnome-component-widget.h
@@ -0,0 +1,92 @@
+/* -*- Mode: C; c-set-style: gnu indent-tabs-mode: t; c-basic-offset: 4; tab-width: 8 -*- */
+/*
+ * Copyright (C) 2000 SuSE GmbH
+ * Author: Martin Baulig <baulig suse de>
+ *
+ * This file is part of the Gnome Library.
+ *
+ * The Gnome Library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * The Gnome Library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with the Gnome Library; see the file COPYING.LIB. If not,
+ * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+/*
+ @NOTATION@
+ */
+
+/* GnomeSelector client
+ *
+ * Author: Martin Baulig <baulig suse de>
+ */
+
+#ifndef GNOME_SELECTOR_CLIENT_H
+#define GNOME_SELECTOR_CLIENT_H
+
+
+#include <bonobo/bonobo-widget.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))
+
+
+typedef struct _GnomeSelectorClient GnomeSelectorClient;
+typedef struct _GnomeSelectorClientPrivate GnomeSelectorClientPrivate;
+typedef struct _GnomeSelectorClientClass GnomeSelectorClientClass;
+
+struct _GnomeSelectorClient {
+ BonoboWidget widget;
+
+ /*< private >*/
+ GnomeSelectorClientPrivate *_priv;
+};
+
+struct _GnomeSelectorClientClass {
+ BonoboWidgetClass parent_class;
+};
+
+GtkType
+gnome_selector_client_get_type (void) G_GNUC_CONST;
+
+GnomeSelectorClient *
+gnome_selector_client_new (GNOME_Selector corba_selector,
+ Bonobo_UIContainer uic);
+
+GnomeSelectorClient *
+gnome_selector_client_construct (GnomeSelectorClient *client,
+ GNOME_Selector corba_selector,
+ Bonobo_UIContainer uic);
+
+/* Get/set the text in the entry widget. */
+gchar *
+gnome_selector_client_get_entry_text (GnomeSelectorClient *client);
+
+void
+gnome_selector_client_set_entry_text (GnomeSelectorClient *client,
+ const gchar *text);
+
+/* 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);
+
+G_END_DECLS
+
+#endif
diff --git a/libgnomeui/gnome-entry.c b/libgnomeui/gnome-entry.c
index eee06a6..cbf1e49 100644
--- a/libgnomeui/gnome-entry.c
+++ b/libgnomeui/gnome-entry.c
@@ -43,6 +43,8 @@
#include "gnome-entry.h"
struct _GnomeEntryPrivate {
+ BonoboControl *control;
+
GtkWidget *combo;
GtkWidget *entry;
};
@@ -50,26 +52,22 @@ struct _GnomeEntryPrivate {
static void gnome_entry_class_init (GnomeEntryClass *class);
static void gnome_entry_init (GnomeEntry *gentry);
-static void gnome_entry_destroy (GtkObject *object);
static void gnome_entry_finalize (GObject *object);
-static gchar *get_entry_text_handler (GnomeSelector *selector);
+static gchar *get_entry_text_handler (GnomeSelector *selector,
+ GnomeEntry *gentry);
static void set_entry_text_handler (GnomeSelector *selector,
- const gchar *text);
-static void activate_entry_handler (GnomeSelector *selector);
-static void history_changed_handler (GnomeSelector *selector);
+ const gchar *text,
+ GnomeEntry *gentry);
+static void activate_entry_handler (GnomeSelector *selector,
+ GnomeEntry *gentry);
+static void history_changed_handler (GnomeSelector *selector,
+ GnomeEntry *gentry);
static void entry_activated_cb (GtkWidget *widget,
- gpointer data);
-static void do_construct_handler (GnomeSelector *selector);
-
-
-static GObject*
-gnome_entry_constructor (GType type,
- guint n_construct_properties,
- GObjectConstructParam *construct_properties);
+ GnomeSelector *selector);
-static GnomeSelectorClass *parent_class;
+static GnomeSelectorClientClass *parent_class;
guint
gnome_entry_get_type (void)
@@ -88,7 +86,7 @@ gnome_entry_get_type (void)
NULL
};
- entry_type = gtk_type_unique (gnome_selector_get_type (), &entry_info);
+ entry_type = gtk_type_unique (gnome_selector_client_get_type (), &entry_info);
}
return entry_type;
@@ -97,27 +95,15 @@ gnome_entry_get_type (void)
static void
gnome_entry_class_init (GnomeEntryClass *class)
{
- GnomeSelectorClass *selector_class;
GtkObjectClass *object_class;
GObjectClass *gobject_class;
- selector_class = (GnomeSelectorClass *) class;
object_class = (GtkObjectClass *) class;
gobject_class = (GObjectClass *) class;
- parent_class = gtk_type_class (gnome_selector_get_type ());
+ parent_class = gtk_type_class (gnome_selector_client_get_type ());
- object_class->destroy = gnome_entry_destroy;
gobject_class->finalize = gnome_entry_finalize;
-
- gobject_class->constructor = gnome_entry_constructor;
-
- selector_class->get_entry_text = get_entry_text_handler;
- selector_class->set_entry_text = set_entry_text_handler;
- selector_class->activate_entry = activate_entry_handler;
- selector_class->history_changed = history_changed_handler;
-
- selector_class->do_construct = do_construct_handler;
}
static void
@@ -126,103 +112,17 @@ gnome_entry_init (GnomeEntry *gentry)
gentry->_priv = g_new0(GnomeEntryPrivate, 1);
}
-static gboolean
-get_value_boolean (GnomeEntry *gentry, const gchar *prop_name)
-{
- GValue value = { 0, };
- gboolean retval;
-
- g_value_init (&value, G_TYPE_BOOLEAN);
- g_object_get_property (G_OBJECT (gentry), prop_name, &value);
- retval = g_value_get_boolean (&value);
- g_value_unset (&value);
-
- return retval;
-}
-
-static gboolean
-has_value_widget (GnomeEntry *gentry, const gchar *prop_name)
-{
- GValue value = { 0, };
- gboolean retval;
-
- g_value_init (&value, GTK_TYPE_WIDGET);
- g_object_get_property (G_OBJECT (gentry), prop_name, &value);
- retval = g_value_get_object (&value) != NULL;
- g_value_unset (&value);
-
- return retval;
-}
-
-static void
-do_construct_handler (GnomeSelector *selector)
-{
- GnomeEntry *gentry;
-
- g_return_if_fail (selector != NULL);
- g_return_if_fail (GNOME_IS_ENTRY (selector));
-
- gentry = GNOME_ENTRY (selector);
-
- g_message (G_STRLOC);
-
- if (get_value_boolean (gentry, "want_default_behaviour")) {
- g_object_set (G_OBJECT (gentry),
- "want_default_behaviour", FALSE,
- "use_default_entry_widget", TRUE,
- "want_browse_button", FALSE,
- "want_clear_button", FALSE,
- "want_default_button", FALSE,
- NULL);
- }
-
- if (get_value_boolean (gentry, "use_default_entry_widget") &&
- !has_value_widget (gentry, "entry_widget")) {
- GtkWidget *entry_widget;
- GValue value = { 0, };
-
- g_message (G_STRLOC ": default entry");
-
- entry_widget = gtk_combo_new ();
-
- g_value_init (&value, GTK_TYPE_WIDGET);
- g_value_set_object (&value, G_OBJECT (entry_widget));
- g_object_set_property (G_OBJECT (gentry), "entry_widget", &value);
- g_value_unset (&value);
-
- gentry->_priv->combo = entry_widget;
- gentry->_priv->entry = GTK_COMBO (entry_widget)->entry;
-
- gtk_combo_disable_activate (GTK_COMBO (entry_widget));
- gtk_combo_set_case_sensitive (GTK_COMBO (entry_widget), TRUE);
-
- gtk_signal_connect (GTK_OBJECT (gentry->_priv->entry),
- "activate",
- GTK_SIGNAL_FUNC (entry_activated_cb),
- gentry);
- }
-
- GNOME_CALL_PARENT_HANDLER (GNOME_SELECTOR_CLASS, do_construct, (selector));
-}
-
-static GObject*
-gnome_entry_constructor (GType type,
- guint n_construct_properties,
- GObjectConstructParam *construct_properties)
+GtkWidget *
+gnome_entry_construct_from_selector (GnomeEntry *gentry,
+ GNOME_Selector corba_selector,
+ Bonobo_UIContainer uic)
{
- GObject *object = G_OBJECT_CLASS (parent_class)->constructor (type,
- n_construct_properties,
- construct_properties);
- GnomeEntry *gentry = GNOME_ENTRY (object);
-
- g_message (G_STRLOC ": %d - %d", type, GNOME_TYPE_ENTRY);
-
- if (type == GNOME_TYPE_ENTRY)
- gnome_selector_do_construct (GNOME_SELECTOR (gentry));
-
- g_message (G_STRLOC);
+ 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);
- return object;
+ return (GtkWidget *) gnome_selector_client_construct
+ (GNOME_SELECTOR_CLIENT (gentry), corba_selector, uic);
}
@@ -239,29 +139,50 @@ gnome_entry_constructor (GType type,
GtkWidget *
gnome_entry_new (const gchar *history_id)
{
+ GnomeSelector *selector;
GnomeEntry *gentry;
+ GtkWidget *entry_widget;
- gentry = g_object_new (gnome_entry_get_type (),
- "history_id", history_id,
- NULL);
+ selector = g_object_new (gnome_selector_get_type (),
+ "history_id", history_id,
+ NULL);
- return GTK_WIDGET (gentry);
-}
+ gentry = g_object_new (gnome_entry_get_type (), NULL);
-static void
-gnome_entry_destroy (GtkObject *object)
-{
- GnomeEntry *gentry;
+ entry_widget = gtk_combo_new ();
- /* remember, destroy can be run multiple times! */
+ gentry->_priv->combo = entry_widget;
+ gentry->_priv->entry = GTK_COMBO (entry_widget)->entry;
- g_return_if_fail (object != NULL);
- g_return_if_fail (GNOME_IS_ENTRY (object));
+ gtk_combo_disable_activate (GTK_COMBO (entry_widget));
+ gtk_combo_set_case_sensitive (GTK_COMBO (entry_widget), TRUE);
- gentry = GNOME_ENTRY (object);
+ g_signal_connect_data (gentry->_priv->entry, "activate",
+ G_CALLBACK (entry_activated_cb),
+ selector, NULL, FALSE, FALSE);
+
+ gtk_widget_show_all (entry_widget);
- if (GTK_OBJECT_CLASS (parent_class)->destroy)
- (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
+ gentry->_priv->control = bonobo_control_new (entry_widget);
+
+ gnome_selector_bind_to_control (selector,
+ BONOBO_OBJREF (gentry->_priv->control));
+
+ g_signal_connect_data (selector, "get_entry_text",
+ G_CALLBACK (get_entry_text_handler),
+ gentry, NULL, FALSE, FALSE);
+ g_signal_connect_data (selector, "set_entry_text",
+ G_CALLBACK (set_entry_text_handler),
+ gentry, NULL, FALSE, FALSE);
+ g_signal_connect_data (selector, "activate_entry",
+ G_CALLBACK (activate_entry_handler),
+ gentry, NULL, FALSE, FALSE);
+ g_signal_connect_data (selector, "history_changed",
+ G_CALLBACK (history_changed_handler),
+ gentry, NULL, FALSE, FALSE);
+
+ return gnome_entry_construct_from_selector
+ (gentry, BONOBO_OBJREF (selector), CORBA_OBJECT_NIL);
}
static void
@@ -282,67 +203,63 @@ gnome_entry_finalize (GObject *object)
}
static gchar *
-get_entry_text_handler (GnomeSelector *selector)
+get_entry_text_handler (GnomeSelector *selector, GnomeEntry *gentry)
{
- GnomeEntry *gentry;
const char *text;
g_return_val_if_fail (selector != NULL, NULL);
- g_return_val_if_fail (GNOME_IS_ENTRY (selector), NULL);
-
- gentry = GNOME_ENTRY (selector);
+ g_return_val_if_fail (GNOME_IS_SELECTOR (selector), NULL);
+ g_return_val_if_fail (gentry != NULL, NULL);
+ g_return_val_if_fail (GNOME_IS_ENTRY (gentry), NULL);
text = gtk_entry_get_text (GTK_ENTRY (gentry->_priv->entry));
return g_strdup (text);
}
static void
-set_entry_text_handler (GnomeSelector *selector, const gchar *text)
+set_entry_text_handler (GnomeSelector *selector, const gchar *text,
+ GnomeEntry *gentry)
{
- GnomeEntry *gentry;
-
g_return_if_fail (selector != NULL);
- g_return_if_fail (GNOME_IS_ENTRY (selector));
-
- gentry = GNOME_ENTRY (selector);
+ g_return_if_fail (GNOME_IS_SELECTOR (selector));
+ g_return_if_fail (gentry != NULL);
+ g_return_if_fail (GNOME_IS_ENTRY (gentry));
if (gentry->_priv->entry)
gtk_entry_set_text (GTK_ENTRY (gentry->_priv->entry), text);
}
static void
-activate_entry_handler (GnomeSelector *selector)
+activate_entry_handler (GnomeSelector *selector, GnomeEntry *gentry)
{
- GnomeEntry *gentry;
const char *text;
g_return_if_fail (selector != NULL);
- g_return_if_fail (GNOME_IS_ENTRY (selector));
-
- gentry = GNOME_ENTRY (selector);
+ g_return_if_fail (GNOME_IS_SELECTOR (selector));
+ g_return_if_fail (gentry != NULL);
+ g_return_if_fail (GNOME_IS_ENTRY (gentry));
text = gtk_entry_get_text (GTK_ENTRY (gentry->_priv->entry));
gnome_selector_prepend_history (selector, TRUE, text);
}
static void
-history_changed_handler (GnomeSelector *selector)
+history_changed_handler (GnomeSelector *selector, GnomeEntry *gentry)
{
- GnomeEntry *gentry;
GtkWidget *list_widget;
GList *items = NULL;
GSList *history_list, *c;
g_return_if_fail (selector != NULL);
- g_return_if_fail (GNOME_IS_ENTRY (selector));
-
- gentry = GNOME_ENTRY (selector);
+ g_return_if_fail (GNOME_IS_SELECTOR (selector));
+ g_return_if_fail (gentry != NULL);
+ g_return_if_fail (GNOME_IS_ENTRY (gentry));
list_widget = GTK_COMBO (gentry->_priv->combo)->list;
gtk_list_clear_items (GTK_LIST (list_widget), 0, -1);
- history_list = gnome_selector_get_history (GNOME_SELECTOR (gentry));
+ history_list = gnome_selector_get_history (selector);
for (c = history_list; c; c = c->next) {
GtkWidget *item;
@@ -361,12 +278,12 @@ history_changed_handler (GnomeSelector *selector)
}
static void
-entry_activated_cb (GtkWidget *widget, gpointer data)
+entry_activated_cb (GtkWidget *widget, GnomeSelector *selector)
{
- g_return_if_fail (data != NULL);
- g_return_if_fail (GNOME_IS_SELECTOR (data));
+ g_return_if_fail (selector != NULL);
+ g_return_if_fail (GNOME_IS_SELECTOR (selector));
- gnome_selector_activate_entry (GNOME_SELECTOR (data));
+ g_signal_emit_by_name (selector, "activate_entry");
}
gchar *
@@ -375,7 +292,7 @@ gnome_entry_get_text (GnomeEntry *gentry)
g_return_val_if_fail (gentry != NULL, NULL);
g_return_val_if_fail (GNOME_IS_ENTRY (gentry), NULL);
- return gnome_selector_get_uri (GNOME_SELECTOR (gentry));
+ return gnome_selector_client_get_entry_text (GNOME_SELECTOR_CLIENT (gentry));
}
void
@@ -384,7 +301,7 @@ gnome_entry_set_text (GnomeEntry *gentry, const gchar *text)
g_return_if_fail (gentry != NULL);
g_return_if_fail (GNOME_IS_ENTRY (gentry));
- gnome_selector_set_uri (GNOME_SELECTOR (gentry), NULL,
- text, NULL, NULL);
+ gnome_selector_client_set_entry_text (GNOME_SELECTOR_CLIENT (gentry),
+ text);
}
diff --git a/libgnomeui/gnome-entry.h b/libgnomeui/gnome-entry.h
index 879559f..eb694d9 100644
--- a/libgnomeui/gnome-entry.h
+++ b/libgnomeui/gnome-entry.h
@@ -33,9 +33,8 @@
#define GNOME_ENTRY_H
-#include <glib.h>
-
-#include "gnome-selector.h"
+#include <libgnome/gnome-selector.h>
+#include <libgnomeui/gnome-selector-client.h>
G_BEGIN_DECLS
@@ -54,24 +53,29 @@ typedef struct _GnomeEntryPrivate GnomeEntryPrivate;
typedef struct _GnomeEntryClass GnomeEntryClass;
struct _GnomeEntry {
- GnomeSelector selector;
+ GnomeSelectorClient selector_client;
/*< private >*/
GnomeEntryPrivate *_priv;
};
struct _GnomeEntryClass {
- GnomeSelectorClass parent_class;
+ GnomeSelectorClientClass parent_class;
};
-guint gnome_entry_get_type (void) G_GNUC_CONST;
-GtkWidget *gnome_entry_new (const gchar *history_id);
+GtkType gnome_entry_get_type (void) G_GNUC_CONST;
+
+GtkWidget *gnome_entry_new (const gchar *history_id);
+
+GtkWidget *gnome_entry_construct_from_selector (GnomeEntry *gentry,
+ GNOME_Selector corba_selector,
+ Bonobo_UIContainer uic);
-gchar *gnome_entry_get_text (GnomeEntry *gentry);
+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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]