diff options
author | Diego Escalante Urrelo <diegoe@src.gnome.org> | 2009-01-16 06:07:08 +0800 |
---|---|---|
committer | Diego Escalante Urrelo <diegoe@src.gnome.org> | 2009-01-16 06:07:08 +0800 |
commit | 5c4c64876f3f2b58809fd047abed1fba8265cfbf (patch) | |
tree | 89bee231e2f614abfd28b1d51f2021360cd461e3 /lib | |
parent | 2fefd6be854823210b1f29462866656a92ae0331 (diff) | |
download | gsoc2013-epiphany-5c4c64876f3f2b58809fd047abed1fba8265cfbf.tar.gz gsoc2013-epiphany-5c4c64876f3f2b58809fd047abed1fba8265cfbf.tar.zst gsoc2013-epiphany-5c4c64876f3f2b58809fd047abed1fba8265cfbf.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=/trunk/; revision=8693
Diffstat (limited to 'lib')
-rw-r--r-- | lib/widgets/ephy-location-entry.c | 42 |
1 files changed, 41 insertions, 1 deletions
diff --git a/lib/widgets/ephy-location-entry.c b/lib/widgets/ephy-location-entry.c index 01eeccaa7..0d3d2d88b 100644 --- a/lib/widgets/ephy-location-entry.c +++ b/lib/widgets/ephy-location-entry.c @@ -92,6 +92,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); enum signalsEnum { @@ -998,6 +1003,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); +} + /** * ephy_location_entry_set_match_func: * @entry: an #EphyLocationEntry widget @@ -1054,7 +1086,7 @@ ephy_location_entry_set_completion (EphyLocationEntry *entry, 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 @@ ephy_location_entry_set_completion (EphyLocationEntry *entry, 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); |