diff options
-rw-r--r-- | lib/widgets/ephy-location-entry.c | 38 | ||||
-rw-r--r-- | src/ephy-completion-model.c | 5 |
2 files changed, 39 insertions, 4 deletions
diff --git a/lib/widgets/ephy-location-entry.c b/lib/widgets/ephy-location-entry.c index a7f670add..08843166e 100644 --- a/lib/widgets/ephy-location-entry.c +++ b/lib/widgets/ephy-location-entry.c @@ -122,6 +122,12 @@ static void ephy_location_entry_class_init (EphyLocationEntryClass *klass); static void ephy_location_entry_init (EphyLocationEntry *le); static gboolean ephy_location_entry_reset_internal (EphyLocationEntry *, gboolean); +static void extracell_data_func (GtkCellLayout *cell_layout, + GtkCellRenderer *cell, + GtkTreeModel *tree_model, + GtkTreeIter *iter, + gpointer data); + static GObjectClass *parent_class = NULL; enum signalsEnum @@ -1006,6 +1012,29 @@ cursor_on_match_cb (GtkEntryCompletion *completion, return TRUE; } +static void +extracell_data_func (GtkCellLayout *cell_layout, + GtkCellRenderer *cell, + GtkTreeModel *tree_model, + GtkTreeIter *iter, + gpointer data) +{ + char *cdata; + GValue visible = { 0, }; + GValue text = { 0, }; + + gtk_tree_model_get (tree_model, iter, GPOINTER_TO_UINT(data), &cdata, -1); + + g_value_init (&text, G_TYPE_STRING); + g_value_init (&visible, G_TYPE_BOOLEAN); + + g_value_set_string (&text, cdata); + g_value_set_boolean (&visible, (cdata != NULL)); + + g_object_set_property (G_OBJECT (cell), "text", &text); + g_object_set_property (G_OBJECT (cell), "visible", &visible); +} + void ephy_location_entry_set_completion (EphyLocationEntry *le, GtkTreeModel *model, @@ -1066,13 +1095,16 @@ ephy_location_entry_set_completion (EphyLocationEntry *le, g_object_set (le->priv->extracell, "ellipsize", PANGO_ELLIPSIZE_END, "ellipsize-set", TRUE, - "alignment", PANGO_ALIGN_RIGHT, + "alignment", PANGO_ALIGN_LEFT, NULL); gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (completion), le->priv->extracell, TRUE); - gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (completion), - le->priv->extracell, "text", extra_col); + + gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT (completion), + le->priv->extracell, extracell_data_func, + GUINT_TO_POINTER (extra_col), + NULL); g_object_set (completion, "inline-selection", TRUE, NULL); g_signal_connect (completion, "cursor-on-match", diff --git a/src/ephy-completion-model.c b/src/ephy-completion-model.c index c15286309..5e6b80c2d 100644 --- a/src/ephy-completion-model.c +++ b/src/ephy-completion-model.c @@ -499,7 +499,10 @@ ephy_completion_model_get_value (GtkTreeModel *tree_model, { 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 */ + /* We set an additional text for the item title only for + * history, since we assume that people know the url of + * their bookmarks + */ if (group == HISTORY_GROUP) { const char *text; |