From 2c6951c4eed882becbc78c9a7d32a495bf64ebee Mon Sep 17 00:00:00 2001 From: Michael Kogan Date: Fri, 11 Aug 2023 10:09:02 +0200 Subject: [PATCH 1/2] Fix #597: The edit button is disabled For some reason due to Glib::IO::AppInfo::get_recommended_for_type failing to determine recommended apps for the "Open with" menu switching the edit button to sensitive fails. Checking $apps for being undefinied leaves the user without apps in the "Open with" menu but keeps the edit button enabled. --- bin/shutter | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/bin/shutter b/bin/shutter index 5a455266..d9aa2ac9 100755 --- a/bin/shutter +++ b/bin/shutter @@ -8653,6 +8653,11 @@ sub STARTUP { # https://developer.gnome.org/gio/stable/GAppInfo.html my $apps = Glib::IO::AppInfo::get_recommended_for_type($mime_type); + # $apps is undefined if Glib::IO::AppInfo::get_recommended_for_type fails + unless (defined $apps) { + return $menu_programs; + } + #no apps determined! unless (scalar @$apps) { $sm->{_menuitem_reopen}->set_sensitive(FALSE); From 0c86d676947d02d6655a35b7b37cab668482ca6f Mon Sep 17 00:00:00 2001 From: Michael Kogan Date: Fri, 11 Aug 2023 15:59:53 +0200 Subject: [PATCH 2/2] Disable "open with" menu if determining apps fails; catch undefined $apps on another occasion --- bin/shutter | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/bin/shutter b/bin/shutter index d9aa2ac9..07ca2eec 100755 --- a/bin/shutter +++ b/bin/shutter @@ -4953,6 +4953,11 @@ sub STARTUP { #get applications my $apps = Glib::IO::AppInfo::get_recommended_for_type('image/png'); + # $apps is undefined if Glib::IO::AppInfo::get_recommended_for_type fails + unless (defined $apps) { + return $model; + } + #no apps determined! unless (scalar @$apps) { return $model; @@ -8655,6 +8660,8 @@ sub STARTUP { # $apps is undefined if Glib::IO::AppInfo::get_recommended_for_type fails unless (defined $apps) { + $sm->{_menuitem_reopen}->set_sensitive(FALSE); + $sm->{_menuitem_large_reopen}->set_sensitive(FALSE); return $menu_programs; }