From 22018e260415892f9480469e5b89be67a5ab57a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guido=20G=C3=BCnther?= Date: Fri, 1 Aug 2025 11:28:37 +0200 Subject: [PATCH 1/6] treewide: Use `-` instead of `_` for swapped-object-signal MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Guido Günther Part-of: --- src/background-manager.c | 8 ++++---- src/batteryinfo.c | 4 ++-- src/bt-manager.c | 4 ++-- src/media-player.c | 12 ++++++------ src/top-panel.c | 4 ++-- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/background-manager.c b/src/background-manager.c index eb3a7d8a8..8c383af22 100644 --- a/src/background-manager.c +++ b/src/background-manager.c @@ -400,10 +400,10 @@ phosh_background_manager_idle_init (PhoshManager *manager) self->settings = g_settings_new ("org.gnome.desktop.background"); g_object_connect (self->settings, - "swapped_signal::changed::" BG_KEY_PICTURE_URI, on_settings_changed, self, - "swapped_signal::changed::" BG_KEY_PICTURE_URI_DARK, on_settings_changed, self, - "swapped_signal::changed::" BG_KEY_PICTURE_OPTIONS, on_settings_changed, self, - "swapped_signal::changed::" BG_KEY_PRIMARY_COLOR, on_settings_changed, self, + "swapped-signal::changed::" BG_KEY_PICTURE_URI, on_settings_changed, self, + "swapped-signal::changed::" BG_KEY_PICTURE_URI_DARK, on_settings_changed, self, + "swapped-signal::changed::" BG_KEY_PICTURE_OPTIONS, on_settings_changed, self, + "swapped-signal::changed::" BG_KEY_PRIMARY_COLOR, on_settings_changed, self, NULL); self->interface_settings = g_settings_new ("org.gnome.desktop.interface"); g_signal_connect_swapped (self->interface_settings, diff --git a/src/batteryinfo.c b/src/batteryinfo.c index 47e4d82d0..844807028 100644 --- a/src/batteryinfo.c +++ b/src/batteryinfo.c @@ -144,10 +144,10 @@ on_up_client_new_ready (GObject *source, GAsyncResult *result, gpointer data) } g_object_connect (self->device, - "swapped_object_signal::notify::percentage", + "swapped-object-signal::notify::percentage", G_CALLBACK (on_property_changed), self, - "swapped_object_signal::notify::state", + "swapped-object-signal::notify::state", G_CALLBACK (on_property_changed), self, NULL); diff --git a/src/bt-manager.c b/src/bt-manager.c index cb3e2668d..d5eb06d20 100644 --- a/src/bt-manager.c +++ b/src/bt-manager.c @@ -200,10 +200,10 @@ on_proxy_new_for_bus_finish (GObject *source_object, } g_object_connect (self->proxy, - "swapped_object_signal::notify::bluetooth-airplane-mode", + "swapped-object-signal::notify::bluetooth-airplane-mode", G_CALLBACK (on_bt_airplane_mode_changed), self, - "swapped_object_signal::notify::bluetooth-has-airplane-mode", + "swapped-object-signal::notify::bluetooth-has-airplane-mode", G_CALLBACK (on_bt_has_airplane_mode_changed), self, NULL); diff --git a/src/media-player.c b/src/media-player.c index e91b0e2cc..07d88437c 100644 --- a/src/media-player.c +++ b/src/media-player.c @@ -989,22 +989,22 @@ phosh_media_player_set_player (PhoshMediaPlayer *self, PhoshMprisDBusMediaPlayer g_debug ("Connected player %p", priv->player); g_object_connect (priv->player, - "swapped_object_signal::notify::metadata", + "swapped-object-signal::notify::metadata", G_CALLBACK (on_metadata_changed), self, - "swapped_object_signal::notify::playback-status", + "swapped-object-signal::notify::playback-status", G_CALLBACK (on_playback_status_changed), self, - "swapped_object_signal::notify::can-go-next", + "swapped-object-signal::notify::can-go-next", G_CALLBACK (on_can_go_next_changed), self, - "swapped_object_signal::notify::can-go-previous", + "swapped-object-signal::notify::can-go-previous", G_CALLBACK (on_can_go_previous_changed), self, - "swapped_object_signal::notify::can-play", + "swapped-object-signal::notify::can-play", G_CALLBACK (on_can_play), self, - "swapped_object_signal::notify::can-seek", + "swapped-object-signal::notify::can-seek", G_CALLBACK (on_can_seek), self, NULL); diff --git a/src/top-panel.c b/src/top-panel.c index 905f2a15b..6fb5552d2 100644 --- a/src/top-panel.c +++ b/src/top-panel.c @@ -596,8 +596,8 @@ phosh_top_panel_constructed (GObject *object) self->xkbinfo = gnome_xkb_info_new (); self->seat = gdk_display_get_default_seat (display); g_object_connect (self->seat, - "swapped_signal::device-added", G_CALLBACK (on_seat_device_changed), self, - "swapped_signal::device-removed", G_CALLBACK (on_seat_device_changed), self, + "swapped-signal::device-added", G_CALLBACK (on_seat_device_changed), self, + "swapped-signal::device-removed", G_CALLBACK (on_seat_device_changed), self, NULL); g_signal_connect_swapped (self->input_settings, "changed::sources", G_CALLBACK (on_input_setting_changed), -- GitLab From 187d8bbcc03e3589ff3936055bbe5d69978ca13d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guido=20G=C3=BCnther?= Date: Fri, 1 Aug 2025 11:50:46 +0200 Subject: [PATCH 2/6] abi: Allow to access phosh_shell_get_type() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Plugins should be able to perform type checks. Signed-off-by: Guido Günther Part-of: --- src/phosh-exported-symbols.txt.in | 1 + 1 file changed, 1 insertion(+) diff --git a/src/phosh-exported-symbols.txt.in b/src/phosh-exported-symbols.txt.in index 1328d3975..9ba715e2d 100644 --- a/src/phosh-exported-symbols.txt.in +++ b/src/phosh-exported-symbols.txt.in @@ -1,6 +1,7 @@ phosh_shell_get_default; phosh_shell_get_locked; phosh_shell_get_primary_monitor; + phosh_shell_get_type; # Utils are useful in plugins too phosh_util_*; -- GitLab From 2d8c22291e08c500243121c69bb1c333e8943f6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guido=20G=C3=BCnther?= Date: Fri, 1 Aug 2025 11:31:08 +0200 Subject: [PATCH 3/6] pomodoro-quick-setting: Allow to start timer on screen unlock MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Otherwise it is easy to forget to turn it on. Signed-off-by: Guido Günther Part-of: --- .../mobi.phosh.plugins.pomodoro.gschema.xml | 7 +++++ .../pomodoro-quick-setting.c | 29 +++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/plugins/pomodoro-quick-setting/mobi.phosh.plugins.pomodoro.gschema.xml b/plugins/pomodoro-quick-setting/mobi.phosh.plugins.pomodoro.gschema.xml index e7c358f7f..e1ec9de70 100644 --- a/plugins/pomodoro-quick-setting/mobi.phosh.plugins.pomodoro.gschema.xml +++ b/plugins/pomodoro-quick-setting/mobi.phosh.plugins.pomodoro.gschema.xml @@ -15,5 +15,12 @@ The duration of the break in seconds. + + false + Start on unlock + + Whether to start the timer on screen unlock + + diff --git a/plugins/pomodoro-quick-setting/pomodoro-quick-setting.c b/plugins/pomodoro-quick-setting/pomodoro-quick-setting.c index 5e907c6ee..24e7cd16c 100644 --- a/plugins/pomodoro-quick-setting/pomodoro-quick-setting.c +++ b/plugins/pomodoro-quick-setting/pomodoro-quick-setting.c @@ -1,5 +1,6 @@ /* * Copyright (C) 2024 The Phosh Developers + * 2025 Phosh.mobi e.V. * * SPDX-License-Identifier: GPL-3.0-or-later * @@ -22,6 +23,8 @@ #define ACTIVE_ICON "pomodoro-active-symbolic" #define BREAK_ICON "pomodoro-break-symbolic" +#define START_ON_UNLOCK_KEY "start-on-unlock" + /** * PhoshPomodoroQuickSetting: * @@ -186,6 +189,25 @@ phosh_pomodoro_quick_setting_set_state (PhoshPomodoroQuickSetting *self, PhoshPo } +static void +on_shell_locked (PhoshPomodoroQuickSetting *self, GParamSpec *pspec, PhoshShell *shell) +{ + g_assert (PHOSH_IS_SHELL (shell)); + g_assert (PHOSH_IS_POMODORO_QUICK_SETTING (self)); + + if (phosh_shell_get_locked (shell)) + return; + + if (self->state != PHOSH_POMODORO_STATE_OFF) + return; + + if (!g_settings_get_boolean (self->settings, START_ON_UNLOCK_KEY)) + return; + + phosh_pomodoro_quick_setting_set_state (self, PHOSH_POMODORO_STATE_ACTIVE); +} + + static void phosh_pomodoro_quick_setting_set_property (GObject *object, guint property_id, @@ -355,5 +377,12 @@ phosh_pomodoro_quick_setting_init (PhoshPomodoroQuickSetting *self) G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE, transform_to_icon_name, NULL, NULL, NULL); + + g_signal_connect_object (phosh_shell_get_default (), + "notify::locked", + G_CALLBACK (on_shell_locked), + self, + G_CONNECT_SWAPPED); + update_label (self); } -- GitLab From ee784f590508f6767c20b6bec9895b9191dfe3fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guido=20G=C3=BCnther?= Date: Fri, 1 Aug 2025 11:39:00 +0200 Subject: [PATCH 4/6] pomodoro-quick-setting: Start on login MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit For the user this isn't easily distinguishable from a regular unlock. Since the top-panel can be recreated we use a global variable. Signed-off-by: Guido Günther Part-of: --- plugins/pomodoro-quick-setting/pomodoro-quick-setting.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/plugins/pomodoro-quick-setting/pomodoro-quick-setting.c b/plugins/pomodoro-quick-setting/pomodoro-quick-setting.c index 24e7cd16c..549c3fdf1 100644 --- a/plugins/pomodoro-quick-setting/pomodoro-quick-setting.c +++ b/plugins/pomodoro-quick-setting/pomodoro-quick-setting.c @@ -50,6 +50,7 @@ struct _PhoshPomodoroQuickSetting { G_DEFINE_TYPE (PhoshPomodoroQuickSetting, phosh_pomodoro_quick_setting, PHOSH_TYPE_QUICK_SETTING); +static gboolean _started_on_login; static void phosh_pomodoro_quick_setting_clear_timers (PhoshPomodoroQuickSetting *self) @@ -383,6 +384,10 @@ phosh_pomodoro_quick_setting_init (PhoshPomodoroQuickSetting *self) G_CALLBACK (on_shell_locked), self, G_CONNECT_SWAPPED); + if (g_settings_get_boolean (self->settings, START_ON_UNLOCK_KEY) && !_started_on_login) { + phosh_pomodoro_quick_setting_set_state (self, PHOSH_POMODORO_STATE_ACTIVE); + _started_on_login = TRUE; + } update_label (self); } -- GitLab From 8feca98d790a1da27fe4f5d9e86d2ab91c6cf0f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guido=20G=C3=BCnther?= Date: Fri, 1 Aug 2025 11:43:52 +0200 Subject: [PATCH 5/6] phosh-pomodoro-quick-setting-prefs: Shorten key names MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit They're only used in this compilation unit Signed-off-by: Guido Günther Part-of: --- .../prefs/pomodoro-quick-setting-prefs.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/pomodoro-quick-setting/prefs/pomodoro-quick-setting-prefs.c b/plugins/pomodoro-quick-setting/prefs/pomodoro-quick-setting-prefs.c index 9beda2730..c443c5cdc 100644 --- a/plugins/pomodoro-quick-setting/prefs/pomodoro-quick-setting-prefs.c +++ b/plugins/pomodoro-quick-setting/prefs/pomodoro-quick-setting-prefs.c @@ -15,8 +15,8 @@ #include #define POMODORO_QUICK_SETTING_SCHEMA_ID "mobi.phosh.plugins.pomodoro" -#define POMODORO_QUICK_SETTING_ACTIVE_DURATION_KEY "active-duration" -#define POMODORO_QUICK_SETTING_BREAK_DURATION_KEY "break-duration" +#define ACTIVE_DURATION_KEY "active-duration" +#define BREAK_DURATION_KEY "break-duration" /** * PhoshPomodoroQuickSettingPrefs: @@ -95,7 +95,7 @@ phosh_pomodoro_quick_setting_prefs_init (PhoshPomodoroQuickSettingPrefs *self) self->setting = g_settings_new (POMODORO_QUICK_SETTING_SCHEMA_ID); - g_settings_bind_with_mapping (self->setting, POMODORO_QUICK_SETTING_ACTIVE_DURATION_KEY, + g_settings_bind_with_mapping (self->setting, ACTIVE_DURATION_KEY, self->active_duration_spin_row, "value", G_SETTINGS_BIND_DEFAULT, duration_get_mapping, @@ -103,7 +103,7 @@ phosh_pomodoro_quick_setting_prefs_init (PhoshPomodoroQuickSettingPrefs *self) NULL /* userdata */, NULL /* destroyfunc */); - g_settings_bind_with_mapping (self->setting, POMODORO_QUICK_SETTING_BREAK_DURATION_KEY, + g_settings_bind_with_mapping (self->setting, BREAK_DURATION_KEY, self->break_duration_spin_row, "value", G_SETTINGS_BIND_DEFAULT, duration_get_mapping, -- GitLab From 2668cf2a14946db0075443c14d04cb0d6b41e0a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guido=20G=C3=BCnther?= Date: Fri, 1 Aug 2025 11:43:52 +0200 Subject: [PATCH 6/6] phosh-pomodoro-quick-setting-prefs: Allow to set 'start-on-unlock' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Guido Günther Part-of: --- .../prefs/pomodoro-quick-setting-prefs.c | 9 +++++++++ plugins/pomodoro-quick-setting/prefs/prefs.ui | 7 +++++++ 2 files changed, 16 insertions(+) diff --git a/plugins/pomodoro-quick-setting/prefs/pomodoro-quick-setting-prefs.c b/plugins/pomodoro-quick-setting/prefs/pomodoro-quick-setting-prefs.c index c443c5cdc..55765c3b0 100644 --- a/plugins/pomodoro-quick-setting/prefs/pomodoro-quick-setting-prefs.c +++ b/plugins/pomodoro-quick-setting/prefs/pomodoro-quick-setting-prefs.c @@ -1,5 +1,6 @@ /* * Copyright (C) 2024 The Phosh Developers + * 2025 Phosh.mobi e.V. * * SPDX-License-Identifier: GPL-3.0-or-later * @@ -17,6 +18,7 @@ #define POMODORO_QUICK_SETTING_SCHEMA_ID "mobi.phosh.plugins.pomodoro" #define ACTIVE_DURATION_KEY "active-duration" #define BREAK_DURATION_KEY "break-duration" +#define START_ON_UNLOCK_KEY "start-on-unlock" /** * PhoshPomodoroQuickSettingPrefs: @@ -28,6 +30,7 @@ struct _PhoshPomodoroQuickSettingPrefs { AdwSpinRow *active_duration_spin_row; AdwSpinRow *break_duration_spin_row; + AdwSwitchRow *start_on_unlock_switch_row; GSettings *setting; }; @@ -85,6 +88,8 @@ phosh_pomodoro_quick_setting_prefs_class_init (PhoshPomodoroQuickSettingPrefsCla active_duration_spin_row); gtk_widget_class_bind_template_child (widget_class, PhoshPomodoroQuickSettingPrefs, break_duration_spin_row); + gtk_widget_class_bind_template_child (widget_class, PhoshPomodoroQuickSettingPrefs, + start_on_unlock_switch_row); } @@ -110,4 +115,8 @@ phosh_pomodoro_quick_setting_prefs_init (PhoshPomodoroQuickSettingPrefs *self) duration_set_mapping, NULL /* userdata */, NULL /* destroyfunc */); + + g_settings_bind (self->setting, START_ON_UNLOCK_KEY, + self->start_on_unlock_switch_row, "active", + G_SETTINGS_BIND_DEFAULT); } diff --git a/plugins/pomodoro-quick-setting/prefs/prefs.ui b/plugins/pomodoro-quick-setting/prefs/prefs.ui index aa39cfe5a..78454acb9 100644 --- a/plugins/pomodoro-quick-setting/prefs/prefs.ui +++ b/plugins/pomodoro-quick-setting/prefs/prefs.ui @@ -39,6 +39,13 @@ + + + _Start on unlock + Whether to start the timer on screen unlock + 1 + + -- GitLab