public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH installer 0/4] Drop deprecated GTK 3 methods
@ 2023-06-15 12:14 Maximiliano Sandoval
  2023-06-15 12:15 ` [pve-devel] [PATCH installer 1/4] stop using Gtk3::Misc->set_alignment Maximiliano Sandoval
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Maximiliano Sandoval @ 2023-06-15 12:14 UTC (permalink / raw)
  To: pve-devel

Small series of patches to drop the use of properties and methods that were
deprecated in GTK 3.

Maximiliano Sandoval (4):
  stop using Gtk3::Misc->set_alignment
  stop using Gtk3::HBox and Gtk3::VBox
  stop using Gtk3::HSeparator
  stop using Gtk3::Window->set_has_resize_grip

 proxinstall | 84 ++++++++++++++++++++++++++---------------------------
 1 file changed, 42 insertions(+), 42 deletions(-)

-- 
2.39.2





^ permalink raw reply	[flat|nested] 6+ messages in thread

* [pve-devel] [PATCH installer 1/4] stop using Gtk3::Misc->set_alignment
  2023-06-15 12:14 [pve-devel] [PATCH installer 0/4] Drop deprecated GTK 3 methods Maximiliano Sandoval
@ 2023-06-15 12:15 ` Maximiliano Sandoval
  2023-06-15 12:15 ` [pve-devel] [PATCH installer 2/4] stop using Gtk3::HBox and Gtk3::VBox Maximiliano Sandoval
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Maximiliano Sandoval @ 2023-06-15 12:15 UTC (permalink / raw)
  To: pve-devel

This was deprecated in GTK 3.14, instead we use
GtkLabel:{xalign,yalign}. Note that by default they are both set to 0.5.

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
---
 proxinstall | 23 +++++++++++------------
 1 file changed, 11 insertions(+), 12 deletions(-)

diff --git a/proxinstall b/proxinstall
index d385bc5..00b2d14 100755
--- a/proxinstall
+++ b/proxinstall
@@ -1612,7 +1612,7 @@ sub create_text_input {
 
     my $label = Gtk3::Label->new($text);
     $label->set_size_request(150, -1);
-    $label->set_alignment(1, 0.5);
+    $label->set_xalign(1.0);
     $hbox->pack_start($label, 0, 0, 10);
     my $e1 = Gtk3::Entry->new();
     $e1->set_width_chars(35);
@@ -1628,7 +1628,7 @@ sub create_cidr_inputs {
 
     my $label = Gtk3::Label->new('IP Address (CIDR)');
     $label->set_size_request(150, -1);
-    $label->set_alignment(1, 0.5);
+    $label->set_xalign(1.0);
     $hbox->pack_start($label, 0, 0, 10);
 
     my $ip_el = Gtk3::Entry->new();
@@ -1638,7 +1638,6 @@ sub create_cidr_inputs {
 
     $label = Gtk3::Label->new('/');
     $label->set_size_request(10, -1);
-    $label->set_alignment(0.5, 0.5);
     $hbox->pack_start($label, 0, 0, 2);
 
     my $cidr_el = Gtk3::Entry->new();
@@ -1745,7 +1744,7 @@ sub create_ipconf_view {
     my $devicebox = Gtk3::HBox->new(0, 0);
     my $label = Gtk3::Label->new("Management Interface:");
     $label->set_size_request(150, -1);
-    $label->set_alignment(1, 0.5);
+    $label->set_xalign(1.0);
     $devicebox->pack_start($label, 0, 0, 10);
     $devicebox->pack_start($device_cb, 0, 0, 0);
 
@@ -2009,7 +2008,7 @@ sub create_password_view {
     my $hbox1 = Gtk3::HBox->new(0, 0);
     my $label = Gtk3::Label->new("Password");
     $label->set_size_request(150, -1);
-    $label->set_alignment(1, 0.5);
+    $label->set_xalign(1.0);
     $hbox1->pack_start($label, 0, 0, 10);
     my $pwe1 = Gtk3::Entry->new();
     $pwe1->set_visibility(0);
@@ -2020,7 +2019,7 @@ sub create_password_view {
     my $hbox2 = Gtk3::HBox->new(0, 0);
     $label = Gtk3::Label->new("Confirm");
     $label->set_size_request(150, -1);
-    $label->set_alignment(1, 0.5);
+    $label->set_xalign(1.0);
     $hbox2->pack_start($label, 0, 0, 10);
     my $pwe2 = Gtk3::Entry->new();
     $pwe2->set_visibility(0);
@@ -2031,7 +2030,7 @@ sub create_password_view {
     my $hbox3 = Gtk3::HBox->new(0, 0);
     $label = Gtk3::Label->new("Email");
     $label->set_size_request(150, -1);
-    $label->set_alignment(1, 0.5);
+    $label->set_xalign(1.0);
     $hbox3->pack_start($label, 0, 0, 10);
     my $eme = Gtk3::Entry->new();
     $eme->set_size_request(200, -1);
@@ -2113,14 +2112,14 @@ sub create_country_view {
     my $hbox2 = Gtk3::HBox->new(0, 0);
     my $label = Gtk3::Label->new("Time zone");
     $label->set_size_request(150, -1);
-    $label->set_alignment(1, 0.5);
+    $label->set_xalign(1.0);
     $hbox2->pack_start($label, 0, 0, 10);
     update_zonelist ($hbox2);
 
     my $hbox3 = Gtk3::HBox->new(0, 0);
     $label = Gtk3::Label->new("Keyboard Layout");
     $label->set_size_request(150, -1);
-    $label->set_alignment(1, 0.5);
+    $label->set_xalign(1.0);
     $hbox3->pack_start($label, 0, 0, 10);
 
     my $kmapcb = Gtk3::ComboBoxText->new();
@@ -2231,7 +2230,7 @@ sub create_country_view {
     my $hbox =  Gtk3::HBox->new(0, 0);
 
     $label = Gtk3::Label->new("Country");
-    $label->set_alignment(1, 0.5);
+    $label->set_xalign(1.0);
     $label->set_size_request(150, -1);
     $hbox->pack_start($label, 0, 0, 10);
     $hbox->pack_start($w, 0, 0, 0);
@@ -2295,7 +2294,7 @@ my $create_label_widget_grid = sub {
 	my $widget = @$labeled_widgets[$i+1];
 	my $label = Gtk3::Label->new(@$labeled_widgets[$i]);
 	$label->set_visible(1);
-	$label->set_alignment (1, 0.5);
+	$label->set_xalign(1.0);
 	$grid->attach($label, 0, $row, 1, 1);
 	$widget->set_visible(1);
 	$grid->attach($widget, 1, $row, 1, 1);
@@ -2523,7 +2522,7 @@ sub create_hdoption_view {
 
     # Filesystem type
     my $label0 = Gtk3::Label->new("Filesystem");
-    $label0->set_alignment (1, 0.5);
+    $label0->set_xalign(1.0);
     $grid->attach($label0, 0, $row, 1, 1);
 
     my $fstypecb = Gtk3::ComboBoxText->new();
-- 
2.39.2





^ permalink raw reply	[flat|nested] 6+ messages in thread

* [pve-devel] [PATCH installer 2/4] stop using Gtk3::HBox and Gtk3::VBox
  2023-06-15 12:14 [pve-devel] [PATCH installer 0/4] Drop deprecated GTK 3 methods Maximiliano Sandoval
  2023-06-15 12:15 ` [pve-devel] [PATCH installer 1/4] stop using Gtk3::Misc->set_alignment Maximiliano Sandoval
@ 2023-06-15 12:15 ` Maximiliano Sandoval
  2023-06-15 12:15 ` [pve-devel] [PATCH installer 3/4] stop using Gtk3::HSeparator Maximiliano Sandoval
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Maximiliano Sandoval @ 2023-06-15 12:15 UTC (permalink / raw)
  To: pve-devel

These widgets were deprecated in GTK 3.2 and replaced by Gtk3::Box which
was introduced in 3.0.

The packing changes require to horizontally expand the WebKit2::WebView
widget.

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
---
 proxinstall | 49 +++++++++++++++++++++++++------------------------
 1 file changed, 25 insertions(+), 24 deletions(-)

diff --git a/proxinstall b/proxinstall
index 00b2d14..105904f 100755
--- a/proxinstall
+++ b/proxinstall
@@ -1493,7 +1493,7 @@ sub create_main_window {
     $window->fullscreen() if !is_test_mode();
     $window->set_decorated(0) if !is_test_mode();
 
-    my $vbox = Gtk3::VBox->new(0, 0);
+    my $vbox = Gtk3::Box->new('vertical', 0);
 
     my $logofn = "$env->{product}-banner.png";
     my $image = Gtk3::Image->new_from_file("${proxmox_libdir}/$logofn");
@@ -1506,7 +1506,7 @@ sub create_main_window {
 
     $vbox->pack_start($image, 0, 0, 0);
 
-    my $hbox = Gtk3::HBox->new(0, 0);
+    my $hbox = Gtk3::Box->new('horizontal', 0);
     $vbox->pack_start($hbox, 1, 1, 0);
 
  #  my $f1 = Gtk3::Frame->new ('test');
@@ -1516,7 +1516,7 @@ sub create_main_window {
     my $sep1 = Gtk3::HSeparator->new();
     $vbox->pack_start($sep1, 0, 0, 0);
 
-    $cmdbox = Gtk3::HBox->new();
+    $cmdbox = Gtk3::Box->new('horizontal', 0);
     $vbox->pack_start($cmdbox, 0, 0, 10);
 
     $next = Gtk3::Button->new('_Next');
@@ -1534,25 +1534,26 @@ sub create_main_window {
     $cmdbox->pack_start($abort, 0, 0, 10);
     $abort->signal_connect(clicked => sub { exit (-1); });
 
-    my $vbox2 = Gtk3::VBox->new(0, 0);
+    my $vbox2 = Gtk3::Box->new('vertical', 0);
     $hbox->add($vbox2);
 
     $htmlview = Gtk3::WebKit2::WebView->new();
+    $htmlview->set_hexpand(1);
     my $scrolls = Gtk3::ScrolledWindow->new();
     $scrolls->add($htmlview);
 
-    my $hbox2 = Gtk3::HBox->new(0, 0);
+    my $hbox2 = Gtk3::Box->new('horizontal', 0);
     $hbox2->pack_start($scrolls, 1, 1, 0);
 
     $vbox2->pack_start($hbox2, 1, 1, 0);
 
-    my $vbox3 = Gtk3::VBox->new(0, 0);
+    my $vbox3 = Gtk3::Box->new('vertical', 0);
     $vbox2->pack_start($vbox3, 0, 0, 0);
 
     my $sep2 = Gtk3::HSeparator->new;
     $vbox3->pack_start($sep2, 0, 0, 0);
 
-    $inbox = Gtk3::HBox->new(0, 0);
+    $inbox = Gtk3::Box->new('horizontal', 0);
     $vbox3->pack_start($inbox, 0, 0, 0);
 
     $window->add($vbox);
@@ -1741,7 +1742,7 @@ sub create_ipconf_view {
 	$device_cb->set_active(0);
     }
 
-    my $devicebox = Gtk3::HBox->new(0, 0);
+    my $devicebox = Gtk3::Box->new('horizontal', 0);
     my $label = Gtk3::Label->new("Management Interface:");
     $label->set_size_request(150, -1);
     $label->set_xalign(1.0);
@@ -1861,7 +1862,7 @@ sub create_ack_view {
 
     cleanup_view();
 
-    my $vbox =  Gtk3::VBox->new(0, 0);
+    my $vbox =  Gtk3::Box->new('vertical', 0);
     $inbox->pack_start($vbox, 1, 0, 0);
 
     my $reboot_checkbox = Gtk3::CheckButton->new('Automatically reboot after successful installation');
@@ -2000,12 +2001,12 @@ sub create_password_view {
 
     cleanup_view();
 
-    my $vbox2 =  Gtk3::VBox->new(0, 0);
+    my $vbox2 =  Gtk3::Box->new('vertical', 0);
     $inbox->pack_start($vbox2, 1, 0, 0);
-    my $vbox =  Gtk3::VBox->new(0, 0);
+    my $vbox =  Gtk3::Box->new('vertical', 0);
     $vbox2->pack_start($vbox, 0, 0, 10);
 
-    my $hbox1 = Gtk3::HBox->new(0, 0);
+    my $hbox1 = Gtk3::Box->new('horizontal', 0);
     my $label = Gtk3::Label->new("Password");
     $label->set_size_request(150, -1);
     $label->set_xalign(1.0);
@@ -2016,7 +2017,7 @@ sub create_password_view {
     $pwe1->set_size_request(200, -1);
     $hbox1->pack_start($pwe1, 0, 0, 0);
 
-    my $hbox2 = Gtk3::HBox->new(0, 0);
+    my $hbox2 = Gtk3::Box->new('horizontal', 0);
     $label = Gtk3::Label->new("Confirm");
     $label->set_size_request(150, -1);
     $label->set_xalign(1.0);
@@ -2027,7 +2028,7 @@ sub create_password_view {
     $pwe2->set_size_request(200, -1);
     $hbox2->pack_start($pwe2, 0, 0, 0);
 
-    my $hbox3 = Gtk3::HBox->new(0, 0);
+    my $hbox3 = Gtk3::Box->new('horizontal', 0);
     $label = Gtk3::Label->new("Email");
     $label->set_size_request(150, -1);
     $label->set_xalign(1.0);
@@ -2095,9 +2096,9 @@ sub create_country_view {
 
     my $locales = $env->{locales};
 
-    my $vbox2 =  Gtk3::VBox->new(0, 0);
+    my $vbox2 =  Gtk3::Box->new('vertical', 0);
     $inbox->pack_start($vbox2, 1, 0, 0);
-    my $vbox =  Gtk3::VBox->new(0, 0);
+    my $vbox =  Gtk3::Box->new('vertical', 0);
     $vbox2->pack_start($vbox, 0, 0, 10);
 
     my $w = Gtk3::Entry->new();
@@ -2109,14 +2110,14 @@ sub create_country_view {
     $c->set_popup_set_width(1);
     $c->set_inline_completion(1);
 
-    my $hbox2 = Gtk3::HBox->new(0, 0);
+    my $hbox2 = Gtk3::Box->new('horizontal', 0);
     my $label = Gtk3::Label->new("Time zone");
     $label->set_size_request(150, -1);
     $label->set_xalign(1.0);
     $hbox2->pack_start($label, 0, 0, 10);
     update_zonelist ($hbox2);
 
-    my $hbox3 = Gtk3::HBox->new(0, 0);
+    my $hbox3 = Gtk3::Box->new('horizontal', 0);
     $label = Gtk3::Label->new("Keyboard Layout");
     $label->set_size_request(150, -1);
     $label->set_xalign(1.0);
@@ -2227,7 +2228,7 @@ sub create_country_view {
 
     $w->set_completion ($c);
 
-    my $hbox =  Gtk3::HBox->new(0, 0);
+    my $hbox =  Gtk3::Box->new('horizontal', 0);
 
     $label = Gtk3::Label->new("Country");
     $label->set_xalign(1.0);
@@ -2855,9 +2856,9 @@ sub create_hdsel_view {
 
     cleanup_view();
 
-    my $vbox =  Gtk3::VBox->new(0, 0);
+    my $vbox =  Gtk3::Box->new('vertical', 0);
     $inbox->pack_start($vbox, 1, 0, 0);
-    my $hbox =  Gtk3::HBox->new(0, 0);
+    my $hbox =  Gtk3::Box->new('horizontal', 0);
     $vbox->pack_start($hbox, 0, 0, 10);
 
     my $cached_disks = get_cached_disks();
@@ -2942,12 +2943,12 @@ sub create_extract_view {
     $prev_btn->set_sensitive(0);
     $prev_btn->hide();
 
-    my $vbox =  Gtk3::VBox->new(0, 0);
+    my $vbox =  Gtk3::Box->new('vertical', 0);
     $inbox->pack_start ($vbox, 1, 0, 0);
-    my $hbox =  Gtk3::HBox->new(0, 0);
+    my $hbox =  Gtk3::Box->new('horizontal', 0);
     $vbox->pack_start ($hbox, 0, 0, 10);
 
-    my $vbox2 =  Gtk3::VBox->new(0, 0);
+    my $vbox2 =  Gtk3::Box->new('vertical', 0);
     $hbox->pack_start ($vbox2, 0, 0, 0);
 
     $progress_status = Gtk3::Label->new('');
-- 
2.39.2





^ permalink raw reply	[flat|nested] 6+ messages in thread

* [pve-devel] [PATCH installer 3/4] stop using Gtk3::HSeparator
  2023-06-15 12:14 [pve-devel] [PATCH installer 0/4] Drop deprecated GTK 3 methods Maximiliano Sandoval
  2023-06-15 12:15 ` [pve-devel] [PATCH installer 1/4] stop using Gtk3::Misc->set_alignment Maximiliano Sandoval
  2023-06-15 12:15 ` [pve-devel] [PATCH installer 2/4] stop using Gtk3::HBox and Gtk3::VBox Maximiliano Sandoval
@ 2023-06-15 12:15 ` Maximiliano Sandoval
  2023-06-15 12:15 ` [pve-devel] [PATCH installer 4/4] stop using Gtk3::Window->set_has_resize_grip Maximiliano Sandoval
  2023-06-19  7:35 ` [pve-devel] applied: [PATCH installer 0/4] Drop deprecated GTK 3 methods Thomas Lamprecht
  4 siblings, 0 replies; 6+ messages in thread
From: Maximiliano Sandoval @ 2023-06-15 12:15 UTC (permalink / raw)
  To: pve-devel

This was deprecated in GTK 3.2, the replacement Gtk3::Separator was
added in GTK 3.0.

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
---
 proxinstall | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/proxinstall b/proxinstall
index 105904f..d2f3d26 100755
--- a/proxinstall
+++ b/proxinstall
@@ -1513,7 +1513,7 @@ sub create_main_window {
  #  $f1->set_shadow_type ('none');
  #  $hbox->pack_start ($f1, 1, 1, 0);
 
-    my $sep1 = Gtk3::HSeparator->new();
+    my $sep1 = Gtk3::Separator->new('horizontal');
     $vbox->pack_start($sep1, 0, 0, 0);
 
     $cmdbox = Gtk3::Box->new('horizontal', 0);
@@ -1550,7 +1550,7 @@ sub create_main_window {
     my $vbox3 = Gtk3::Box->new('vertical', 0);
     $vbox2->pack_start($vbox3, 0, 0, 0);
 
-    my $sep2 = Gtk3::HSeparator->new;
+    my $sep2 = Gtk3::Separator->new('horizontal');
     $vbox3->pack_start($sep2, 0, 0, 0);
 
     $inbox = Gtk3::Box->new('horizontal', 0);
@@ -2553,7 +2553,7 @@ sub create_hdoption_view {
 
     $row++;
 
-    my $sep = Gtk3::HSeparator->new();
+    my $sep = Gtk3::Separator->new('horizontal');
     $sep->set_visible(1);
     $grid->attach($sep, 0, $row, 2, 1);
     $row++;
@@ -2674,7 +2674,7 @@ sub create_hdoption_view {
 	&$switch_view();
     });
 
-    my $sep2 = Gtk3::HSeparator->new();
+    my $sep2 = Gtk3::Separator->new('horizontal');
     $sep2->set_visible(1);
     $contarea->pack_end($sep2, 1, 1, 10);
 
-- 
2.39.2





^ permalink raw reply	[flat|nested] 6+ messages in thread

* [pve-devel] [PATCH installer 4/4] stop using Gtk3::Window->set_has_resize_grip
  2023-06-15 12:14 [pve-devel] [PATCH installer 0/4] Drop deprecated GTK 3 methods Maximiliano Sandoval
                   ` (2 preceding siblings ...)
  2023-06-15 12:15 ` [pve-devel] [PATCH installer 3/4] stop using Gtk3::HSeparator Maximiliano Sandoval
@ 2023-06-15 12:15 ` Maximiliano Sandoval
  2023-06-19  7:35 ` [pve-devel] applied: [PATCH installer 0/4] Drop deprecated GTK 3 methods Thomas Lamprecht
  4 siblings, 0 replies; 6+ messages in thread
From: Maximiliano Sandoval @ 2023-06-15 12:15 UTC (permalink / raw)
  To: pve-devel

The property GtkWindow::has-resize-grip was deprecated in GTK 3.14,
instead we make the window unresizable.

Note that we set the value of resizable only after the window has been
mapped and knows how much space it needs, also note that this only works
correctly if the window is properly displayed via present.

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
---
 proxinstall | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/proxinstall b/proxinstall
index d2f3d26..154703a 100755
--- a/proxinstall
+++ b/proxinstall
@@ -1489,7 +1489,7 @@ sub create_main_window {
 
     $window = Gtk3::Window->new();
     $window->set_default_size(1024, 768);
-    $window->set_has_resize_grip(0);
+    $window->signal_connect(map => sub { $window->set_resizable(0); });
     $window->fullscreen() if !is_test_mode();
     $window->set_decorated(0) if !is_test_mode();
 
@@ -1559,7 +1559,7 @@ sub create_main_window {
     $window->add($vbox);
 
     $window->show_all;
-    $window->realize();
+    $window->present();
 }
 
 sub cleanup_view {
-- 
2.39.2





^ permalink raw reply	[flat|nested] 6+ messages in thread

* [pve-devel] applied: [PATCH installer 0/4] Drop deprecated GTK 3 methods
  2023-06-15 12:14 [pve-devel] [PATCH installer 0/4] Drop deprecated GTK 3 methods Maximiliano Sandoval
                   ` (3 preceding siblings ...)
  2023-06-15 12:15 ` [pve-devel] [PATCH installer 4/4] stop using Gtk3::Window->set_has_resize_grip Maximiliano Sandoval
@ 2023-06-19  7:35 ` Thomas Lamprecht
  4 siblings, 0 replies; 6+ messages in thread
From: Thomas Lamprecht @ 2023-06-19  7:35 UTC (permalink / raw)
  To: Proxmox VE development discussion, Maximiliano Sandoval

Am 15/06/2023 um 14:14 schrieb Maximiliano Sandoval:
> Small series of patches to drop the use of properties and methods that were
> deprecated in GTK 3.
> 
> Maximiliano Sandoval (4):
>   stop using Gtk3::Misc->set_alignment
>   stop using Gtk3::HBox and Gtk3::VBox
>   stop using Gtk3::HSeparator
>   stop using Gtk3::Window->set_has_resize_grip
> 
>  proxinstall | 84 ++++++++++++++++++++++++++---------------------------
>  1 file changed, 42 insertions(+), 42 deletions(-)
> 


applied, thanks!




^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-06-19  7:35 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-15 12:14 [pve-devel] [PATCH installer 0/4] Drop deprecated GTK 3 methods Maximiliano Sandoval
2023-06-15 12:15 ` [pve-devel] [PATCH installer 1/4] stop using Gtk3::Misc->set_alignment Maximiliano Sandoval
2023-06-15 12:15 ` [pve-devel] [PATCH installer 2/4] stop using Gtk3::HBox and Gtk3::VBox Maximiliano Sandoval
2023-06-15 12:15 ` [pve-devel] [PATCH installer 3/4] stop using Gtk3::HSeparator Maximiliano Sandoval
2023-06-15 12:15 ` [pve-devel] [PATCH installer 4/4] stop using Gtk3::Window->set_has_resize_grip Maximiliano Sandoval
2023-06-19  7:35 ` [pve-devel] applied: [PATCH installer 0/4] Drop deprecated GTK 3 methods Thomas Lamprecht

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal