diff options
author | Xan Lopez <xlopez@igalia.com> | 2011-05-22 18:01:43 +0800 |
---|---|---|
committer | Xan Lopez <xlopez@igalia.com> | 2011-05-22 18:03:46 +0800 |
commit | 231b8a0bbba7479044d5fa57e805c142755df116 (patch) | |
tree | 333525d95022a4f7209e9127c9187d520b19099f /lib/widgets | |
parent | 0bf62245971fca798531600bf5e961fbc7724db3 (diff) | |
download | gsoc2013-epiphany-231b8a0bbba7479044d5fa57e805c142755df116.tar.gz gsoc2013-epiphany-231b8a0bbba7479044d5fa57e805c142755df116.tar.zst gsoc2013-epiphany-231b8a0bbba7479044d5fa57e805c142755df116.zip |
ephy-location-entry: do not use a yellow background for secure sites
Adds unneeded clutter to the entry, we'll just rely on a visible
symbolic lock icon when needed.
Diffstat (limited to 'lib/widgets')
-rw-r--r-- | lib/widgets/ephy-location-entry.c | 116 | ||||
-rw-r--r-- | lib/widgets/ephy-location-entry.h | 3 |
2 files changed, 0 insertions, 119 deletions
diff --git a/lib/widgets/ephy-location-entry.c b/lib/widgets/ephy-location-entry.c index 0ad827757..702646df1 100644 --- a/lib/widgets/ephy-location-entry.c +++ b/lib/widgets/ephy-location-entry.c @@ -55,8 +55,6 @@ struct _EphyLocationEntryPrivate GtkWidget *entry; char *lock_stock_id; GdkPixbuf *favicon; - GdkRGBA secure_bg_color; - GdkRGBA secure_fg_color; GSList *search_terms; @@ -79,7 +77,6 @@ struct _EphyLocationEntryPrivate guint can_redo : 1; guint block_update : 1; guint original_address : 1; - guint secure : 1; guint apply_colors : 1; guint needs_reset : 1; guint show_lock : 1; @@ -92,9 +89,6 @@ static const GtkTargetEntry url_drag_types [] = { EPHY_DND_TEXT_TYPE, 0, 2 } }; -static const GdkRGBA fallback_bg_color = { 0.97, 0.97, 0.74, 1 }; /* yellow-ish */ -static const GdkRGBA fallback_fg_color = { 0, 0, 0, 1 }; /* black */ - static void ephy_location_entry_class_init (EphyLocationEntryClass *klass); static void ephy_location_entry_init (EphyLocationEntry *le); static gboolean ephy_location_entry_reset_internal (EphyLocationEntry *, gboolean); @@ -122,64 +116,6 @@ static gint signals[LAST_SIGNAL] = { 0 }; G_DEFINE_TYPE (EphyLocationEntry, ephy_location_entry, GTK_TYPE_TOOL_ITEM) -static void -ephy_location_entry_style_updated (GtkWidget *widget) -{ - EphyLocationEntry *entry = EPHY_LOCATION_ENTRY (widget); - EphyLocationEntryPrivate *priv = entry->priv; - GtkSettings *settings; - - GtkStyleContext *style; - GdkRGBA *bg_color = NULL; - GdkRGBA *fg_color = NULL; - - char *theme; - gboolean is_a11y_theme; - - if (GTK_WIDGET_CLASS (ephy_location_entry_parent_class)->style_updated) - { - GTK_WIDGET_CLASS (ephy_location_entry_parent_class)->style_updated (widget); - } - - settings = gtk_settings_get_for_screen (gtk_widget_get_screen (widget)); - g_object_get (settings, "gtk-theme-name", &theme, NULL); - is_a11y_theme = strstr (theme, "HighContrast") != NULL || - strstr (theme, "LowContrast") != NULL; - g_free (theme); - - style = gtk_widget_get_style_context (widget); - gtk_style_context_get_style (style, - "secure-fg-color", &fg_color, - "secure-bg-color", &bg_color, - NULL); - - /* We only use the fallback colors when we don't have an a11y theme */ - priv->apply_colors = !is_a11y_theme || (fg_color != NULL && bg_color != NULL); - - if (fg_color != NULL) - { - priv->secure_fg_color = *fg_color; - gdk_rgba_free (fg_color); - } - else - { - priv->secure_fg_color = fallback_fg_color; - } - - if (bg_color != NULL) - { - priv->secure_bg_color = *bg_color; - gdk_rgba_free (bg_color); - } - else - { - priv->secure_bg_color = fallback_bg_color; - } - - /* Apply the new style */ - ephy_location_entry_set_secure (entry, priv->secure); -} - inline static void free_search_terms (GSList *search_terms) { @@ -218,12 +154,9 @@ static void ephy_location_entry_class_init (EphyLocationEntryClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); - GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); object_class->finalize = ephy_location_entry_finalize; - widget_class->style_updated = ephy_location_entry_style_updated; - /** * EphyLocationEntry::user-changed: * @entry: the object on which the signal is emitted @@ -299,20 +232,6 @@ ephy_location_entry_class_init (EphyLocationEntryClass *klass) 0, G_TYPE_NONE); - gtk_widget_class_install_style_property (widget_class, - g_param_spec_boxed ("secure-bg-color", - "Secure background colour", - "Background colour to use for secure sites", - GDK_TYPE_RGBA, - G_PARAM_READABLE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); - - gtk_widget_class_install_style_property (widget_class, - g_param_spec_boxed ("secure-fg-color", - "Secure foreground Colour", - "Foreground colour to use for secure sites", - GDK_TYPE_RGBA, - G_PARAM_READABLE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); - g_type_class_add_private (object_class, sizeof (EphyLocationEntryPrivate)); } @@ -1598,41 +1517,6 @@ ephy_location_entry_set_favicon (EphyLocationEntry *entry, } /** - * ephy_location_entry_set_secure: - * @entry: an #EphyLocationEntry widget - * @secure: whether the page is secure and thus the location bar should reflect - * that - * - * Set @entry to give visual feedback if the page is @secure. If it is, the - * location bar will have its background painted differently (yellow by - * default). - * - **/ -void -ephy_location_entry_set_secure (EphyLocationEntry *entry, - gboolean secure) -{ - EphyLocationEntryPrivate *priv = entry->priv; - GtkWidget *widget = GTK_WIDGET (entry); - GtkWidget *gentry = priv->entry; - - priv->secure = secure; - - /* We have to set the color of the GtkEntry in the EphyIconEntry */ - if (priv->secure && priv->apply_colors) - { - gtk_widget_override_color (gentry, GTK_STATE_FLAG_NORMAL, &priv->secure_fg_color); - gtk_widget_override_background_color (gentry, GTK_STATE_FLAG_NORMAL, &priv->secure_bg_color); - } - else - { - gtk_widget_override_color (gentry, GTK_STATE_FLAG_NORMAL, NULL); - gtk_widget_override_background_color (gentry, GTK_STATE_FLAG_NORMAL, NULL); - } - gtk_widget_queue_draw (widget); -} - -/** * ephy_location_entry_set_show_lock: * @entry: an #EphyLocationEntry widget * @show_lock: if @entry should show a lock icon indicating the security level diff --git a/lib/widgets/ephy-location-entry.h b/lib/widgets/ephy-location-entry.h index 2bb0d46c0..b1abd624a 100644 --- a/lib/widgets/ephy-location-entry.h +++ b/lib/widgets/ephy-location-entry.h @@ -102,9 +102,6 @@ GtkWidget *ephy_location_entry_get_entry (EphyLocationEntry *entry); void ephy_location_entry_set_favicon (EphyLocationEntry *entry, GdkPixbuf *pixbuf); -void ephy_location_entry_set_secure (EphyLocationEntry *entry, - gboolean secure); - void ephy_location_entry_set_show_lock (EphyLocationEntry *entry, gboolean show_lock); |