tray/window: append new devices rather than inserting them at the top
This commit is contained in:
parent
92f7e761ee
commit
27de1aea11
|
@ -352,20 +352,22 @@ def _remove_device(index):
|
||||||
|
|
||||||
|
|
||||||
def _add_receiver(receiver):
|
def _add_receiver(receiver):
|
||||||
|
index = len(_devices_info)
|
||||||
|
|
||||||
device_info = (receiver.path, None, receiver.name, None, None)
|
device_info = (receiver.path, None, receiver.name, None, None)
|
||||||
_devices_info.insert(0, device_info)
|
_devices_info.append(device_info)
|
||||||
|
|
||||||
new_menu_item = Gtk.ImageMenuItem.new_with_label(receiver.name)
|
new_menu_item = Gtk.ImageMenuItem.new_with_label(receiver.name)
|
||||||
_menu.insert(new_menu_item, 0)
|
_menu.insert(new_menu_item, index)
|
||||||
icon_set = _icons.device_icon_set(receiver.name)
|
icon_set = _icons.device_icon_set(receiver.name)
|
||||||
new_menu_item.set_image(Gtk.Image().new_from_icon_set(icon_set, _MENU_ICON_SIZE))
|
new_menu_item.set_image(Gtk.Image().new_from_icon_set(icon_set, _MENU_ICON_SIZE))
|
||||||
new_menu_item.show_all()
|
new_menu_item.show_all()
|
||||||
new_menu_item.connect('activate', _window_popup, receiver.path)
|
new_menu_item.connect('activate', _window_popup, receiver.path)
|
||||||
|
|
||||||
_devices_info.insert(1, ('-', None, None, None, None))
|
_devices_info.append(('-', None, None, None, None))
|
||||||
separator = Gtk.SeparatorMenuItem.new()
|
separator = Gtk.SeparatorMenuItem.new()
|
||||||
separator.set_visible(True)
|
separator.set_visible(True)
|
||||||
_menu.insert(separator, 1)
|
_menu.insert(separator, index + 1)
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
|
|
@ -362,9 +362,9 @@ def _receiver_row(receiver_path, receiver=None):
|
||||||
item = _model.iter_next(item)
|
item = _model.iter_next(item)
|
||||||
|
|
||||||
if not item and receiver is not None:
|
if not item and receiver is not None:
|
||||||
_model.insert(None, 0, _TREE_SEPATATOR)
|
|
||||||
row_data = (receiver_path, True, receiver.name, _icons.device_icon_name(receiver.name), '', receiver)
|
row_data = (receiver_path, True, receiver.name, _icons.device_icon_name(receiver.name), '', receiver)
|
||||||
item = _model.insert(None, 0, row_data)
|
item = _model.append(None, row_data)
|
||||||
|
_model.append(None, _TREE_SEPATATOR)
|
||||||
|
|
||||||
return item or None
|
return item or None
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue