[epiphany] Remove various show_lock properties



commit 487ff820a86238fd21efe7b1288c58d60c04a1e0
Author: Michael Catanzaro <mcatanzaro igalia com>
Date:   Sun Aug 10 23:12:15 2014 -0500

    Remove various show_lock properties
    
    EphyTitleBox and EphyLocationEntry now know to show the lock whenever
    the security level is not EPHY_SECURITY_LEVEL_NO_SECURITY.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=666808

 lib/widgets/ephy-location-entry.c |   53 +-----------------------------------
 lib/widgets/ephy-location-entry.h |    3 --
 src/ephy-title-box.c              |   31 +--------------------
 src/ephy-title-box.h              |    3 --
 src/ephy-window.c                 |   38 ++------------------------
 5 files changed, 7 insertions(+), 121 deletions(-)
---
diff --git a/lib/widgets/ephy-location-entry.c b/lib/widgets/ephy-location-entry.c
index 3e739e8..839a0be 100644
--- a/lib/widgets/ephy-location-entry.c
+++ b/lib/widgets/ephy-location-entry.c
@@ -79,7 +79,6 @@ struct _EphyLocationEntryPrivate
        guint original_address : 1;
        guint apply_colors : 1;
        guint needs_reset : 1;
-       guint show_lock : 1;
        guint show_favicon : 1;
 
        GtkTargetList *drag_targets;
@@ -112,7 +111,6 @@ enum
        PROP_LOCATION,
        PROP_FAVICON,
        PROP_SECURITY_LEVEL,
-       PROP_SHOW_LOCK,
        PROP_SHOW_FAVICON
 };
 
@@ -150,10 +148,6 @@ ephy_location_entry_set_property (GObject *object,
                ephy_location_entry_set_security_level (entry,
                                                        g_value_get_enum (value));
                break;
-       case PROP_SHOW_LOCK:
-               ephy_location_entry_set_show_lock (entry,
-                                                  g_value_get_boolean (value));
-               break;
        case PROP_SHOW_FAVICON:
                ephy_location_entry_set_show_favicon (entry,
                                                      g_value_get_boolean (value));
@@ -270,19 +264,6 @@ ephy_location_entry_class_init (EphyLocationEntryClass *klass)
                                                             EPHY_SECURITY_LEVEL_NO_SECURITY,
                                                             G_PARAM_WRITABLE | G_PARAM_STATIC_NAME | 
G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
 
-       /**
-       * EphyLocationEntry:show-lock:
-       *
-       * If we should show the security icon.
-       */
-       g_object_class_install_property (object_class,
-                                        PROP_SHOW_LOCK,
-                                        g_param_spec_boolean ("show-lock",
-                                                              "Show Lock",
-                                                              "If we should show the security icon",
-                                                              FALSE,
-                                                              G_PARAM_WRITABLE | G_PARAM_STATIC_NAME | 
G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
-
        g_object_class_install_property (object_class,
                                         PROP_SHOW_FAVICON,
                                         g_param_spec_boolean ("show-favicon",
@@ -970,7 +951,6 @@ ephy_location_entry_init (EphyLocationEntry *le)
        p->user_changed = FALSE;
        p->block_update = FALSE;
        p->saved_text = NULL;
-       p->show_lock = FALSE;
        p->show_favicon = TRUE;
        p->dns_prefetch_handler = 0;
 
@@ -1593,39 +1573,11 @@ ephy_location_entry_set_show_favicon (EphyLocationEntry *entry,
 }
 
 /**
- * ephy_location_entry_set_show_lock:
- * @entry: an #EphyLocationEntry widget
- * @show_lock: if @entry should show a lock icon indicating the security level
- * of the page
- *
- * If @show_lock is TRUE, the location bar will show an icon reflecting the
- * security level of the page, by default it's shown only in secure (HTTPS) pages
- *
- **/
-void
-ephy_location_entry_set_show_lock (EphyLocationEntry *entry,
-                                  gboolean show_lock)
-{
-       EphyLocationEntryPrivate *priv;
-
-       g_return_if_fail (EPHY_IS_LOCATION_ENTRY (entry));
-
-       priv = entry->priv;
-
-       priv->show_lock = show_lock != FALSE;
-
-       gtk_entry_set_icon_from_gicon (GTK_ENTRY (entry),
-                                      GTK_ENTRY_ICON_SECONDARY,
-                                      show_lock ? priv->lock_gicon : NULL);
-}
-
-/**
  * ephy_location_entry_set_security_level:
  * @entry: an #EphyLocationEntry widget
  * @state: the #EphySecurityLevel
  *
- * Set the lock icon to be displayed, to actually show the icon see 
- * ephy_location_entry_set_show_lock.
+ * Set the lock icon to be displayed
  *
  **/
 void
@@ -1653,8 +1605,7 @@ ephy_location_entry_set_security_level (EphyLocationEntry *entry,
                break;
        }
 
-       if (priv->show_lock) {
-               g_warn_if_fail (security_level != EPHY_SECURITY_LEVEL_NO_SECURITY);
+       if (security_level != EPHY_SECURITY_LEVEL_NO_SECURITY) {
                gtk_entry_set_icon_from_gicon (GTK_ENTRY (entry),
                                               GTK_ENTRY_ICON_SECONDARY,
                                               priv->lock_gicon);
diff --git a/lib/widgets/ephy-location-entry.h b/lib/widgets/ephy-location-entry.h
index f5a0bb3..22f2d65 100644
--- a/lib/widgets/ephy-location-entry.h
+++ b/lib/widgets/ephy-location-entry.h
@@ -105,9 +105,6 @@ void                ephy_location_entry_set_favicon         (EphyLocationEntry *entry,
 void            ephy_location_entry_set_show_favicon    (EphyLocationEntry *entry,
                                                         gboolean show_favicon);
 
-void           ephy_location_entry_set_show_lock       (EphyLocationEntry *entry,
-                                                        gboolean show_lock);
-
 void           ephy_location_entry_set_security_level  (EphyLocationEntry *entry,
                                                         EphySecurityLevel security_level);
 
diff --git a/src/ephy-title-box.c b/src/ephy-title-box.c
index 910593b..37b28c0 100644
--- a/src/ephy-title-box.c
+++ b/src/ephy-title-box.c
@@ -620,39 +620,11 @@ ephy_title_box_set_mode (EphyTitleBox    *title_box,
 }
 
 /**
- * ephy_title_box_set_show_lock:
- * @title_box: an #EphyTitleBox
- * @show_lock: if @title_box should show a lock icon indicating the security level
- * of the page
- *
- * If @show_lock is TRUE, the title will show an icon reflecting the
- * security level of the page, by default it's shown only in secure and
- * insecure pages (insecure meaning secure pages with something broken in such
- * security).
- *
- **/
-void
-ephy_title_box_set_show_lock (EphyTitleBox *title_box,
-                              gboolean      show_lock)
-{
-  EphyTitleBoxPrivate *priv;
-
-  g_return_if_fail (EPHY_IS_TITLE_BOX (title_box));
-
-  priv = ephy_title_box_get_instance_private (title_box);
-
-  gtk_widget_set_visible (priv->lock_image, show_lock);
-
-  ephy_location_entry_set_show_lock (EPHY_LOCATION_ENTRY (priv->entry), show_lock);
-}
-
-/**
  * ephy_title_box_set_security_level:
  * @title_box: an #EphyTitleBox
  * @mode: an #EphySecurityLevel
  *
- * Set the lock icon to be displayed; to actually show the icon see
- * ephy_title_box_set_show_lock.
+ * Sets the lock icon to be displayed by the title box and location entry
  **/
 void
 ephy_title_box_set_security_level (EphyTitleBox         *title_box,
@@ -668,6 +640,7 @@ ephy_title_box_set_security_level (EphyTitleBox         *title_box,
                                                "channel-secure-symbolic" : "channel-insecure-symbolic",
                                   NULL);
 
+  gtk_widget_set_visible (priv->lock_image, security_level != EPHY_SECURITY_LEVEL_NO_SECURITY);
   ephy_location_entry_set_security_level (EPHY_LOCATION_ENTRY (priv->entry), security_level);
 }
 
diff --git a/src/ephy-title-box.h b/src/ephy-title-box.h
index 3321d94..ba2038a 100644
--- a/src/ephy-title-box.h
+++ b/src/ephy-title-box.h
@@ -68,9 +68,6 @@ EphyTitleBoxMode    ephy_title_box_get_mode             (EphyTitleBox         *t
 void                ephy_title_box_set_mode             (EphyTitleBox         *title_box,
                                                          EphyTitleBoxMode      mode);
 
-void                ephy_title_box_set_show_lock        (EphyTitleBox         *title_box,
-                                                         gboolean              show_lock);
-
 void                ephy_title_box_set_security_level   (EphyTitleBox         *title_box,
                                                          EphySecurityLevel     security_level);
 
diff --git a/src/ephy-window.c b/src/ephy-window.c
index 0021eaa..dfba724 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -358,7 +358,6 @@ struct _EphyWindowPrivate
        guint present_on_insert : 1;
        guint key_theme_is_emacs : 1;
        guint updating_address : 1;
-       guint show_lock : 1;
        guint force_close : 1;
        guint checking_modified_forms : 1;
 };
@@ -711,50 +710,19 @@ sync_tab_load_status (EphyWebView *view,
 }
 
 static void
-_ephy_window_set_security_state (EphyWindow *window,
-                                gboolean show_lock,
-                                EphySecurityLevel security_level)
-{
-       EphyWindowPrivate *priv = window->priv;
-       EphyTitleBox *title_box;
-
-       title_box = ephy_toolbar_get_title_box (EPHY_TOOLBAR (priv->toolbar));
-
-       priv->show_lock = show_lock != FALSE;
-
-       ephy_title_box_set_security_level (title_box, security_level);
-       ephy_title_box_set_show_lock (title_box, priv->show_lock);
-}
-
-static void
 sync_tab_security (EphyWebView *view,
                   GParamSpec *pspec,
                   EphyWindow *window)
 {
        EphyWindowPrivate *priv = window->priv;
+       EphyTitleBox *title_box;
        EphySecurityLevel security_level;
-       gboolean show_lock = FALSE;
 
        if (priv->closing) return;
 
        ephy_web_view_get_security_level (view, &security_level, NULL, NULL);
-
-       switch (security_level)
-       {
-               case EPHY_SECURITY_LEVEL_NO_SECURITY:
-                       break;
-               case EPHY_SECURITY_LEVEL_BROKEN_SECURITY:
-                        show_lock = TRUE;
-                        break;
-               case EPHY_SECURITY_LEVEL_STRONG_SECURITY:
-                       show_lock = TRUE;
-                       break;
-               default:
-                       g_assert_not_reached ();
-                       break;
-       }
-
-       _ephy_window_set_security_state (window, show_lock, security_level);
+       title_box = ephy_toolbar_get_title_box (EPHY_TOOLBAR (priv->toolbar));
+       ephy_title_box_set_security_level (title_box, security_level);
 }
 
 static void


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