From 07272233bbe52eaa714d1764d172b5553d7f8a34 Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Fri, 22 Nov 2013 19:06:38 +0100 Subject: OptionMenu has been deprecated prior to Gtk3 --- perl-install/ugtk3.pm | 66 --------------------------------------------------- 1 file changed, 66 deletions(-) (limited to 'perl-install/ugtk3.pm') diff --git a/perl-install/ugtk3.pm b/perl-install/ugtk3.pm index e136d6701..ec24d92bc 100644 --- a/perl-install/ugtk3.pm +++ b/perl-install/ugtk3.pm @@ -1283,72 +1283,6 @@ sub toggle_expansion { } } - -# With GTK+, for more GUIes coherency, GtkOptionMenu is recommended instead of a -# combo if the user is selecting from a fixed set of options. -# -# That is, non-editable combo boxes are not encouraged. GtkOptionMenu is much -# easier to use than GtkCombo as well. Use GtkCombo only when you need the -# editable text entry. -# -# GtkOptionMenu is a much better-implemented widget and also the right UI for -# noneditable sets of choices.) -# -# GtkCombo is deprecated in 2.4.x because it still uses deprecated -# GtkList. GtkOption menu is deprecated in order to have an unified widget. -# -# GtkComBox widget replaces GtkOption menu whereas GtkComBoxEntry replaces GtkCombo. -# -# -# This layer try to make OptionMenu and ComboBox look being api -# compatible with Combo since its API is quite nice. - -package Gtk3::OptionMenu; -use MDK::Common; - -# try to get combox <==> option menu mapping -sub set_popdown_strings { - my ($w, @strs) = @_; - my $menu = Gtk3::Menu->new; - # keep string list around for ->set_text compatibilty helper - $w->{strings} = \@strs; - #$w->set_menu((ugtk3::create_factory_menu($window, [ "File", (undef) x 3, '' ], map { [ "File/" . $_, (undef) x 3, '' ] } @strs))[0]); - $menu->append(ugtk3::gtkshow(Gtk3::MenuItem->new_with_label($_))) foreach @strs; - $w->set_menu($menu); - $w; -} - -sub new_with_strings { - my ($class, $strs, $o_val) = @_; - my $w = $class->new; - $w->set_popdown_strings(@$strs); - $w->set_text($o_val) if $o_val; - $w; -} - -sub entry { - my ($w) = @_; - return $w; -} - -sub get_text { - my ($w) = @_; - $w->get_history == -1 ? '' : $w->{strings}[$w->get_history]; -} - -sub set_text { - my ($w, $val) = @_; - each_index { - if ($_ eq $val) { - $w->set_history($::i); - return; - } - } @{$w->{strings}}; -} - - - - package Gtk3::ComboBox; use MDK::Common; -- cgit v1.2.1