From a10cdecb4a7fb010e73ef04d80027286cb5673a7 Mon Sep 17 00:00:00 2001 From: Angelo Naselli Date: Sun, 20 Jul 2014 10:49:25 +0200 Subject: used the same code in a single point --- lib/AdminPanel/Rpmdragora/edit_urpm_sources.pm | 40 +++++++++++--------------- 1 file changed, 16 insertions(+), 24 deletions(-) diff --git a/lib/AdminPanel/Rpmdragora/edit_urpm_sources.pm b/lib/AdminPanel/Rpmdragora/edit_urpm_sources.pm index 9b9382c..2518509 100644 --- a/lib/AdminPanel/Rpmdragora/edit_urpm_sources.pm +++ b/lib/AdminPanel/Rpmdragora/edit_urpm_sources.pm @@ -1538,6 +1538,7 @@ sub mainwindow() { } elsif ($eventType == $yui::YEvent::MenuEvent) { ### MENU ### + my $changed = 0; my $item = $event->item(); my $menuLabel = $item->label(); if ($menuLabel eq $fileMenu{ quit }->label()) { @@ -1570,32 +1571,10 @@ sub mainwindow() { update_callback(); } elsif ($menuLabel eq $fileMenu{ add_media }->label()) { - if (easy_add_callback_with_mirror()) { - yui::YUI::app()->busyCursor(); - $dialog->startMultipleChanges(); - - $mirrorTbl->deleteAllItems(); - my $itemCollection = readMedia(); - $mirrorTbl->addItems($itemCollection); - - $dialog->recalcLayout(); - $dialog->doneMultipleChanges(); - yui::YUI::app()->normalCursor(); - } + $changed = easy_add_callback_with_mirror(); } elsif ($menuLabel eq $fileMenu{ custom }->label()) { - if (add_callback()) { - yui::YUI::app()->busyCursor(); - $dialog->startMultipleChanges(); - - $mirrorTbl->deleteAllItems(); - my $itemCollection = readMedia(); - $mirrorTbl->addItems($itemCollection); - - $dialog->recalcLayout(); - $dialog->doneMultipleChanges(); - yui::YUI::app()->normalCursor(); - } + $changed = add_callback(); } elsif ($menuLabel eq $optionsMenu{ proxy }->label()) { proxy_callback(); @@ -1603,6 +1582,19 @@ sub mainwindow() { elsif ($menuLabel eq $optionsMenu{ global }->label()) { options_callback(); } + if ($changed) { + yui::YUI::app()->busyCursor(); + $dialog->startMultipleChanges(); + + $mirrorTbl->deleteAllItems(); + my $itemCollection = readMedia(); + $mirrorTbl->addItems($itemCollection); + + $dialog->recalcLayout(); + $dialog->doneMultipleChanges(); + yui::YUI::app()->normalCursor(); + } + } elsif ($eventType == $yui::YEvent::WidgetEvent) { # widget selected -- cgit v1.2.1