/* * update_tabs_visibility: Hide tabs if there is only one tab * and the pref is not set or when in application mode. */ static void update_tabs_visibility (EphyNotebook *nb, gboolean before_inserting) { EphyEmbedShellMode mode; gboolean show_tabs = FALSE; guint num; EphyPrefsUITabsBarVisibilityPolicy policy; mode = ephy_embed_shell_get_mode (EPHY_EMBED_SHELL (ephy_shell_get_default ())); num = gtk_notebook_get_n_pages (GTK_NOTEBOOK (nb)); if (before_inserting) num++; policy = g_settings_get_enum (EPHY_SETTINGS_UI, EPHY_PREFS_UI_TABS_BAR_VISIBILITY_POLICY); if (mode != EPHY_EMBED_SHELL_MODE_APPLICATION && nb->adaptive_mode != EPHY_ADAPTIVE_MODE_NARROW && ((policy == EPHY_PREFS_UI_TABS_BAR_VISIBILITY_POLICY_MORE_THAN_ONE && num > 1) || policy == EPHY_PREFS_UI_TABS_BAR_VISIBILITY_POLICY_ALWAYS)) show_tabs = TRUE; /* Only show the tabs when the "tabs-allowed" property is TRUE. */ gtk_notebook_set_show_tabs (GTK_NOTEBOOK (nb), nb->tabs_allowed && show_tabs); }
static void ephy_embed_shell_constructed (GObject *object) { EphyEmbedShell *embed_shell; EphyEmbedShellPrivate *priv; G_OBJECT_CLASS (ephy_embed_shell_parent_class)->constructed (object); embed_shell = EPHY_EMBED_SHELL (object); priv = ephy_embed_shell_get_instance_private (embed_shell); /* These do not run the EmbedShell application instance, so make sure that there is a web context and a user content manager for them. */ if (ephy_embed_shell_get_mode (embed_shell) == EPHY_EMBED_SHELL_MODE_TEST || ephy_embed_shell_get_mode (embed_shell) == EPHY_EMBED_SHELL_MODE_SEARCH_PROVIDER) { ephy_embed_shell_create_web_context (embed_shell); priv->user_content = webkit_user_content_manager_new (); } }
static void webkit_pref_callback_user_agent (GSettings *settings, const char *key, gpointer data) { EphyEmbedShell *shell = ephy_embed_shell_get_default (); char *user_agent; if (ephy_embed_shell_get_mode (shell) == EPHY_EMBED_SHELL_MODE_APPLICATION) user_agent = g_strdup_printf ("%s (Web App)", ephy_user_agent_get_internal ()); else user_agent = g_strdup (ephy_user_agent_get_internal ()); webkit_settings_set_user_agent (webkit_settings, user_agent); g_free (user_agent); }
/** * ephy_title_box_set_address: * @title_box: an #EphyTitleBox * @address: (nullable): the URI to use for the subtitle of this #EphyTitleBox * * Sets the address of @title_box to @address */ void ephy_title_box_set_address (EphyTitleBox *title_box, const char *address) { EphyEmbedShellMode mode; g_return_if_fail (EPHY_IS_TITLE_BOX (title_box)); mode = ephy_embed_shell_get_mode (ephy_embed_shell_get_default ()); if (address == NULL || mode == EPHY_EMBED_SHELL_MODE_APPLICATION) { gtk_label_set_text (GTK_LABEL (title_box->subtitle), address); } else { gboolean rtl; char *subtitle; rtl = gtk_widget_get_default_direction () == GTK_TEXT_DIR_RTL; subtitle = g_strconcat (rtl ? "▾ " : address, rtl ? address : " ▾", NULL); gtk_label_set_text (GTK_LABEL (title_box->subtitle), subtitle); g_free (subtitle); } }
static void ephy_embed_shell_setup_process_model (EphyEmbedShell *shell) { EphyEmbedShellPrivate *priv = ephy_embed_shell_get_instance_private (shell); EphyPrefsProcessModel process_model; guint max_processes; if (ephy_embed_shell_get_mode (shell) == EPHY_EMBED_SHELL_MODE_APPLICATION) process_model = EPHY_PREFS_PROCESS_MODEL_SHARED_SECONDARY_PROCESS; else process_model = g_settings_get_enum (EPHY_SETTINGS_MAIN, EPHY_PREFS_PROCESS_MODEL); switch (process_model) { case EPHY_PREFS_PROCESS_MODEL_SHARED_SECONDARY_PROCESS: max_processes = 1; break; case EPHY_PREFS_PROCESS_MODEL_ONE_SECONDARY_PROCESS_PER_WEB_VIEW: max_processes = g_settings_get_uint (EPHY_SETTINGS_MAIN, EPHY_PREFS_MAX_PROCESSES); break; } webkit_web_context_set_process_model (priv->web_context, WEBKIT_PROCESS_MODEL_MULTIPLE_SECONDARY_PROCESSES); webkit_web_context_set_web_process_count_limit (priv->web_context, max_processes); }