[epiphany/wip/exalm/count: 122/122] Show number of open pages on Pages button



commit 8997adcca8abd78c8b719edacaf64fe0bdf97f76
Author: Alexander Mikhaylenko <exalm7659 gmail com>
Date:   Thu May 9 03:06:19 2019 +0500

    Show number of open pages on Pages button
    
    Introduce EphyPagesButton which allows to show an arbitrary number on top
    of a square icon. When the number is more than 100, show an infinity symbol
    instead.
    
    Forcibly set the label scale to prevent it from changing along with
    'gtk-xft-dpi' GtkSettings property.
    
    Use EphyPagesButton instead of the current pages button, and sync the shown
    number with the number of open tabs.
    
    Partially based on https://gitlab.gnome.org/GNOME/epiphany/merge_requests/279
    
    Icons by Tobias Bernard.

 src/ephy-action-bar.c                        |  25 +++-
 src/ephy-pages-button.c                      | 205 +++++++++++++++++++++++++++
 src/ephy-pages-button.h                      |  38 +++++
 src/meson.build                              |   1 +
 src/resources/ephy-tab-counter-symbolic.svg  |  69 +++++++++
 src/resources/ephy-tab-overflow-symbolic.svg |  41 ++++++
 src/resources/epiphany.gresource.xml         |   3 +
 src/resources/gtk/action-bar.ui              |  15 +-
 src/resources/gtk/pages-button.ui            |  32 +++++
 9 files changed, 417 insertions(+), 12 deletions(-)
---
diff --git a/src/ephy-action-bar.c b/src/ephy-action-bar.c
index fd4248380..c4b901a96 100644
--- a/src/ephy-action-bar.c
+++ b/src/ephy-action-bar.c
@@ -20,6 +20,7 @@
  */
 
 #include "ephy-action-bar.h"
+#include "ephy-pages-button.h"
 #include "ephy-pages-popover.h"
 #include "ephy-settings.h"
 #include "ephy-shell.h"
@@ -38,7 +39,8 @@ struct _EphyActionBar {
   EphyWindow *window;
   EphyActionBarStart *action_bar_start;
   EphyActionBarEnd *action_bar_end;
-  GtkMenuButton *pages_button;
+  EphyPagesButton *pages_button;
+  GtkNotebook *notebook;
 };
 
 G_DEFINE_TYPE (EphyActionBar, ephy_action_bar, GTK_TYPE_REVEALER)
@@ -56,6 +58,15 @@ sync_chromes_visibility (EphyActionBar *action_bar)
                                                  chrome & EPHY_WINDOW_CHROME_BOOKMARKS);
 }
 
+static void
+update_pages_button (EphyActionBar *action_bar)
+{
+  int n_pages;
+
+  n_pages = gtk_notebook_get_n_pages (action_bar->notebook);
+  ephy_pages_button_set_n_pages (action_bar->pages_button, n_pages);
+}
+
 static void
 ephy_action_bar_set_property (GObject      *object,
                               guint         property_id,
@@ -96,9 +107,20 @@ ephy_action_bar_constructed (GObject *object)
 {
   EphyActionBar *action_bar = EPHY_ACTION_BAR (object);
 
+  G_OBJECT_CLASS (ephy_action_bar_parent_class)->constructed (object);
+
+  action_bar->notebook = GTK_NOTEBOOK (ephy_window_get_notebook (action_bar->window));
+  update_pages_button (action_bar);
+
   g_signal_connect_object (action_bar->window, "notify::chrome",
                            G_CALLBACK (sync_chromes_visibility), action_bar,
                            G_CONNECT_SWAPPED);
+  g_signal_connect_object (action_bar->notebook, "page-added",
+                           G_CALLBACK (update_pages_button), action_bar,
+                           G_CONNECT_SWAPPED);
+  g_signal_connect_object (action_bar->notebook, "page-removed",
+                           G_CALLBACK (update_pages_button), action_bar,
+                           G_CONNECT_SWAPPED);
 }
 
 static void
@@ -144,6 +166,7 @@ ephy_action_bar_init (EphyActionBar *action_bar)
   /* Ensure the types used by the template have been initialized. */
   EPHY_TYPE_ACTION_BAR_END;
   EPHY_TYPE_ACTION_BAR_START;
+  EPHY_TYPE_PAGES_BUTTON;
 
   gtk_widget_init_template (GTK_WIDGET (action_bar));
 
diff --git a/src/ephy-pages-button.c b/src/ephy-pages-button.c
new file mode 100644
index 000000000..536f5e94c
--- /dev/null
+++ b/src/ephy-pages-button.c
@@ -0,0 +1,205 @@
+/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/*
+ *  Copyright © 2019 Alexander Mikhaylenko <exalm7659 gmail com>
+ *
+ *  This file is part of Epiphany.
+ *
+ *  Epiphany is free software: you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation, either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  Epiphany is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with Epiphany.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "ephy-pages-button.h"
+
+/* Copied from GtkInspector code */
+#define XFT_DPI_MULTIPLIER (96.0 * PANGO_SCALE)
+#define FONT_SIZE_LARGE 8
+#define FONT_SIZE_SMALL 6
+
+struct _EphyPagesButton {
+  GtkButton parent_instance;
+
+  GtkLabel *pages_label;
+  GtkImage *pages_icon;
+
+  int n_pages;
+};
+
+G_DEFINE_TYPE (EphyPagesButton, ephy_pages_button, GTK_TYPE_BUTTON)
+
+enum {
+  PROP_0,
+  PROP_N_PAGES,
+  N_PROPS
+};
+
+static GParamSpec *properties [N_PROPS];
+
+/* FIXME: I hope there is a better way to prevent the label from changing scale */
+static void
+update_label_scale (EphyPagesButton *self,
+                    GtkSettings     *settings)
+{
+  int xft_dpi;
+  PangoAttrList *attrs;
+  PangoAttribute *scale_attribute;
+
+  g_object_get (settings, "gtk-xft-dpi", &xft_dpi, NULL);
+
+  attrs = gtk_label_get_attributes (self->pages_label);
+  scale_attribute = pango_attr_scale_new (XFT_DPI_MULTIPLIER / xft_dpi);
+
+  pango_attr_list_change (attrs, scale_attribute);
+}
+
+static void
+xft_dpi_changed (GtkSettings     *settings,
+                 GParamSpec      *spec,
+                 EphyPagesButton *self)
+{
+  update_label_scale (self, settings);
+}
+
+static void
+update_icon (EphyPagesButton *self)
+{
+  gboolean is_overflow;
+  double font_size;
+  const char *icon_name;
+  g_autofree char *label_text;
+  PangoAttrList *attrs;
+  PangoAttribute *size_attribute;
+
+  is_overflow = self->n_pages >= 100;
+  font_size = self->n_pages >= 10 ? FONT_SIZE_SMALL : FONT_SIZE_LARGE;
+  icon_name = is_overflow ? "ephy-tab-overflow-symbolic" : "ephy-tab-counter-symbolic";
+  label_text = g_strdup_printf ("%u", self->n_pages);
+
+  attrs = gtk_label_get_attributes (self->pages_label);
+  size_attribute = pango_attr_size_new (font_size * PANGO_SCALE);
+  pango_attr_list_change (attrs, size_attribute);
+
+  gtk_widget_set_visible (GTK_WIDGET (self->pages_label), !is_overflow);
+  gtk_label_set_text (self->pages_label, label_text);
+  gtk_image_set_from_icon_name (self->pages_icon, icon_name, GTK_ICON_SIZE_BUTTON);
+}
+
+EphyPagesButton *
+ephy_pages_button_new (void)
+{
+  return g_object_new (EPHY_TYPE_PAGES_BUTTON, NULL);
+}
+
+int
+ephy_pages_button_get_n_pages (EphyPagesButton *self)
+{
+  g_return_val_if_fail (EPHY_IS_PAGES_BUTTON (self), 0);
+
+  return self->n_pages;
+}
+
+void
+ephy_pages_button_set_n_pages (EphyPagesButton *self,
+                               int              n_pages)
+{
+  g_return_if_fail (EPHY_IS_PAGES_BUTTON (self));
+
+  self->n_pages = n_pages;
+
+  update_icon (self);
+}
+
+static void
+ephy_pages_button_get_property (GObject    *object,
+                                guint       prop_id,
+                                GValue     *value,
+                                GParamSpec *pspec)
+{
+  EphyPagesButton *self = EPHY_PAGES_BUTTON (object);
+
+  switch (prop_id) {
+    case PROP_N_PAGES:
+      g_value_set_int (value, ephy_pages_button_get_n_pages (self));
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+  }
+}
+
+static void
+ephy_pages_button_set_property (GObject      *object,
+                                guint         prop_id,
+                                const GValue *value,
+                                GParamSpec   *pspec)
+{
+  EphyPagesButton *self = EPHY_PAGES_BUTTON (object);
+
+  switch (prop_id) {
+    case PROP_N_PAGES:
+      ephy_pages_button_set_n_pages (self, g_value_get_int (value));
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+  }
+}
+
+static void
+ephy_pages_button_constructed (GObject *object)
+{
+  EphyPagesButton *self = EPHY_PAGES_BUTTON (object);
+  GtkSettings *settings;
+
+  G_OBJECT_CLASS (ephy_pages_button_parent_class)->constructed (object);
+
+  update_icon (self);
+
+  settings = gtk_settings_get_default ();
+  update_label_scale (self, settings);
+  g_signal_connect_object (settings, "notify::gtk-xft-dpi",
+                           G_CALLBACK (xft_dpi_changed), self, 0);
+}
+
+static void
+ephy_pages_button_class_init (EphyPagesButtonClass *klass)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+  GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+
+  object_class->get_property = ephy_pages_button_get_property;
+  object_class->set_property = ephy_pages_button_set_property;
+  object_class->constructed = ephy_pages_button_constructed;
+
+  properties [PROP_N_PAGES] =
+    g_param_spec_int ("n-pages",
+                      "Number of pages",
+                      "The number of pages displayed on the button",
+                      0,
+                      G_MAXINT,
+                      1,
+                      (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+  g_object_class_install_properties (object_class, N_PROPS, properties);
+
+  gtk_widget_class_set_template_from_resource (widget_class,
+                                               "/org/gnome/epiphany/gtk/pages-button.ui");
+
+  gtk_widget_class_bind_template_child (widget_class, EphyPagesButton, pages_label);
+  gtk_widget_class_bind_template_child (widget_class, EphyPagesButton, pages_icon);
+}
+
+static void
+ephy_pages_button_init (EphyPagesButton *self)
+{
+  self->n_pages = 1;
+
+  gtk_widget_init_template (GTK_WIDGET (self));
+}
diff --git a/src/ephy-pages-button.h b/src/ephy-pages-button.h
new file mode 100644
index 000000000..f7addb5c3
--- /dev/null
+++ b/src/ephy-pages-button.h
@@ -0,0 +1,38 @@
+/* -*- Mode: C; tab-width: 2; indent-pages-mode: nil; c-basic-offset: 2 -*- */
+/*
+ *  Copyright © 2019 Alexander Mikhaylenko <exalm7659 gmail com>
+ *
+ *  This file is part of Epiphany.
+ *
+ *  Epiphany is free software: you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation, either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  Epiphany is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with Epiphany.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#pragma once
+
+#include <gtk/gtk.h>
+
+G_BEGIN_DECLS
+
+#define EPHY_TYPE_PAGES_BUTTON (ephy_pages_button_get_type())
+
+G_DECLARE_FINAL_TYPE (EphyPagesButton, ephy_pages_button, EPHY, PAGES_BUTTON, GtkButton)
+
+EphyPagesButton *ephy_pages_button_new         (void);
+
+int              ephy_pages_button_get_n_pages (EphyPagesButton *self);
+
+void             ephy_pages_button_set_n_pages (EphyPagesButton *self,
+                                                int              n_pages);
+
+G_END_DECLS
diff --git a/src/meson.build b/src/meson.build
index 66597f5d4..4033d1bb9 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -36,6 +36,7 @@ libephymain_sources = [
   'ephy-mouse-gesture-controller.c',
   'ephy-notebook.c',
   'ephy-page-row.c',
+  'ephy-pages-button.c',
   'ephy-pages-popover.c',
   'ephy-pages-view.c',
   'ephy-search-engine-dialog.c',
diff --git a/src/resources/ephy-tab-counter-symbolic.svg b/src/resources/ephy-tab-counter-symbolic.svg
new file mode 100644
index 000000000..5837085c4
--- /dev/null
+++ b/src/resources/ephy-tab-counter-symbolic.svg
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/";
+   xmlns:cc="http://creativecommons.org/ns#";
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#";
+   xmlns:svg="http://www.w3.org/2000/svg";
+   xmlns="http://www.w3.org/2000/svg";
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd";
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape";
+   width="16"
+   version="1.1"
+   id="svg7384"
+   height="16"
+   sodipodi:docname="tab-counter-symbolic.svg"
+   inkscape:version="0.92.4 5da689c313, 2019-01-14">
+  <sodipodi:namedview
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1"
+     objecttolerance="10"
+     gridtolerance="10"
+     guidetolerance="10"
+     inkscape:pageopacity="0"
+     inkscape:pageshadow="2"
+     inkscape:window-width="1920"
+     inkscape:window-height="1016"
+     id="namedview8"
+     showgrid="true"
+     inkscape:snap-bbox="true"
+     inkscape:bbox-paths="true"
+     inkscape:bbox-nodes="true"
+     inkscape:snap-text-baseline="true"
+     inkscape:zoom="11.313708"
+     inkscape:cx="-14.248148"
+     inkscape:cy="15.003638"
+     inkscape:window-x="0"
+     inkscape:window-y="27"
+     inkscape:window-maximized="1"
+     inkscape:current-layer="g4572">
+    <inkscape:grid
+       type="xygrid"
+       id="grid4519" />
+  </sodipodi:namedview>
+  <metadata
+     id="metadata90">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage"; />
+        <dc:title>Gnome Symbolic Icon Theme</dc:title>
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <title
+     id="title9167">Gnome Symbolic Icon Theme</title>
+  <defs
+     id="defs7386" />
+  <g
+     id="g4572">
+    <path
+       
style="color:#bebebe;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#bebebe;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-
 width:2;
 
stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
+       d="M 2.1992188,0 C 0.94446612,0 0,1.0997689 0,2.3183594 V 13.681641 C 0,14.900231 0.94447706,16 
2.1992188,16 H 13.800781 C 15.055523,16 16,14.90024 16,13.681641 V 2.3183594 C 16,1.0997598 15.055534,0 
13.800781,0 Z m 0,2 H 13.800781 C 13.874369,2 14,2.0752716 14,2.3183594 V 13.681641 C 14,13.924729 
13.87438,14 13.800781,14 H 2.1992188 C 2.1256204,14 2,13.924738 2,13.681641 V 2.3183594 C 2,2.0752625 
2.1256314,2 2.1992188,2 Z"
+       id="rect11749-5-9"
+       inkscape:connector-curvature="0"
+       sodipodi:nodetypes="ssssssssssssssssss" />
+  </g>
+</svg>
diff --git a/src/resources/ephy-tab-overflow-symbolic.svg b/src/resources/ephy-tab-overflow-symbolic.svg
new file mode 100644
index 000000000..602b7ce2c
--- /dev/null
+++ b/src/resources/ephy-tab-overflow-symbolic.svg
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/";
+   xmlns:cc="http://creativecommons.org/ns#";
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#";
+   xmlns:svg="http://www.w3.org/2000/svg";
+   xmlns="http://www.w3.org/2000/svg";
+   height="16"
+   id="svg7384"
+   version="1.1"
+   width="16">
+  <metadata
+     id="metadata90">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage"; />
+        <dc:title>Gnome Symbolic Icon Theme</dc:title>
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <title
+     id="title9167">Gnome Symbolic Icon Theme</title>
+  <defs
+     id="defs7386" />
+  <path
+     id="path859"
+     d="M 2.199219,0 C 0.944466,0 0,1.0997689 0,2.3183594 V 13.681641 C 0,14.900231 0.944477,16 2.199219,16 
H 13.80078 C 15.05552,16 16,14.90024 16,13.681641 V 2.3183594 C 16,1.0997598 15.05553,0 13.80078,0 Z m 0,2 H 
13.80078 C 13.87437,2 14,2.0752716 14,2.3183594 V 13.681641 C 14,13.924729 13.87438,14 13.80078,14 H 2.199219 
C 2.12562,14 2,13.924738 2,13.681641 V 2.3183594 C 2,2.0752625 2.125631,2 2.199219,2 Z"
+     
style="color:#bebebe;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#241f31;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-wi
 dth:2;st
 
roke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
 />
+  <g
+     transform="translate(20)"
+     id="text863"
+     
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:12px;line-height:1.25;font-family:Cantarell;-inkscape-font-specification:'Cantarell
 
Bold';text-align:center;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#241f31;fill-opacity:1;stroke:none"
+     aria-label="∞">
+    <path
+       id="path880"
+       d="m -14.519998,10.488 c 1.14,0 1.836,-0.66 2.388,-1.44 0.504,0.78 1.176,1.44 2.388,1.44 1.572,0 
2.628,-1.068 2.628,-2.64 0,-1.488 -0.972,-2.472 -2.376,-2.472 -1.104,0 -1.8,0.624 -2.352,1.356 -0.48,-0.732 
-1.14,-1.356 -2.352,-1.356 -1.596,0 -2.688,1.056 -2.688,2.64 0,1.476 0.972,2.472 2.364,2.472 z m -0.804,-2.58 
c 0,-0.744 0.396,-1.236 1.056,-1.236 0.744,0 1.152,0.624 1.56,1.38 -0.42,0.636 -0.864,1.14 -1.524,1.14 
-0.672,0 -1.092,-0.516 -1.092,-1.284 z m 5.544,-1.236 c 0.648,0 1.104,0.492 1.104,1.32 0,0.72 -0.36,1.2 
-1.02,1.2 -0.78,0 -1.176,-0.672 -1.572,-1.452 0.408,-0.6 0.852,-1.068 1.488,-1.068 z" />
+  </g>
+</svg>
diff --git a/src/resources/epiphany.gresource.xml b/src/resources/epiphany.gresource.xml
index d1da5f287..2b5b4ead7 100644
--- a/src/resources/epiphany.gresource.xml
+++ b/src/resources/epiphany.gresource.xml
@@ -25,6 +25,7 @@
     <file preprocess="xml-stripblanks" compressed="true">gtk/notebook-context-menu.ui</file>
     <file preprocess="xml-stripblanks" compressed="true">gtk/page-menu-popover.ui</file>
     <file preprocess="xml-stripblanks" compressed="true">gtk/page-row.ui</file>
+    <file preprocess="xml-stripblanks" compressed="true">gtk/pages-button.ui</file>
     <file preprocess="xml-stripblanks" compressed="true">gtk/pages-popover.ui</file>
     <file preprocess="xml-stripblanks" compressed="true">gtk/pages-view.ui</file>
     <file preprocess="xml-stripblanks" compressed="true">gtk/passwords-dialog.ui</file>
@@ -55,6 +56,8 @@
     <file compressed="true" 
alias="scalable/actions/ephy-bookmark-tag-symbolic.svg">ephy-bookmark-tag-symbolic.svg</file>
     <file compressed="true" 
alias="scalable/actions/ephy-missing-favicon-symbolic.svg">ephy-missing-favicon-symbolic.svg</file>
     <file compressed="true" 
alias="scalable/actions/ephy-reader-mode-symbolic.svg">ephy-reader-mode-symbolic.svg</file>
+    <file compressed="true" 
alias="scalable/status/ephy-tab-counter-symbolic.svg">ephy-tab-counter-symbolic.svg</file>
+    <file compressed="true" 
alias="scalable/status/ephy-tab-overflow-symbolic.svg">ephy-tab-overflow-symbolic.svg</file>
   </gresource>
   <gresource prefix="/org/gnome/Epiphany">
     <file compressed="true">themes/shared.css</file>
diff --git a/src/resources/gtk/action-bar.ui b/src/resources/gtk/action-bar.ui
index 75057d237..34c534865 100644
--- a/src/resources/gtk/action-bar.ui
+++ b/src/resources/gtk/action-bar.ui
@@ -6,15 +6,15 @@
       <object class="GtkActionBar" id="action_bar">
         <property name="visible">True</property>
         <child>
-            <object class="EphyActionBarStart" id="action_bar_start">
-              <property name="visible">True</property>
-            </object>
+          <object class="EphyActionBarStart" id="action_bar_start">
+            <property name="visible">True</property>
+          </object>
           <packing>
             <property name="pack-type">start</property>
           </packing>
         </child>
         <child>
-          <object class="GtkButton" id="pages_button">
+          <object class="EphyPagesButton" id="pages_button">
             <property name="visible">True</property>
             <property name="valign">center</property>
             <!-- Translators: tooltip for the page switcher button -->
@@ -23,13 +23,6 @@
             <style>
               <class name="image-button"/>
             </style>
-            <child>
-              <object class="GtkImage" id="bookmarks_image">
-                <property name="visible">True</property>
-                <property name="icon-name">view-paged-symbolic</property>
-                <property name="icon-size">1</property>
-              </object>
-            </child>
           </object>
           <packing>
             <property name="pack-type">end</property>
diff --git a/src/resources/gtk/pages-button.ui b/src/resources/gtk/pages-button.ui
new file mode 100644
index 000000000..6b57c2236
--- /dev/null
+++ b/src/resources/gtk/pages-button.ui
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <!-- interface-requires gtk+ 3.16 -->
+  <template class="EphyPagesButton" parent="GtkButton">
+    <child>
+      <object class="GtkOverlay">
+        <property name="visible">True</property>
+        <child>
+          <object class="GtkImage" id="pages_icon">
+            <property name="visible">True</property>
+          </object>
+        </child>
+        <child type="overlay">
+          <object class="GtkLabel" id="pages_label">
+            <property name="visible">True</property>
+            <property name="halign">center</property>
+            <property name="justify">center</property>
+            <property name="width-chars">2</property>
+            <attributes>
+              <attribute name="font-features" value="tnum=1"/>
+              <attribute name="size" value="7000"/>
+              <attribute name="weight" value="ultrabold"/>
+            </attributes>
+          </object>
+          <packing>
+            <property name="pass_through">True</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+  </template>
+</interface>


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