aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDiego Escalante Urrelo <diegoe@src.gnome.org>2007-09-30 20:58:24 +0800
committerDiego Escalante Urrelo <diegoe@src.gnome.org>2007-09-30 20:58:24 +0800
commit8c8b026fc6c22677eb05255eb4e1bbf1bda7dae3 (patch)
treece0a92a20c03fd5fba25611a231cb99ba78ad546
parentd09bb750b80c245545bb8e97ce9070d9f3d31310 (diff)
downloadgsoc2013-epiphany-8c8b026fc6c22677eb05255eb4e1bbf1bda7dae3.tar
gsoc2013-epiphany-8c8b026fc6c22677eb05255eb4e1bbf1bda7dae3.tar.gz
gsoc2013-epiphany-8c8b026fc6c22677eb05255eb4e1bbf1bda7dae3.tar.bz2
gsoc2013-epiphany-8c8b026fc6c22677eb05255eb4e1bbf1bda7dae3.tar.lz
gsoc2013-epiphany-8c8b026fc6c22677eb05255eb4e1bbf1bda7dae3.tar.xz
gsoc2013-epiphany-8c8b026fc6c22677eb05255eb4e1bbf1bda7dae3.tar.zst
gsoc2013-epiphany-8c8b026fc6c22677eb05255eb4e1bbf1bda7dae3.zip
Make the location entry completion cells smarter, now bookmarks take the full
width of the popup. Also make the extracell (titles of history entries) align to the left so it's less messy and easier to browse a lot of entries with similar titles. Almost-fixes bug #419475. svn path=/trunk/; revision=7508
-rw-r--r--lib/widgets/ephy-location-entry.c38
-rw-r--r--src/ephy-completion-model.c5
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;