[epiphany/wip/bookmarks] bookmarks: Add possibility to remove a tag. Prettify tag widget



commit 6c8467b80e08d6ebae8cc9d9ee6a716976c8d07d
Author: Iulian Radu <iulian radu67 gmail com>
Date:   Thu Jul 28 22:09:31 2016 +0300

    bookmarks: Add possibility to remove a tag. Prettify tag widget

 src/ephy-bookmark-properties-grid.c |  120 +++++++++++++++++++++++++-----
 src/ephy-bookmark.c                 |   35 +++++++--
 src/ephy-bookmark.h                 |    3 +
 src/ephy-bookmarks-manager.c        |  141 ++++++++++++++++++++++++++++-------
 src/ephy-bookmarks-manager.h        |    7 ++
 src/resources/epiphany.css          |   95 ++++++++++++++++++++----
 src/resources/epiphany.scss         |   55 ++++++++++++--
 7 files changed, 381 insertions(+), 75 deletions(-)
---
diff --git a/src/ephy-bookmark-properties-grid.c b/src/ephy-bookmark-properties-grid.c
index f1c9fb2..c12ceda 100644
--- a/src/ephy-bookmark-properties-grid.c
+++ b/src/ephy-bookmark-properties-grid.c
@@ -56,6 +56,31 @@ enum {
 
 static GParamSpec *obj_properties[LAST_PROP];
 
+static int
+flow_box_sort_func (GtkFlowBoxChild *child1, GtkFlowBoxChild *child2)
+{
+  GtkWidget *box1;
+  GtkWidget *box2;
+  GtkWidget *label1;
+  GtkWidget *label2;
+  const char *tag1;
+  const char *tag2;
+
+  g_assert (GTK_IS_FLOW_BOX_CHILD (child1));
+  g_assert (GTK_IS_FLOW_BOX_CHILD (child2));
+
+  box1 = gtk_bin_get_child (GTK_BIN (child1));
+  box2 = gtk_bin_get_child (GTK_BIN (child2));
+
+  label1 = g_object_get_data (G_OBJECT (box1), "label");
+  label2 = g_object_get_data (G_OBJECT (box2), "label");
+
+  tag1 = gtk_label_get_text (GTK_LABEL (label1));
+  tag2 = gtk_label_get_text (GTK_LABEL (label2));
+
+  return ephy_bookmark_tags_compare (tag1, tag2);
+}
+
 static void
 ephy_bookmark_properties_grid_tags_box_child_activated_cb (EphyBookmarkPropertiesGrid *self,
                                                            GtkFlowBoxChild            *child,
@@ -84,6 +109,28 @@ ephy_bookmark_properties_grid_tags_box_child_activated_cb (EphyBookmarkPropertie
   }
 }
 
+static void
+ephy_bookmark_properties_grid_tag_widget_button_clicked_cb (EphyBookmarkPropertiesGrid *self,
+                                                            GtkButton                  *button)
+{
+  EphyBookmarksManager *manager = ephy_shell_get_bookmarks_manager (ephy_shell_get_default ());
+  GtkWidget *box;
+  GtkWidget *flow_box_child;
+  GtkLabel *label;
+
+  g_assert (EPHY_IS_BOOKMARK_PROPERTIES_GRID (self));
+  g_assert (GTK_IS_BUTTON (button));
+
+  box = gtk_widget_get_parent (GTK_WIDGET (button));
+  g_assert (GTK_IS_BOX (box));
+  label = g_object_get_data (G_OBJECT (box), "label");
+
+  ephy_bookmarks_manager_remove_tag (manager, gtk_label_get_text (label));
+
+  flow_box_child = gtk_widget_get_parent (box);
+  gtk_widget_destroy (flow_box_child);
+}
+
 static GtkWidget *
 ephy_bookmark_properties_grid_create_tag_widget (EphyBookmarkPropertiesGrid *self,
                                                  const char *tag,
@@ -107,7 +154,12 @@ ephy_bookmark_properties_grid_create_tag_widget (EphyBookmarkPropertiesGrid *sel
                         gtk_image_new_from_icon_name ("window-close-symbolic",
                                                       GTK_ICON_SIZE_MENU));
   gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
+  gtk_widget_set_can_focus (button, FALSE);
   gtk_box_pack_end (GTK_BOX (box), button, FALSE, FALSE, 0);
+  g_signal_connect_object (button, "clicked",
+                           G_CALLBACK (ephy_bookmark_properties_grid_tag_widget_button_clicked_cb),
+                           self,
+                           G_CONNECT_SWAPPED);
 
   g_object_set_data (G_OBJECT (box), "label", label);
 
@@ -131,6 +183,7 @@ static void
 ephy_bookmark_properties_grid_add_tag_button_clicked_cb (EphyBookmarkPropertiesGrid *self,
                                                          GtkButton                  *button)
 {
+  EphyBookmarksManager *manager = ephy_shell_get_bookmarks_manager (ephy_shell_get_default ());
   GtkEntryBuffer *buffer;
   GtkWidget *widget;
   const char *text;
@@ -140,10 +193,19 @@ ephy_bookmark_properties_grid_add_tag_button_clicked_cb (EphyBookmarkPropertiesG
 
   buffer = gtk_entry_get_buffer (GTK_ENTRY (self->add_tag_entry));
   text = gtk_entry_buffer_get_text (buffer);
+
+  /* Add tag to the list of all tags. */
+  ephy_bookmarks_manager_add_tag (manager, text);
+
+  /* Add tag to the bookmark's list of tags. */
   ephy_bookmark_add_tag (self->bookmark, text);
 
+  /* Create a new widget for the new tag */
   widget = ephy_bookmark_properties_grid_create_tag_widget (self, text, TRUE);
   gtk_flow_box_insert (GTK_FLOW_BOX (self->tags_box), widget, -1);
+
+  gtk_entry_set_text (GTK_ENTRY (self->add_tag_entry), "");
+  gtk_widget_set_sensitive (GTK_WIDGET (button), FALSE);
 }
 
 static void
@@ -155,7 +217,6 @@ ephy_bookmark_properties_grid_remove_bookmark_button_clicked_cb (EphyBookmarkPro
 
   g_signal_emit_by_name (self->bookmark, "removed");
 
-  gtk_widget_hide (gtk_widget_get_parent (gtk_widget_get_parent (GTK_WIDGET (self))));
   gtk_widget_destroy (gtk_widget_get_parent (gtk_widget_get_parent (GTK_WIDGET (self))));
 }
 
@@ -164,18 +225,17 @@ ephy_bookmark_properties_grid_buffer_text_changed_cb (EphyBookmarkPropertiesGrid
                                                       GParamSpec                 *pspec,
                                                       GtkEntryBuffer             *buffer)
 {
+  EphyBookmarksManager *manager = ephy_shell_get_bookmarks_manager (ephy_shell_get_default ());
   const char *text;
 
   g_assert (EPHY_IS_BOOKMARK_PROPERTIES_GRID (self));
   g_assert (GTK_IS_ENTRY_BUFFER (buffer));
 
   text = gtk_entry_buffer_get_text (buffer);
-  /* TODO: Check if the tag already exists. Before doing this check, come up
-   * with a better way of storing a list of all existing tags. The current way
-   * of iterating over all bookmarks and doing a reunion of their tags is
-   * really slow */
-  if (strlen (text) >= 3)
+  if (strlen (text) >= 3 && !ephy_bookmarks_manager_tag_exists (manager, text))
     gtk_widget_set_sensitive (self->add_tag_button, TRUE);
+  else
+    gtk_widget_set_sensitive (self->add_tag_button, FALSE);
 }
 
 static void
@@ -198,6 +258,28 @@ ephy_bookmark_properties_grid_set_property (GObject      *object,
   }
 }
 
+static char*
+get_address (const char *url)
+{
+  SoupURI *uri;
+  char *address;
+  int len;
+
+  uri = soup_uri_new (url);
+  address = g_strconcat (soup_uri_get_host (uri),
+                         soup_uri_get_path (uri),
+                         soup_uri_get_query (uri),
+                         soup_uri_get_fragment (uri),
+                         NULL);
+  soup_uri_free (uri);
+
+  len = strlen (address);
+  if (address[len - 1] == '/')
+    address[len - 1] = '\0';
+
+  return address;
+}
+
 static void
 ephy_bookmark_properties_grid_constructed (GObject *object)
 {
@@ -206,26 +288,21 @@ ephy_bookmark_properties_grid_constructed (GObject *object)
   GSequence *tags;
   GSequence *bookmark_tags;
   GSequenceIter *iter;
-  SoupURI *uri;
+  char *address;
 
   /* Set text for name entry */
   gtk_entry_set_text (GTK_ENTRY (self->name_entry),
                       ephy_bookmark_get_title (self->bookmark));
 
   /* Set text for address entry */
-  uri = soup_uri_new (ephy_bookmark_get_url (self->bookmark));
-  gtk_entry_set_text (GTK_ENTRY (self->address_entry),
-                      g_strconcat (soup_uri_get_host (uri),
-                                   soup_uri_get_path (uri),
-                                   soup_uri_get_query (uri),
-                                   soup_uri_get_fragment (uri),
-                                   NULL));
-  soup_uri_free (uri);
+  address = get_address (ephy_bookmark_get_url (self->bookmark));
+  gtk_entry_set_text (GTK_ENTRY (self->address_entry), address);
+  g_free (address);
 
   /* Create tag widgets */
   tags = ephy_bookmarks_manager_get_tags (manager);
   bookmark_tags = ephy_bookmark_get_tags (self->bookmark);
-  g_sequence_sort (bookmark_tags, (GCompareDataFunc)g_strcmp0, NULL);
+  g_sequence_sort (bookmark_tags, (GCompareDataFunc)ephy_bookmark_tags_compare, NULL);
   for (iter = g_sequence_get_begin_iter (tags);
        !g_sequence_iter_is_end (iter);
        iter = g_sequence_iter_next (iter)) {
@@ -233,7 +310,10 @@ ephy_bookmark_properties_grid_constructed (GObject *object)
     gboolean selected = FALSE;
     const char *tag = g_sequence_get (iter);
 
-    if (g_sequence_lookup (bookmark_tags, (gpointer)tag, (GCompareDataFunc)g_strcmp0, NULL))
+    if (g_sequence_lookup (bookmark_tags,
+                           (gpointer)tag,
+                           (GCompareDataFunc)ephy_bookmark_tags_compare,
+                           NULL))
       selected = TRUE;
 
     widget = ephy_bookmark_properties_grid_create_tag_widget (self, tag, selected);
@@ -245,8 +325,6 @@ ephy_bookmark_properties_grid_constructed (GObject *object)
                            self,
                            G_CONNECT_SWAPPED);
   gtk_widget_show_all (self->tags_box);
-
-  /* Connect */
 }
 
 static void
@@ -298,6 +376,10 @@ ephy_bookmark_properties_grid_init (EphyBookmarkPropertiesGrid *self)
     gtk_grid_remove_column (GTK_GRID (self), 0);
   }
 
+  gtk_flow_box_set_sort_func (GTK_FLOW_BOX (self->tags_box),
+                              (GtkFlowBoxSortFunc)flow_box_sort_func,
+                              NULL, NULL);
+
   g_signal_connect_object (gtk_entry_get_buffer (GTK_ENTRY (self->add_tag_entry)),
                            "notify::text",
                            G_CALLBACK (ephy_bookmark_properties_grid_buffer_text_changed_cb),
diff --git a/src/ephy-bookmark.c b/src/ephy-bookmark.c
index 3cf08b4..194111e 100644
--- a/src/ephy-bookmark.c
+++ b/src/ephy-bookmark.c
@@ -168,14 +168,16 @@ ephy_bookmark_add_tag (EphyBookmark *self,
   GSequenceIter *prev_tag_iter;
 
   g_return_if_fail (EPHY_IS_BOOKMARK (self));
+  g_return_if_fail (tag != NULL);
 
   tag_iter = g_sequence_search (self->tags,
                                 (gpointer)tag,
-                                (GCompareDataFunc)g_strcmp0,
+                                (GCompareDataFunc)ephy_bookmark_tags_compare,
                                 NULL);
 
   prev_tag_iter = g_sequence_iter_prev (tag_iter);
-  if (g_strcmp0 (g_sequence_get (prev_tag_iter), tag) != 0)
+  if (g_sequence_iter_is_end (prev_tag_iter)
+      || g_strcmp0 (g_sequence_get (prev_tag_iter), tag) != 0)
     g_sequence_insert_before (tag_iter, g_strdup (tag));
 }
 
@@ -186,15 +188,15 @@ ephy_bookmark_remove_tag (EphyBookmark *self,
   GSequenceIter *tag_iter;
 
   g_return_if_fail (EPHY_IS_BOOKMARK (self));
+  g_return_if_fail (tag != NULL);
 
   tag_iter = g_sequence_lookup (self->tags,
                                 (gpointer)tag,
-                                (GCompareDataFunc)g_strcmp0,
+                                (GCompareDataFunc)ephy_bookmark_tags_compare,
                                 NULL);
 
-  g_assert (tag_iter != NULL);
-
-  g_sequence_remove (tag_iter);
+  if (tag_iter)
+    g_sequence_remove (tag_iter);
 }
 
 void
@@ -213,3 +215,24 @@ ephy_bookmark_get_tags (EphyBookmark *self)
 
   return self->tags;
 }
+
+int
+ephy_bookmark_tags_compare (const char *tag1, const char *tag2)
+{
+  int result;
+
+  g_assert (tag1 != NULL);
+  g_assert (tag2 != NULL);
+
+  result = g_strcmp0 (tag1, tag2);
+
+  if (result == 0)
+    return 0;
+
+  if (g_strcmp0 (tag1, "Favorites") == 0)
+    return -1;
+  if (g_strcmp0 (tag2, "Favorites") == 0)
+    return 1;
+
+  return result;
+}
diff --git a/src/ephy-bookmark.h b/src/ephy-bookmark.h
index e752f58..9ae8571 100644
--- a/src/ephy-bookmark.h
+++ b/src/ephy-bookmark.h
@@ -39,6 +39,9 @@ void                 ephy_bookmark_set_tags     (EphyBookmark *self,
                                                  GSequence    *tags);
 GSequence           *ephy_bookmark_get_tags     (EphyBookmark *self);
 
+int                  ephy_bookmark_tags_compare (const char *tag1,
+                                                 const char *tag2);
+
 G_END_DECLS
 
 #endif /* _EPHY_BOOKMARK_H */
diff --git a/src/ephy-bookmarks-manager.c b/src/ephy-bookmarks-manager.c
index 6b86c02..7bb4945 100644
--- a/src/ephy-bookmarks-manager.c
+++ b/src/ephy-bookmarks-manager.c
@@ -29,6 +29,7 @@ struct _EphyBookmarksManager {
   GObject     parent_instance;
 
   GList      *bookmarks;
+  GSequence  *tags;
 
   gchar      *gvdb_filename;
 };
@@ -70,8 +71,26 @@ build_variant (EphyBookmark *bookmark)
 }
 
 static void
+ephy_bookmarks_manager_finalize (GObject *object)
+{
+  EphyBookmarksManager *self = EPHY_BOOKMARKS_MANAGER (object);
+
+  if (self->bookmarks != NULL) {
+    g_list_free_full (self->bookmarks, g_object_unref);
+    self->bookmarks = NULL;
+  }
+
+  g_clear_pointer (&self->tags, g_sequence_free);
+
+  G_OBJECT_CLASS (ephy_bookmarks_manager_parent_class)->finalize (object);
+}
+
+static void
 ephy_bookmarks_manager_class_init (EphyBookmarksManagerClass *klass)
 {
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+  object_class->finalize = ephy_bookmarks_manager_finalize;
 }
 
 static void
@@ -81,6 +100,8 @@ ephy_bookmarks_manager_init (EphyBookmarksManager *self)
                                           EPHY_BOOKMARKS_FILE,
                                           NULL);
 
+  self->tags = g_sequence_new (g_free);
+
   ephy_bookmarks_manager_load_from_file (self);
 }
 
@@ -155,6 +176,64 @@ ephy_bookmarks_manager_remove_bookmark (EphyBookmarksManager *self,
   g_list_model_items_changed (G_LIST_MODEL (self), position, 1, 0);
 }
 
+void
+ephy_bookmarks_manager_add_tag (EphyBookmarksManager *self, const char *tag)
+{
+  GSequenceIter *tag_iter;
+  GSequenceIter *prev_tag_iter;
+
+  g_return_if_fail (EPHY_IS_BOOKMARKS_MANAGER (self));
+  g_return_if_fail (tag != NULL);
+
+  tag_iter = g_sequence_search (self->tags,
+                                (gpointer)tag,
+                                (GCompareDataFunc)ephy_bookmark_tags_compare,
+                                NULL);
+
+  prev_tag_iter = g_sequence_iter_prev (tag_iter);
+  if (g_sequence_iter_is_end (prev_tag_iter)
+      || g_strcmp0 (g_sequence_get (prev_tag_iter), tag) != 0)
+    g_sequence_insert_before (tag_iter, g_strdup (tag));
+}
+
+void
+ephy_bookmarks_manager_remove_tag (EphyBookmarksManager *self, const char *tag)
+{
+  GSequenceIter *iter = NULL;
+  GList *l;
+
+  g_return_if_fail (EPHY_IS_BOOKMARKS_MANAGER (self));
+  g_return_if_fail (tag != NULL);
+
+  iter = g_sequence_lookup (self->tags,
+                            (gpointer)tag,
+                            (GCompareDataFunc)ephy_bookmark_tags_compare,
+                            NULL);
+  g_assert (iter != NULL);
+
+  g_sequence_remove (iter);
+
+  /* Also remove the tag from each bookmark if they have it */
+  for (l = self->bookmarks; l != NULL; l = l->next)
+    ephy_bookmark_remove_tag (l->data, tag);
+}
+
+gboolean
+ephy_bookmarks_manager_tag_exists (EphyBookmarksManager *self, const char *tag)
+{
+  GSequenceIter *iter;
+
+  g_return_val_if_fail (EPHY_IS_BOOKMARKS_MANAGER (self), FALSE);
+  g_return_val_if_fail (tag != NULL, FALSE);
+
+  iter = g_sequence_lookup (self->tags,
+                            (gpointer)tag,
+                            (GCompareDataFunc)ephy_bookmark_tags_compare,
+                            NULL);
+
+  return iter != NULL;
+}
+
 GList *
 ephy_bookmarks_manager_get_bookmarks (EphyBookmarksManager *self)
 {
@@ -166,63 +245,58 @@ ephy_bookmarks_manager_get_bookmarks (EphyBookmarksManager *self)
 GSequence *
 ephy_bookmarks_manager_get_tags (EphyBookmarksManager *self)
 {
-  GList *l;
-  GSequence *tags;
-
   g_return_val_if_fail (EPHY_IS_BOOKMARKS_MANAGER (self), NULL);
 
-  tags = g_sequence_new (g_free);
-  for (l = self->bookmarks; l != NULL; l = l->next) {
-    EphyBookmark *bookmark = EPHY_BOOKMARK (l->data);
-    GSequence *bookmark_tags;
-    GSequenceIter *iter;
-
-    bookmark_tags = ephy_bookmark_get_tags (bookmark);
-    for (iter = g_sequence_get_begin_iter (bookmark_tags);
-         !g_sequence_iter_is_end (iter);
-         iter = g_sequence_iter_next (iter)) {
-      char *tag = g_sequence_get (iter);
-
-      if (g_sequence_lookup (tags, tag, (GCompareDataFunc)g_strcmp0, NULL) == NULL)
-        g_sequence_insert_sorted (tags,
-                                  g_strdup (tag),
-                                  (GCompareDataFunc)g_strcmp0,
-                                  NULL);
-    }
-  }
+  return self->tags;
+}
 
-  return tags;
+static void
+add_tag_to_table (const char *tag, GHashTable *table)
+{
+  gvdb_hash_table_insert (table, tag);
 }
 
 void
 ephy_bookmarks_manager_save_to_file (EphyBookmarksManager *self)
 {
+  GHashTable *root_table;
   GHashTable *table;
   GList *l;
 
-  table = gvdb_hash_table_new (NULL, "bookmarks");
+  root_table = gvdb_hash_table_new (NULL, NULL);
 
+  table = gvdb_hash_table_new (root_table, "bookmarks");
   for (l = self->bookmarks; l != NULL; l = l->next) {
     gvdb_hash_table_insert_variant (table,
                                     ephy_bookmark_get_url (l->data),
                                     build_variant (l->data));
   }
+  g_hash_table_unref (table);
 
-  gvdb_table_write_contents (table, self->gvdb_filename, FALSE, NULL);
-
+  table = gvdb_hash_table_new (root_table, "tags");
+  g_sequence_foreach (self->tags, (GFunc)add_tag_to_table, table);
   g_hash_table_unref (table);
+
+  gvdb_table_write_contents (root_table, self->gvdb_filename, FALSE, NULL);
+  g_hash_table_unref (root_table);
 }
 
 void
 ephy_bookmarks_manager_load_from_file (EphyBookmarksManager *self)
 {
+  GvdbTable *root_table;
   GvdbTable *table;
   char **list;
   int length;
   int i;
 
   /* Create a new table to hold data stored in file. */
-  table = gvdb_table_new (self->gvdb_filename, TRUE, NULL);
+  root_table = gvdb_table_new (self->gvdb_filename, TRUE, NULL);
+  g_assert (root_table);
+
+  /* Get bookmarks table */
+  table = gvdb_table_get_table (root_table, "bookmarks");
+  g_assert (table);
 
   /* Iterate over all keys (url's) in the table. */
   list = gvdb_table_get_names (table, &length);
@@ -246,7 +320,7 @@ ephy_bookmarks_manager_load_from_file (EphyBookmarksManager *self)
     tags = g_sequence_new (g_free);
     while (g_variant_iter_next (&iter, "s", &tag)) {
       g_sequence_insert_sorted (tags, tag,
-                                (GCompareDataFunc)g_strcmp0,
+                                (GCompareDataFunc)ephy_bookmark_tags_compare,
                                 NULL);
     }
 
@@ -255,6 +329,17 @@ ephy_bookmarks_manager_load_from_file (EphyBookmarksManager *self)
     ephy_bookmark_set_tags (bookmark, tags);
     ephy_bookmarks_manager_add_bookmark (self, bookmark);
   }
+  gvdb_table_free (table);
+
+  /* Also add tags to the bookmark manager's sequence. */
+  table = gvdb_table_get_table (root_table, "tags");
+  g_assert (table);
+
+  /* Iterate over all keys (url's) in the table. */
+  list = gvdb_table_get_names (table, &length);
+  for (i = 0; i < length; i++)
+    ephy_bookmarks_manager_add_tag (self, list[i]);
 
   gvdb_table_free (table);
+  gvdb_table_free (root_table);
 }
diff --git a/src/ephy-bookmarks-manager.h b/src/ephy-bookmarks-manager.h
index 814a2e6..a16589a 100644
--- a/src/ephy-bookmarks-manager.h
+++ b/src/ephy-bookmarks-manager.h
@@ -31,6 +31,13 @@ void         ephy_bookmarks_manager_add_bookmark         (EphyBookmarksManager *
 void         ephy_bookmarks_manager_remove_bookmark      (EphyBookmarksManager *self,
                                                           EphyBookmark         *bookmark);
 
+void         ephy_bookmarks_manager_add_tag              (EphyBookmarksManager *self,
+                                                          const char           *tag);
+void         ephy_bookmarks_manager_remove_tag           (EphyBookmarksManager *self,
+                                                          const char           *tag);
+gboolean     ephy_bookmarks_manager_tag_exists           (EphyBookmarksManager *self,
+                                                          const char           *tag);
+
 GList       *ephy_bookmarks_manager_get_bookmarks        (EphyBookmarksManager *self);
 GSequence   *ephy_bookmarks_manager_get_tags             (EphyBookmarksManager *self);
 
diff --git a/src/resources/epiphany.css b/src/resources/epiphany.css
index 301aed0..75f8dd1 100644
--- a/src/resources/epiphany.css
+++ b/src/resources/epiphany.css
@@ -135,25 +135,90 @@ button.active-menu {
 .bookmark-tag-widget {
   padding-left: 8px;
   padding-right: 8px;
-  background-color: #d7d7d5; }
+  background-color: #cfcfcd; }
   .bookmark-tag-widget label {
     padding-left: 8px;
     padding-right: 8px; }
   .bookmark-tag-widget button {
-    color: white; }
+    background: none;
+    border: none;
+    box-shadow: none; }
+    .bookmark-tag-widget button:last-child image {
+      color: #454f52; }
+    .bookmark-tag-widget button:last-child:hover image {
+      border: 1px solid;
+      border-radius: 3px;
+      color: #454f52;
+      outline-color: rgba(69, 79, 82, 0.3);
+      border-color: #b6b6b3;
+      border-bottom-color: #91918c;
+      background-image: linear-gradient(to bottom, #e8e8e7, #dededd 60%, #cfcfcd);
+      text-shadow: 0 1px rgba(255, 255, 255, 0.76923);
+      -gtk-icon-shadow: 0 1px rgba(255, 255, 255, 0.76923);
+      box-shadow: inset 0 1px rgba(255, 255, 255, 0.8);
+      color: #454f52;
+      outline-color: rgba(69, 79, 82, 0.3);
+      border-color: #b6b6b3;
+      border-bottom-color: #91918c;
+      background-image: linear-gradient(to bottom, #f7f7f7, #e8e8e7 60%, #dededd);
+      text-shadow: 0 1px rgba(255, 255, 255, 0.76923);
+      -gtk-icon-shadow: 0 1px rgba(255, 255, 255, 0.76923);
+      box-shadow: inset 0 1px white; }
+    .bookmark-tag-widget button:last-child:active image {
+      color: #454f52;
+      outline-color: rgba(69, 79, 82, 0.3);
+      border-color: #b6b6b3;
+      border-bottom-color: #91918c;
+      background-image: linear-gradient(to bottom, #e8e8e7, #dededd 60%, #cfcfcd);
+      text-shadow: 0 1px rgba(255, 255, 255, 0.76923);
+      -gtk-icon-shadow: 0 1px rgba(255, 255, 255, 0.76923);
+      box-shadow: inset 0 1px rgba(255, 255, 255, 0.8);
+      color: #454f52;
+      outline-color: rgba(69, 79, 82, 0.3);
+      border-color: #b6b6b3;
+      background-image: none;
+      background-color: #d9d9d7;
+      box-shadow: inset 0 1px rgba(255, 255, 255, 0);
+      text-shadow: none;
+      -gtk-icon-shadow: none; }
 
 .bookmark-tag-widget-selected {
-  background-color: #4a90d9;
-  color: white; }
-  .bookmark-tag-widget-selected button {
+  background-color: #4a90d9; }
+  .bookmark-tag-widget-selected label {
     color: white; }
-    .bookmark-tag-widget-selected button:hover {
-      color: #2e3436;
-      outline-color: rgba(46, 52, 54, 0.3);
-      border-color: #215d9c;
-      border-bottom-color: #184472;
-      background-image: linear-gradient(to bottom, #63a0de, #4a90d9 60%, #3986d5);
-      text-shadow: 0 1px rgba(255, 255, 255, 0.76923);
-      -gtk-icon-shadow: 0 1px rgba(255, 255, 255, 0.76923);
-      box-shadow: inset 0 1px rgba(255, 255, 255, 0.4);
-      color: white; }
+  .bookmark-tag-widget-selected button:last-child image {
+    color: white; }
+  .bookmark-tag-widget-selected button:last-child:hover image {
+    color: white;
+    outline-color: rgba(255, 255, 255, 0.3);
+    border-color: #215d9c;
+    border-bottom-color: #184472;
+    background-image: linear-gradient(to bottom, #4a90d9, #3986d5 60%, #2a76c6);
+    text-shadow: 0 -1px rgba(0, 0, 0, 0.54353);
+    -gtk-icon-shadow: 0 -1px rgba(0, 0, 0, 0.54353);
+    box-shadow: inset 0 1px rgba(255, 255, 255, 0.4);
+    color: white;
+    outline-color: rgba(255, 255, 255, 0.3);
+    border-color: #215d9c;
+    border-bottom-color: #184472;
+    background-image: linear-gradient(to bottom, #63a0de, #4a90d9 60%, #3986d5);
+    text-shadow: 0 -1px rgba(0, 0, 0, 0.49553);
+    -gtk-icon-shadow: 0 -1px rgba(0, 0, 0, 0.49553);
+    box-shadow: inset 0 1px rgba(255, 255, 255, 0.4); }
+  .bookmark-tag-widget-selected button:last-child:active image {
+    color: white;
+    outline-color: rgba(255, 255, 255, 0.3);
+    border-color: #215d9c;
+    border-bottom-color: #184472;
+    background-image: linear-gradient(to bottom, #4a90d9, #3986d5 60%, #2a76c6);
+    text-shadow: 0 -1px rgba(0, 0, 0, 0.54353);
+    -gtk-icon-shadow: 0 -1px rgba(0, 0, 0, 0.54353);
+    box-shadow: inset 0 1px rgba(255, 255, 255, 0.4);
+    color: white;
+    outline-color: rgba(255, 255, 255, 0.3);
+    border-color: #215d9c;
+    background-image: none;
+    background-color: #3180d4;
+    box-shadow: inset 0 1px rgba(255, 255, 255, 0);
+    text-shadow: none;
+    -gtk-icon-shadow: none; }
diff --git a/src/resources/epiphany.scss b/src/resources/epiphany.scss
index 35f481d..2564833 100644
--- a/src/resources/epiphany.scss
+++ b/src/resources/epiphany.scss
@@ -124,10 +124,11 @@ $edge_color: lighten($incognito_color, 13%);
   }
 }
 
+$close_button_fg_color: lighten($fg_color, 10%);
 .bookmark-tag-widget {
   padding-left: 8px;
   padding-right: 8px;
-  background-color: darken($bg_color, 7%);
+  background-color: darken($bg_color, 10%);
 
   label {
     padding-left: 8px;
@@ -135,20 +136,60 @@ $edge_color: lighten($incognito_color, 13%);
   }
 
   button {
-    color: white;
+    background: none;
+    border: none;
+    box-shadow: none;
+
+    &:last-child {
+      image {
+        color: $close_button_fg_color;
+      }
+
+      &:hover {
+        image {
+          border: 1px solid;
+          border-radius: 3px;
+          @include button(normal, $bg_color, $close_button_fg_color);
+          @include button(hover, $bg_color, $close_button_fg_color);
+        }
+      }
+
+      &:active {
+        image {
+          @include button(normal, $bg_color, $close_button_fg_color);
+          @include button(active, $bg_color, $close_button_fg_color);
+        }
+      }
+    }
   }
 }
 
 .bookmark-tag-widget-selected {
   background-color: $selected_bg_color;
-  color: white;
 
-  button {
+  label {
     color: white;
+  }
+
+  button {
+    &:last-child {
+      image {
+        color: white;
+      }
 
-    &:hover {
-      @include button(hover, $selected_bg_color);
-      color: white;
+      &:hover {
+        image {
+          @include button(normal, $selected_bg_color, white);
+          @include button(hover, $selected_bg_color, white);
+        }
+      }
+
+      &:active {
+        image {
+          @include button(normal, $selected_bg_color, white);
+          @include button(active, $selected_bg_color, white);
+        }
+      }
     }
   }
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]