[network-manager-applet/lr/vpn-scroll: 2/2] editor: scroll the VPN page




commit 1eaa5c251424fa665887f147c7292542aa56b715
Author: Lubomir Rintel <lkundrak v3 sk>
Date:   Mon Oct 25 09:26:40 2021 +0200

    editor: scroll the VPN page
    
    Some of the VPN pages are *insanely* long, such as strongswan. Add a
    scrolled window for it, so that the window still fits on the screen.

 src/connection-editor/nm-connection-editor.c | 25 +++++++++++++++++++++----
 1 file changed, 21 insertions(+), 4 deletions(-)
---
diff --git a/src/connection-editor/nm-connection-editor.c b/src/connection-editor/nm-connection-editor.c
index 8436e6c7..de3c16bf 100644
--- a/src/connection-editor/nm-connection-editor.c
+++ b/src/connection-editor/nm-connection-editor.c
@@ -736,8 +736,10 @@ static void
 page_initialized (CEPage *page, GError *error, gpointer user_data)
 {
        NMConnectionEditor *editor = NM_CONNECTION_EDITOR (user_data);
-       GtkWidget *widget, *parent;
        GtkNotebook *notebook;
+       GtkWidget *parent;
+       GtkWidget *scrolled;
+       GtkWidget *widget;
        GtkWidget *label;
        GList *children, *iter;
        gpointer order, child_order;
@@ -755,11 +757,29 @@ page_initialized (CEPage *page, GError *error, gpointer user_data)
        /* Add the page to the UI */
        notebook = GTK_NOTEBOOK (gtk_builder_get_object (editor->builder, "notebook"));
        label = gtk_label_new (ce_page_get_title (page));
+
        widget = ce_page_get_page (page);
        parent = gtk_widget_get_parent (widget);
        if (parent)
                gtk_container_remove (GTK_CONTAINER (parent), widget);
 
+       if (CE_IS_PAGE_VPN (page)) {
+               if (ce_page_vpn_can_export (CE_PAGE_VPN (page)))
+                       gtk_widget_show (editor->export_button);
+
+               scrolled = gtk_scrolled_window_new (NULL, NULL);
+               gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled), GTK_POLICY_NEVER, 
GTK_POLICY_AUTOMATIC);
+               gtk_container_add (GTK_CONTAINER (scrolled), widget);
+               gtk_widget_show (scrolled);
+               widget = scrolled;
+
+#if GTK_CHECK_VERSION(3,22,0)
+               NM_LIBNM_COMPAT_UNDEPRECATE (
+                       gtk_scrolled_window_set_propagate_natural_height (GTK_SCROLLED_WINDOW (scrolled),
+                                                                         TRUE));
+#endif
+       }
+
        order = g_object_get_data (G_OBJECT (page), ORDER_TAG);
        g_object_set_data (G_OBJECT (widget), ORDER_TAG, order);
 
@@ -773,9 +793,6 @@ page_initialized (CEPage *page, GError *error, gpointer user_data)
 
        gtk_notebook_insert_page (notebook, widget, label, i);
 
-       if (CE_IS_PAGE_VPN (page) && ce_page_vpn_can_export (CE_PAGE_VPN (page)))
-               gtk_widget_show (editor->export_button);
-
        /* Move the page from the initializing list to the main page list */
        editor->initializing_pages = g_slist_remove (editor->initializing_pages, page);
        editor->pages = g_slist_append (editor->pages, page);


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