Re: [Ekiga-devel-list] URI ComboBoxEntry



On 9/11/06, Jan Schampera <jan schampera web de> wrote:
While you were writing the last few mails I dug into that stuff. If
you already have working code, can you share it?

The patch is attached (although I developed it against a version which
is a few days old and rebased it to CVS HEAD, it should work).
ephy-icon-entry.h/c does the hard part of the icon entry and is copied
verbatim from the Epiphany browser source.

The lines enclosed by "TEST TEST TEST" add a icon to demonstrate that
it actually works, though probably the final version will/should have
a GmURIEntry derived from EphyIconEntry which handles the nasty stuff
of setting up the actual icons and provide functions like
"gm_uri_entry_set_security_status()" for Ekiga to call.

--
Daniel
=== added file 'lib/gui/ephy-icon-entry.c'
--- lib/gui/ephy-icon-entry.c	1970-01-01 00:00:00 +0000
+++ lib/gui/ephy-icon-entry.c	2006-09-11 13:59:08 +0000
@@ -0,0 +1,352 @@
+/*
+ *  Copyright (C) 2003, 2004, 2005  Christian Persch
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2 of the License, or (at your option) any later version.
+ *
+ *  This 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
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with this library; if not, write to the
+ *  Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ *  Boston, MA 02111-1307, USA.
+ *
+ *  Adapted and modified from gtk+ code:
+ *
+ *  Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *  Modified by the GTK+ Team and others 1997-2005.  See the AUTHORS
+ *  file in the gtk+ distribution for a list of people on the GTK+ Team.
+ *  See the ChangeLog in the gtk+ distribution files for a list of changes.
+ *  These files are distributed with GTK+ at ftp://ftp.gtk.org/pub/gtk/. 
+ *
+ *  $Id: ephy-icon-entry.c,v 1.4 2005/08/07 20:31:32 chpe Exp $
+ */
+
+#include "config.h"
+
+#include "ephy-icon-entry.h"
+
+#include <gtk/gtkentry.h>
+#include <gtk/gtkbox.h>
+#include <gtk/gtkhbox.h>
+
+#define EPHY_ICON_ENTRY_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_ICON_ENTRY, EphyIconEntryPrivate))
+
+struct _EphyIconEntryPrivate
+{
+	GtkWidget *hbox;
+};
+
+static GtkWidgetClass *parent_class = NULL;
+
+/* private helper functions */
+
+static gboolean
+entry_focus_change_cb (GtkWidget *widget,
+		       GdkEventFocus *event,
+		       GtkWidget *entry)
+{
+	gtk_widget_queue_draw (entry);
+
+	return FALSE;
+}
+
+static void
+ephy_icon_entry_get_borders (GtkWidget *widget,
+			     GtkWidget *entry,
+			     int *xborder,
+			     int *yborder)
+{
+	int focus_width;
+	gboolean interior_focus;
+
+	g_return_if_fail (entry->style != NULL);
+
+	gtk_widget_style_get (entry,
+			      "focus-line-width", &focus_width,
+			      "interior-focus", &interior_focus,
+			      NULL);
+
+	*xborder = entry->style->xthickness;
+	*yborder = entry->style->ythickness;
+
+	if (!interior_focus)
+	{
+		*xborder += focus_width;
+		*yborder += focus_width;
+	}
+}
+
+static void
+ephy_icon_entry_paint (GtkWidget *widget,
+		       GdkEventExpose *event)
+{
+	EphyIconEntry *entry = EPHY_ICON_ENTRY (widget);
+	GtkWidget *entry_widget = entry->entry;
+	int x = 0, y = 0, width, height, focus_width;
+	gboolean interior_focus;
+
+	gtk_widget_style_get (entry_widget,
+			      "interior-focus", &interior_focus,
+			      "focus-line-width", &focus_width,
+			      NULL);
+
+	gdk_drawable_get_size (widget->window, &width, &height);
+
+	if (GTK_WIDGET_HAS_FOCUS (entry_widget) && !interior_focus)
+	{
+		x += focus_width;
+		y += focus_width;
+		width -= 2 * focus_width;
+		height -= 2 * focus_width;
+	}
+
+	gtk_paint_flat_box (entry_widget->style, widget->window, 
+			    GTK_WIDGET_STATE (entry_widget), GTK_SHADOW_NONE,
+			    NULL, entry_widget, "entry_bg", 
+			    /* FIXME: was 0, 0 in gtk_entry_expose, but I think this is correct: */
+			    x, y, width, height);
+     
+	gtk_paint_shadow (entry_widget->style, widget->window,
+			  GTK_STATE_NORMAL, GTK_SHADOW_IN,
+			  NULL, entry_widget, "entry",
+			  x, y, width, height);
+
+	if (GTK_WIDGET_HAS_FOCUS (entry_widget) && !interior_focus)
+	{
+		x -= focus_width;
+		y -= focus_width;
+		width += 2 * focus_width;
+		height += 2 * focus_width;
+
+		gtk_paint_focus (entry_widget->style, widget->window,
+				 GTK_WIDGET_STATE (entry_widget),
+				 NULL, entry_widget, "entry",
+				 /* FIXME: was 0, 0 in gtk_entry_draw_frame, but I think this is correct: */
+				 x, y, width, height);
+	}
+}
+
+/* Class implementation */
+
+static void
+ephy_icon_entry_init (EphyIconEntry *entry)
+{
+	EphyIconEntryPrivate *priv;
+	GtkWidget *widget = (GtkWidget *) entry;
+
+	priv = entry->priv = EPHY_ICON_ENTRY_GET_PRIVATE (entry);
+
+	GTK_WIDGET_UNSET_FLAGS (widget, GTK_NO_WINDOW);
+
+	priv->hbox = gtk_hbox_new (FALSE, /* FIXME */ 0);
+	gtk_container_add (GTK_CONTAINER (entry), priv->hbox);
+
+	entry->entry = gtk_entry_new ();
+	gtk_entry_set_has_frame (GTK_ENTRY (entry->entry), FALSE);
+	gtk_box_pack_start (GTK_BOX (priv->hbox), entry->entry, TRUE, TRUE, /* FIXME */ 0);
+
+	/* We need to queue a redraw when focus changes, to comply with themes
+	 * (like Clearlooks) which draw focused and unfocused entries differently.
+	 */
+	g_signal_connect_after (entry->entry, "focus-in-event",
+				G_CALLBACK (entry_focus_change_cb), entry);
+	g_signal_connect_after (entry->entry, "focus-out-event",
+				G_CALLBACK (entry_focus_change_cb), entry);
+}
+
+static void
+ephy_icon_entry_realize (GtkWidget *widget)
+{
+	GdkWindowAttr attributes;
+	gint attributes_mask;
+	gint border_width;
+
+	GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
+
+	border_width = GTK_CONTAINER (widget)->border_width;
+
+	attributes.x = widget->allocation.x + border_width;
+	attributes.y = widget->allocation.y + border_width;
+	attributes.width = widget->allocation.width - 2 * border_width;
+	attributes.height = widget->allocation.height - 2 * border_width;
+	attributes.window_type = GDK_WINDOW_CHILD;
+	attributes.event_mask = gtk_widget_get_events (widget)
+				| GDK_EXPOSURE_MASK;
+
+	attributes.visual = gtk_widget_get_visual (widget);
+	attributes.colormap = gtk_widget_get_colormap (widget);
+	attributes.wclass = GDK_INPUT_OUTPUT;
+	attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
+
+	widget->window = gdk_window_new (gtk_widget_get_parent_window (widget),
+					 &attributes, attributes_mask);
+	gdk_window_set_user_data (widget->window, widget);
+
+	widget->style = gtk_style_attach (widget->style, widget->window);
+
+	gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL);
+}
+
+static void
+ephy_icon_entry_size_request (GtkWidget *widget,
+			      GtkRequisition *requisition)
+{
+	EphyIconEntry *entry = EPHY_ICON_ENTRY (widget);
+	GtkContainer *container = GTK_CONTAINER (widget);
+	GtkBin *bin = GTK_BIN (widget);
+	int xborder, yborder;
+
+	requisition->width = requisition->height = container->border_width * 2;
+
+	gtk_widget_ensure_style (entry->entry);
+	ephy_icon_entry_get_borders (widget, entry->entry, &xborder, &yborder);
+
+	if (GTK_WIDGET_VISIBLE (bin->child))
+	{
+		GtkRequisition child_requisition;
+
+		gtk_widget_size_request (bin->child, &child_requisition);
+		requisition->width += child_requisition.width;
+		requisition->height += child_requisition.height;
+	}
+
+	requisition->width += 2 * xborder;
+	requisition->height += 2 * yborder;
+}
+
+static void
+ephy_icon_entry_size_allocate (GtkWidget *widget,
+			       GtkAllocation *allocation)
+{
+	EphyIconEntry *entry = EPHY_ICON_ENTRY (widget);
+	GtkContainer *container = GTK_CONTAINER (widget);
+	GtkBin *bin = GTK_BIN (widget);
+	GtkAllocation child_allocation;
+	int xborder, yborder;
+
+	widget->allocation = *allocation;
+
+	ephy_icon_entry_get_borders (widget, entry->entry, &xborder, &yborder);
+
+	if (GTK_WIDGET_REALIZED (widget))
+	{
+		child_allocation.x = container->border_width;
+		child_allocation.y = container->border_width;
+		child_allocation.width = MAX (allocation->width - container->border_width * 2, 0);
+		child_allocation.height = MAX (allocation->height - container->border_width * 2, 0);
+
+		gdk_window_move_resize (widget->window,
+					allocation->x + child_allocation.x,
+					allocation->y + child_allocation.y,
+					child_allocation.width,
+					child_allocation.height);
+	}
+  
+	child_allocation.x = container->border_width + xborder;
+	child_allocation.y = container->border_width + yborder;
+	child_allocation.width = MAX (allocation->width - (container->border_width + xborder) * 2, 0);
+	child_allocation.height = MAX (allocation->height - (container->border_width + yborder) * 2, 0);
+
+	gtk_widget_size_allocate (bin->child, &child_allocation);
+}
+
+static gboolean
+ephy_icon_entry_expose (GtkWidget *widget,
+			GdkEventExpose *event)
+{
+	if (GTK_WIDGET_DRAWABLE (widget) &&
+	    event->window == widget->window)
+	{
+		ephy_icon_entry_paint (widget, event);
+	}
+
+	return parent_class->expose_event (widget, event);
+}
+
+static void
+ephy_icon_entry_class_init (EphyIconEntryClass *klass)
+{
+	GObjectClass *object_class = G_OBJECT_CLASS (klass);
+	GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+
+	parent_class = GTK_WIDGET_CLASS (g_type_class_peek_parent (klass));
+
+	widget_class->realize = ephy_icon_entry_realize;
+	widget_class->size_request = ephy_icon_entry_size_request;
+	widget_class->size_allocate = ephy_icon_entry_size_allocate;
+	widget_class->expose_event = ephy_icon_entry_expose;
+
+	g_type_class_add_private (object_class, sizeof (EphyIconEntryPrivate));
+}
+
+GType
+ephy_icon_entry_get_type (void)
+{
+	static GType type = 0;
+
+	if (G_UNLIKELY (type == 0))
+	{
+		static const GTypeInfo our_info =
+		{
+			sizeof (EphyIconEntryClass),
+			NULL,
+			NULL,
+			(GClassInitFunc) ephy_icon_entry_class_init,
+			NULL,
+			NULL,
+			sizeof (EphyIconEntry),
+			0,
+			(GInstanceInitFunc) ephy_icon_entry_init
+		};
+
+		type = g_type_register_static (GTK_TYPE_BIN,
+					       "EphyIconEntry",
+					       &our_info, 0);
+	}
+
+	return type;
+}
+
+/* public functions */
+
+GtkWidget *
+ephy_icon_entry_new (void)
+{
+	return GTK_WIDGET (g_object_new (EPHY_TYPE_ICON_ENTRY, NULL));
+}
+
+void
+ephy_icon_entry_pack_widget (EphyIconEntry *entry,
+			     GtkWidget *widget,
+			     gboolean start)
+{
+	EphyIconEntryPrivate *priv;
+
+	g_return_if_fail (EPHY_IS_ICON_ENTRY (entry));
+
+	priv = entry->priv;
+
+	if (start)
+	{
+		gtk_box_pack_start (GTK_BOX (priv->hbox), widget, FALSE, FALSE, /* FIXME */ 2);
+		gtk_box_reorder_child (GTK_BOX (priv->hbox), widget, 0);
+	}
+	else
+	{
+		gtk_box_pack_end (GTK_BOX (priv->hbox), widget, FALSE, FALSE, /* FIXME */ 2);
+	}
+}
+
+GtkWidget *
+ephy_icon_entry_get_entry (EphyIconEntry *entry)
+{
+	g_return_val_if_fail (EPHY_IS_ICON_ENTRY (entry), NULL);
+
+	return entry->entry;
+}

=== added file 'lib/gui/ephy-icon-entry.h'
--- lib/gui/ephy-icon-entry.h	1970-01-01 00:00:00 +0000
+++ lib/gui/ephy-icon-entry.h	2006-09-11 13:59:08 +0000
@@ -0,0 +1,76 @@
+/*
+ *  Copyright (C) 2003, 2004, 2005  Christian Persch
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2 of the License, or (at your option) any later version.
+ *
+ *  This 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
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with this library; if not, write to the
+ *  Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ *  Boston, MA 02111-1307, USA.
+ *
+ *  Adapted and modified from gtk+ code:
+ *
+ *  Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *  Modified by the GTK+ Team and others 1997-2000.  See the AUTHORS
+ *  file in the gtk+ distribution for a list of people on the GTK+ Team.
+ *  See the ChangeLog in the gtk+ distribution files for a list of changes.
+ *  These files are distributed with GTK+ at ftp://ftp.gtk.org/pub/gtk/. 
+ *
+ *  $Id: ephy-icon-entry.h,v 1.2 2005/08/07 20:31:32 chpe Exp $
+ */
+
+#ifndef EPHY_ICON_ENTRY_H
+#define EPHY_ICON_ENTRY_H
+
+#include <gtk/gtkbin.h>
+
+G_BEGIN_DECLS
+
+#define EPHY_TYPE_ICON_ENTRY		(ephy_icon_entry_get_type())
+#define EPHY_ICON_ENTRY(object)		(G_TYPE_CHECK_INSTANCE_CAST((object), EPHY_TYPE_ICON_ENTRY, EphyIconEntry))
+#define EPHY_ICON_ENTRY_CLASS(klass)	(G_TYPE_CHECK_CLASS_CAST((klass), EPHY_TYPE_ICON_ENTRY, EphyIconEntryClass))
+#define EPHY_IS_ICON_ENTRY(object)	(G_TYPE_CHECK_INSTANCE_TYPE((object), EPHY_TYPE_ICON_ENTRY))
+#define EPHY_IS_ICON_ENTRY_CLASS(klass)	(G_TYPE_CHECK_CLASS_TYPE((klass), EPHY_TYPE_ICON_ENTRY))
+#define EPHY_ICON_ENTRY_GET_CLASS(obj)	(G_TYPE_INSTANCE_GET_CLASS((obj), EPHY_TYPE_ICON_ENTRY, EphyIconEntryClass))
+
+typedef struct _EphyIconEntryClass	EphyIconEntryClass;
+typedef struct _EphyIconEntry		EphyIconEntry;
+typedef struct _EphyIconEntryPrivate	EphyIconEntryPrivate;
+
+struct _EphyIconEntryClass
+{
+	GtkBinClass parent_class;
+};
+
+struct _EphyIconEntry
+{
+	GtkBin parent_object;
+
+	/*< public >*/
+	GtkWidget *entry;
+
+	/*< private >*/
+	EphyIconEntryPrivate *priv;
+};
+
+GType		ephy_icon_entry_get_type	(void);
+
+GtkWidget      *ephy_icon_entry_new		(void);
+
+void		ephy_icon_entry_pack_widget	(EphyIconEntry *entry,
+						 GtkWidget *widget,
+						 gboolean start);
+
+GtkWidget      *ephy_icon_entry_get_entry	(EphyIconEntry *entry);
+
+G_END_DECLS
+
+#endif

=== modified file 'src/gui/main.cpp'
--- src/gui/main.cpp	2006-09-10 12:57:42 +0000
+++ src/gui/main.cpp	2006-09-11 14:01:24 +0000
@@ -64,6 +64,7 @@
 #include "gmlevelmeter.h"
 #include "gmroster.h"
 #include "gmpowermeter.h"
+#include "ephy-icon-entry.h"
 
 
 #include "../pixmaps/text_logo.xpm"
@@ -136,7 +137,7 @@
   GtkWidget *statusbar;
   GtkWidget *statusbar_ebox;
   GtkWidget *qualitymeter;
-  GtkWidget *combo;
+  GtkWidget *uri;
   GtkWidget *main_notebook;
   GtkWidget *main_video_image;
   GtkWidget *local_video_image;
@@ -623,9 +624,27 @@
   /* URL bar */
   /* Entry */
   item = gtk_tool_item_new ();
-  mw->combo = gtk_combo_box_entry_new_text ();
-
-  gtk_container_add (GTK_CONTAINER (item), mw->combo);
+  mw->uri = ephy_icon_entry_new ();
+
+  /********************** TEST TEST TEST *********************/
+  GtkWidget* lock_ebox = NULL;
+  GtkWidget* lock = NULL;
+
+  lock_ebox = gtk_event_box_new ();
+  gtk_container_set_border_width (GTK_CONTAINER (lock_ebox), 2);
+  gtk_widget_add_events (lock_ebox, GDK_BUTTON_PRESS_MASK);
+  gtk_event_box_set_visible_window (GTK_EVENT_BOX (lock_ebox), FALSE);
+
+  lock = gtk_image_new_from_icon_name ("stock_lock-open",
+                                   GTK_ICON_SIZE_MENU);
+  gtk_container_add (GTK_CONTAINER (lock_ebox), lock);
+
+  ephy_icon_entry_pack_widget (EPHY_ICON_ENTRY (mw->uri),
+                               lock_ebox,
+                               FALSE);
+  /********************** TEST TEST TEST *********************/
+
+  gtk_container_add (GTK_CONTAINER (item), mw->uri);
   gtk_container_set_border_width (GTK_CONTAINER (item), 4);
   gtk_tool_item_set_expand (GTK_TOOL_ITEM (item), TRUE);
   
@@ -639,14 +658,15 @@
   gtk_entry_completion_set_model (GTK_ENTRY_COMPLETION (completion),
 				  GTK_TREE_MODEL (list_store));
   gtk_entry_completion_set_text_column (GTK_ENTRY_COMPLETION (completion), 2);
-  gtk_entry_set_completion (GTK_ENTRY (GTK_BIN (mw->combo)->child), completion);
+  gtk_entry_set_completion (GTK_ENTRY (ephy_icon_entry_get_entry (EPHY_ICON_ENTRY (mw->uri))),
+                            completion);
   
-  gtk_entry_set_text (GTK_ENTRY (GTK_BIN (mw->combo)->child),
+  gtk_entry_set_text (GTK_ENTRY (ephy_icon_entry_get_entry (EPHY_ICON_ENTRY (mw->uri))),
 		      GMURL ().GetDefaultURL ());
 
-  // set the position to the end of the combo
-  int len = strlen(gtk_entry_get_text (GTK_ENTRY (GTK_BIN (mw->combo)->child)));
-  gtk_editable_set_position (GTK_EDITABLE (GTK_WIDGET ((GTK_BIN (mw->combo))->child)),len);
+  // set the position to the end of the entry
+  int len = strlen(gtk_entry_get_text (GTK_ENTRY (ephy_icon_entry_get_entry (EPHY_ICON_ENTRY (mw->uri)))));
+  gtk_editable_set_position (GTK_EDITABLE (GTK_WIDGET (ephy_icon_entry_get_entry (EPHY_ICON_ENTRY (mw->uri)))),len);
 
   gtk_entry_completion_set_match_func (GTK_ENTRY_COMPLETION (completion),
 				       entry_completion_url_match_cb,
@@ -655,9 +675,9 @@
   
   gm_main_window_urls_history_update (main_window);
 
-  g_signal_connect (G_OBJECT (GTK_BIN (mw->combo)->child), "changed", 
+  g_signal_connect (G_OBJECT (ephy_icon_entry_get_entry (EPHY_ICON_ENTRY (mw->uri))), "changed", 
 		    GTK_SIGNAL_FUNC (url_changed_cb), (gpointer) main_window);
-  g_signal_connect (G_OBJECT (GTK_BIN (mw->combo)->child), "activate", 
+  g_signal_connect (G_OBJECT (ephy_icon_entry_get_entry (EPHY_ICON_ENTRY (mw->uri))), "activate", 
 		    GTK_SIGNAL_FUNC (url_activated_cb), NULL);
   g_signal_connect (G_OBJECT (completion), "match-selected", 
 		    GTK_SIGNAL_FUNC (completion_url_selected_cb), NULL);
@@ -682,7 +702,7 @@
 
   g_signal_connect (G_OBJECT (mw->connect_button), "released",
                     G_CALLBACK (connect_button_clicked_cb), 
-		    GTK_ENTRY (GTK_BIN (mw->combo)->child));
+		    GTK_ENTRY (ephy_icon_entry_get_entry (EPHY_ICON_ENTRY (mw->uri))));
 
   gtk_widget_show_all (GTK_WIDGET (toolbar));
   
@@ -2605,12 +2625,9 @@
 
   GmContact *c = NULL;
 
-  GValue val = {0, };
-
   GtkWidget *main_window = NULL;
 
-  GtkTreeModel *history_model = NULL;
-  GtkTreeModel *cache_model = NULL;
+  GtkTreeModel *completion_model = NULL;
   GtkEntryCompletion *completion = NULL;
 
   GtkTreeIter tree_iter;
@@ -2633,16 +2650,15 @@
 
 
   /* Get the placed calls history */
-  g_value_init (&val, G_TYPE_INT);
-  g_value_set_int (&val, -1);
-  g_object_set_property (G_OBJECT (mw->combo), "active", &val);
-
   gdk_threads_enter ();
   c2 = gm_calls_history_get_calls (PLACED_CALL, 10, TRUE, TRUE);
 
-  history_model = 
-    gtk_combo_box_get_model (GTK_COMBO_BOX (mw->combo));
-  gtk_list_store_clear (GTK_LIST_STORE (history_model));
+  completion = GTK_ENTRY_COMPLETION (
+                gtk_entry_get_completion (GTK_ENTRY (
+                  ephy_icon_entry_get_entry (EPHY_ICON_ENTRY (mw->uri)))));
+
+  completion_model = gtk_entry_completion_get_model (completion);
+  gtk_list_store_clear (GTK_LIST_STORE (completion_model));
   gdk_threads_leave ();
 
   iter = c2;
@@ -2652,7 +2668,7 @@
     if (c->url && strcmp (c->url, "")) {
 
       gdk_threads_enter ();
-      gtk_combo_box_append_text (GTK_COMBO_BOX (mw->combo), c->url);
+      gtk_entry_completion_insert_action_text (completion, cpt, c->url);
       gdk_threads_leave ();
       cpt++;
     }
@@ -2680,11 +2696,6 @@
   c2 = gm_calls_history_get_calls (MAX_VALUE_CALL, 25, TRUE, FALSE);
   contacts = g_slist_concat (c1, c2);
 
-  completion = 
-    gtk_entry_get_completion (GTK_ENTRY (GTK_BIN (mw->combo)->child));
-  cache_model = 
-    gtk_entry_completion_get_model (GTK_ENTRY_COMPLETION (completion));
-  gtk_list_store_clear (GTK_LIST_STORE (cache_model));
   gdk_threads_leave ();
 
 
@@ -2704,8 +2715,8 @@
 	entry = g_strdup (c->url);
 
       gdk_threads_enter ();
-      gtk_list_store_append (GTK_LIST_STORE (cache_model), &tree_iter);
-      gtk_list_store_set (GTK_LIST_STORE (cache_model), &tree_iter, 
+      gtk_list_store_append (GTK_LIST_STORE (completion_model), &tree_iter);
+      gtk_list_store_set (GTK_LIST_STORE (completion_model), &tree_iter, 
 			  0, c->fullname,
 			  1, c->url,
 			  2, (char *) entry, -1);
@@ -4425,7 +4436,7 @@
 
   g_return_if_fail (mw != NULL);
 
-  entry = GTK_WIDGET (GTK_BIN (mw->combo)->child);
+  entry = ephy_icon_entry_get_entry (EPHY_ICON_ENTRY (mw->uri));
  
   gtk_entry_set_text (GTK_ENTRY (entry), url);
   gtk_editable_set_position (GTK_EDITABLE (entry), -1);
@@ -4450,7 +4461,7 @@
 
   g_return_if_fail (mw != NULL && url != NULL);
  
-  entry = GTK_WIDGET (GTK_BIN (mw->combo)->child);
+  entry = ephy_icon_entry_get_entry (EPHY_ICON_ENTRY (mw->uri));
 
   if (gtk_editable_get_selection_bounds (GTK_EDITABLE (entry), NULL, NULL)) {
 
@@ -4475,7 +4486,7 @@
 
   g_return_val_if_fail (mw != NULL, NULL);
  
-  return gtk_entry_get_text (GTK_ENTRY (GTK_BIN (mw->combo)->child));
+  return gtk_entry_get_text (GTK_ENTRY (ephy_icon_entry_get_entry (EPHY_ICON_ENTRY (mw->uri))));
 }
 
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]