[epiphany/mcatanzaro/mobile-user-agent] Remove code to set mobile user agent



commit 11ae2fd23bdb1048eb0c01ee6c09748227c6b11a
Author: Michael Catanzaro <mcatanzaro gnome org>
Date:   Mon Jun 29 09:59:58 2020 -0500

    Remove code to set mobile user agent
    
    Apparently this never worked properly and needs to be done in WebKit
    instead. See:
    
    https://gitlab.gnome.org/GNOME/epiphany/-/merge_requests/601#note_853104

 lib/ephy-user-agent.c | 47 +----------------------------------------------
 lib/ephy-user-agent.h |  1 -
 src/ephy-shell.c      |  2 --
 3 files changed, 1 insertion(+), 49 deletions(-)
---
diff --git a/lib/ephy-user-agent.c b/lib/ephy-user-agent.c
index 631005193..4f7ecd0db 100644
--- a/lib/ephy-user-agent.c
+++ b/lib/ephy-user-agent.c
@@ -26,50 +26,6 @@
 
 #include <webkit2/webkit2.h>
 
-static gboolean mobile_user_agent = FALSE;
-static char *user_agent = NULL;
-
-void
-ephy_user_agent_init_sync (void)
-{
-  g_autoptr (GError) error = NULL;
-  g_autoptr (GDBusConnection) connection = NULL;
-  g_autoptr (GVariant) var = NULL;
-  g_autoptr (GVariant) v = NULL;
-  const char *chassis;
-
-  connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, &error);
-  if (!connection) {
-    g_debug ("Could not connect to system bus: %s", error->message);
-    return;
-  }
-
-  var = g_dbus_connection_call_sync (connection,
-                                     "org.freedesktop.hostname1",
-                                     "/org/freedesktop/hostname1",
-                                     "org.freedesktop.DBus.Properties",
-                                     "Get",
-                                     g_variant_new ("(ss)",
-                                                    "org.freedesktop.hostname1",
-                                                    "Chassis"),
-                                     NULL,
-                                     G_DBUS_CALL_FLAGS_NONE,
-                                     -1,
-                                     NULL,
-                                     &error);
-
-  if (!var) {
-    g_debug ("Could not access chassis property: %s", error->message);
-    return;
-  }
-
-  g_variant_get (var, "(v)", &v);
-  chassis = g_variant_get_string (v, NULL);
-  mobile_user_agent = g_strcmp0 (chassis, "handset") == 0;
-
-  g_clear_pointer (&user_agent, g_free);
-}
-
 const char *
 ephy_user_agent_get (void)
 {
@@ -89,9 +45,8 @@ ephy_user_agent_get (void)
   web_app = ephy_profile_dir_is_web_application ();
 
   settings = webkit_settings_new ();
-  user_agent = g_strdup_printf ("%s%s%s",
+  user_agent = g_strdup_printf ("%s%s",
                                 webkit_settings_get_user_agent (settings),
-                                mobile_user_agent ? " Mobile" : "",
                                 web_app ? " (Web App)" : "");
   g_object_unref (settings);
 
diff --git a/lib/ephy-user-agent.h b/lib/ephy-user-agent.h
index ce57b5315..353bbbb49 100644
--- a/lib/ephy-user-agent.h
+++ b/lib/ephy-user-agent.h
@@ -25,6 +25,5 @@
 G_BEGIN_DECLS
 
 const char *ephy_user_agent_get (void);
-void ephy_user_agent_init_sync (void);
 
 G_END_DECLS
diff --git a/src/ephy-shell.c b/src/ephy-shell.c
index 421588cac..972550cca 100644
--- a/src/ephy-shell.c
+++ b/src/ephy-shell.c
@@ -40,7 +40,6 @@
 #include "ephy-title-box.h"
 #include "ephy-title-widget.h"
 #include "ephy-type-builtins.h"
-#include "ephy-user-agent.h"
 #include "ephy-web-app-utils.h"
 #include "ephy-web-view.h"
 #include "ephy-window.h"
@@ -476,7 +475,6 @@ ephy_shell_startup (GApplication *application)
   G_APPLICATION_CLASS (ephy_shell_parent_class)->startup (application);
 
   /* We're not remoting; start our services */
-  ephy_user_agent_init_sync ();
 
   mode = ephy_embed_shell_get_mode (embed_shell);
   if (mode != EPHY_EMBED_SHELL_MODE_APPLICATION) {


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