Skip to content

Commit 54c0900

Browse files
committed
Lint fixups
1 parent dc78f09 commit 54c0900

File tree

3 files changed

+20
-25
lines changed

3 files changed

+20
-25
lines changed

lib/desktop/menu.ex

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -343,18 +343,16 @@ defmodule Desktop.Menu do
343343

344344
@impl true
345345
def handle_cast({:set_icon, icon}, menu) do
346-
with {:ok, menu} <- set_adapter_icon(menu, icon) do
347-
{:noreply, menu}
348-
else
346+
case set_adapter_icon(menu, icon) do
347+
{:ok, menu} -> {:noreply, menu}
349348
_error -> {:noreply, menu}
350349
end
351350
end
352351

353352
def handle_cast({:trigger_event, event}, menu = %{module: module}) do
354353
menu =
355-
with {:ok, {:noreply, menu}} <- invoke_module_func(module, :handle_event, [event, menu]) do
356-
update_dom(menu)
357-
else
354+
case invoke_module_func(module, :handle_event, [event, menu]) do
355+
{:ok, {:noreply, menu}} -> update_dom(menu)
358356
_ -> menu
359357
end
360358

@@ -419,9 +417,8 @@ defmodule Desktop.Menu do
419417
end
420418

421419
defp proxy_handle_info(msg, menu = %Menu{module: module}) do
422-
with {:ok, {:noreply, menu}} <- invoke_module_func(module, :handle_info, [msg, menu]) do
423-
update_dom(menu)
424-
else
420+
case invoke_module_func(module, :handle_info, [msg, menu]) do
421+
{:ok, {:noreply, menu}} -> update_dom(menu)
425422
_ -> menu
426423
end
427424
end

lib/desktop/menu/adapters/wx.ex

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -154,21 +154,21 @@ defmodule Desktop.Menu.Adapter.Wx do
154154
end
155155

156156
defp create_taskbar_icon(fn_create_popup, icon) do
157-
with {:ok, taskbar_icon = %TaskBarIcon{wx_taskbar_icon: wx_taskbar_icon}} <-
158-
TaskBarIcon.create(fn_create_popup) do
159-
TaskBarIcon.connect(taskbar_icon)
160-
TaskBarIcon.set_icon(taskbar_icon, icon)
161-
162-
if OS.type() == Windows do
163-
# This links the taskbar icon and the application itself on Windows
164-
if Code.ensure_loaded?(:wxNotificationMessage) &&
165-
Kernel.function_exported?(:wxNotificationMessage, :useTaskBarIcon, 1) do
166-
:wxNotificationMessage.useTaskBarIcon(wx_taskbar_icon)
157+
case TaskBarIcon.create(fn_create_popup) do
158+
{:ok, taskbar_icon = %TaskBarIcon{wx_taskbar_icon: wx_taskbar_icon}} ->
159+
TaskBarIcon.connect(taskbar_icon)
160+
TaskBarIcon.set_icon(taskbar_icon, icon)
161+
162+
if OS.type() == Windows do
163+
# This links the taskbar icon and the application itself on Windows
164+
if Code.ensure_loaded?(:wxNotificationMessage) &&
165+
Kernel.function_exported?(:wxNotificationMessage, :useTaskBarIcon, 1) do
166+
:wxNotificationMessage.useTaskBarIcon(wx_taskbar_icon)
167+
end
167168
end
168-
end
169169

170-
taskbar_icon
171-
else
170+
taskbar_icon
171+
172172
error ->
173173
Logger.warning("Failed to create TaskBar Icon: #{inspect(error)}")
174174
nil

lib/desktop/window.ex

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -494,9 +494,7 @@ defmodule Desktop.Window do
494494
case Enum.find(noties, fn {_, {wx_ref, _callback}} -> wx_ref == obj end) do
495495
nil ->
496496
Logger.error(
497-
"Received unhandled notification event #{inspect(obj)}: #{inspect(action)} (#{
498-
inspect(noties)
499-
})"
497+
"Received unhandled notification event #{inspect(obj)}: #{inspect(action)} (#{inspect(noties)})"
500498
)
501499

502500
{_, {_ref, nil}} ->

0 commit comments

Comments
 (0)