aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDiego Escalante Urrelo <diegoe@src.gnome.org>2009-01-20 07:18:07 +0800
committerDiego Escalante Urrelo <diegoe@src.gnome.org>2009-01-20 07:18:07 +0800
commitdc4280bd77a956ec0a6945f8f48ddd0797e09317 (patch)
tree15c5d3e08264fd8e149867711244eb54a12f55de
parent32346230ef41985be62fd3280f60436f50633cf9 (diff)
downloadgsoc2013-epiphany-dc4280bd77a956ec0a6945f8f48ddd0797e09317.tar
gsoc2013-epiphany-dc4280bd77a956ec0a6945f8f48ddd0797e09317.tar.gz
gsoc2013-epiphany-dc4280bd77a956ec0a6945f8f48ddd0797e09317.tar.bz2
gsoc2013-epiphany-dc4280bd77a956ec0a6945f8f48ddd0797e09317.tar.lz
gsoc2013-epiphany-dc4280bd77a956ec0a6945f8f48ddd0797e09317.tar.xz
gsoc2013-epiphany-dc4280bd77a956ec0a6945f8f48ddd0797e09317.tar.zst
gsoc2013-epiphany-dc4280bd77a956ec0a6945f8f48ddd0797e09317.zip
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. svn path=/branches/gnome-2-26/; revision=8704
-rw-r--r--lib/widgets/ephy-location-entry.c42
-rw-r--r--src/ephy-completion-model.c17
-rw-r--r--src/ephy-location-action.c2
3 files changed, 47 insertions, 14 deletions
diff --git a/lib/widgets/ephy-location-entry.c b/lib/widgets/ephy-location-entry.c
index a50d46733..98d94579f 100644
--- a/lib/widgets/ephy-location-entry.c
+++ b/lib/widgets/ephy-location-entry.c
@@ -96,6 +96,11 @@ static void textcell_data_func (GtkCellLayout *cell_layout,
GtkTreeModel *tree_model,
GtkTreeIter *iter,
gpointer data);
+static void extracell_data_func (GtkCellLayout *cell_layout,
+ GtkCellRenderer *cell,
+ GtkTreeModel *tree_model,
+ GtkTreeIter *iter,
+ gpointer data);
static GObjectClass *parent_class = NULL;
@@ -1036,6 +1041,33 @@ textcell_data_func (GtkCellLayout *cell_layout,
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);
+}
+
void
ephy_location_entry_set_match_func (EphyLocationEntry *le,
GtkEntryCompletionMatchFunc match_func,
@@ -1063,7 +1095,7 @@ ephy_location_entry_set_completion (EphyLocationEntry *le,
EphyLocationEntryPrivate *priv = le->priv;
GtkTreeModel *sort_model;
GtkEntryCompletion *completion;
- GtkCellRenderer *cell, *iconcell;
+ GtkCellRenderer *cell, *iconcell, *extracell;
le->priv->text_col = text_col;
le->priv->action_col = action_col;
@@ -1112,6 +1144,14 @@ ephy_location_entry_set_completion (EphyLocationEntry *le,
le,
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,
+ le,
+ NULL);
+
g_object_set (completion, "inline-selection", TRUE, NULL);
g_signal_connect (completion, "cursor-on-match",
G_CALLBACK (cursor_on_match_cb), le);
diff --git a/src/ephy-completion-model.c b/src/ephy-completion-model.c
index 895ba0369..13b1ce82d 100644
--- a/src/ephy-completion-model.c
+++ b/src/ephy-completion-model.c
@@ -243,9 +243,11 @@ ephy_completion_model_get_column_type (GtkTreeModel *tree_model,
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;
@@ -267,7 +269,7 @@ init_text_col (GValue *value, EphyNode *node, int group)
case BOOKMARKS_GROUP:
case HISTORY_GROUP:
text = ephy_node_get_property_string
- (node, EPHY_NODE_BMK_PROP_TITLE);
+ (node, EPHY_NODE_PAGE_PROP_TITLE);
break;
default:
@@ -422,15 +424,8 @@ ephy_completion_model_get_value (GtkTreeModel *tree_model,
switch (column)
{
case EPHY_COMPLETION_EXTRA_COL:
- g_value_init (value, G_TYPE_STRING);
- /* We set an additional text for the item title only for
- * history, since we assume that people know the url of
- * their bookmarks
- */
- const char *text;
- text = ephy_node_get_property_string
- (node, EPHY_NODE_PAGE_PROP_LOCATION);
- g_value_set_string (value, text);
+ 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);
diff --git a/src/ephy-location-action.c b/src/ephy-location-action.c
index 293b244ed..8b307fc44 100644
--- a/src/ephy-location-action.c
+++ b/src/ephy-location-action.c
@@ -117,13 +117,11 @@ match_func (GtkEntryCompletion *completion,
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;
}