[epiphany] Use a custom style for incognito mode



commit d0af7ceec1ee8bf2cb16f1553fc9f4f2879b4886
Author: William Jon McCann <william jon mccann gmail com>
Date:   Thu Jan 2 14:16:18 2014 -0500

    Use a custom style for incognito mode
    
    https://bugzilla.gnome.org/show_bug.cgi?id=696078

 src/Makefile.am                    |    1 +
 src/ephy-main.c                    |    5 -----
 src/ephy-toolbar.c                 |    2 ++
 src/ephy-window.c                  |    5 +++++
 src/epiphany.gresource.xml         |    1 +
 src/resources/epiphany.css         |   26 ++++++++++++++++++++++++++
 src/resources/incognito-tinted.png |  Bin 0 -> 8497 bytes
 7 files changed, 35 insertions(+), 5 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index 1cfed7e..5969918 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -111,6 +111,7 @@ RESOURCE_FILES = \
        resources/passwords-dialog.ui             \
        resources/epiphany.css                    \
        resources/incognito.png                   \
+       resources/incognito-tinted.png            \
        resources/error.html                      \
        resources/process-crash.html              \
        resources/recovery.html                   \
diff --git a/src/ephy-main.c b/src/ephy-main.c
index 96ac40b..1f9af3e 100644
--- a/src/ephy-main.c
+++ b/src/ephy-main.c
@@ -430,11 +430,6 @@ main (int argc,
     mode = EPHY_EMBED_SHELL_MODE_PRIVATE;
   else if (incognito_mode) {
     mode = EPHY_EMBED_SHELL_MODE_INCOGNITO;
-
-    /* Use the right theming. */
-    g_object_set (gtk_settings_get_default (),
-                  "gtk-application-prefer-dark-theme", TRUE,
-                  NULL);
   } else if (application_mode) {
     char *app_name;
     char *app_icon;
diff --git a/src/ephy-toolbar.c b/src/ephy-toolbar.c
index 0becdde..3f55f3f 100644
--- a/src/ephy-toolbar.c
+++ b/src/ephy-toolbar.c
@@ -109,6 +109,7 @@ ephy_toolbar_constructed (GObject *object)
   gtk_activatable_set_related_action (GTK_ACTIVATABLE (button),
                                       action);
   gtk_button_set_label (GTK_BUTTON (button), NULL);
+  gtk_style_context_add_class (gtk_widget_get_style_context (button), "image-button");
   gtk_container_add (GTK_CONTAINER (box), button);
 
   /* Forward */
@@ -121,6 +122,7 @@ ephy_toolbar_constructed (GObject *object)
   gtk_activatable_set_related_action (GTK_ACTIVATABLE (button),
                                       action);
   gtk_button_set_label (GTK_BUTTON (button), NULL);
+  gtk_style_context_add_class (gtk_widget_get_style_context (button), "image-button");
   gtk_container_add (GTK_CONTAINER (box), button);
 
   gtk_style_context_add_class (gtk_widget_get_style_context (box),
diff --git a/src/ephy-window.c b/src/ephy-window.c
index d650296..d2d32ed 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -3198,10 +3198,15 @@ setup_toolbar (EphyWindow *window)
        GtkWidget *toolbar;
        GtkAction *action;
        EphyWindowPrivate *priv = window->priv;
+       EphyEmbedShellMode app_mode;
 
        toolbar = ephy_toolbar_new (window);
        gtk_window_set_titlebar (GTK_WINDOW (window), toolbar);
 
+       app_mode = ephy_embed_shell_get_mode (ephy_embed_shell_get_default ());
+       if (app_mode == EPHY_EMBED_SHELL_MODE_INCOGNITO)
+               gtk_style_context_add_class (gtk_widget_get_style_context (toolbar), "incognito-mode");
+
        action = gtk_action_group_get_action (priv->toolbar_action_group,
                                              "NavigationBack");
        g_signal_connect_swapped (action, "open-link",
diff --git a/src/epiphany.gresource.xml b/src/epiphany.gresource.xml
index fff66ff..29c0d03 100644
--- a/src/epiphany.gresource.xml
+++ b/src/epiphany.gresource.xml
@@ -2,6 +2,7 @@
 <gresources>
   <gresource prefix="/org/gnome/epiphany">
     <file>incognito.png</file>
+    <file>incognito-tinted.png</file>
     <file preprocess="xml-stripblanks" compressed="true">epiphany.ui</file>
     <file preprocess="xml-stripblanks" compressed="true">prefs-dialog.ui</file>
     <file preprocess="xml-stripblanks" compressed="true">prefs-lang-dialog.ui</file>
diff --git a/src/resources/epiphany.css b/src/resources/epiphany.css
index 113856f..babf4ba 100644
--- a/src/resources/epiphany.css
+++ b/src/resources/epiphany.css
@@ -25,3 +25,29 @@
     padding: 12px;
     border-radius: 10px;
 }
+
+EphyToolbar.incognito-mode {
+    background-color: transparent;
+    background-image: url("resource://org/gnome/epiphany/incognito-tinted.png"),
+                      linear-gradient(to bottom,
+                                      #e4ecf5,
+                                      #c5cfd8);
+    background-repeat: no-repeat;
+    background-position: 6ex center, 0 0;
+    background-size: auto 180%;
+    border-color: shade(#c5cfd8, 0.90);
+    box-shadow: none;
+}
+
+EphyToolbar.incognito-mode *:insensitive {
+    background-color: transparent;
+}
+
+EphyToolbar.incognito-mode EphyMiddleClickableButton,
+EphyToolbar.incognito-mode > .button {
+    background-image: linear-gradient(to bottom,
+                                      #e4ecf5,
+                                      #c5cfd8);
+    border-color: shade(#c5cfd8, 0.90);
+}
+
diff --git a/src/resources/incognito-tinted.png b/src/resources/incognito-tinted.png
new file mode 100644
index 0000000..8c80e3a
Binary files /dev/null and b/src/resources/incognito-tinted.png differ


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