[monkey-bubble: 366/753] Use the new GnomeEntryComponent. (PROP_IS_FILE_ENTRY): New property; this
- From: Sven Herzberg <herzi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [monkey-bubble: 366/753] Use the new GnomeEntryComponent. (PROP_IS_FILE_ENTRY): New property; this
- Date: Wed, 14 Jul 2010 22:26:26 +0000 (UTC)
commit 93e3304d3d050143471dc5e1e9cdbca62e5479fd
Author: Martin Baulig <baulig suse de>
Date: Sun Jun 3 14:52:16 2001 +0000
Use the new GnomeEntryComponent. (PROP_IS_FILE_ENTRY): New property; this
2001-06-03 Martin Baulig <baulig suse de>
* gnome-entry.c: Use the new GnomeEntryComponent.
(PROP_IS_FILE_ENTRY): New property; this widget can now be used both
as normal and as file entry.
* gnome-entry.[ch] (gnome_file_entry_new): New function.
* gnome-file-entry.[ch]: Removed.
* gnome-selector-component.c
(PROP_CONFIG_MONIKER): New property. This is a moniker to a Bonobo_PropertyBag
with the default configuration (look&feel) for the selector.
(ensure_properties_handler): Set defaults from the property bag.
libgnomeui/ChangeLog | 15 +++
libgnomeui/Makefile.am | 2 -
libgnomeui/gnome-entry.c | 240 +++++++++++++++--------------------------
libgnomeui/gnome-entry.h | 3 +-
libgnomeui/gnome-file-entry.c | 156 --------------------------
libgnomeui/gnome-file-entry.h | 79 --------------
libgnomeui/libgnomeui.h | 1 -
7 files changed, 103 insertions(+), 393 deletions(-)
---
diff --git a/libgnomeui/ChangeLog b/libgnomeui/ChangeLog
index adc2d5d..df7f09b 100644
--- a/libgnomeui/ChangeLog
+++ b/libgnomeui/ChangeLog
@@ -1,5 +1,20 @@
2001-06-03 Martin Baulig <baulig suse de>
+ * gnome-entry.c: Use the new GnomeEntryComponent.
+ (PROP_IS_FILE_ENTRY): New property; this widget can now be used both
+ as normal and as file entry.
+
+ * gnome-entry.[ch] (gnome_file_entry_new): New function.
+
+ * gnome-file-entry.[ch]: Removed.
+
+ * gnome-selector-component.c
+ (PROP_CONFIG_MONIKER): New property. This is a moniker to a Bonobo_PropertyBag
+ with the default configuration (look&feel) for the selector.
+ (ensure_properties_handler): Set defaults from the property bag.
+
+2001-06-03 Martin Baulig <baulig suse de>
+
* gnome-icon-item.[ch]: Derive from GnomeCanvasText.
2001-06-02 Martin Baulig <baulig suse de>
diff --git a/libgnomeui/Makefile.am b/libgnomeui/Makefile.am
index 3ff51cb..9749b31 100644
--- a/libgnomeui/Makefile.am
+++ b/libgnomeui/Makefile.am
@@ -84,7 +84,6 @@ libgnomeui_2_la_SOURCES = \
gnome-selector-component.c \
gnome-selector-dialog-client.c \
gnome-entry.c \
- gnome-file-entry.c \
gnome-image-entry.c \
gnome-image-selector.c \
gnome-font-picker.c \
@@ -125,7 +124,6 @@ gnome_headers = \
gnome-selector-component.h \
gnome-selector-dialog-client.h \
gnome-entry.h \
- gnome-file-entry.h \
gnome-image-entry.h \
gnome-image-selector.h \
gnome-font-picker.h \
diff --git a/libgnomeui/gnome-entry.c b/libgnomeui/gnome-entry.c
index 78db3b3..fb130cc 100644
--- a/libgnomeui/gnome-entry.c
+++ b/libgnomeui/gnome-entry.c
@@ -44,10 +44,9 @@
#include "gnome-entry.h"
struct _GnomeEntryPrivate {
- BonoboControl *control;
+ gboolean constructed;
- GtkWidget *combo;
- GtkWidget *entry;
+ gboolean is_file_entry;
};
@@ -55,20 +54,14 @@ static void gnome_entry_class_init (GnomeEntryClass *class);
static void gnome_entry_init (GnomeEntry *gentry);
static void gnome_entry_finalize (GObject *object);
-static gchar *get_entry_text_handler (GnomeSelector *selector,
- GnomeEntry *gentry);
-static void set_entry_text_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,
- GnomeSelector *selector);
+static GnomeSelectorClientClass *parent_class;
+enum {
+ PROP_0,
-static GnomeSelectorClientClass *parent_class;
+ /* Construction properties */
+ PROP_IS_FILE_ENTRY,
+};
GType
gnome_entry_get_type (void)
@@ -94,6 +87,49 @@ gnome_entry_get_type (void)
}
static void
+gnome_entry_set_property (GObject *object, guint param_id,
+ const GValue *value, GParamSpec *pspec)
+{
+ GnomeEntry *entry;
+
+ g_return_if_fail (object != NULL);
+ g_return_if_fail (GNOME_IS_ENTRY (object));
+
+ entry = GNOME_ENTRY (object);
+
+ switch (param_id) {
+ case PROP_IS_FILE_ENTRY:
+ g_assert (!entry->_priv->constructed);
+ entry->_priv->is_file_entry = g_value_get_boolean (value);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
+ break;
+ }
+}
+
+static void
+gnome_entry_get_property (GObject *object, guint param_id, GValue *value,
+ GParamSpec *pspec)
+{
+ GnomeEntry *entry;
+
+ g_return_if_fail (object != NULL);
+ g_return_if_fail (GNOME_IS_ENTRY (object));
+
+ entry = GNOME_ENTRY (object);
+
+ switch (param_id) {
+ case PROP_IS_FILE_ENTRY:
+ g_value_set_boolean (value, entry->_priv->is_file_entry);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
+ break;
+ }
+}
+
+static void
gnome_entry_class_init (GnomeEntryClass *class)
{
GtkObjectClass *object_class;
@@ -104,6 +140,18 @@ gnome_entry_class_init (GnomeEntryClass *class)
parent_class = gtk_type_class (gnome_selector_client_get_type ());
+ gobject_class->get_property = gnome_entry_get_property;
+ gobject_class->set_property = gnome_entry_set_property;
+
+ /* Construction properties */
+ g_object_class_install_property
+ (gobject_class,
+ PROP_IS_FILE_ENTRY,
+ g_param_spec_boolean ("is-file-entry", NULL, NULL,
+ FALSE,
+ (G_PARAM_READABLE | G_PARAM_WRITABLE |
+ G_PARAM_CONSTRUCT_ONLY)));
+
gobject_class->finalize = gnome_entry_finalize;
}
@@ -127,78 +175,48 @@ gnome_entry_construct (GnomeEntry *gentry,
}
GtkWidget *
-gnome_entry_new_full (GnomeSelector *selector,
- Bonobo_UIContainer uic)
+gnome_entry_new (void)
{
- BonoboEventSource *event_source;
- GtkWidget *entry_widget;
- GnomeEntry *gentry;
-
- entry_widget = gtk_combo_new ();
-
- gentry = g_object_new (gnome_entry_get_type (), NULL);
-
- 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);
-
- g_signal_connect_data (gentry->_priv->entry, "activate",
- G_CALLBACK (entry_activated_cb),
- selector, NULL, FALSE, FALSE);
-
- gtk_widget_show_all (entry_widget);
+ GnomeEntry *entry;
- gentry->_priv->control = bonobo_control_new (entry_widget);
+ entry = g_object_new (gnome_entry_get_type (),
+ "is-file-entry", FALSE,
+ NULL);
- event_source = bonobo_event_source_new ();
-
- gnome_selector_construct (selector, event_source, CORBA_OBJECT_NIL);
-
- gnome_selector_bind_to_control (selector,
- BONOBO_OBJECT (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 (gentry, BONOBO_OBJREF (selector),
- CORBA_OBJECT_NIL);
+ return (GtkWidget *) gnome_selector_client_construct
+ (GNOME_SELECTOR_CLIENT (entry),
+ "OAFIID:GNOME_UI_Component_Entry",
+ CORBA_OBJECT_NIL);
}
GtkWidget *
-gnome_entry_new (void)
+gnome_file_entry_new (void)
{
- GnomeSelector *selector;
+ GnomeEntry *entry;
- selector = g_object_new (gnome_selector_get_type (), NULL);
+ entry = g_object_new (gnome_entry_get_type (),
+ "is-file-entry", TRUE,
+ NULL);
- return gnome_entry_new_full (selector, CORBA_OBJECT_NIL);
+ return (GtkWidget *) gnome_selector_client_construct
+ (GNOME_SELECTOR_CLIENT (entry),
+ "OAFIID:GNOME_UI_Component_Entry",
+ CORBA_OBJECT_NIL);
}
GtkWidget *
-gnome_entry_new_from_selector (GNOME_Selector corba_selector,
+gnome_entry_new_from_selector (GNOME_Selector corba_selector,
Bonobo_UIContainer uic)
{
- GnomeEntry *gentry;
+ GnomeEntry *entry;
g_return_val_if_fail (corba_selector != CORBA_OBJECT_NIL, NULL);
- gentry = g_object_new (gnome_entry_get_type (), NULL);
-
- return gnome_entry_construct (gentry, corba_selector, uic);
-}
+ entry = g_object_new (gnome_entry_get_type (), NULL);
+ return (GtkWidget *) gnome_selector_client_construct_from_objref
+ (GNOME_SELECTOR_CLIENT (entry), corba_selector, uic);
+}
static void
gnome_entry_finalize (GObject *object)
@@ -217,90 +235,6 @@ gnome_entry_finalize (GObject *object)
(* G_OBJECT_CLASS (parent_class)->finalize) (object);
}
-static gchar *
-get_entry_text_handler (GnomeSelector *selector, GnomeEntry *gentry)
-{
- const char *text;
-
- g_return_val_if_fail (selector != NULL, NULL);
- 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,
- GnomeEntry *gentry)
-{
- g_return_if_fail (selector != NULL);
- 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, GnomeEntry *gentry)
-{
- const char *text;
-
- g_return_if_fail (selector != NULL);
- 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, text);
-}
-
-static void
-history_changed_handler (GnomeSelector *selector, GnomeEntry *gentry)
-{
- GtkWidget *list_widget;
- GList *items = NULL;
- GSList *history_list, *c;
-
- g_return_if_fail (selector != NULL);
- 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 (selector);
-
- for (c = history_list; c; c = c->next) {
- GtkWidget *item;
-
- item = gtk_list_item_new_with_label (c->data);
- items = g_list_prepend (items, item);
- gtk_widget_show_all (item);
- }
-
- items = g_list_reverse (items);
-
- gtk_list_prepend_items (GTK_LIST (list_widget), items);
-
- g_slist_foreach (history_list, (GFunc) g_free, NULL);
- g_slist_free (history_list);
-}
-
-static void
-entry_activated_cb (GtkWidget *widget, GnomeSelector *selector)
-{
- g_return_if_fail (selector != NULL);
- g_return_if_fail (GNOME_IS_SELECTOR (selector));
-
- g_signal_emit_by_name (selector, "activate_entry");
-}
-
gchar *
gnome_entry_get_text (GnomeEntry *gentry)
{
diff --git a/libgnomeui/gnome-entry.h b/libgnomeui/gnome-entry.h
index 55ddb56..b7c2481 100644
--- a/libgnomeui/gnome-entry.h
+++ b/libgnomeui/gnome-entry.h
@@ -68,8 +68,7 @@ GType gnome_entry_get_type (void) G_GNUC_CONST;
GtkWidget *gnome_entry_new (void);
-GtkWidget *gnome_entry_new_full (GnomeSelector *selector,
- Bonobo_UIContainer uic);
+GtkWidget *gnome_file_entry_new (void);
GtkWidget *gnome_entry_new_from_selector (GNOME_Selector corba_selector,
Bonobo_UIContainer uic);
diff --git a/libgnomeui/libgnomeui.h b/libgnomeui/libgnomeui.h
index d3368da..f816a09 100644
--- a/libgnomeui/libgnomeui.h
+++ b/libgnomeui/libgnomeui.h
@@ -42,7 +42,6 @@
#include <libgnomeui/gnome-color-picker.h>
#include <libgnomeui/gnome-cursors.h>
#include <libgnomeui/gnome-entry.h>
-#include <libgnomeui/gnome-file-entry.h>
#include <libgnomeui/gnome-image-entry.h>
#include <libgnomeui/gnome-image-selector.h>
#include <libgnomeui/gnome-font-picker.h>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]