[epiphany/wip/notification-permissions: 4/8] Rename EphyHostsManager to EphyPermissionsManager
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany/wip/notification-permissions: 4/8] Rename EphyHostsManager to EphyPermissionsManager
- Date: Mon, 30 Jan 2017 05:27:05 +0000 (UTC)
commit fb084ccb1eb88ba6a6b7274639bf0ce73dacc7f8
Author: Michael Catanzaro <mcatanzaro gnome org>
Date: Thu Dec 29 15:58:21 2016 -0600
Rename EphyHostsManager to EphyPermissionsManager
embed/ephy-embed-shell.c | 14 ++--
embed/ephy-embed-shell.h | 4 +-
embed/ephy-web-view.c | 85 ++++++++++----------
embed/web-extension/ephy-web-extension.c | 21 +++---
lib/Makefile.am | 4 +-
...-hosts-manager.c => ephy-permissions-manager.c} | 73 +++++++++--------
...-hosts-manager.h => ephy-permissions-manager.h} | 50 ++++++------
7 files changed, 125 insertions(+), 126 deletions(-)
---
diff --git a/embed/ephy-embed-shell.c b/embed/ephy-embed-shell.c
index 18dc8ee..7e18019 100644
--- a/embed/ephy-embed-shell.c
+++ b/embed/ephy-embed-shell.c
@@ -61,7 +61,7 @@ typedef struct {
EphyEmbedShellMode mode;
WebKitUserContentManager *user_content;
EphyDownloadsManager *downloads_manager;
- EphyHostsManager *hosts_manager;
+ EphyPermissionsManager *permissions_manager;
EphyAboutHandler *about_handler;
EphyViewSourceHandler *source_handler;
guint update_overview_timeout_id;
@@ -120,7 +120,7 @@ ephy_embed_shell_dispose (GObject *object)
g_clear_object (&priv->source_handler);
g_clear_object (&priv->user_content);
g_clear_object (&priv->downloads_manager);
- g_clear_object (&priv->hosts_manager);
+ g_clear_object (&priv->permissions_manager);
g_clear_object (&priv->web_context);
g_clear_object (&priv->dbus_server);
g_clear_object (&priv->filters_manager);
@@ -1428,12 +1428,12 @@ ephy_embed_shell_get_downloads_manager (EphyEmbedShell *shell)
return priv->downloads_manager;
}
-EphyHostsManager *
-ephy_embed_shell_get_hosts_manager (EphyEmbedShell *shell)
+EphyPermissionsManager *
+ephy_embed_shell_get_permissions_manager (EphyEmbedShell *shell)
{
EphyEmbedShellPrivate *priv = ephy_embed_shell_get_instance_private (shell);
- if (!priv->hosts_manager)
- priv->hosts_manager = ephy_hosts_manager_new ();
- return priv->hosts_manager;
+ if (!priv->permissions_manager)
+ priv->permissions_manager = ephy_permissions_manager_new ();
+ return priv->permissions_manager;
}
diff --git a/embed/ephy-embed-shell.h b/embed/ephy-embed-shell.h
index e327e7e..27f7219 100644
--- a/embed/ephy-embed-shell.h
+++ b/embed/ephy-embed-shell.h
@@ -24,7 +24,7 @@
#include <webkit2/webkit2.h>
#include "ephy-downloads-manager.h"
#include "ephy-history-service.h"
-#include "ephy-hosts-manager.h"
+#include "ephy-permissions-manager.h"
G_BEGIN_DECLS
@@ -78,6 +78,6 @@ void ephy_embed_shell_schedule_thumbnail_update (EphyEmbedShell
EphyHistoryURL *url);
WebKitUserContentManager *ephy_embed_shell_get_user_content_manager (EphyEmbedShell *shell);
EphyDownloadsManager *ephy_embed_shell_get_downloads_manager (EphyEmbedShell *shell);
-EphyHostsManager *ephy_embed_shell_get_hosts_manager (EphyEmbedShell *shell);
+EphyPermissionsManager *ephy_embed_shell_get_permissions_manager (EphyEmbedShell *shell);
G_END_DECLS
diff --git a/embed/ephy-web-view.c b/embed/ephy-web-view.c
index fe246b5..740183f 100644
--- a/embed/ephy-web-view.c
+++ b/embed/ephy-web-view.c
@@ -36,6 +36,7 @@
#include "ephy-form-auth-data.h"
#include "ephy-history-service.h"
#include "ephy-lib-type-builtins.h"
+#include "ephy-permissions-manager.h"
#include "ephy-prefs.h"
#include "ephy-settings.h"
#include "ephy-snapshot-service.h"
@@ -730,12 +731,12 @@ form_auth_data_save_confirmation_response (GtkInfoBar *info_bar,
if (response_id == GTK_RESPONSE_REJECT) {
EphyEmbedShell *shell = ephy_embed_shell_get_default ();
- EphyHostsManager *manager = ephy_embed_shell_get_hosts_manager (shell);
+ EphyPermissionsManager *manager = ephy_embed_shell_get_permissions_manager (shell);
- ephy_hosts_manager_set_permission_for_address (manager,
- EPHY_HOST_PERMISSION_TYPE_SAVE_PASSWORD,
- data->origin,
- EPHY_HOST_PERMISSION_DENY);
+ ephy_permissions_manager_set_permission_for_address (manager,
+ EPHY_PERMISSION_TYPE_SAVE_PASSWORD,
+ data->origin,
+ EPHY_PERMISSION_DENY);
}
g_object_weak_unref (G_OBJECT (info_bar), (GWeakNotify)form_auth_save_confirmation_info_bar_destroyed_cb,
data);
@@ -1336,7 +1337,7 @@ decide_on_permission_request (GtkWidget *info_bar,
PermissionRequestData *data)
{
const char *address;
- EphyHostPermissionType permission_type;
+ EphyPermissionType permission_type;
switch (response) {
case GTK_RESPONSE_YES:
@@ -1348,14 +1349,14 @@ decide_on_permission_request (GtkWidget *info_bar,
}
if (WEBKIT_IS_GEOLOCATION_PERMISSION_REQUEST (data->request)) {
- permission_type = EPHY_HOST_PERMISSION_TYPE_ACCESS_LOCATION;
+ permission_type = EPHY_PERMISSION_TYPE_ACCESS_LOCATION;
} else if (WEBKIT_IS_NOTIFICATION_PERMISSION_REQUEST (data->request)) {
- permission_type = EPHY_HOST_PERMISSION_TYPE_SHOW_NOTIFICATIONS;
+ permission_type = EPHY_PERMISSION_TYPE_SHOW_NOTIFICATIONS;
} else if (WEBKIT_IS_USER_MEDIA_PERMISSION_REQUEST (data->request)) {
if (webkit_user_media_permission_is_for_video_device (WEBKIT_USER_MEDIA_PERMISSION_REQUEST
(data->request)))
- permission_type = EPHY_HOST_PERMISSION_TYPE_ACCESS_WEBCAM;
+ permission_type = EPHY_PERMISSION_TYPE_ACCESS_WEBCAM;
else
- permission_type = EPHY_HOST_PERMISSION_TYPE_ACCESS_MICROPHONE;
+ permission_type = EPHY_PERMISSION_TYPE_ACCESS_MICROPHONE;
} else {
g_assert_not_reached ();
}
@@ -1364,16 +1365,16 @@ decide_on_permission_request (GtkWidget *info_bar,
if (response != GTK_RESPONSE_NONE && ephy_embed_utils_address_has_web_scheme (address)) {
EphyEmbedShell *shell;
- EphyHostsManager *hosts_manager;
+ EphyPermissionsManager *permissions_manager;
shell = ephy_embed_shell_get_default ();
- hosts_manager = ephy_embed_shell_get_hosts_manager (shell);
+ permissions_manager = ephy_embed_shell_get_permissions_manager (shell);
- ephy_hosts_manager_set_permission_for_address (hosts_manager,
- permission_type,
- data->origin,
- response == GTK_RESPONSE_YES ? EPHY_HOST_PERMISSION_ALLOW
- : EPHY_HOST_PERMISSION_DENY);
+ ephy_permissions_manager_set_permission_for_address (permissions_manager,
+ permission_type,
+ data->origin,
+ response == GTK_RESPONSE_YES ? EPHY_PERMISSION_ALLOW
+ :
EPHY_PERMISSION_DENY);
}
g_object_weak_unref (G_OBJECT (info_bar), (GWeakNotify)permission_request_info_bar_destroyed_cb, data);
@@ -1384,7 +1385,7 @@ decide_on_permission_request (GtkWidget *info_bar,
static void
show_permission_request_info_bar (WebKitWebView *web_view,
WebKitPermissionRequest *decision,
- EphyHostPermissionType permission_type)
+ EphyPermissionType permission_type)
{
PermissionRequestData *data;
GtkWidget *info_bar;
@@ -1408,27 +1409,27 @@ show_permission_request_info_bar (WebKitWebView *web_view,
return;
switch (permission_type) {
- case EPHY_HOST_PERMISSION_TYPE_SHOW_NOTIFICATIONS:
+ case EPHY_PERMISSION_TYPE_SHOW_NOTIFICATIONS:
/* Translators: Notification policy for a specific site. */
message = g_markup_printf_escaped (_("The page at <b>%s</b> wants to show desktop notifications."),
origin);
break;
- case EPHY_HOST_PERMISSION_TYPE_ACCESS_LOCATION:
+ case EPHY_PERMISSION_TYPE_ACCESS_LOCATION:
/* Translators: Geolocation policy for a specific site. */
message = g_markup_printf_escaped (_("The page at <b>%s</b> wants to know your location."),
origin);
break;
- case EPHY_HOST_PERMISSION_TYPE_ACCESS_MICROPHONE:
+ case EPHY_PERMISSION_TYPE_ACCESS_MICROPHONE:
/* Translators: Microphone policy for a specific site. */
message = g_markup_printf_escaped (_("The page at <b>%s</b> wants to use your microphone."),
origin);
break;
- case EPHY_HOST_PERMISSION_TYPE_ACCESS_WEBCAM:
+ case EPHY_PERMISSION_TYPE_ACCESS_WEBCAM:
/* Translators: Webcam policy for a specific site. */
message = g_markup_printf_escaped (_("The page at <b>%s</b> wants to use your webcam."),
origin);
break;
- case EPHY_HOST_PERMISSION_TYPE_SAVE_PASSWORD:
+ case EPHY_PERMISSION_TYPE_SAVE_PASSWORD:
default:
g_assert_not_reached ();
}
@@ -1453,19 +1454,19 @@ show_permission_request_info_bar (WebKitWebView *web_view,
g_free (origin);
switch (permission_type) {
- case EPHY_HOST_PERMISSION_TYPE_SHOW_NOTIFICATIONS:
+ case EPHY_PERMISSION_TYPE_SHOW_NOTIFICATIONS:
track_info_bar (info_bar, &EPHY_WEB_VIEW (web_view)->notification_info_bar);
break;
- case EPHY_HOST_PERMISSION_TYPE_ACCESS_LOCATION:
+ case EPHY_PERMISSION_TYPE_ACCESS_LOCATION:
track_info_bar (info_bar, &EPHY_WEB_VIEW (web_view)->geolocation_info_bar);
break;
- case EPHY_HOST_PERMISSION_TYPE_ACCESS_MICROPHONE:
+ case EPHY_PERMISSION_TYPE_ACCESS_MICROPHONE:
track_info_bar (info_bar, &EPHY_WEB_VIEW (web_view)->microphone_info_bar);
break;
- case EPHY_HOST_PERMISSION_TYPE_ACCESS_WEBCAM:
+ case EPHY_PERMISSION_TYPE_ACCESS_WEBCAM:
track_info_bar (info_bar, &EPHY_WEB_VIEW (web_view)->webcam_info_bar);
break;
- case EPHY_HOST_PERMISSION_TYPE_SAVE_PASSWORD:
+ case EPHY_PERMISSION_TYPE_SAVE_PASSWORD:
default:
g_assert_not_reached ();
}
@@ -1480,44 +1481,44 @@ permission_request_cb (WebKitWebView *web_view,
{
const char *address;
EphyEmbedShell *shell;
- EphyHostsManager *hosts_manager;
- EphyHostPermission permission;
- EphyHostPermissionType permission_type;
+ EphyPermissionsManager *permissions_manager;
+ EphyPermission permission;
+ EphyPermissionType permission_type;
shell = ephy_embed_shell_get_default ();
if (WEBKIT_IS_GEOLOCATION_PERMISSION_REQUEST (decision)) {
- permission_type = EPHY_HOST_PERMISSION_TYPE_ACCESS_LOCATION;
+ permission_type = EPHY_PERMISSION_TYPE_ACCESS_LOCATION;
} else if (WEBKIT_IS_NOTIFICATION_PERMISSION_REQUEST (decision)) {
/* Application mode implies being OK with notifications. */
if (ephy_embed_shell_get_mode (shell) == EPHY_EMBED_SHELL_MODE_APPLICATION) {
webkit_permission_request_allow (decision);
return TRUE;
}
- permission_type = EPHY_HOST_PERMISSION_TYPE_SHOW_NOTIFICATIONS;
+ permission_type = EPHY_PERMISSION_TYPE_SHOW_NOTIFICATIONS;
} else if (WEBKIT_IS_USER_MEDIA_PERMISSION_REQUEST (decision)) {
if (webkit_user_media_permission_is_for_video_device (WEBKIT_USER_MEDIA_PERMISSION_REQUEST (decision)))
- permission_type = EPHY_HOST_PERMISSION_TYPE_ACCESS_WEBCAM;
+ permission_type = EPHY_PERMISSION_TYPE_ACCESS_WEBCAM;
else
- permission_type = EPHY_HOST_PERMISSION_TYPE_ACCESS_MICROPHONE;
+ permission_type = EPHY_PERMISSION_TYPE_ACCESS_MICROPHONE;
} else {
return FALSE;
}
address = ephy_web_view_get_address (EPHY_WEB_VIEW (web_view));
- hosts_manager = ephy_embed_shell_get_hosts_manager (ephy_embed_shell_get_default ());
- permission = ephy_hosts_manager_get_permission_for_address (hosts_manager,
- permission_type,
- address);
+ permissions_manager = ephy_embed_shell_get_permissions_manager (ephy_embed_shell_get_default ());
+ permission = ephy_permissions_manager_get_permission_for_address (permissions_manager,
+ permission_type,
+ address);
switch (permission) {
- case EPHY_HOST_PERMISSION_ALLOW:
+ case EPHY_PERMISSION_ALLOW:
webkit_permission_request_allow (decision);
return TRUE;
- case EPHY_HOST_PERMISSION_DENY:
+ case EPHY_PERMISSION_DENY:
webkit_permission_request_deny (decision);
return TRUE;
- case EPHY_HOST_PERMISSION_UNDECIDED:
+ case EPHY_PERMISSION_UNDECIDED:
default:
break;
}
diff --git a/embed/web-extension/ephy-web-extension.c b/embed/web-extension/ephy-web-extension.c
index 5c35b33..99e9b6f 100644
--- a/embed/web-extension/ephy-web-extension.c
+++ b/embed/web-extension/ephy-web-extension.c
@@ -27,7 +27,7 @@
#include "ephy-embed-form-auth.h"
#include "ephy-file-helpers.h"
#include "ephy-form-auth-data.h"
-#include "ephy-hosts-manager.h"
+#include "ephy-permissions-manager.h"
#include "ephy-prefs.h"
#include "ephy-settings.h"
#include "ephy-uri-helpers.h"
@@ -54,7 +54,7 @@ struct _EphyWebExtension {
EphyFormAuthDataCache *form_auth_data_cache;
GHashTable *form_auth_data_save_requests;
EphyWebOverviewModel *overview_model;
- EphyHostsManager *hosts_manager;
+ EphyPermissionsManager *permissions_manager;
EphyUriTester *uri_tester;
};
@@ -374,7 +374,7 @@ should_store_cb (const char *username,
{
EphyEmbedFormAuth *form_auth = EPHY_EMBED_FORM_AUTH (user_data);
EphyWebExtension *web_extension;
- EphyHostPermission permission;
+ EphyPermission permission;
SoupURI *uri;
char *uri_string;
char *password_field_value = NULL;
@@ -385,11 +385,11 @@ should_store_cb (const char *username,
return;
web_extension = ephy_web_extension_get ();
- permission = ephy_hosts_manager_get_permission_for_address (web_extension->hosts_manager,
- EPHY_HOST_PERMISSION_TYPE_SAVE_PASSWORD,
- uri_string);
+ permission = ephy_permissions_manager_get_permission_for_address (web_extension->permissions_manager,
+ EPHY_PERMISSION_TYPE_SAVE_PASSWORD,
+ uri_string);
- if (permission == EPHY_HOST_PERMISSION_DENY) {
+ if (permission == EPHY_PERMISSION_DENY) {
LOG ("User/password storage permission previously denied. Not asking about storing.");
goto out;
}
@@ -412,7 +412,7 @@ should_store_cb (const char *username,
if (g_strcmp0 (username, username_field_value) == 0 &&
g_strcmp0 (password, password_field_value) == 0) {
LOG ("User/password already stored. Not asking about storing.");
- } else if (permission == EPHY_HOST_PERMISSION_ALLOW) {
+ } else if (permission == EPHY_PERMISSION_ALLOW) {
LOG ("User/password not yet stored. Storing.");
store_password (form_auth);
} else {
@@ -421,7 +421,6 @@ should_store_cb (const char *username,
}
g_free (username_field_value);
-
} else {
LOG ("No result on query; asking whether we should store.");
request_decision_on_storing (g_object_ref (form_auth));
@@ -1469,7 +1468,7 @@ ephy_web_extension_dispose (GObject *object)
g_clear_object (&extension->uri_tester);
g_clear_object (&extension->overview_model);
- g_clear_object (&extension->hosts_manager);
+ g_clear_object (&extension->permissions_manager);
g_clear_pointer (&extension->form_auth_data_cache,
ephy_form_auth_data_cache_free);
@@ -1585,7 +1584,7 @@ ephy_web_extension_initialize (EphyWebExtension *extension,
if (!is_private_profile)
extension->form_auth_data_cache = ephy_form_auth_data_cache_new ();
- extension->hosts_manager = ephy_hosts_manager_new ();
+ extension->permissions_manager = ephy_permissions_manager_new ();
g_signal_connect_swapped (extension->extension, "page-created",
G_CALLBACK (ephy_web_extension_page_created_cb),
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 784dc1c..fe29036 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -23,10 +23,10 @@ libephymisc_la_SOURCES = \
ephy-form-auth-data.h \
ephy-gui.c \
ephy-gui.h \
- ephy-hosts-manager.c \
- ephy-hosts-manager.h \
ephy-langs.c \
ephy-langs.h \
+ ephy-permissions-manager.c \
+ ephy-permissions-manager.h \
ephy-prefs.h \
ephy-profile-utils.c \
ephy-profile-utils.h \
diff --git a/lib/ephy-hosts-manager.c b/lib/ephy-permissions-manager.c
similarity index 61%
rename from lib/ephy-hosts-manager.c
rename to lib/ephy-permissions-manager.c
index 0ab3849..ab7a42d 100644
--- a/lib/ephy-hosts-manager.c
+++ b/lib/ephy-permissions-manager.c
@@ -1,6 +1,7 @@
/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/*
* Copyright © 2015 Gustavo Noronha Silva <gns gnome org>
+ * Copyright © 2016 Igalia S.L.
*
* This file is part of Epiphany.
*
@@ -19,7 +20,7 @@
*/
#include "config.h"
-#include "ephy-hosts-manager.h"
+#include "ephy-permissions-manager.h"
#include "ephy-file-helpers.h"
#include "ephy-string.h"
@@ -27,7 +28,7 @@
#define G_SETTINGS_ENABLE_BACKEND 1
#include <gio/gsettingsbackend.h>
-struct _EphyHostsManager
+struct _EphyPermissionsManager
{
GObject parent_instance;
@@ -35,36 +36,36 @@ struct _EphyHostsManager
GHashTable *settings_mapping;
};
-G_DEFINE_TYPE (EphyHostsManager, ephy_hosts_manager, G_TYPE_OBJECT)
+G_DEFINE_TYPE (EphyPermissionsManager, ephy_permissions_manager, G_TYPE_OBJECT)
static void
-ephy_hosts_manager_init (EphyHostsManager *manager)
+ephy_permissions_manager_init (EphyPermissionsManager *manager)
{
manager->hosts_mapping = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, g_object_unref);
manager->settings_mapping = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, g_free);
}
static void
-ephy_hosts_manager_dispose (GObject *object)
+ephy_permissions_manager_dispose (GObject *object)
{
- EphyHostsManager *manager = EPHY_HOSTS_MANAGER (object);
+ EphyPermissionsManager *manager = EPHY_PERMISSIONS_MANAGER (object);
g_clear_pointer (&manager->hosts_mapping, g_hash_table_destroy);
g_clear_pointer (&manager->settings_mapping, g_hash_table_destroy);
- G_OBJECT_CLASS (ephy_hosts_manager_parent_class)->dispose (object);
+ G_OBJECT_CLASS (ephy_permissions_manager_parent_class)->dispose (object);
}
static void
-ephy_hosts_manager_class_init (EphyHostsManagerClass *klass)
+ephy_permissions_manager_class_init (EphyPermissionsManagerClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- object_class->dispose = ephy_hosts_manager_dispose;
+ object_class->dispose = ephy_permissions_manager_dispose;
/**
- * EphyHostsManager::setting-changed:
- * @host_manager: the #EphyHostsManager that received the signal
+ * EphyPermissionsManager::setting-changed:
+ * @permissions_manager: the #EphyPermissionsManager that received the signal
* @host: the hostname for which the setting changed
* @key: the name of the key that changed
*
@@ -73,7 +74,7 @@ ephy_hosts_manager_class_init (EphyHostsManagerClass *klass)
* change on the UI for instance.
**/
g_signal_new ("setting-changed",
- EPHY_TYPE_HOSTS_MANAGER,
+ EPHY_TYPE_PERMISSIONS_MANAGER,
G_SIGNAL_RUN_FIRST,
0, NULL, NULL, NULL,
G_TYPE_NONE,
@@ -83,17 +84,17 @@ ephy_hosts_manager_class_init (EphyHostsManagerClass *klass)
}
static void
-setting_changed_cb (GSettings *settings,
- char *key,
- EphyHostsManager *manager)
+setting_changed_cb (GSettings *settings,
+ char *key,
+ EphyPermissionsManager *manager)
{
const char *host = g_hash_table_lookup (manager->settings_mapping, settings);
g_signal_emit_by_name (manager, "setting-changed", host, key);
}
static GSettings *
-ephy_hosts_manager_get_settings_for_address (EphyHostsManager *manager,
- const char *address)
+ephy_permissions_manager_get_settings_for_address (EphyPermissionsManager *manager,
+ const char *address)
{
char *host = ephy_string_get_host_name (address);
char *key_file = NULL;
@@ -129,46 +130,46 @@ ephy_hosts_manager_get_settings_for_address (EphyHostsManager *manager,
return settings;
}
-EphyHostsManager *
-ephy_hosts_manager_new (void)
+EphyPermissionsManager *
+ephy_permissions_manager_new (void)
{
- return EPHY_HOSTS_MANAGER (g_object_new (EPHY_TYPE_HOSTS_MANAGER, NULL));
+ return EPHY_PERMISSIONS_MANAGER (g_object_new (EPHY_TYPE_PERMISSIONS_MANAGER, NULL));
}
static const char *
-permission_type_to_string (EphyHostPermissionType type)
+permission_type_to_string (EphyPermissionType type)
{
switch (type) {
- case EPHY_HOST_PERMISSION_TYPE_SHOW_NOTIFICATIONS:
+ case EPHY_PERMISSION_TYPE_SHOW_NOTIFICATIONS:
return "notifications-permission";
- case EPHY_HOST_PERMISSION_TYPE_SAVE_PASSWORD:
+ case EPHY_PERMISSION_TYPE_SAVE_PASSWORD:
return "save-password-permission";
- case EPHY_HOST_PERMISSION_TYPE_ACCESS_LOCATION:
+ case EPHY_PERMISSION_TYPE_ACCESS_LOCATION:
return "geolocation-permission";
- case EPHY_HOST_PERMISSION_TYPE_ACCESS_MICROPHONE:
+ case EPHY_PERMISSION_TYPE_ACCESS_MICROPHONE:
return "audio-device-permission";
- case EPHY_HOST_PERMISSION_TYPE_ACCESS_WEBCAM:
+ case EPHY_PERMISSION_TYPE_ACCESS_WEBCAM:
return "video-device-permission";
default:
g_assert_not_reached ();
}
}
-EphyHostPermission
-ephy_hosts_manager_get_permission_for_address (EphyHostsManager *manager,
- EphyHostPermissionType type,
- const char *address)
+EphyPermission
+ephy_permissions_manager_get_permission_for_address (EphyPermissionsManager *manager,
+ EphyPermissionType type,
+ const char *address)
{
- GSettings *settings = ephy_hosts_manager_get_settings_for_address (manager, address);
+ GSettings *settings = ephy_permissions_manager_get_settings_for_address (manager, address);
return g_settings_get_enum (settings, permission_type_to_string (type));
}
void
-ephy_hosts_manager_set_permission_for_address (EphyHostsManager *manager,
- EphyHostPermissionType type,
- const char *address,
- EphyHostPermission permission)
+ephy_permissions_manager_set_permission_for_address (EphyPermissionsManager *manager,
+ EphyPermissionType type,
+ const char *address,
+ EphyPermission permission)
{
- GSettings *settings = ephy_hosts_manager_get_settings_for_address (manager, address);
+ GSettings *settings = ephy_permissions_manager_get_settings_for_address (manager, address);
g_settings_set_enum (settings, permission_type_to_string (type), permission);
}
diff --git a/lib/ephy-hosts-manager.h b/lib/ephy-permissions-manager.h
similarity index 52%
rename from lib/ephy-hosts-manager.h
rename to lib/ephy-permissions-manager.h
index 9472c58..75fe2bf 100644
--- a/lib/ephy-hosts-manager.h
+++ b/lib/ephy-permissions-manager.h
@@ -1,6 +1,7 @@
/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/*
* Copyright © 2015 Gustavo Noronha Silva <gns gnome org>
+ * Copyright © 2016 Igalia S.L.
*
* This file is part of Epiphany.
*
@@ -18,40 +19,37 @@
* along with Epiphany. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef EPHY_HOSTS_MANAGER_H
-#define EPHY_HOSTS_MANAGER_H
+#pragma once
#include <glib-object.h>
G_BEGIN_DECLS
-#define EPHY_TYPE_HOSTS_MANAGER (ephy_hosts_manager_get_type ())
+#define EPHY_TYPE_PERMISSIONS_MANAGER (ephy_permissions_manager_get_type ())
-G_DECLARE_FINAL_TYPE (EphyHostsManager, ephy_hosts_manager, EPHY, HOSTS_MANAGER, GObject)
+G_DECLARE_FINAL_TYPE (EphyPermissionsManager, ephy_permissions_manager, EPHY, PERMISSIONS_MANAGER, GObject)
typedef enum {
- EPHY_HOST_PERMISSION_UNDECIDED = -1,
- EPHY_HOST_PERMISSION_DENY = 0,
- EPHY_HOST_PERMISSION_ALLOW = 1,
-} EphyHostPermission;
+ EPHY_PERMISSION_UNDECIDED = -1,
+ EPHY_PERMISSION_DENY = 0,
+ EPHY_PERMISSION_ALLOW = 1,
+} EphyPermission;
typedef enum {
- EPHY_HOST_PERMISSION_TYPE_SHOW_NOTIFICATIONS,
- EPHY_HOST_PERMISSION_TYPE_SAVE_PASSWORD,
- EPHY_HOST_PERMISSION_TYPE_ACCESS_LOCATION,
- EPHY_HOST_PERMISSION_TYPE_ACCESS_MICROPHONE,
- EPHY_HOST_PERMISSION_TYPE_ACCESS_WEBCAM
-} EphyHostPermissionType;
-
-EphyHostsManager* ephy_hosts_manager_new (void);
-
-EphyHostPermission ephy_hosts_manager_get_permission_for_address (EphyHostsManager *manager,
- EphyHostPermissionType type,
- const char *address);
-void ephy_hosts_manager_set_permission_for_address (EphyHostsManager *manager,
- EphyHostPermissionType type,
- const char *address,
- EphyHostPermission permission);
+ EPHY_PERMISSION_TYPE_SHOW_NOTIFICATIONS,
+ EPHY_PERMISSION_TYPE_SAVE_PASSWORD,
+ EPHY_PERMISSION_TYPE_ACCESS_LOCATION,
+ EPHY_PERMISSION_TYPE_ACCESS_MICROPHONE,
+ EPHY_PERMISSION_TYPE_ACCESS_WEBCAM
+} EphyPermissionType;
+
+EphyPermissionsManager *ephy_permissions_manager_new (void);
+
+EphyPermission ephy_permissions_manager_get_permission_for_address (EphyPermissionsManager *manager,
+ EphyPermissionType type,
+ const char
*address);
+void ephy_permissions_manager_set_permission_for_address (EphyPermissionsManager *manager,
+ EphyPermissionType type,
+ const char *address,
+ EphyPermission
permission);
G_END_DECLS
-
-#endif /* EPHY_HOSTS_MANAGER_H */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]