summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJan-Michael Brummer <jan.brummer@tabos.org>2019-04-13 22:27:24 +0200
committerMichael Catanzaro <mcatanzaro@posteo.net>2019-05-27 12:15:28 +0000
commit5cd090e32880dad7fba291767b5a32f06f7b7d56 (patch)
tree7582c321fbaa3bb94d5f615eaa0debaae3983732 /src
parentf793d533d4d9dc6eda6c5d20648721cd61859523 (diff)
downloadepiphany-5cd090e32880dad7fba291767b5a32f06f7b7d56.tar.gz
Make cookies dialog responsive
Diffstat (limited to 'src')
-rw-r--r--src/cookies-dialog.c357
-rw-r--r--src/resources/gtk/cookies-dialog.ui188
2 files changed, 174 insertions, 371 deletions
diff --git a/src/cookies-dialog.c b/src/cookies-dialog.c
index 00365b17a..09157080f 100644
--- a/src/cookies-dialog.c
+++ b/src/cookies-dialog.c
@@ -1,6 +1,7 @@
/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/*
* Copyright © 2013 Red Hat, Inc.
+ * Copyright © 2019 Jan-Michael Brummer
*
* This file is part of Epiphany.
*
@@ -32,20 +33,12 @@
#include "cookies-dialog.h"
-enum {
- COL_COOKIES_HOST,
- COL_COOKIES_HOST_KEY,
- COL_COOKIES_DATA,
-};
-
struct _EphyCookiesDialog {
GtkDialog parent_instance;
- GtkWidget *cookies_treeview;
- GtkTreeSelection *tree_selection;
- GtkWidget *liststore;
- GtkWidget *treemodelfilter;
- GtkWidget *treemodelsort;
+ GtkWidget *cookies_listbox;
+ GtkWidget *search_bar;
+ GtkWidget *search_entry;
GActionGroup *action_group;
@@ -57,30 +50,35 @@ struct _EphyCookiesDialog {
G_DEFINE_TYPE (EphyCookiesDialog, ephy_cookies_dialog, GTK_TYPE_DIALOG)
-static void populate_model (EphyCookiesDialog *dialog);
-static void cookie_changed_cb (WebKitCookieManager *cookie_manager,
- EphyCookiesDialog *dialog);
+static void populate_model (EphyCookiesDialog *self);
static void
-reload_model (EphyCookiesDialog *dialog)
+clear_listbox (GtkWidget *listbox)
{
- g_signal_handlers_disconnect_by_func (webkit_website_data_manager_get_cookie_manager (dialog->data_manager), cookie_changed_cb, dialog);
- gtk_list_store_clear (GTK_LIST_STORE (dialog->liststore));
- dialog->filled = FALSE;
- populate_model (dialog);
+ GList *children, *iter;
+
+ children = gtk_container_get_children (GTK_CONTAINER (listbox));
+
+ for (iter = children; iter != NULL; iter = g_list_next (iter))
+ gtk_widget_destroy (GTK_WIDGET (iter->data));
+
+ g_list_free (children);
}
static void
-cookie_changed_cb (WebKitCookieManager *cookie_manager,
- EphyCookiesDialog *dialog)
+reload_model (EphyCookiesDialog *self)
{
- reload_model (dialog);
+ clear_listbox (self->cookies_listbox);
+ self->filled = FALSE;
+ populate_model (self);
}
static void
ephy_cookies_dialog_dispose (GObject *object)
{
- g_signal_handlers_disconnect_by_func (webkit_website_data_manager_get_cookie_manager (EPHY_COOKIES_DIALOG (object)->data_manager), cookie_changed_cb, object);
+ EphyCookiesDialog *self = EPHY_COOKIES_DIALOG (object);
+
+ g_clear_pointer (&self->search_text, g_free);
G_OBJECT_CLASS (ephy_cookies_dialog_parent_class)->dispose (object);
}
@@ -92,125 +90,37 @@ ephy_cookies_dialog_finalize (GObject *object)
}
static void
-forget (GSimpleAction *action,
- GVariant *parameter,
- gpointer user_data)
+forget_clicked (GtkButton *button,
+ gpointer user_data)
{
- EphyCookiesDialog *dialog = EPHY_COOKIES_DIALOG (user_data);
- GList *llist, *rlist = NULL, *l, *r;
+ EphyCookiesDialog *self = EPHY_COOKIES_DIALOG (user_data);
+ GtkListBoxRow *row = g_object_get_data (G_OBJECT (button), "row");
GList *data_to_remove = NULL;
- GtkTreeModel *model;
- GtkTreePath *path;
- GtkTreeIter iter, iter2;
- GtkTreeRowReference *row_ref = NULL;
-
- llist = gtk_tree_selection_get_selected_rows (dialog->tree_selection, &model);
-
- if (llist == NULL) {
- /* nothing to delete, return early */
- return;
- }
-
- for (l = llist; l != NULL; l = l->next) {
- rlist = g_list_prepend (rlist, gtk_tree_row_reference_new (model, (GtkTreePath *)l->data));
- }
-
- /* Intelligent selection logic, no actual selection yet */
-
- path = gtk_tree_row_reference_get_path ((GtkTreeRowReference *)g_list_first (rlist)->data);
-
- gtk_tree_model_get_iter (model, &iter, path);
- gtk_tree_path_free (path);
- iter2 = iter;
-
- if (gtk_tree_model_iter_next (GTK_TREE_MODEL (model), &iter)) {
- path = gtk_tree_model_get_path (GTK_TREE_MODEL (model), &iter);
- row_ref = gtk_tree_row_reference_new (model, path);
- } else {
- path = gtk_tree_model_get_path (GTK_TREE_MODEL (model), &iter2);
- if (gtk_tree_path_prev (path)) {
- row_ref = gtk_tree_row_reference_new (model, path);
- }
- }
- gtk_tree_path_free (path);
-
- /* Removal */
- for (r = rlist; r != NULL; r = r->next) {
- GValue val = { 0, };
-
- GtkTreeIter filter_iter;
- GtkTreeIter child_iter;
+ WebKitWebsiteData *data = NULL;
- path = gtk_tree_row_reference_get_path ((GtkTreeRowReference *)r->data);
- gtk_tree_model_get_iter (model, &iter, path);
- gtk_tree_model_get_value (model, &iter, COL_COOKIES_DATA, &val);
- data_to_remove = g_list_prepend (data_to_remove, g_value_dup_boxed (&val));
- g_value_unset (&val);
-
- gtk_tree_model_sort_convert_iter_to_child_iter (GTK_TREE_MODEL_SORT (dialog->treemodelsort),
- &filter_iter,
- &iter);
-
- gtk_tree_model_filter_convert_iter_to_child_iter (GTK_TREE_MODEL_FILTER (dialog->treemodelfilter),
- &child_iter,
- &filter_iter);
-
- gtk_list_store_remove (GTK_LIST_STORE (dialog->liststore), &child_iter);
-
- gtk_tree_row_reference_free ((GtkTreeRowReference *)r->data);
- gtk_tree_path_free (path);
- }
-
- g_list_foreach (llist, (GFunc)gtk_tree_path_free, NULL);
- g_list_free (llist);
- g_list_free (rlist);
+ gtk_list_box_select_row (GTK_LIST_BOX (self->cookies_listbox), row);
+ data = g_object_get_data (G_OBJECT (row), "data");
+ data_to_remove = g_list_append (data_to_remove, data);
if (data_to_remove) {
- webkit_website_data_manager_remove (dialog->data_manager, WEBKIT_WEBSITE_DATA_COOKIES, data_to_remove, NULL, NULL, NULL);
+ webkit_website_data_manager_remove (self->data_manager, WEBKIT_WEBSITE_DATA_COOKIES, data_to_remove, NULL, NULL, NULL);
g_list_free_full (data_to_remove, (GDestroyNotify)webkit_website_data_unref);
- }
-
- /* Selection */
- if (row_ref != NULL) {
- path = gtk_tree_row_reference_get_path (row_ref);
- if (path != NULL) {
- gtk_tree_view_set_cursor (GTK_TREE_VIEW (dialog->cookies_treeview), path, NULL, FALSE);
- gtk_tree_path_free (path);
- }
-
- gtk_tree_row_reference_free (row_ref);
+ gtk_container_remove (GTK_CONTAINER (self->cookies_listbox), GTK_WIDGET (row));
}
}
static void
-update_selection_actions (GActionMap *action_map,
- gboolean has_selection)
-{
- GAction *forget_action;
-
- forget_action = g_action_map_lookup_action (action_map, "forget");
- g_simple_action_set_enabled (G_SIMPLE_ACTION (forget_action), has_selection);
-}
-
-static void
-on_treeview_selection_changed (GtkTreeSelection *selection,
- EphyCookiesDialog *dialog)
-{
- update_selection_actions (G_ACTION_MAP (dialog->action_group),
- gtk_tree_selection_count_selected_rows (selection) > 0);
-}
-
-static void
on_search_entry_changed (GtkSearchEntry *entry,
- EphyCookiesDialog *dialog)
+ EphyCookiesDialog *self)
{
const char *text;
text = gtk_entry_get_text (GTK_ENTRY (entry));
- g_free (dialog->search_text);
- dialog->search_text = g_strdup (text);
- gtk_tree_model_filter_refilter (GTK_TREE_MODEL_FILTER (dialog->treemodelfilter));
+ g_free (self->search_text);
+ self->search_text = g_strdup (text);
+
+ gtk_list_box_invalidate_filter (GTK_LIST_BOX (self->cookies_listbox));
}
static void
@@ -218,10 +128,10 @@ forget_all (GSimpleAction *action,
GVariant *parameter,
gpointer user_data)
{
- EphyCookiesDialog *dialog = EPHY_COOKIES_DIALOG (user_data);
+ EphyCookiesDialog *self = EPHY_COOKIES_DIALOG (user_data);
- webkit_website_data_manager_clear (dialog->data_manager, WEBKIT_WEBSITE_DATA_COOKIES, 0, NULL, NULL, NULL);
- reload_model (dialog);
+ webkit_website_data_manager_clear (self->data_manager, WEBKIT_WEBSITE_DATA_COOKIES, 0, NULL, NULL, NULL);
+ reload_model (self);
}
static void
@@ -238,97 +148,43 @@ ephy_cookies_dialog_class_init (EphyCookiesDialogClass *klass)
gtk_widget_class_set_template_from_resource (widget_class,
"/org/gnome/epiphany/gtk/cookies-dialog.ui");
- gtk_widget_class_bind_template_child (widget_class, EphyCookiesDialog, liststore);
- gtk_widget_class_bind_template_child (widget_class, EphyCookiesDialog, treemodelfilter);
- gtk_widget_class_bind_template_child (widget_class, EphyCookiesDialog, treemodelsort);
- gtk_widget_class_bind_template_child (widget_class, EphyCookiesDialog, cookies_treeview);
- gtk_widget_class_bind_template_child (widget_class, EphyCookiesDialog, tree_selection);
+ gtk_widget_class_bind_template_child (widget_class, EphyCookiesDialog, cookies_listbox);
+ gtk_widget_class_bind_template_child (widget_class, EphyCookiesDialog, search_bar);
+ gtk_widget_class_bind_template_child (widget_class, EphyCookiesDialog, search_entry);
- gtk_widget_class_bind_template_callback (widget_class, on_treeview_selection_changed);
gtk_widget_class_bind_template_callback (widget_class, on_search_entry_changed);
}
-static gboolean
-cookie_search_equal (GtkTreeModel *model,
- int column,
- const gchar *key,
- GtkTreeIter *iter,
- gpointer search_data)
-{
- GValue value = { 0, };
- gboolean retval;
-
- /* Note that this is function has to return FALSE for a *match* ! */
-
- gtk_tree_model_get_value (model, iter, column, &value);
- retval = strstr (g_value_get_string (&value), key) == NULL;
- g_value_unset (&value);
-
- return retval;
-}
-
static void
-cookie_add (EphyCookiesDialog *dialog,
+cookie_add (EphyCookiesDialog *self,
WebKitWebsiteData *data)
{
+ HdyActionRow *row;
+ GtkWidget *button;
const char *domain;
- GtkListStore *store;
- GtkTreeIter iter;
- int column[3] = { COL_COOKIES_HOST, COL_COOKIES_HOST_KEY, COL_COOKIES_DATA };
- GValue value[3] = { { 0, }, { 0, }, { 0, } };
-
- store = GTK_LIST_STORE (dialog->liststore);
-
- /* NOTE: We use this strange method to insert the row, because
- * we want to use g_value_take_string but all the row data needs to
- * be inserted in one call as it's needed when the new row is sorted
- * into the model.
- */
-
- g_value_init (&value[0], G_TYPE_STRING);
- g_value_init (&value[1], G_TYPE_STRING);
- g_value_init (&value[2], WEBKIT_TYPE_WEBSITE_DATA);
domain = webkit_website_data_get_name (data);
- g_value_set_string (&value[0], domain);
- g_value_take_string (&value[1], ephy_string_collate_key_for_domain (domain, -1));
- g_value_take_boxed (&value[2], data);
- gtk_list_store_insert_with_valuesv (store, &iter, -1,
- column, value,
- G_N_ELEMENTS (value));
+ /* Row */
+ row = hdy_action_row_new ();
+ hdy_action_row_set_title (row, domain);
- g_value_unset (&value[0]);
- g_value_unset (&value[1]);
- g_value_unset (&value[2]);
-}
-
-static int
-compare_cookie_host_keys (GtkTreeModel *model,
- GtkTreeIter *a,
- GtkTreeIter *b,
- gpointer user_data)
-{
- GValue a_value = { 0, };
- GValue b_value = { 0, };
- int retval;
-
- gtk_tree_model_get_value (model, a, COL_COOKIES_HOST_KEY, &a_value);
- gtk_tree_model_get_value (model, b, COL_COOKIES_HOST_KEY, &b_value);
-
- retval = strcmp (g_value_get_string (&a_value),
- g_value_get_string (&b_value));
+ button = gtk_button_new_from_icon_name ("user-trash-symbolic", GTK_ICON_SIZE_BUTTON);
+ gtk_widget_set_valign (button, GTK_ALIGN_CENTER);
+ g_object_set_data (G_OBJECT (button), "row", row);
+ gtk_widget_set_tooltip_text (button, _("Remove cookie"));
+ g_signal_connect (button, "clicked", G_CALLBACK (forget_clicked), self);
+ hdy_action_row_add_action (row, button);
+ g_object_set_data (G_OBJECT (row), "data", data);
- g_value_unset (&a_value);
- g_value_unset (&b_value);
-
- return retval;
+ gtk_widget_show_all (GTK_WIDGET (row));
+ gtk_list_box_insert (GTK_LIST_BOX (self->cookies_listbox), GTK_WIDGET (row), -1);
}
static void
get_domains_with_cookies_cb (WebKitWebsiteDataManager *data_manager,
GAsyncResult *result,
- EphyCookiesDialog *dialog)
+ EphyCookiesDialog *self)
{
GList *data_list;
@@ -337,110 +193,73 @@ get_domains_with_cookies_cb (WebKitWebsiteDataManager *data_manager,
return;
for (GList *l = data_list; l && l->data; l = g_list_next (l))
- cookie_add (dialog, (WebKitWebsiteData *)l->data);
+ cookie_add (self, (WebKitWebsiteData *)l->data);
/* The list items have been consumed, so we need only to free the list. */
g_list_free (data_list);
- /* Now turn on sorting */
- gtk_tree_sortable_set_sort_func (GTK_TREE_SORTABLE (dialog->liststore),
- COL_COOKIES_HOST_KEY,
- (GtkTreeIterCompareFunc)compare_cookie_host_keys,
- NULL, NULL);
- gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (dialog->liststore),
- COL_COOKIES_HOST_KEY,
- GTK_SORT_ASCENDING);
-
- g_signal_connect (webkit_website_data_manager_get_cookie_manager (data_manager),
- "changed",
- G_CALLBACK (cookie_changed_cb),
- dialog);
-
- dialog->filled = TRUE;
-}
-
-static gboolean
-row_visible_func (GtkTreeModel *model,
- GtkTreeIter *iter,
- EphyCookiesDialog *dialog)
-{
- gboolean visible = FALSE;
- gchar *host;
-
- if (dialog->search_text == NULL)
- return TRUE;
-
- gtk_tree_model_get (model, iter,
- COL_COOKIES_HOST, &host,
- -1);
-
- if (host != NULL && strstr (host, dialog->search_text) != NULL)
- visible = TRUE;
-
- g_free (host);
-
- return visible;
+ self->filled = TRUE;
}
static void
-populate_model (EphyCookiesDialog *dialog)
+populate_model (EphyCookiesDialog *self)
{
- g_assert (dialog->filled == FALSE);
+ g_assert (self->filled == FALSE);
- webkit_website_data_manager_fetch (dialog->data_manager,
+ webkit_website_data_manager_fetch (self->data_manager,
WEBKIT_WEBSITE_DATA_COOKIES,
NULL,
(GAsyncReadyCallback)get_domains_with_cookies_cb,
- dialog);
-}
-
-static void
-setup_page (EphyCookiesDialog *dialog)
-{
- gtk_tree_view_set_search_equal_func (GTK_TREE_VIEW (dialog->cookies_treeview),
- (GtkTreeViewSearchEqualFunc)cookie_search_equal,
- dialog, NULL);
- populate_model (dialog);
+ self);
}
static GActionGroup *
-create_action_group (EphyCookiesDialog *dialog)
+create_action_group (EphyCookiesDialog *self)
{
const GActionEntry entries[] = {
- { "forget", forget },
{ "forget-all", forget_all }
};
GSimpleActionGroup *group;
group = g_simple_action_group_new ();
- g_action_map_add_action_entries (G_ACTION_MAP (group), entries, G_N_ELEMENTS (entries), dialog);
+ g_action_map_add_action_entries (G_ACTION_MAP (group), entries, G_N_ELEMENTS (entries), self);
return G_ACTION_GROUP (group);
}
+static gboolean
+filter_func (GtkListBoxRow *row,
+ gpointer user_data)
+{
+ EphyCookiesDialog *self = EPHY_COOKIES_DIALOG (user_data);
+
+ if (self->search_text)
+ return !!strstr (hdy_action_row_get_title (HDY_ACTION_ROW (row)), self->search_text);
+
+ return TRUE;
+}
+
static void
-ephy_cookies_dialog_init (EphyCookiesDialog *dialog)
+ephy_cookies_dialog_init (EphyCookiesDialog *self)
{
WebKitWebContext *web_context;
EphyEmbedShell *shell = ephy_embed_shell_get_default ();
- gtk_widget_init_template (GTK_WIDGET (dialog));
-
- gtk_tree_model_filter_set_visible_func (GTK_TREE_MODEL_FILTER (dialog->treemodelfilter),
- (GtkTreeModelFilterVisibleFunc)row_visible_func,
- dialog,
- NULL);
+ gtk_widget_init_template (GTK_WIDGET (self));
web_context = ephy_embed_shell_get_web_context (shell);
- dialog->data_manager = webkit_web_context_get_website_data_manager (web_context);
+ self->data_manager = webkit_web_context_get_website_data_manager (web_context);
+
+ populate_model (self);
- setup_page (dialog);
+ self->action_group = create_action_group (self);
+ gtk_widget_insert_action_group (GTK_WIDGET (self), "cookies", self->action_group);
- dialog->action_group = create_action_group (dialog);
- gtk_widget_insert_action_group (GTK_WIDGET (dialog), "cookies", dialog->action_group);
+ gtk_list_box_set_header_func (GTK_LIST_BOX (self->cookies_listbox), hdy_list_box_separator_header, NULL, NULL);
+ gtk_list_box_set_filter_func (GTK_LIST_BOX (self->cookies_listbox), filter_func, self, NULL);
- update_selection_actions (G_ACTION_MAP (dialog->action_group), FALSE);
+ hdy_search_bar_connect_entry (HDY_SEARCH_BAR (self->search_bar), GTK_ENTRY (self->search_entry));
}
EphyCookiesDialog *
diff --git a/src/resources/gtk/cookies-dialog.ui b/src/resources/gtk/cookies-dialog.ui
index d91d80c43..b9931f7b7 100644
--- a/src/resources/gtk/cookies-dialog.ui
+++ b/src/resources/gtk/cookies-dialog.ui
@@ -1,161 +1,145 @@
<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.22.1 -->
<interface>
- <requires lib="gtk+" version="3.10"/>
- <object class="GtkListStore" id="liststore">
- <columns>
- <!-- column-name HOST -->
- <column type="gchararray"/>
- <!-- column-name HOST_KEY -->
- <column type="gchararray"/>
- <!-- column-name DATA -->
- <column type="WebKitWebsiteData"/>
- </columns>
+ <requires lib="gtk+" version="3.20"/>
+ <requires lib="libhandy" version="0.0"/>
+ <object class="GtkImage" id="image1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="icon_name">edit-find-symbolic</property>
</object>
- <object class="GtkTreeModelFilter" id="treemodelfilter">
- <property name="child_model">liststore</property>
- </object>
- <object class="GtkTreeModelSort" id="treemodelsort">
- <property name="model">treemodelfilter</property>
+ <object class="GtkImage" id="image2">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="icon_name">user-trash-symbolic</property>
</object>
<template class="EphyCookiesDialog" parent="GtkDialog">
- <property name="height_request">500</property>
+ <property name="can_focus">False</property>
<property name="modal">True</property>
<property name="window_position">center</property>
<property name="default_width">300</property>
<property name="default_height">600</property>
<property name="destroy_with_parent">True</property>
<property name="type_hint">dialog</property>
- <signal name="key-press-event" handler="gtk_search_bar_handle_event" object="search_bar" swapped="true"/>
- <child internal-child="headerbar">
+ <signal name="key-press-event" handler="hdy_search_bar_handle_event" object="search_bar" swapped="yes"/>
+ <child type="titlebar">
<object class="GtkHeaderBar">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="title" translatable="yes">Cookies</property>
- <property name="show-close-button">True</property>
+ <property name="show_close_button">True</property>
<child>
<object class="GtkButton">
- <property name="label" translatable="yes">C_lear All</property>
<property name="visible">True</property>
- <property name="use_underline">True</property>
- <property name="valign">center</property>
- <property name="action-name">cookies.forget-all</property>
- <accelerator key="Delete" modifiers="GDK_SHIFT_MASK" signal="clicked"/>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="action_name">cookies.forget-all</property>
+ <property name="image">image2</property>
+ <property name="always_show_image">True</property>
+ <property name="tooltip_text" translatable="yes">Remove all cookies</property>
+ <accelerator key="Delete" signal="clicked" modifiers="GDK_SHIFT_MASK"/>
<style>
<class name="destructive-action"/>
- <class name="text-button"/>
</style>
</object>
</child>
<child>
- <object class="GtkToggleButton" id="search_button">
+ <object class="GtkToggleButton">
+ <property name="name">search_button</property>
<property name="visible">True</property>
- <property name="valign">center</property>
- <accelerator key="F" modifiers="GDK_CONTROL_MASK" signal="clicked"/>
- <style>
- <class name="image-button"/>
- </style>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="image">image1</property>
+ <property name="always_show_image">True</property>
+ <property name="active" bind-source="search_bar" bind-property="search-mode-enabled" bind-flags="sync-create|bidirectional"/>
<child internal-child="accessible">
<object class="AtkObject">
<property name="AtkObject::accessible-name" translatable="yes">Search</property>
<property name="AtkObject::accessible-description" translatable="yes">Filter cookies</property>
</object>
</child>
- <child>
- <object class="GtkImage">
- <property name="visible">True</property>
- <property name="icon-name">edit-find-symbolic</property>
- <property name="icon-size">1</property>
- </object>
- </child>
+ <accelerator key="f" signal="clicked" modifiers="GDK_SHIFT_MASK"/>
</object>
<packing>
- <property name="pack-type">end</property>
+ <property name="pack_type">end</property>
+ <property name="position">1</property>
</packing>
</child>
</object>
</child>
<child internal-child="vbox">
<object class="GtkBox">
- <property name="border_width">0</property>
- <child>
- <object class="GtkSearchBar" id="search_bar">
- <property name="visible">True</property>
- <property name="search-mode-enabled" bind-source="search_button" bind-property="active" bind-flags="bidirectional|sync-create"/>
+ <property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
+ <child internal-child="action_area">
+ <object class="GtkButtonBox">
+ <property name="can_focus">False</property>
+ <property name="layout_style">end</property>
<child>
- <object class="GtkSearchEntry">
- <property name="visible">True</property>
- <property name="width-request">300</property> <!-- looks cool and same as passwords-dialog -->
- <property name="primary_icon_name">edit-find-symbolic</property>
- <property name="primary_icon_activatable">False</property>
- <property name="primary_icon_sensitive">False</property>
- <property name="placeholder_text" translatable="yes">Search cookies</property>
- <signal name="search-changed" handler="on_search_entry_changed"/>
- </object>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
</child>
</object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">2</property>
+ </packing>
</child>
<child>
- <object class="GtkScrolledWindow">
- <property name="width_request">400</property>
- <property name="height_request">300</property>
+ <object class="HdySearchBar" id="search_bar">
<property name="visible">True</property>
- <property name="expand">True</property>
- <property name="hscrollbar_policy">never</property>
- <property name="min_content_width">300</property>
- <property name="min_content_height">300</property>
- <child>
- <object class="GtkTreeView" id="cookies_treeview">
- <property name="visible">True</property>
- <property name="model">treemodelsort</property>
- <property name="enable_search">False</property>
- <property name="search_column">0</property>
- <child internal-child="selection">
- <object class="GtkTreeSelection" id="tree_selection">
- <property name="mode">multiple</property>
- <signal name="changed" handler="on_treeview_selection_changed"/>
- </object>
- </child>
- <child>
- <object class="GtkTreeViewColumn">
- <property name="sizing">autosize</property>
- <property name="title" translatable="yes">Site</property>
- <property name="clickable">True</property>
- <property name="reorderable">True</property>
- <property name="sort_column_id">0</property>
- <child>
- <object class="GtkCellRendererText"/>
- <attributes>
- <attribute name="text">0</attribute>
- </attributes>
- </child>
- </object>
- </child>
- </object>
- </child>
+ <property name="can_focus">False</property>
+ <property name="valign">start</property>
+ <property name="hexpand">True</property>
+ <property name="show_close_button">False</property>
+ <child>
+ <object class="HdyColumn">
+ <property name="visible">True</property>
+ <property name="hexpand">True</property>
+ <property name="maximum-width">600</property>
+ <child>
+ <object class="GtkSearchEntry" id="search_entry">
+ <property name="visible">True</property>
+ <property name="hexpand">True</property>
+ <signal name="changed" handler="on_search_entry_changed"/>
+ </object>
+ </child>
+ </object>
+ </child>
</object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
</child>
<child>
- <object class="GtkActionBar">
+ <object class="GtkScrolledWindow">
<property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="vexpand">True</property>
+ <property name="shadow_type">in</property>
<child>
- <object class="GtkButton">
+ <object class="GtkViewport">
<property name="visible">True</property>
- <property name="sensitive">False</property>
- <property name="tooltip_text" translatable="yes">Delete the selected cookies</property>
- <property name="action-name">cookies.forget</property>
- <accelerator key="Delete" signal="clicked"/>
- <accelerator key="KP_Delete" signal="clicked"/>
- <style>
- <class name="image-button"/>
- </style>
+ <property name="can_focus">False</property>
<child>
- <object class="GtkImage">
+ <object class="GtkListBox" id="cookies_listbox">
<property name="visible">True</property>
- <property name="icon_name">list-remove-symbolic</property>
- <property name="icon_size">1</property>
+ <property name="can_focus">False</property>
</object>
</child>
</object>
</child>
</object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
</child>
</object>
</child>