Migrate plugins page to grid
authorRicardo Mones <ricardo@mones.org>
Thu, 15 Nov 2018 23:31:09 +0000 (00:31 +0100)
committerRicardo Mones <ricardo@mones.org>
Thu, 15 Nov 2018 23:31:09 +0000 (00:31 +0100)
clawsker

index 35bc2a1..dbfaa22 100755 (executable)
--- a/clawsker
+++ b/clawsker
@@ -2223,43 +2223,37 @@ sub new_accounts_page() {
 );
 
 sub new_plugins_page() {
-    my %frame = ();
-    $frame{'AttRemover'} =
-                new_subpage_frame (
-                     new_hbox_pack (
-                          new_text_box_for_int (\%pr::plu, 'arm_winw', $PLHPVALUE{'AttRemover'}),
-                          new_text_box_for_int (\%pr::plu, 'arm_winh', $PLHPVALUE{'AttRemover'})),
-                     _('Attachment remover'), 'not-packed');
-    $frame{'GPG'} =
-                new_subpage_frame (
-                     new_hbox_pack (
-                          new_text_box_for_int (\%pr::plu, 'gpg_alimit', $PLHPVALUE{'GPG'})),
-                     _('GPG'), 'not-packed');
-    $frame{'ManageSieve'} =
-                new_subpage_frame (
-                     new_hbox_pack (
-                          new_text_box_for_int (\%pr::plu, 'msv_winw', $PLHPVALUE{'ManageSieve'}),
-                          new_text_box_for_int (\%pr::plu, 'msv_winh', $PLHPVALUE{'ManageSieve'})),
-                     _('Sieve manager'), 'not-packed');
-    $frame{'Libravatar'} =
-                new_subpage_frame (
-                     new_hbox_pack (
-                          new_text_box_for_nchar (\%pr::plu, 'lav_burl', $PLHPVALUE{'Libravatar'})),
-                     _('Libravatar'), 'not-packed');
-    $frame{'PerlPlugin'} =
-                new_subpage_frame (
-                     new_hbox_pack (
-                          new_selection_box_for (\%pr::plu, 'prl_flvb', $PLHPVALUE{'PerlPlugin'})),
-                     _('Perl'), 'not-packed');
-    foreach (@PLUGINS) {
-        $frame{$_}->set_sensitive (defined $PLHPVALUE{$_});
+    my %widget = (
+        'AttRemover' => [
+            new_text_box_for_int (\%pr::plu, 'arm_winw', $PLHPVALUE{'AttRemover'}),
+            new_text_box_for_int (\%pr::plu, 'arm_winh', $PLHPVALUE{'AttRemover'})
+        ],
+        'GPG' => [
+            new_text_box_for_int (\%pr::plu, 'gpg_alimit', $PLHPVALUE{'GPG'})
+        ],
+        'ManageSieve' => [
+            new_text_box_for_int (\%pr::plu, 'msv_winw', $PLHPVALUE{'ManageSieve'}),
+            new_text_box_for_int (\%pr::plu, 'msv_winh', $PLHPVALUE{'ManageSieve'})
+        ],
+        'Libravatar' => [
+            new_text_box_for_nchar (\%pr::plu, 'lav_burl', $PLHPVALUE{'Libravatar'})
+        ],
+        'PerlPlugin' => [
+            new_selection_box_for (\%pr::plu, 'prl_flvb', $PLHPVALUE{'PerlPlugin'})
+        ]
+    );
+    foreach my $pk (@PLUGINS) {
+        foreach my $wg (@{$widget{$pk}}) {
+            $wg->set_sensitive (defined $PLHPVALUE{$pk});
+        }
     }
-    return new_vbox_pack (
-                $frame{'AttRemover'},
-                $frame{'GPG'},
-                $frame{'ManageSieve'},
-                $frame{'Libravatar'},
-                $frame{'PerlPlugin'});
+    return new_grid_pack (3, 14, [
+        [ _('Attachment remover') ], $widget{'AttRemover'}, [ '--' ],
+        [ _('GPG') ], $widget{'GPG'}, [ '--' ],
+        [ _('Sieve manager') ], $widget{'ManageSieve'}, [ '--' ],
+        [ _('Libravatar') ], $widget{'Libravatar'}, [ '--' ],
+        [ _('Perl') ], $widget{'PerlPlugin'}
+    ]);
 }
 
 use constant {