aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRobert Tari <robert@tari.in>2021-12-15 12:01:57 +0100
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2021-12-15 14:37:06 +0100
commit706ba0db4d54b8268e7ee634b54f7fae5c2d870b (patch)
tree80e4999e6d8d684919f236acbcf8d45897f2fcab /src
parent2022bfc52e277437bc7fa0ab74d5a3560daa54e0 (diff)
downloadayatana-indicator-bluetooth-706ba0db4d54b8268e7ee634b54f7fae5c2d870b.tar.gz
ayatana-indicator-bluetooth-706ba0db4d54b8268e7ee634b54f7fae5c2d870b.tar.bz2
ayatana-indicator-bluetooth-706ba0db4d54b8268e7ee634b54f7fae5c2d870b.zip
src/desktop.vala: Fix device section layout
fixes https://github.com/AyatanaIndicators/ayatana-indicator-bluetooth/issues/35
Diffstat (limited to 'src')
-rw-r--r--src/desktop.vala27
1 files changed, 23 insertions, 4 deletions
diff --git a/src/desktop.vala b/src/desktop.vala
index 56b61cb..ae9b0db 100644
--- a/src/desktop.vala
+++ b/src/desktop.vala
@@ -60,6 +60,14 @@ class Desktop: Profile
actions += create_browse_files_action ();
actions += create_send_file_action ();
actions += create_show_settings_action ();
+
+ if (!AyatanaCommon.utils_is_lomiri())
+ {
+ SimpleAction pAction = new SimpleAction ("item-enabled", VariantType.BOOLEAN);
+ pAction.set_enabled(false);
+ actions += pAction;
+ }
+
foreach (var a in actions)
action_group.add_action (a);
@@ -177,7 +185,9 @@ class Desktop: Profile
}
// only show the device if it's got actions that we can perform on it
- if (submenu.get_n_items () > 0)
+ int nItems = submenu.get_n_items();
+
+ if (nItems > 0)
{
item = new MenuItem (device.name, null);
item.set_attribute_value ("icon", device.icon.serialize());
@@ -185,13 +195,22 @@ class Desktop: Profile
if (AyatanaCommon.utils_is_lomiri())
{
item.set_submenu (submenu);
+ device_section.append_item (item);
}
else
{
- item.set_section (submenu);
+ item.set_detailed_action("indicator.item-enabled");
+ item.set_attribute("x-ayatana-type", "s", "org.ayatana.indicator.basic");
+ item.set_attribute("x-ayatana-use-markup", "b", true);
+ item.set_label("<b>" + device.name + "</b>");
+ device_section.append_item(item);
+
+ for (int nItem = 0; nItem < nItems; nItem++)
+ {
+ MenuItem pItem = new MenuItem.from_model(submenu, nItem);
+ device_section.append_item(pItem);
+ }
}
-
- device_section.append_item (item);
}
}
}