Skip to content

Commit

Permalink
ManagerMenu: Drop the bluetooth status menu item
Browse files Browse the repository at this point in the history
  • Loading branch information
infirit committed Mar 19, 2024
1 parent cac503f commit 5f94159
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 43 deletions.
22 changes: 0 additions & 22 deletions blueman/gui/manager/ManagerMenu.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from blueman.gui.manager.ManagerDeviceList import ManagerDeviceList
from blueman.gui.manager.ManagerDeviceMenu import ManagerDeviceMenu
from blueman.gui.CommonUi import show_about_dialog
from blueman.main.DBusProxies import AppletService
from blueman.Constants import WEBSITE
from blueman.Functions import launch, adapter_path_to_name

Expand Down Expand Up @@ -86,15 +85,6 @@ def __init__(self, blueman: "Blueman"):
self._adapter_settings = blueman.builder.get_widget("prefs_item", Gtk.ImageMenuItem)
self._adapter_settings.connect("activate", lambda x: self.blueman.adapter_properties())

self._power_item = blueman.builder.get_widget("power_item", Gtk.ImageMenuItem)
self._power_item.connect(
"activate",
lambda x: self.blueman.Applet.SetBluetoothStatus(
'(b)',
not self.blueman.Applet.GetBluetoothStatus()
)
)

exit_item = blueman.builder.get_widget("exit_item", Gtk.ImageMenuItem)
exit_item.connect("activate", lambda x: self.blueman.quit())

Expand All @@ -112,16 +102,6 @@ def __init__(self, blueman: "Blueman"):
self._sort_timestamp_item.connect("activate", self._on_sorting_changed, "timestamp")
self._sort_type_item.connect("activate", self._on_sorting_changed, "sort-type")

self.blueman.Applet.connect('g-signal', self._on_applet_signal)
self._applet_plugins_changed()

def _on_applet_signal(self, _proxy: AppletService, _sender: str, signal_name: str, params: GLib.Variant) -> None:
if signal_name == "PluginsChanged":
self._applet_plugins_changed()

def _applet_plugins_changed(self) -> None:
self._power_item.set_visible("PowerManager" in self.blueman.Applet.QueryPlugins())

def _on_sorting_changed(self, btn: Gtk.CheckMenuItem, sort_opt: str) -> None:
if sort_opt == 'alias' and btn.props.active:
self.Config['sort-by'] = "alias"
Expand Down Expand Up @@ -235,11 +215,9 @@ def _update_power(self) -> None:
if any(adapter["Powered"] for (_, adapter) in self.adapter_items.values()):
self.Search.props.visible = True
self._adapter_settings.props.visible = True
self._power_item.props.label = _("Turn Bluetooth _Off")
else:
self.Search.props.visible = False
self._adapter_settings.props.visible = False
self._power_item.props.label = _("Turn Bluetooth _On")

def _on_plugin_dialog_activate(self, _item: Gtk.MenuItem) -> None:
def cb(_proxy: Gio.DBusProxy, _res: Any, _userdata: Any) -> None:
Expand Down
21 changes: 0 additions & 21 deletions data/ui/manager-main.ui
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,6 @@
<property name="can-focus">False</property>
<property name="icon-name">application-x-addon-symbolic</property>
</object>
<object class="GtkImage" id="im_power">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="icon-name">bluetooth-disabled-symbolic</property>
</object>
<object class="GtkImage" id="im_prefs">
<property name="visible">True</property>
<property name="can-focus">False</property>
Expand Down Expand Up @@ -106,22 +101,6 @@
<property name="can-focus">False</property>
</object>
</child>
<child>
<object class="GtkImageMenuItem" id="power_item">
<property name="label" translatable="yes">Turn Bluetooth _On</property>
<property name="visible">False</property>
<property name="can-focus">False</property>
<property name="use-underline">True</property>
<property name="image">im_power</property>
<property name="use-stock">False</property>
</object>
</child>
<child>
<object class="GtkSeparatorMenuItem">
<property name="visible">True</property>
<property name="can-focus">False</property>
</object>
</child>
<child>
<object class="GtkImageMenuItem" id="exit_item">
<property name="label" translatable="yes">_Exit</property>
Expand Down

0 comments on commit 5f94159

Please sign in to comment.