[Xfce4-commits] <midori:master> Show some basic information in description box when domain is selected
Christian Dywan
noreply at xfce.org
Fri Jan 8 00:18:09 CET 2010
Updating branch refs/heads/master
to 973c82fdaeac14ac2aa43b3bab9779fe0351a186 (commit)
from d7aa05b9ec97f7fba6096f311ce5cc9737e410cd (commit)
commit 973c82fdaeac14ac2aa43b3bab9779fe0351a186
Author: Enrico Tröger <enrico.troeger at uvena.de>
Date: Fri Jan 8 00:08:24 2010 +0100
Show some basic information in description box when domain is selected
extensions/cookie-manager/cookie-manager-page.c | 37 +++++++++++++++++++++-
1 files changed, 35 insertions(+), 2 deletions(-)
diff --git a/extensions/cookie-manager/cookie-manager-page.c b/extensions/cookie-manager/cookie-manager-page.c
index 509d2d1..3d5cc19 100644
--- a/extensions/cookie-manager/cookie-manager-page.c
+++ b/extensions/cookie-manager/cookie-manager-page.c
@@ -609,6 +609,25 @@ static gchar *cm_get_cookie_description_text(SoupCookie *cookie)
}
+static gchar *cm_get_domain_description_text(const gchar *domain, gint cookie_count)
+{
+ gchar *str, *text;
+
+ if (*domain == '.')
+ domain++; /* skip a leading dot */
+
+ text = g_markup_printf_escaped(
+ _("<b>Domain</b>: %s\n<b>Cookies</b>: %d"),
+ domain, cookie_count);
+
+ str = g_strconcat(text, "\n\n\n\n", NULL);
+
+ g_free(text);
+
+ return str;
+}
+
+
#if GTK_CHECK_VERSION(2, 12, 0)
static gboolean cm_tree_query_tooltip(GtkWidget *widget, gint x, gint y, gboolean keyboard_mode,
GtkTooltip *tooltip, CookieManagerPage *cmp)
@@ -743,7 +762,7 @@ static void cm_tree_selection_changed_cb(GtkTreeSelection *selection, CookieMana
GList *rows;
GtkTreeIter iter, iter_store;
GtkTreeModel *model;
- gchar *text;
+ gchar *text, *name;
gboolean valid = TRUE;
gboolean delete_possible = TRUE;
guint rows_len;
@@ -765,6 +784,8 @@ static void cm_tree_selection_changed_cb(GtkTreeSelection *selection, CookieMana
gtk_tree_model_filter_convert_iter_to_child_iter(GTK_TREE_MODEL_FILTER(model),
&iter_store, &iter);
}
+ else
+ valid = FALSE;
if (valid && gtk_tree_store_iter_is_valid(priv->store, &iter_store))
{
@@ -778,7 +799,19 @@ static void cm_tree_selection_changed_cb(GtkTreeSelection *selection, CookieMana
g_free(text);
}
else
- valid = FALSE;
+ {
+ gtk_tree_model_get(model, &iter, COOKIE_MANAGER_COL_NAME, &name, -1);
+ if (name != NULL)
+ {
+ gint cookie_count = gtk_tree_model_iter_n_children(model, &iter);
+
+ text = cm_get_domain_description_text(name, cookie_count);
+ gtk_label_set_markup(GTK_LABEL(priv->desc_label), text);
+
+ g_free(text);
+ g_free(name);
+ }
+ }
}
/* This is a bit hack'ish but we add some empty lines to get a minimum height of the
* label at the bottom without any font size calculation. */
More information about the Xfce4-commits
mailing list