[epiphany] Rename EphyCertificatePopover to EphySecurityPopover



commit 383cd9974233dddd473499094252beaa9d25d923
Author: Michael Catanzaro <mcatanzaro igalia com>
Date:   Sat Feb 7 10:31:48 2015 -0600

    Rename EphyCertificatePopover to EphySecurityPopover
    
    Since it is now used for HTTP as well.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=744064

 lib/widgets/Makefile.am                            |    4 +-
 lib/widgets/ephy-certificate-popover.h             |   67 ----------
 ...rtificate-popover.c => ephy-security-popover.c} |  127 ++++++++++----------
 lib/widgets/ephy-security-popover.h                |   68 +++++++++++
 src/ephy-window.c                                  |   30 +++---
 5 files changed, 149 insertions(+), 147 deletions(-)
---
diff --git a/lib/widgets/Makefile.am b/lib/widgets/Makefile.am
index 277f1bf..a120ed1 100644
--- a/lib/widgets/Makefile.am
+++ b/lib/widgets/Makefile.am
@@ -66,8 +66,6 @@ nodist_libephywidgets_la_SOURCES = \
 libephywidgets_la_SOURCES = \
        ephy-certificate-dialog.c               \
        ephy-certificate-dialog.h               \
-       ephy-certificate-popover.c              \
-       ephy-certificate-popover.h              \
        ephy-downloads-popover.h                \
        ephy-downloads-popover.c                \
        ephy-downloads-progress-icon.h          \
@@ -82,6 +80,8 @@ libephywidgets_la_SOURCES = \
        ephy-middle-clickable-button.h          \
        ephy-node-view.c                        \
        ephy-node-view.h                        \
+       ephy-security-popover.c                 \
+       ephy-security-popover.h                 \
        ephy-tree-model-node.c                  \
        ephy-tree-model-node.h                  \
        ephy-tree-model-sort.c                  \
diff --git a/lib/widgets/ephy-certificate-popover.c b/lib/widgets/ephy-security-popover.c
similarity index 73%
rename from lib/widgets/ephy-certificate-popover.c
rename to lib/widgets/ephy-security-popover.c
index 3759f00..97a4447 100644
--- a/lib/widgets/ephy-certificate-popover.c
+++ b/lib/widgets/ephy-security-popover.c
@@ -1,6 +1,6 @@
 /* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /*
- *  Copyright © 2014 Igalia S.L.
+ *  Copyright © 2014, 2015 Igalia S.L.
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -17,7 +17,7 @@
  */
 
 #include "config.h"
-#include "ephy-certificate-popover.h"
+#include "ephy-security-popover.h"
 
 #include <glib/gi18n.h>
 #include <libsoup/soup.h>
@@ -26,11 +26,12 @@
 #include "ephy-lib-type-builtins.h"
 
 /**
- * SECTION:ephy-certificate-popover
- * @short_description: A popover to show basic SSL connection information
+ * SECTION:ephy-security-popover
+ * @short_description: A popover to show basic TLS connection information
  *
- * #EphyCertificatePopover shows basic information about an SSL connection
- * and allows opening #EphyCertificateDialog for more detailed information.
+ * #EphySecurityPopover shows basic information about a TLS connection
+ * and allows opening #EphyCertificateDialog for more detailed information. It
+ * can also be used to show that a connection does not use TLS at all.
  */
 
 enum
@@ -42,7 +43,7 @@ enum
   PROP_TLS_ERRORS,
 };
 
-struct _EphyCertificatePopoverPrivate
+struct _EphySecurityPopoverPrivate
 {
   char *address;
   char *hostname;
@@ -55,13 +56,13 @@ struct _EphyCertificatePopoverPrivate
   EphySecurityLevel security_level;
 };
 
-G_DEFINE_TYPE_WITH_PRIVATE (EphyCertificatePopover, ephy_certificate_popover, GTK_TYPE_POPOVER)
+G_DEFINE_TYPE_WITH_PRIVATE (EphySecurityPopover, ephy_security_popover, GTK_TYPE_POPOVER)
 
 static void
-ephy_certificate_popover_set_address (EphyCertificatePopover *popover,
-                                      const char *address)
+ephy_security_popover_set_address (EphySecurityPopover *popover,
+                                   const char *address)
 {
-  EphyCertificatePopoverPrivate *priv = popover->priv;
+  EphySecurityPopoverPrivate *priv = popover->priv;
   SoupURI *uri;
   char *label_text;
   char *uri_text;
@@ -81,20 +82,20 @@ ephy_certificate_popover_set_address (EphyCertificatePopover *popover,
 }
 
 static void
-ephy_certificate_popover_set_certificate (EphyCertificatePopover *popover,
-                                          GTlsCertificate *certificate)
+ephy_security_popover_set_certificate (EphySecurityPopover *popover,
+                                       GTlsCertificate *certificate)
 {
-  EphyCertificatePopoverPrivate *priv = popover->priv;
+  EphySecurityPopoverPrivate *priv = popover->priv;
 
   if (certificate)
     priv->certificate = g_object_ref (certificate);
 }
 
 static void
-ephy_certificate_popover_set_security_level (EphyCertificatePopover *popover,
-                                             EphySecurityLevel security_level)
+ephy_security_popover_set_security_level (EphySecurityPopover *popover,
+                                          EphySecurityLevel security_level)
 {
-  EphyCertificatePopoverPrivate *priv = popover->priv;
+  EphySecurityPopoverPrivate *priv = popover->priv;
   GIcon *icon;
   char *address_text;
   char *label_text = NULL;
@@ -148,8 +149,8 @@ static void
 certificate_button_clicked_cb (GtkButton *button,
                                gpointer user_data)
 {
-  EphyCertificatePopover *popover = EPHY_CERTIFICATE_POPOVER (user_data);
-  EphyCertificatePopoverPrivate *priv = popover->priv;
+  EphySecurityPopover *popover = EPHY_SECURITY_POPOVER (user_data);
+  EphySecurityPopoverPrivate *priv = popover->priv;
   GtkWidget *dialog;
 
   dialog = ephy_certificate_dialog_new (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (popover))),
@@ -167,13 +168,13 @@ certificate_button_clicked_cb (GtkButton *button,
 }
 
 static void
-ephy_certificate_popover_constructed (GObject *object)
+ephy_security_popover_constructed (GObject *object)
 {
-  EphyCertificatePopover *popover = EPHY_CERTIFICATE_POPOVER (object);
-  EphyCertificatePopoverPrivate *priv = popover->priv;
+  EphySecurityPopover *popover = EPHY_SECURITY_POPOVER (object);
+  EphySecurityPopoverPrivate *priv = popover->priv;
   GtkWidget *certificate_button;
 
-  G_OBJECT_CLASS (ephy_certificate_popover_parent_class)->constructed (object);
+  G_OBJECT_CLASS (ephy_security_popover_parent_class)->constructed (object);
 
   if (!priv->certificate)
     return;
@@ -192,46 +193,46 @@ ephy_certificate_popover_constructed (GObject *object)
 }
 
 static void
-ephy_certificate_popover_dispose (GObject *object)
+ephy_security_popover_dispose (GObject *object)
 {
-  EphyCertificatePopover *popover = EPHY_CERTIFICATE_POPOVER (object);
-  EphyCertificatePopoverPrivate *priv = popover->priv;
+  EphySecurityPopover *popover = EPHY_SECURITY_POPOVER (object);
+  EphySecurityPopoverPrivate *priv = popover->priv;
 
   g_clear_object (&priv->certificate);
 
-  G_OBJECT_CLASS (ephy_certificate_popover_parent_class)->dispose (object);
+  G_OBJECT_CLASS (ephy_security_popover_parent_class)->dispose (object);
 }
 
 static void
-ephy_certificate_popover_finalize (GObject *object)
+ephy_security_popover_finalize (GObject *object)
 {
-  EphyCertificatePopover *popover = EPHY_CERTIFICATE_POPOVER (object);
-  EphyCertificatePopoverPrivate *priv = popover->priv;
+  EphySecurityPopover *popover = EPHY_SECURITY_POPOVER (object);
+  EphySecurityPopoverPrivate *priv = popover->priv;
 
   g_free (priv->address);
   g_free (priv->hostname);
 
-  G_OBJECT_CLASS (ephy_certificate_popover_parent_class)->finalize (object);
+  G_OBJECT_CLASS (ephy_security_popover_parent_class)->finalize (object);
 }
 
 static void
-ephy_certificate_popover_set_property (GObject *object,
-                                       guint prop_id,
-                                       const GValue *value,
-                                       GParamSpec *pspec)
+ephy_security_popover_set_property (GObject *object,
+                                    guint prop_id,
+                                    const GValue *value,
+                                    GParamSpec *pspec)
 {
-  EphyCertificatePopover *popover = EPHY_CERTIFICATE_POPOVER (object);
-  EphyCertificatePopoverPrivate *priv = popover->priv;
+  EphySecurityPopover *popover = EPHY_SECURITY_POPOVER (object);
+  EphySecurityPopoverPrivate *priv = popover->priv;
 
   switch (prop_id) {
   case PROP_ADDRESS:
-    ephy_certificate_popover_set_address (popover, g_value_get_string (value));
+    ephy_security_popover_set_address (popover, g_value_get_string (value));
     break;
   case PROP_CERTIFICATE:
-    ephy_certificate_popover_set_certificate (popover, g_value_get_object (value));
+    ephy_security_popover_set_certificate (popover, g_value_get_object (value));
     break;
   case PROP_SECURITY_LEVEL:
-    ephy_certificate_popover_set_security_level (popover, g_value_get_enum (value));
+    ephy_security_popover_set_security_level (popover, g_value_get_enum (value));
     break;
   case PROP_TLS_ERRORS:
     priv->tls_errors = g_value_get_flags (value);
@@ -242,11 +243,11 @@ ephy_certificate_popover_set_property (GObject *object,
 }
 
 static void
-ephy_certificate_popover_get_preferred_width (GtkWidget *widget,
-                                              gint *minimum_width,
-                                              gint *natural_width)
+ephy_security_popover_get_preferred_width (GtkWidget *widget,
+                                           gint *minimum_width,
+                                           gint *natural_width)
 {
-  GTK_WIDGET_CLASS (ephy_certificate_popover_parent_class)->get_preferred_width (widget,
+  GTK_WIDGET_CLASS (ephy_security_popover_parent_class)->get_preferred_width (widget,
                                                                                  minimum_width,
                                                                                  natural_width);
 
@@ -255,20 +256,20 @@ ephy_certificate_popover_get_preferred_width (GtkWidget *widget,
 }
 
 static void
-ephy_certificate_popover_class_init (EphyCertificatePopoverClass *klass)
+ephy_security_popover_class_init (EphySecurityPopoverClass *klass)
 {
   GObjectClass *object_class = G_OBJECT_CLASS (klass);
   GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
 
-  object_class->constructed = ephy_certificate_popover_constructed;
-  object_class->dispose = ephy_certificate_popover_dispose;
-  object_class->finalize = ephy_certificate_popover_finalize;
-  object_class->set_property = ephy_certificate_popover_set_property;
+  object_class->constructed = ephy_security_popover_constructed;
+  object_class->dispose = ephy_security_popover_dispose;
+  object_class->finalize = ephy_security_popover_finalize;
+  object_class->set_property = ephy_security_popover_set_property;
 
-  widget_class->get_preferred_width = ephy_certificate_popover_get_preferred_width;
+  widget_class->get_preferred_width = ephy_security_popover_get_preferred_width;
 
   /**
-   * EphyCertificatePopover:address:
+   * EphySecurityPopover:address:
    *
    * The address of the website.
    */
@@ -283,7 +284,7 @@ ephy_certificate_popover_class_init (EphyCertificatePopoverClass *klass)
                                                         G_PARAM_STATIC_STRINGS));
 
   /**
-   * EphyCertificatePopover:certificate:
+   * EphySecurityPopover:certificate:
    *
    * The certificate of the website.
    */
@@ -298,7 +299,7 @@ ephy_certificate_popover_class_init (EphyCertificatePopoverClass *klass)
                                                         G_PARAM_STATIC_STRINGS));
 
   /**
-   * EphyCertificatePopover:tls-errors:
+   * EphySecurityPopover:tls-errors:
    *
    * Indicates issues with the security of the website.
    */
@@ -314,7 +315,7 @@ ephy_certificate_popover_class_init (EphyCertificatePopoverClass *klass)
                                                        G_PARAM_STATIC_STRINGS));
 
   /**
-   * EphyCertificatePopover:security-level:
+   * EphySecurityPopover:security-level:
    *
    * The state of the lock displayed in the address bar.
    */
@@ -331,11 +332,11 @@ ephy_certificate_popover_class_init (EphyCertificatePopoverClass *klass)
 }
 
 static void
-ephy_certificate_popover_init (EphyCertificatePopover *popover)
+ephy_security_popover_init (EphySecurityPopover *popover)
 {
-  EphyCertificatePopoverPrivate *priv;
+  EphySecurityPopoverPrivate *priv;
 
-  popover->priv = ephy_certificate_popover_get_instance_private (popover);
+  popover->priv = ephy_security_popover_get_instance_private (popover);
   priv = popover->priv;
 
   priv->grid = gtk_grid_new ();
@@ -360,15 +361,15 @@ ephy_certificate_popover_init (EphyCertificatePopover *popover)
   gtk_widget_show_all (priv->grid);
 }
 
-GtkWidget *ephy_certificate_popover_new (GtkWidget *relative_to,
-                                         const char *address,
-                                         GTlsCertificate *certificate,
-                                         GTlsCertificateFlags tls_errors,
-                                         EphySecurityLevel security_level)
+GtkWidget *ephy_security_popover_new (GtkWidget *relative_to,
+                                      const char *address,
+                                      GTlsCertificate *certificate,
+                                      GTlsCertificateFlags tls_errors,
+                                      EphySecurityLevel security_level)
 {
   g_return_val_if_fail (address != NULL, NULL);
 
-  return GTK_WIDGET (g_object_new (EPHY_TYPE_CERTIFICATE_POPOVER,
+  return GTK_WIDGET (g_object_new (EPHY_TYPE_SECURITY_POPOVER,
                                    "address", address,
                                    "certificate", certificate,
                                    "relative-to", relative_to,
diff --git a/lib/widgets/ephy-security-popover.h b/lib/widgets/ephy-security-popover.h
new file mode 100644
index 0000000..06e48c9
--- /dev/null
+++ b/lib/widgets/ephy-security-popover.h
@@ -0,0 +1,68 @@
+/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/*
+ *  Copyright © 2014, 2015 Igalia S.L.
+ *
+ *  This program 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 2, or (at your option)
+ *  any later version.
+ *
+ *  This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#if !defined (__EPHY_EPIPHANY_H_INSIDE__) && !defined (EPIPHANY_COMPILATION)
+#error "Only <epiphany/epiphany.h> can be included directly."
+#endif
+
+#ifndef EPHY_SECURITY_POPOVER_H
+#define EPHY_SECURITY_POPOVER_H
+
+#include <gio/gio.h>
+#include <gtk/gtk.h>
+
+#include "ephy-security-levels.h"
+
+G_BEGIN_DECLS
+
+#define EPHY_TYPE_SECURITY_POPOVER            (ephy_security_popover_get_type())
+#define EPHY_SECURITY_POPOVER(object)         (G_TYPE_CHECK_INSTANCE_CAST((object), 
EPHY_TYPE_SECURITY_POPOVER, EphySecurityPopover))
+#define EPHY_IS_SECURITY_POPOVER(object)      (G_TYPE_CHECK_INSTANCE_TYPE((object), 
EPHY_TYPE_SECURITY_POPOVER))
+#define EPHY_SECURITY_POPOVER_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass), EPHY_TYPE_SECURITY_POPOVER, 
EphySecurityPopoverClass))
+#define EPHY_IS_SECURITY_POPOVER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), EPHY_TYPE_SECURITY_POPOVER))
+#define EPHY_SECURITY_POPOVER_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj), EPHY_TYPE_SECURITY_POPOVER, 
EphySecurityPopoverClass))
+
+typedef struct _EphySecurityPopover        EphySecurityPopover;
+typedef struct _EphySecurityPopoverClass   EphySecurityPopoverClass;
+typedef struct _EphySecurityPopoverPrivate EphySecurityPopoverPrivate;
+
+struct _EphySecurityPopover
+{
+  GtkPopover parent_object;
+
+  /*< private >*/
+  EphySecurityPopoverPrivate *priv;
+};
+
+struct _EphySecurityPopoverClass
+{
+  GtkPopoverClass parent_class;
+};
+
+GType      ephy_security_popover_get_type (void);
+
+GtkWidget *ephy_security_popover_new      (GtkWidget *relative_to,
+                                           const char *address,
+                                           GTlsCertificate *certificate,
+                                           GTlsCertificateFlags tls_errors,
+                                           EphySecurityLevel security_level);
+
+G_END_DECLS
+
+#endif
diff --git a/src/ephy-window.c b/src/ephy-window.c
index 8103305..55f40cc 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -23,7 +23,6 @@
 
 #include "ephy-action-helper.h"
 #include "ephy-bookmarks-ui.h"
-#include "ephy-certificate-popover.h"
 #include "ephy-combined-stop-reload-action.h"
 #include "ephy-debug.h"
 #include "ephy-embed-container.h"
@@ -43,6 +42,7 @@
 #include "ephy-notebook.h"
 #include "ephy-prefs.h"
 #include "ephy-private.h"
+#include "ephy-security-popover.h"
 #include "ephy-session.h"
 #include "ephy-settings.h"
 #include "ephy-shell.h"
@@ -3153,9 +3153,9 @@ zoom_to_level_cb (GtkAction *action,
 }
 
 static void
-open_certificate_popover (EphyWindow *window,
-                         GtkWidget *relative_to,
-                         GdkRectangle *lock_position)
+open_security_popover (EphyWindow *window,
+                      GtkWidget *relative_to,
+                      GdkRectangle *lock_position)
 {
        EphyWindowPrivate *priv = window->priv;
        EphyWebView *view;
@@ -3163,22 +3163,22 @@ open_certificate_popover (EphyWindow *window,
        GTlsCertificateFlags tls_errors;
        EphySecurityLevel security_level;
        GtkWidget *location_entry;
-       GtkWidget *certificate_popover;
+       GtkWidget *security_popover;
 
        view = ephy_embed_get_web_view (priv->active_embed);
        ephy_web_view_get_security_level (view, &security_level, &certificate, &tls_errors);
        location_entry = ephy_toolbar_get_location_entry (EPHY_TOOLBAR (priv->toolbar));
 
-       certificate_popover = ephy_certificate_popover_new (relative_to,
-                                                           ephy_location_entry_get_location 
(EPHY_LOCATION_ENTRY (location_entry)),
-                                                           certificate,
-                                                           tls_errors,
-                                                           security_level);
+       security_popover = ephy_security_popover_new (relative_to,
+                                                     ephy_location_entry_get_location (EPHY_LOCATION_ENTRY 
(location_entry)),
+                                                     certificate,
+                                                     tls_errors,
+                                                     security_level);
 
-       g_signal_connect (certificate_popover, "closed",
+       g_signal_connect (security_popover, "closed",
                          G_CALLBACK (gtk_widget_destroy), NULL);
-       gtk_popover_set_pointing_to (GTK_POPOVER (certificate_popover), lock_position);
-       gtk_widget_show (certificate_popover);
+       gtk_popover_set_pointing_to (GTK_POPOVER (security_popover), lock_position);
+       gtk_widget_show (security_popover);
 }
 
 static void
@@ -3192,7 +3192,7 @@ location_controller_lock_clicked_cb (EphyLocationController *controller,
 
        location_entry = ephy_toolbar_get_location_entry (EPHY_TOOLBAR (priv->toolbar));
        gtk_entry_get_icon_area (GTK_ENTRY (location_entry), GTK_ENTRY_ICON_SECONDARY, &lock_position);
-       open_certificate_popover (window, location_entry, &lock_position);
+       open_security_popover (window, location_entry, &lock_position);
 }
 
 static void
@@ -3202,7 +3202,7 @@ title_box_lock_clicked_cb (EphyTitleBox *title_box,
 {
        EphyWindow *window = EPHY_WINDOW (user_data);
 
-       open_certificate_popover (window, GTK_WIDGET (title_box), lock_position);
+       open_security_popover (window, GTK_WIDGET (title_box), lock_position);
 }
 
 static GtkWidget *


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