[evolution/tintou/plugins-preferences] plugin-manager: Make it a page in the preferences




commit 60c3a5826dab817c43b64b2d4cc1e5b007e840d6
Author: Corentin Noël <corentin noel collabora com>
Date:   Tue Jul 6 10:25:32 2021 +0200

    plugin-manager: Make it a page in the preferences
    
    Move the plugins preferences into the preferences window, allows to have one less
    dialog to look-at to configure evolution.

 data/icons/CMakeLists.txt                          |  1 +
 ...icolor_categories_48x48_preferences-plugins.svg | 43 ++++++++++
 .../plugin-manager/evolution-plugin-manager.c      | 97 +++++++---------------
 3 files changed, 75 insertions(+), 66 deletions(-)
---
diff --git a/data/icons/CMakeLists.txt b/data/icons/CMakeLists.txt
index 60235cf637..773a6f960f 100644
--- a/data/icons/CMakeLists.txt
+++ b/data/icons/CMakeLists.txt
@@ -103,6 +103,7 @@ set(private_icons
        hicolor_categories_48x48_preferences-composer.png
        hicolor_categories_48x48_preferences-mail.png
        hicolor_categories_48x48_preferences-mail-accounts.png
+       hicolor_categories_48x48_preferences-plugins.svg
        hicolor_categories_48x48_preferences-system-network-proxy.png
        hicolor_places_16x16_mail-inbox.png
        hicolor_places_16x16_mail-outbox.png
diff --git a/data/icons/hicolor_categories_48x48_preferences-plugins.svg 
b/data/icons/hicolor_categories_48x48_preferences-plugins.svg
new file mode 100644
index 0000000000..8749118860
--- /dev/null
+++ b/data/icons/hicolor_categories_48x48_preferences-plugins.svg
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+   version="1.1"
+   id="svg2"
+   width="51.200001"
+   height="51.200001"
+   viewBox="0 0 51.200001 51.200001"
+   xmlns:xlink="http://www.w3.org/1999/xlink";
+   xmlns="http://www.w3.org/2000/svg";
+   xmlns:svg="http://www.w3.org/2000/svg";>
+  <defs
+     id="defs6">
+    <linearGradient
+       xlink:href="#linearGradient3203"
+       id="linearGradient3917"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="matrix(0.47949058,0,0,0.47861213,-270.84046,232.18377)"
+       x1="592"
+       y1="-154"
+       x2="592"
+       y2="-183.62457" />
+    <linearGradient
+       id="linearGradient3203">
+      <stop
+         style="stop-color:#154d92;stop-opacity:1"
+         offset="0"
+         id="stop3199" />
+      <stop
+         style="stop-color:#2074db;stop-opacity:1"
+         offset="1"
+         id="stop3201" />
+    </linearGradient>
+  </defs>
+  <g
+     id="g8">
+    <path
+       id="path3913"
+       d="m 10.473545,9.2153279 0.73336,6.3112701 c 0.15336,1.31987 0.41717,2.63554 0.39321,3.96388 
-0.012,0.66417 -0.12225,1.34116 -0.44523,1.92371 -0.1615,0.29126 -0.37637,0.5557 -0.64182,0.75937 
-0.26545,0.203676 -0.5826,0.345136 -0.91591,0.387456 -0.54012,0.0686 -1.07796,-0.12197 -1.5748,-0.342276 
-0.4968397,-0.22032 -0.9892597,-0.477 -1.5283597,-0.553 -0.52629,-0.0742 -1.07294,0.0331 -1.54386,0.2769 
-0.47091,0.24381 -0.86656,0.620376 -1.15446,1.062076 -0.5758,0.88341 -0.70923,1.99441 -0.56624,3.03571 
0.10842,0.78949 0.37781,1.57739 0.90369,2.18124 0.26293,0.30193 0.58795,0.55355 0.95608,0.71576 
0.36812,0.16222 0.77976,0.23309 1.17976,0.18413 0.55504,-0.0679 1.05295,-0.35549 1.55686,-0.59529 
0.2519597,-0.1199 0.5106897,-0.22957 0.7824597,-0.2947 0.27176,-0.0651 0.55839,-0.0845 0.83117,-0.0236 
0.29424,0.0656 0.56363,0.22359 0.77889,0.43242 0.21527,0.20884 0.3779,0.46714 0.49344,0.74253 0.23107,0.55078 
0.27472,1.15838 0.30322,1.75397 0.17068,3.56708 -0.1022,7.15468 -0.81055,10.656
 45 2.4459,0.85498 4.96199,1.51369 7.51539,1.96755 0.84637,0.15043 1.72478,0.27742 2.55848,0.069 
0.41685,-0.1042 0.81611,-0.29423 1.13377,-0.58064 0.31766,-0.2864 0.54975,-0.67272 0.61548,-1.09269 
0.0491,-0.31366 0.006,-0.63664 -0.0893,-0.93987 -0.0948,-0.30324 -0.23974,-0.58881 -0.39602,-0.86608 
-0.31258,-0.55454 -0.67976,-1.0983 -0.80157,-1.72157 -0.1084,-0.55466 -0.009,-1.14088 0.24356,-1.64771 
0.25245,-0.50683 0.65264,-0.93543 1.12276,-1.25672 0.94024,-0.64261 2.1217,-0.84796 3.2648,-0.85714 
1.04722,-0.009 2.13007,0.14645 3.01888,0.69385 0.44441,0.27371 0.83215,0.64423 1.09442,1.09215 
0.26228,0.44793 0.39488,0.97466 0.34167,1.48951 -0.0409,0.39608 -0.18831,0.7745 -0.36818,1.13075 
-0.17987,0.35626 -0.39311,0.69512 -0.57787,1.04892 -0.18475,0.35381 -0.3422,0.72723 -0.39943,1.12134 
-0.0572,0.39411 -0.007,0.81296 0.19927,1.1547 0.147,0.24303 0.36671,0.43742 0.61003,0.58687 0.24332,0.14943 
0.51069,0.25639 0.78035,0.35198 1.73962,0.61659 3.64078,0.78179 5.46257,0.47467 1.8218,-0.30711 
 3.56005,-1.08585 4.99451,-2.23753 l -0.93079,-6.88961 c -0.16368,-1.21147 -0.41018,-2.42215 
-0.37743,-3.64396 0.0164,-0.61089 0.12246,-1.23066 0.41049,-1.77142 0.14401,-0.27039 0.33358,-0.51858 
0.56781,-0.718 0.23425,-0.19942 0.51399,-0.34916 0.81505,-0.41861 0.28715,-0.0662 0.58821,-0.0588 
0.87847,-0.008 0.29027,0.0513 0.57108,0.14543 0.84568,0.25159 0.54921,0.21233 1.08808,0.47659 1.67249,0.55471 
0.53999,0.0722 1.09885,-0.022 1.59271,-0.24968 0.49385,-0.22761 0.92257,-0.58604 1.24778,-1.01818 
0.6504,-0.86428 0.86958,-1.99946 0.73587,-3.06846 -0.10894,-0.871 -0.45149,-2.10408 -1.06191,-2.741466 
-0.30522,-0.31868 -0.6747,-0.57906 -1.08493,-0.74691 -0.41023,-0.16784 -0.86126,-0.24186 -1.30318,-0.19957 
-0.58833,0.0563 -1.1348,0.31124 -1.68674,0.52027 -0.27597,0.10453 -0.55736,0.19861 -0.84811,0.25099 
-0.29075,0.0524 -0.59223,0.0622 -0.88071,-9.9e-4 -0.4367,-0.0961 -0.82678,0.0157 -1.1094,-0.32702 
-0.28262,-0.34278 -0.46197,-0.7615 -0.55611,-1.19377 -0.18827,-0.86454 -0.0447,-1.76141 0
 .0828,-2.63675 0.42737,-2.93472 0.66797,-5.89601 0.71991,-8.8605301 -2.61078,-0.82852 -5.30205,-1.4090595 
-8.02469,-1.7310095 -0.8378,-0.0991 -1.70845,-0.17059 -2.50734,0.0977 -0.39945,0.13417 -0.77384,0.35501 
-1.05489,0.6659995 -0.28104,0.31098 -0.46385,0.71543 -0.47273,1.13231 -0.006,0.29375 0.0724,0.58507 
0.19632,0.85213 0.12391,0.2670701 0.29217,0.5117701 0.47174,0.7459101 0.35913,0.4683 0.7728,0.90993 
0.9982,1.45369 0.24733,0.59664 0.24319,1.28304 0.0297,1.8923 -0.21352,0.60927 -0.62828,1.14123 
-1.14354,1.5367 -0.51527,0.39546 -1.12793,0.65795 -1.76336,0.80394 -0.63544,0.146 -1.29395,0.17806 
-1.94522,0.14052 -1.05059,-0.0606 -2.12136,-0.31629 -2.96158,-0.94255 -0.42012,-0.31313 -0.77531,-0.71661 
-1.00359,-1.18518 -0.22829,-0.46855 -0.3261,-1.00302 -0.24827,-1.51735 0.10575,-0.69894 0.51658,-1.3086 
0.86265,-1.92702 0.17304,-0.3092 0.33283,-0.62831 0.43188,-0.9678301 0.099,-0.33952 0.13547,-0.7022 
0.0601,-1.04761 -0.0787,-0.36059 -0.27794,-0.69064 -0.54359,-0.9497 -0.26566,-0.259
 0695 -0.59567,-0.4490495 -0.94634,-0.5752795 -0.70134,-0.25248 -1.468,-0.25188 -2.21313,-0.20875 
-2.7737,0.16054 -5.51343,0.8746795 -8.00649,2.0869495 z"
+       
style="display:inline;fill:#62a0ea;fill-opacity:1;fill-rule:nonzero;stroke:url(#linearGradient3917);stroke-width:1;enable-background:new"
 />
+  </g>
+</svg>
diff --git a/src/modules/plugin-manager/evolution-plugin-manager.c 
b/src/modules/plugin-manager/evolution-plugin-manager.c
index bc72074be9..aafb739887 100644
--- a/src/modules/plugin-manager/evolution-plugin-manager.c
+++ b/src/modules/plugin-manager/evolution-plugin-manager.c
@@ -275,45 +275,27 @@ eppm_enable_toggled (GtkCellRendererToggle *renderer,
        gtk_tree_path_free (path);
 }
 
-static void
-action_plugin_manager_cb (GtkAction *action,
-                          EExtension *extension)
+static GtkWidget *
+plugins_page_new (EPreferencesWindow *window)
 {
        Manager *m;
        gint i;
-       GtkWidget *dialog;
-       GtkWidget *hbox, *w;
+       GtkWidget *vbox, *hbox, *w;
        GtkWidget *overview_page;
-       GtkWidget *content_area;
        GtkListStore *store;
        GtkTreeView *tree_view;
        GtkTreeSelection *selection;
+       GtkTreePath *path;
        GtkCellRenderer *renderer;
        GSList *plugins, *link;
        gchar *string;
        GtkWidget *subvbox;
-       EExtensible *extensible;
 
        m = g_malloc0 (sizeof (*m));
 
-       /* Retrieve the parent EShellWindow. */
-       extensible = e_extension_get_extensible (extension);
-
        /* Setup the ui */
-       dialog = gtk_dialog_new_with_buttons (
-               _("Plugin Manager"),
-               GTK_WINDOW (extensible),
-               GTK_DIALOG_DESTROY_WITH_PARENT,
-               _("_Close"), GTK_RESPONSE_CLOSE, NULL);
-
-       content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
-
-       gtk_window_set_default_size (GTK_WINDOW (dialog), 640, 400);
-       gtk_container_set_border_width (GTK_CONTAINER (dialog), 6);
-
        hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
        gtk_container_set_border_width (GTK_CONTAINER (hbox), 6);
-       gtk_box_pack_start (GTK_BOX (content_area), hbox, TRUE, TRUE, 0);
 
        string = g_markup_printf_escaped (
                "<i>%s</i>", _("Note: Some changes "
@@ -327,7 +309,9 @@ action_plugin_manager_cb (GtkAction *action,
        gtk_widget_show (w);
        g_free (string);
 
-       gtk_box_pack_start (GTK_BOX (content_area), w, FALSE, TRUE, 12);
+       vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
+       gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 0);
+       gtk_box_pack_start (GTK_BOX (vbox), w, FALSE, TRUE, 0);
 
        notebook = gtk_notebook_new ();
        gtk_notebook_set_show_tabs (GTK_NOTEBOOK (notebook), TRUE);
@@ -396,6 +380,8 @@ action_plugin_manager_cb (GtkAction *action,
                        COL_PLUGIN_CFG_WIDGET, cfg_widget, -1);
        }
 
+       g_slist_free_full (plugins, g_object_unref);
+
        /* setup the treeview */
        tree_view = GTK_TREE_VIEW (gtk_tree_view_new ());
        gtk_tree_view_set_reorderable (tree_view, FALSE);
@@ -489,25 +475,22 @@ action_plugin_manager_cb (GtkAction *action,
        gtk_widget_show_all (overview_page);
 
        selection = gtk_tree_view_get_selection (tree_view);
-       gtk_tree_selection_set_mode (selection, GTK_SELECTION_SINGLE);
-       g_signal_connect (
+       g_signal_connect_data (
                selection, "changed",
-               G_CALLBACK (eppm_selection_changed), m);
+               G_CALLBACK (eppm_selection_changed),
+               m, (GClosureNotify) g_free, 0);
+       gtk_tree_selection_set_mode (selection, GTK_SELECTION_BROWSE);
+
+       path = gtk_tree_path_new_first ();
+       gtk_tree_selection_select_path (selection, path);
+       gtk_tree_path_free (path);
 
        atk_object_set_name (
                gtk_widget_get_accessible (
                GTK_WIDGET (tree_view)), _("Plugin"));
 
-       gtk_dialog_run (GTK_DIALOG (dialog));
-
-       gtk_widget_destroy (dialog);
-
-       g_slist_foreach (plugins, (GFunc) g_object_unref, NULL);
-       g_slist_free (plugins);
-
        g_object_unref (store);
-
-       g_free (m);
+       return vbox;
 }
 
 static void
@@ -516,42 +499,24 @@ plugin_manager_constructed (GObject *object)
        EExtensible *extensible;
        EPluginManager *extension;
        EShellWindow *shell_window;
-       GtkActionGroup *action_group;
-       GtkUIManager *ui_manager;
-       GtkAction *action;
-       const gchar *action_name;
-       const gchar *action_label;
-       const gchar *action_tooltip;
-       const gchar *widget_path;
-       guint merge_id;
+       EShell *shell;
+       GtkWidget *preferences_window;
 
        extension = E_PLUGIN_MANAGER (object);
        extensible = e_extension_get_extensible (E_EXTENSION (extension));
 
        shell_window = E_SHELL_WINDOW (extensible);
-       action_group = E_SHELL_WINDOW_ACTION_GROUP_SHELL (shell_window);
-       ui_manager = e_shell_window_get_ui_manager (shell_window);
-       merge_id = gtk_ui_manager_new_merge_id (ui_manager);
-
-       action_name = "plugin-manager";
-       action_label = _("_Plugins");
-       action_tooltip = _("Enable and disable plugins");
-       widget_path = "/main-menu/edit-menu/administrative-actions";
-
-       action = gtk_action_new (
-               action_name, action_label, action_tooltip, NULL);
-
-       g_signal_connect (
-               action, "activate",
-               G_CALLBACK (action_plugin_manager_cb), extension);
-
-       gtk_action_group_add_action (action_group, action);
-
-       gtk_ui_manager_add_ui (
-               ui_manager, merge_id, widget_path, action_name,
-               action_name, GTK_UI_MANAGER_AUTO, FALSE);
-
-       g_object_unref (action);
+       shell = e_shell_window_get_shell (shell_window);
+       preferences_window = e_shell_get_preferences_window (shell);
+
+       e_preferences_window_add_page (
+               E_PREFERENCES_WINDOW (preferences_window),
+               "page-plugins",
+               "preferences-plugins",
+               _("Plugins"),
+               NULL,
+               (EPreferencesWindowCreatePageFn) plugins_page_new,
+               900);
 
        /* Chain up to parent's constructed() method. */
        G_OBJECT_CLASS (e_plugin_manager_parent_class)->constructed (object);


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