191
191
self.apps_category = None
192
192
self.apps_subcategory = None
193
193
self.apps_search_term = None
194
self.custom_list_mode = False
195
194
# keep track of applications that have been requested to be added
196
195
# to the Unity launcher
197
196
self.unity_launcher_items = {}
416
415
# we only show the prompt for apps with a desktop file
417
416
if not appdetails.desktop_file:
419
self.action_bar.set_label(_("Add %s to the launcher?" % app.name))
420
418
self.action_bar.add_button(ACTION_BUTTON_CANCEL_ADD_TO_LAUNCHER,
422
420
self.on_cancel_add_to_launcher,
436
435
LOG.debug("the application '%s' will be added to the Unity launcher when installation is complete" % app.name)
437
(icon_name, icon_size, icon_x, icon_y) = self._get_icon_details_for_launcher_service(app)
436
(icon_size, icon_x, icon_y) = self._get_onscreen_icon_details_for_launcher_service(app)
438
437
launcher_info = UnityLauncherInfo(app.name,
440
439
"", # we set the icon_file_path value *after* install
445
444
"", # we set the installed_desktop_file_path *after* install
447
446
self.unity_launcher_items[app.pkgname] = launcher_info
448
self.action_bar.unset_label()
449
447
self.action_bar.set_label(_("%s will be added to the launcher when installation completes." % app.name))
450
448
self.action_bar.remove_button(ACTION_BUTTON_CANCEL_ADD_TO_LAUNCHER)
451
449
self.action_bar.remove_button(ACTION_BUTTON_ADD_TO_LAUNCHER)
453
def _get_icon_details_for_launcher_service(self, app):
451
def _get_onscreen_icon_details_for_launcher_service(self, app):
454
452
if self.is_app_details_view_showing():
455
453
return self.app_details_view.get_app_icon_details()
456
elif self.is_applist_view_showing():
457
455
# TODO: implement the app list view case once it has been specified
458
return ("", "", None, None, None)
460
458
def on_cancel_add_to_launcher(self, args):
461
459
self.action_bar.clear()
467
465
launcher_info.icon_file_path = get_file_path_from_iconname(self.icons,
468
466
launcher_info.icon_name)
469
467
launcher_info.installed_desktop_file_path \
470
= convert_desktop_file_to_installed_location(launcher_info.app_install_desktop_file_path)
468
= convert_desktop_file_to_installed_location(launcher_info.app_install_desktop_file_path,
471
470
if result.success:
472
471
self._send_dbus_signal_to_unity_launcher(launcher_info)
473
472
self.action_bar.clear()
503
502
def show_appview_spinner(self):
504
503
""" display the spinner in the appview panel """
505
self.action_bar.clear()
504
if not self.apps_search_term:
505
self.action_bar.clear()
506
506
self.spinner_view.stop()
507
507
self.spinner_notebook.set_current_page(self.PAGE_SPINNER)
508
508
# "mask" the spinner view momentarily to prevent it from flashing into
573
575
label = gettext.ngettext("_Hide %(amount)i technical item_",
574
576
"_Hide %(amount)i technical items_",
575
577
pkgs) % { 'amount': pkgs, }
576
self.action_bar.set_label(label, self._hide_nonapp_pkgs)
578
self.action_bar.set_label(label, link_result=self._hide_nonapp_pkgs)
578
580
label = gettext.ngettext("_Show %(amount)i technical item_",
579
581
"_Show %(amount)i technical items_",
580
582
pkgs) % { 'amount': pkgs, }
581
self.action_bar.set_label(label, self._show_nonapp_pkgs)
583
self.action_bar.set_label(label, link_result=self._show_nonapp_pkgs)
583
585
def update_search_help(self):
584
586
search = self.searchentry.get_text()
674
676
@wait_for_apt_cache_ready
675
677
def _refresh_apps_with_apt_cache(self, query):
676
LOG.debug("softwarepane query: %s" % query)
678
#~ self.refresh_seq_nr += 1
679
#~ LOG.debug("softwarepane query: %s" % query)
681
#~ old_model = self.app_view.get_model()
682
#~ if old_model is not None:
683
#~ # *ugh* deactivate the old model because otherwise it keeps
684
#~ # getting progress_changed events and eats CPU time until its
685
#~ # garbage collected
686
#~ old_model.active = False
687
#~ while gtk.events_pending():
688
#~ gtk.main_iteration()
690
#~ LOG.debug("softwarepane query: %s" % query)
691
#~ # create new model and attach it
692
#~ seq_nr = self.refresh_seq_nr
693
#~ # In custom list mode, search should yield the exact package name.
694
#~ new_model = AppStore(self.cache,
698
#~ limit=self.get_app_items_limit(),
699
#~ sortmode=self.get_sort_mode(),
700
#~ exact=self.custom_list_mode,
701
#~ nonapps_visible = self.nonapps_visible,
702
#~ filter=self.apps_filter)
704
#~ #print "new_model", new_model, len(new_model), seq_nr
705
#~ # between request of the new model and actual delivery other
706
#~ # events may have happend
707
#~ if seq_nr != self.refresh_seq_nr:
708
#~ LOG.info("discarding new model (%s != %s)" % (seq_nr, self.refresh_seq_nr))
710
#~ >>>>>>> MERGE-SOURCE
713
679
with ExecutionTime("enquirer.set_query()"):
714
680
self.enquirer.set_query(query,