[monkey-bubble: 270/753] Reflect latest GnomeSelector API changes.



commit 8e5bc248646a0ae6cbfecd6be1d58beaa32f80f9
Author: Martin Baulig <baulig suse de>
Date:   Tue May 8 22:02:14 2001 +0000

    Reflect latest GnomeSelector API changes.
    
    2001-05-08  Martin Baulig  <baulig suse de>
    
    	* gnome-entry.[ch]: Reflect latest GnomeSelector API changes.

 libgnomeui/ChangeLog          |    7 ++
 libgnomeui/gnome-entry.c      |   38 ++++++----
 libgnomeui/gnome-entry.h      |    4 +
 libgnomeui/gnome-file-entry.c |  163 +++++++++++++++++++++++++++++++++++++++++
 libgnomeui/gnome-file-entry.h |   79 ++++++++++++++++++++
 5 files changed, 276 insertions(+), 15 deletions(-)
---
diff --git a/libgnomeui/ChangeLog b/libgnomeui/ChangeLog
index c0eb669..ccd1bc8 100644
--- a/libgnomeui/ChangeLog
+++ b/libgnomeui/ChangeLog
@@ -1,3 +1,10 @@
+2001-05-09  Martin Baulig  <baulig suse de>
+
+	* gnome-entry.h (gnome_entry_new_full): New function.
+
+	* gnome-file-entry.[ch]: New files; this already existed in
+	GNOME 1.x, but we're now using the new GnomeSelector API.
+
 2001-05-08  Martin Baulig  <baulig suse de>
 
 	* gnome-entry.[ch]: Reflect latest GnomeSelector API changes.
diff --git a/libgnomeui/gnome-entry.c b/libgnomeui/gnome-entry.c
index 2c1455c..668538d 100644
--- a/libgnomeui/gnome-entry.c
+++ b/libgnomeui/gnome-entry.c
@@ -110,13 +110,13 @@ gnome_entry_class_init (GnomeEntryClass *class)
 static void
 gnome_entry_init (GnomeEntry *gentry)
 {
-	gentry->_priv = g_new0(GnomeEntryPrivate, 1);
+	gentry->_priv = g_new0 (GnomeEntryPrivate, 1);
 }
 
 GtkWidget *
-gnome_entry_construct (GnomeEntry *gentry,
-		       GNOME_Selector corba_selector,
-		       Bonobo_UIContainer uic)
+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);
@@ -138,21 +138,18 @@ gnome_entry_construct (GnomeEntry *gentry,
  * Returns: Newly-created GnomeEntry widget.
  */
 GtkWidget *
-gnome_entry_new (const gchar *history_id)
+gnome_entry_new_full (GnomeSelector      *selector,
+		      Bonobo_UIContainer  uic,
+		      const gchar        *history_id)
 {
-	GnomeSelector *selector;
 	BonoboEventSource *event_source;
-	GnomeEntry *gentry;
 	GtkWidget *entry_widget;
+	GnomeEntry *gentry;
 
-	selector = g_object_new (gnome_selector_get_type (),
-				 "history_id", history_id,
-				 NULL);
+	entry_widget = gtk_combo_new ();
 
 	gentry = g_object_new (gnome_entry_get_type (), NULL);
 
-	entry_widget = gtk_combo_new ();
-
 	gentry->_priv->combo = entry_widget;
 	gentry->_priv->entry = GTK_COMBO (entry_widget)->entry;
 
@@ -192,6 +189,18 @@ gnome_entry_new (const gchar *history_id)
 }
 
 GtkWidget *
+gnome_entry_new (const gchar *history_id)
+{
+	GnomeSelector *selector;
+
+	selector = g_object_new (gnome_selector_get_type (),
+				 "history_id", history_id,
+				 NULL);
+
+	return gnome_entry_new_full (selector, CORBA_OBJECT_NIL, history_id);
+}
+
+GtkWidget *
 gnome_entry_new_from_selector (GNOME_Selector corba_selector,
 			       Bonobo_UIContainer uic)
 {
@@ -200,9 +209,8 @@ gnome_entry_new_from_selector (GNOME_Selector corba_selector,
 	g_return_val_if_fail (corba_selector != CORBA_OBJECT_NIL, NULL);
 
 	gentry = g_object_new (gnome_entry_get_type (), NULL);
-
-	return (GtkWidget *) gnome_selector_client_construct
-		(GNOME_SELECTOR_CLIENT (gentry), corba_selector, uic);
+	
+	return gnome_entry_construct (gentry, corba_selector, uic);
 }
 
 
diff --git a/libgnomeui/gnome-entry.h b/libgnomeui/gnome-entry.h
index a343f2f..0cbeabb 100644
--- a/libgnomeui/gnome-entry.h
+++ b/libgnomeui/gnome-entry.h
@@ -68,6 +68,10 @@ GType        gnome_entry_get_type          (void) G_GNUC_CONST;
 
 GtkWidget   *gnome_entry_new               (const gchar        *history_id);
 
+GtkWidget   *gnome_entry_new_full          (GnomeSelector      *selector,
+                                            Bonobo_UIContainer  uic,
+                                            const gchar        *history_id);
+
 GtkWidget   *gnome_entry_new_from_selector (GNOME_Selector      corba_selector,
                                             Bonobo_UIContainer  uic);
 
diff --git a/libgnomeui/gnome-file-entry.c b/libgnomeui/gnome-file-entry.c
new file mode 100644
index 0000000..def6c82
--- /dev/null
+++ b/libgnomeui/gnome-file-entry.c
@@ -0,0 +1,163 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation
+ * All rights reserved.
+ *
+ * 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@
+ */
+
+/* GnomeFileEntry widget - combo box with auto-saved history
+ *
+ * Author: Federico Mena <federico nuclecu unam mx>
+ */
+
+#include <config.h>
+
+#include <stdio.h>
+#include <string.h>
+#include <gtk/gtkentry.h>
+#include <gtk/gtkcombo.h>
+#include <gtk/gtklist.h>
+#include <gtk/gtklistitem.h>
+#include <gtk/gtksignal.h>
+#include <libgnome/gnome-i18n.h>
+#include <libgnome/gnome-file-selector.h>
+#include "gnome-macros.h"
+#include "gnome-file-entry.h"
+
+struct _GnomeFileEntryPrivate {
+};
+	
+
+static void   gnome_file_entry_class_init   (GnomeFileEntryClass *class);
+static void   gnome_file_entry_init         (GnomeFileEntry      *gentry);
+static void   gnome_file_entry_finalize     (GObject         *object);
+
+static GnomeEntryClass *parent_class;
+
+GType
+gnome_file_entry_get_type (void)
+{
+	static GType entry_type = 0;
+
+	if (!entry_type) {
+		GtkTypeInfo entry_info = {
+			"GnomeFileEntry",
+			sizeof (GnomeFileEntry),
+			sizeof (GnomeFileEntryClass),
+			(GtkClassInitFunc) gnome_file_entry_class_init,
+			(GtkObjectInitFunc) gnome_file_entry_init,
+			NULL,
+			NULL,
+			NULL
+		};
+
+		entry_type = gtk_type_unique (gnome_entry_get_type (), &entry_info);
+	}
+
+	return entry_type;
+}
+
+static void
+gnome_file_entry_class_init (GnomeFileEntryClass *class)
+{
+	GtkObjectClass *object_class;
+	GObjectClass *gobject_class;
+
+	object_class = (GtkObjectClass *) class;
+	gobject_class = (GObjectClass *) class;
+
+	parent_class = gtk_type_class (gnome_entry_get_type ());
+
+	gobject_class->finalize = gnome_file_entry_finalize;
+}
+
+static void
+gnome_file_entry_init (GnomeFileEntry *gentry)
+{
+	gentry->_priv = g_new0 (GnomeFileEntryPrivate, 1);
+}
+
+GtkWidget *
+gnome_file_entry_construct (GnomeFileEntry     *fentry,
+			    GNOME_Selector      corba_selector,
+			    Bonobo_UIContainer  uic)
+{
+	g_return_val_if_fail (fentry != NULL, NULL);
+	g_return_val_if_fail (GNOME_IS_FILE_ENTRY (fentry), NULL);
+	g_return_val_if_fail (corba_selector != CORBA_OBJECT_NIL, NULL);
+
+	return (GtkWidget *) gnome_entry_construct
+		(GNOME_ENTRY (fentry), corba_selector, uic);
+}
+
+
+/**
+ * gnome_file_entry_new
+ * @history_id: If not %NULL, the text id under which history data is stored
+ *
+ * Description: Creates a new GnomeFileEntry widget.  If  @history_id is
+ * not %NULL, then the history list will be saved and restored between
+ * uses under the given id.
+ *
+ * Returns: Newly-created GnomeFileEntry widget.
+ */
+GtkWidget *
+gnome_file_entry_new (const gchar *history_id)
+{
+	GnomeSelector *selector;
+
+	selector = g_object_new (gnome_file_selector_get_type (),
+				 "history_id", history_id,
+				 NULL);
+
+	return gnome_entry_new_full (selector, CORBA_OBJECT_NIL, history_id);
+}
+
+GtkWidget *
+gnome_file_entry_new_from_selector (GNOME_Selector     corba_selector,
+				    Bonobo_UIContainer uic)
+{
+	GnomeFileEntry *fentry;
+
+	g_return_val_if_fail (corba_selector != CORBA_OBJECT_NIL, NULL);
+
+	fentry = g_object_new (gnome_file_entry_get_type (), NULL);
+
+	return gnome_file_entry_construct (fentry, corba_selector, uic);
+}
+
+static void
+gnome_file_entry_finalize (GObject *object)
+{
+	GnomeFileEntry *gentry;
+
+	g_return_if_fail (object != NULL);
+	g_return_if_fail (GNOME_IS_ENTRY (object));
+
+	gentry = GNOME_FILE_ENTRY (object);
+
+	g_free (gentry->_priv);
+	gentry->_priv = NULL;
+
+	if (G_OBJECT_CLASS (parent_class)->finalize)
+		(* G_OBJECT_CLASS (parent_class)->finalize) (object);
+}
diff --git a/libgnomeui/gnome-file-entry.h b/libgnomeui/gnome-file-entry.h
new file mode 100644
index 0000000..8654060
--- /dev/null
+++ b/libgnomeui/gnome-file-entry.h
@@ -0,0 +1,79 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation
+ * All rights reserved.
+ *
+ * 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@
+ */
+
+/* GnomeFileEntry widget - combo box with auto-saved history
+ *
+ * Author: Federico Mena <federico nuclecu unam mx>
+ */
+
+#ifndef GNOME_FILE_ENTRY_H
+#define GNOME_FILE_ENTRY_H
+
+
+#include <libgnome/gnome-selector.h>
+#include <libgnomeui/gnome-entry.h>
+
+
+G_BEGIN_DECLS
+
+
+#define GNOME_TYPE_FILE_ENTRY            (gnome_file_entry_get_type ())
+#define GNOME_FILE_ENTRY(obj)            (GTK_CHECK_CAST ((obj), GNOME_TYPE_ENTRY, GnomeFileEntry))
+#define GNOME_FILE_ENTRY_CLASS(klass)    (GTK_CHECK_CLASS_CAST ((klass), GNOME_TYPE_ENTRY, GnomeFileEntryClass))
+#define GNOME_IS_FILE_ENTRY(obj)         (GTK_CHECK_TYPE ((obj), GNOME_TYPE_ENTRY))
+#define GNOME_IS_FILE_ENTRY_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GNOME_TYPE_ENTRY))
+
+
+typedef struct _GnomeFileEntry        GnomeFileEntry;
+typedef struct _GnomeFileEntryPrivate GnomeFileEntryPrivate;
+typedef struct _GnomeFileEntryClass   GnomeFileEntryClass;
+
+struct _GnomeFileEntry {
+	GnomeEntry entry;
+
+	/*< private >*/
+	GnomeFileEntryPrivate *_priv;
+};
+
+struct _GnomeFileEntryClass {
+	GnomeEntryClass parent_class;
+};
+
+
+GType        gnome_file_entry_get_type          (void) G_GNUC_CONST;
+
+GtkWidget   *gnome_file_entry_new               (const gchar        *history_id);
+
+GtkWidget   *gnome_file_entry_new_from_selector (GNOME_Selector      corba_selector,
+                                                 Bonobo_UIContainer  uic);
+
+GtkWidget   *gnome_file_entry_construct         (GnomeFileEntry     *fentry,
+                                                 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]