epiphany r8693 - in trunk: lib/widgets src



Author: diegoe
Date: Thu Jan 15 22:07:08 2009
New Revision: 8693
URL: http://svn.gnome.org/viewvc/epiphany?rev=8693&view=rev

Log:
Include a bookmark indication in the woohoo bar

If the result shown in the row is a bookmark, the epiphany bookmark icon will
be drawn to the right of it.

Modified:
   trunk/lib/widgets/ephy-location-entry.c
   trunk/src/ephy-completion-model.c
   trunk/src/ephy-location-action.c

Modified: trunk/lib/widgets/ephy-location-entry.c
==============================================================================
--- trunk/lib/widgets/ephy-location-entry.c	(original)
+++ trunk/lib/widgets/ephy-location-entry.c	Thu Jan 15 22:07:08 2009
@@ -92,6 +92,11 @@
 			GtkTreeModel *tree_model,
 			GtkTreeIter *iter,
 			gpointer data);
+static void extracell_data_func (GtkCellLayout *cell_layout,
+			GtkCellRenderer *cell,
+			GtkTreeModel *tree_model,
+			GtkTreeIter *iter,
+			gpointer data);
 
 enum signalsEnum
 {
@@ -998,6 +1003,33 @@
 	g_free (url);
 }
 
+static void
+extracell_data_func (GtkCellLayout *cell_layout,
+			GtkCellRenderer *cell,
+			GtkTreeModel *tree_model,
+			GtkTreeIter *iter,
+			gpointer data)
+{
+	EphyLocationEntryPrivate *priv;
+	gboolean is_bookmark = FALSE;
+	GValue visible = { 0, };
+
+	priv = EPHY_LOCATION_ENTRY (data)->priv;
+	gtk_tree_model_get (tree_model, iter,
+			priv->extra_col, &is_bookmark,
+			-1);
+
+	if (is_bookmark)
+		g_object_set (G_OBJECT (cell),
+				"stock-id", EPHY_STOCK_BOOKMARK,
+				NULL);
+
+	g_value_init (&visible, G_TYPE_BOOLEAN);
+	g_value_set_boolean (&visible, is_bookmark);
+	g_object_set_property (G_OBJECT (cell), "visible", &visible);
+	g_value_unset (&visible);
+}
+
 /**
  * ephy_location_entry_set_match_func:
  * @entry: an #EphyLocationEntry widget
@@ -1054,7 +1086,7 @@
 	EphyLocationEntryPrivate *priv = entry->priv;
 	GtkTreeModel *sort_model;
 	GtkEntryCompletion *completion;
-	GtkCellRenderer *cell, *iconcell;
+	GtkCellRenderer *cell, *iconcell, *extracell;
 
 	entry->priv->text_col = text_col;
 	entry->priv->action_col = action_col;
@@ -1103,6 +1135,14 @@
 					entry,
 					NULL);
 
+	extracell = gtk_cell_renderer_pixbuf_new ();
+	gtk_cell_layout_pack_end (GTK_CELL_LAYOUT (completion),
+				    extracell, FALSE);
+	gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT (completion),
+					extracell, extracell_data_func,
+					entry,
+					NULL);
+
 	g_object_set (completion, "inline-selection", TRUE, NULL);
 	g_signal_connect (completion, "cursor-on-match",
 			  G_CALLBACK (cursor_on_match_cb), entry);

Modified: trunk/src/ephy-completion-model.c
==============================================================================
--- trunk/src/ephy-completion-model.c	(original)
+++ trunk/src/ephy-completion-model.c	Thu Jan 15 22:07:08 2009
@@ -243,9 +243,11 @@
 		case EPHY_COMPLETION_TEXT_COL:
 		case EPHY_COMPLETION_ACTION_COL:
 		case EPHY_COMPLETION_KEYWORDS_COL:
-		case EPHY_COMPLETION_EXTRA_COL:
 			type =  G_TYPE_STRING;
 			break;
+		case EPHY_COMPLETION_EXTRA_COL:
+			type = G_TYPE_BOOLEAN;
+			break;
 		case EPHY_COMPLETION_FAVICON_COL:
 			type = GDK_TYPE_PIXBUF;
 			break;
@@ -456,10 +458,8 @@
 	switch (column)
 	{
 		case EPHY_COMPLETION_EXTRA_COL:
-			g_value_init (value, G_TYPE_STRING);
-			g_value_set_string (value,
-					ephy_node_get_property_string
-					 (node, EPHY_NODE_PAGE_PROP_LOCATION));
+			g_value_init (value, G_TYPE_BOOLEAN);
+			g_value_set_boolean (value, (group == BOOKMARKS_GROUP));
 			break;
 		case EPHY_COMPLETION_TEXT_COL:
 			g_value_init (value, G_TYPE_STRING);

Modified: trunk/src/ephy-location-action.c
==============================================================================
--- trunk/src/ephy-location-action.c	(original)
+++ trunk/src/ephy-location-action.c	Thu Jan 15 22:07:08 2009
@@ -133,13 +133,11 @@
 	ret = (g_regex_match (regex, item, G_REGEX_MATCH_NOTEMPTY, NULL)
 		|| g_regex_match (regex, url, G_REGEX_MATCH_NOTEMPTY, NULL)
 		|| g_regex_match (regex, keywords, G_REGEX_MATCH_NOTEMPTY, NULL)
-		|| (extra && g_regex_match (regex, extra, G_REGEX_MATCH_NOTEMPTY, NULL))
 		);
 
 	g_free (item);
 	g_free (url);
 	g_free (keywords);
-	g_free (extra);
 
 	return ret;
 }



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