diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b86c6d8cebc3c7ec7a3f46595d3a123391e6e250..3e32d9c9fce6a0131f284b0ec05f40c90d3f0486 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -43,7 +43,7 @@ variables: # For ci-fairy FDO_UPSTREAM_REPO: World/Phosh/phosh # screenshot and asan builds on DEBIAN_IMAGE so keep them in sync - IMAGE_VERSION: v0.0.2025-06-16.2 + IMAGE_VERSION: v0.0.2025-09-27 DEBIAN_IMAGE: $CI_REGISTRY/world/phosh/phosh/debian:$IMAGE_VERSION SCREENSHOT_IMAGE: $CI_REGISTRY/world/phosh/phosh/screenshot:$IMAGE_VERSION ASAN_IMAGE: $CI_REGISTRY/world/phosh/phosh/asan:$IMAGE_VERSION diff --git a/.gitlab-ci/asan.Dockerfile b/.gitlab-ci/asan.Dockerfile index 7025c2923ebc01bb12eff3b0c103c780e2e9370e..4f7a7230a0d248b7fc47f3ff48858fe4f1da0a92 100644 --- a/.gitlab-ci/asan.Dockerfile +++ b/.gitlab-ci/asan.Dockerfile @@ -1,4 +1,4 @@ -FROM registry.gitlab.gnome.org/world/phosh/phosh/debian:v0.0.2025-06-16.2 +FROM registry.gitlab.gnome.org/world/phosh/phosh/debian:v0.0.2025-09-27 RUN export DEBIAN_FRONTEND=noninteractive \ && apt-get -y update \ diff --git a/.gitlab-ci/debian.Dockerfile b/.gitlab-ci/debian.Dockerfile index 50762c9d7cbf9bb2ae51e983feeaa9b133a0bb97..80a6d26e74a4975c8f17a72e1468ed857e04164e 100644 --- a/.gitlab-ci/debian.Dockerfile +++ b/.gitlab-ci/debian.Dockerfile @@ -1,15 +1,13 @@ - FROM debian:trixie-slim RUN export DEBIAN_FRONTEND=noninteractive \ && apt-get -y update \ - && apt-get -y install --no-install-recommends wget ca-certificates gnupg eatmydata \ - && eatmydata apt-get --no-install-recommends -y install build-essential git wget gcovr locales uncrustify abi-compliance-checker abi-dumper universal-ctags \ - && eatmydata apt-get -y install clang clang-tools lld # For clang build \ - && eatmydata apt-get -y update \ + && apt-get -y install --no-install-recommends eatmydata \ && eatmydata apt-get -y dist-upgrade \ + && apt-get -y install --no-install-recommends wget ca-certificates gnupg \ + && eatmydata apt-get --no-install-recommends -y install build-essential git wget gcovr locales uncrustify abi-compliance-checker abi-dumper universal-ctags \ + && eatmydata apt-get -y install clang clang-tools lld \ && cd /home/user/app \ - && eatmydata apt-get -y update \ && eatmydata apt-get --no-install-recommends -y build-dep . \ && eatmydata apt-get clean diff --git a/.gitlab-ci/screenshot.Dockerfile b/.gitlab-ci/screenshot.Dockerfile index 1ac42ef289faabb0fa666176a3b84a569dea8e84..9274f20789dd48a4a85f406074b1134f8e158ef9 100644 --- a/.gitlab-ci/screenshot.Dockerfile +++ b/.gitlab-ci/screenshot.Dockerfile @@ -1,4 +1,4 @@ -FROM registry.gitlab.gnome.org/world/phosh/phosh/debian:v0.0.2025-06-16.2 +FROM registry.gitlab.gnome.org/world/phosh/phosh/debian:v0.0.2025-09-27 RUN export DEBIAN_FRONTEND=noninteractive \ && apt-get -y update \ diff --git a/src/batteryinfo.c b/src/batteryinfo.c index 84480702888a90f699c697f7508df4d6d6d27ae7..d59c1a11be1081feb5919ea631a2a3c05ea9f943 100644 --- a/src/batteryinfo.c +++ b/src/batteryinfo.c @@ -14,7 +14,6 @@ #include "batteryinfo.h" #include "upower.h" -#include "util.h" #include @@ -88,15 +87,15 @@ phosh_battery_info_get_property (GObject *object, static void -on_property_changed (PhoshBatteryInfo *self, - GParamSpec *pspec, - UpDevice *device) +on_property_changed (PhoshBatteryInfo *self, + GParamSpec *pspec, + UpDevice *device) { - UpDeviceState state; - gdouble percentage; - gint smallest_ten; - gboolean is_charging; - gboolean is_charged; + UpDeviceState state; + gdouble percentage; + gint smallest_ten; + gboolean is_charging; + gboolean is_charged; g_autofree char *icon_name = NULL; g_autofree char *info = NULL; @@ -110,11 +109,10 @@ on_property_changed (PhoshBatteryInfo *self, if (is_charged) { icon_name = g_strdup ("battery-level-100-charged-symbolic"); } else { - if (is_charging) { + if (is_charging) icon_name = g_strdup_printf ("battery-level-%d-charging-symbolic", smallest_ten); - } else { + else icon_name = g_strdup_printf ("battery-level-%d-symbolic", smallest_ten); - } } phosh_status_icon_set_icon_name (PHOSH_STATUS_ICON (self), icon_name); phosh_status_icon_set_info (PHOSH_STATUS_ICON (self), info); diff --git a/src/feedback-manager.c b/src/feedback-manager.c index 0d7030341076aba5e1c793f76468a71400dd7998..5b88f4792435ccf5ada08b83608d26214614d114 100644 --- a/src/feedback-manager.c +++ b/src/feedback-manager.c @@ -12,6 +12,7 @@ #include "feedback-manager.h" #include "shell-priv.h" +#include "util.h" #include @@ -58,8 +59,12 @@ on_event_triggered (LfbEvent *event, g_autoptr (GError) err = NULL; if (!lfb_event_trigger_feedback_finish (event, res, &err)) { - g_warning_once ("Failed to trigger feedback for '%s': %s", - lfb_event_get_event (event), err->message); + if (g_error_matches (err, G_DBUS_ERROR, G_DBUS_ERROR_SERVICE_UNKNOWN)) { + g_debug ("Feedbackd service not found: %s", err->message); + } else { + g_warning ("Failed to trigger feedback for '%s': %s", + lfb_event_get_event (event), err->message); + } } } diff --git a/src/location-manager.c b/src/location-manager.c index 81e881570a2ae798797a8b7a55eeb974f6cf661e..5d1f295c4ffe81ca11c36a94a746c004235d8c4d 100644 --- a/src/location-manager.c +++ b/src/location-manager.c @@ -70,6 +70,7 @@ typedef struct _PhoshLocationManager { GSettings *location_settings; gboolean enabled; gboolean active; + GDBusConnection *connection; /* Current Request */ GtkWidget *prompt; @@ -308,9 +309,7 @@ phosh_location_manager_geoclue2_agent_iface_init (PhoshGeoClueDBusOrgFreedesktop static void -on_bus_acquired (GObject *source_object, - GAsyncResult *res, - gpointer user_data) +on_bus_acquired (GObject *source_object, GAsyncResult *res, gpointer user_data) { g_autoptr (GError) err = NULL; PhoshLocationManager *self; @@ -323,8 +322,9 @@ on_bus_acquired (GObject *source_object, } self = PHOSH_LOCATION_MANAGER (user_data); + self->connection = connection; g_dbus_interface_skeleton_export (G_DBUS_INTERFACE_SKELETON (self), - connection, + self->connection, LOCATION_AGENT_DBUS_PATH, NULL); update_accuracy_level (self, self->enabled); @@ -332,10 +332,11 @@ on_bus_acquired (GObject *source_object, static void -on_add_agent_ready (PhoshGeoClueDBusManager *manager, - GAsyncResult *res, - gpointer user_data) +on_add_agent_ready (GObject *source_object, + GAsyncResult *res, + gpointer user_data) { + PhoshGeoClueDBusManager *manager = PHOSH_GEO_CLUE_DBUS_MANAGER (source_object); g_autoptr (GError) err = NULL; if (phosh_geo_clue_dbus_manager_call_add_agent_finish (manager, res, &err)) @@ -384,8 +385,8 @@ on_manager_proxy_ready (GObject *source_object, phosh_geo_clue_dbus_manager_call_add_agent (self->manager_proxy, /* Agent whitelisted in geoclue conf */ "sm.puri.Phosh", - NULL, - (GAsyncReadyCallback)on_add_agent_ready, + self->cancel, + on_add_agent_ready, NULL); g_signal_connect_swapped (self->manager_proxy, "notify::in-use", @@ -409,7 +410,7 @@ on_manager_name_appeared (GDBusConnection *connection, G_DBUS_PROXY_FLAGS_NONE, GEOCLUE_SERVICE, GEOCLUE_MANAGER_PATH, - NULL, + self->cancel, (GAsyncReadyCallback)on_manager_proxy_ready, self); } @@ -453,6 +454,7 @@ phosh_location_manager_dispose (GObject *object) g_clear_object (&self->location_settings); g_clear_object (&self->manager_proxy); + g_clear_object (&self->connection); G_OBJECT_CLASS (phosh_location_manager_parent_class)->dispose (object); } diff --git a/src/monitor-manager.c b/src/monitor-manager.c index 920b4cf0c4d0b17e6c968d8a2a99a2ea64397a2c..0a3a97dac6c1d53307507bb71c2e87d36ddb472e 100644 --- a/src/monitor-manager.c +++ b/src/monitor-manager.c @@ -1262,10 +1262,12 @@ on_gsd_color_temperature_changed (PhoshMonitorManager*self, static void -on_gsd_color_proxy_new_for_bus_finish (GObject *source_object, - GAsyncResult *res, - PhoshMonitorManager *self) +on_gsd_color_proxy_new_for_bus_finish (GObject *source_object, + GAsyncResult *res, + gpointer user_data) + { + PhoshMonitorManager *self = PHOSH_MONITOR_MANAGER (user_data); g_autoptr (GError) err = NULL; PhoshDBusColor *proxy; @@ -1306,7 +1308,7 @@ on_idle (PhoshMonitorManager *self) GSD_COLOR_BUS_NAME, GSD_COLOR_OBJECT_PATH, self->cancel, - (GAsyncReadyCallback) on_gsd_color_proxy_new_for_bus_finish, + on_gsd_color_proxy_new_for_bus_finish, self); return FALSE; diff --git a/src/proximity.c b/src/proximity.c index d1c0c0c6e0a51c0290c52ef6c02e605281eb85a5..cc8bb4860afa60383d1c7543468fb88ac4fc3986 100644 --- a/src/proximity.c +++ b/src/proximity.c @@ -42,6 +42,8 @@ typedef struct _PhoshProximity { PhoshSensorProxyManager *sensor_proxy_manager; PhoshCallsManager *calls_manager; PhoshFader *fader; + + GCancellable *cancel; } PhoshProximity; G_DEFINE_TYPE (PhoshProximity, phosh_proximity, G_TYPE_OBJECT); @@ -139,13 +141,13 @@ phosh_proximity_claim_proximity (PhoshProximity *self, gboolean claim) if (claim) { phosh_dbus_sensor_proxy_call_claim_proximity ( PHOSH_DBUS_SENSOR_PROXY (self->sensor_proxy_manager), - NULL, + self->cancel, (GAsyncReadyCallback)on_proximity_claimed, self); } else { phosh_dbus_sensor_proxy_call_release_proximity ( PHOSH_DBUS_SENSOR_PROXY (self->sensor_proxy_manager), - NULL, + self->cancel, (GAsyncReadyCallback)on_proximity_released, self); } @@ -289,6 +291,9 @@ phosh_proximity_dispose (GObject *object) { PhoshProximity *self = PHOSH_PROXIMITY (object); + g_cancellable_cancel (self->cancel); + g_clear_object (&self->cancel); + if (self->sensor_proxy_manager) { g_signal_handlers_disconnect_by_data (self->sensor_proxy_manager, self); @@ -353,6 +358,7 @@ phosh_proximity_class_init (PhoshProximityClass *klass) static void phosh_proximity_init (PhoshProximity *self) { + self->cancel = g_cancellable_new (); } diff --git a/src/util.c b/src/util.c index f154f941dcb48a9bd7edf83bdd6971193c867e27..c753b66af1c92f9877abb850486cf2ccddd566ed 100644 --- a/src/util.c +++ b/src/util.c @@ -242,6 +242,37 @@ phosh_error_warnv (const char *log_domain, } +gboolean +phosh_error_warnv2 (const char *log_domain, + GError *err, + GQuark domain, + int code1, + int code2, + const char *fmt, ...) +{ + g_autofree char *msg = NULL; + gboolean matched = FALSE; + va_list args; + + if (err == NULL) + return FALSE; + + va_start (args, fmt); + msg = g_strdup_vprintf(fmt, args); + va_end (args); + + if (g_error_matches (err, domain, code1) || + g_error_matches (err, domain, code2)) + matched = TRUE; + + g_log (log_domain, + matched ? G_LOG_LEVEL_DEBUG : G_LOG_LEVEL_WARNING, + "%s: %s", msg, err->message); + + return matched; +} + + static void randname (char *buf) { diff --git a/src/util.h b/src/util.h index 4f52e32e4547a0457935f786d0f3f7a68b5430fb..09f52a29f7937eef66c4dc4ea2d9c5762383659e 100644 --- a/src/util.h +++ b/src/util.h @@ -14,8 +14,10 @@ #define phosh_async_error_warn(err, ...) \ phosh_error_warnv (G_LOG_DOMAIN, err, G_IO_ERROR, G_IO_ERROR_CANCELLED, __VA_ARGS__) -#define phosh_dbus_service_error_warn(err, ...) \ - phosh_error_warnv (G_LOG_DOMAIN, err, G_IO_ERROR, G_IO_ERROR_NOT_FOUND, __VA_ARGS__) +#define phosh_dbus_service_error_warn(err, ...) \ + phosh_error_warnv2 (G_LOG_DOMAIN, err, G_IO_ERROR, \ + G_IO_ERROR_NOT_FOUND, G_IO_ERROR_CANCELLED, \ + __VA_ARGS__) void phosh_cp_widget_destroy (void *widget); GDesktopAppInfo *phosh_get_desktop_app_info_for_app_id (const char *app_id); @@ -28,6 +30,13 @@ gboolean phosh_error_warnv (const char *log_domain, int code, const char *fmt, ...) G_GNUC_PRINTF(5, 6); +gboolean phosh_error_warnv2 (const char *log_domain, + GError *err, + GQuark domain, + int code1, + int code2, + const gchar *fmt, + ...) G_GNUC_PRINTF(6, 7); int phosh_create_shm_file (off_t size); char *phosh_util_escape_markup (const char *markup, gboolean allow_markup); gboolean phosh_util_gesture_is_touch (GtkGestureSingle *gesture); diff --git a/src/wwan/phosh-wwan-mm.c b/src/wwan/phosh-wwan-mm.c index dfd9d78ddc3efe79da388b12bb718558222c1b44..ac9b5ab919ba893b25698975682c8b0113cdab3c 100644 --- a/src/wwan/phosh-wwan-mm.c +++ b/src/wwan/phosh-wwan-mm.c @@ -51,6 +51,7 @@ typedef struct _PhoshWWanMM { MMManager *manager; GCancellable *cancel; + GDBusConnection *connection; guint signal_quality; const char *access_tec; @@ -559,8 +560,9 @@ on_mm_object_removed (PhoshWWanMM *self, GDBusObject *object, MMManager *manager static void -on_mm_manager_ready (GObject *source_object, GAsyncResult *res, PhoshWWanMM *self) +on_mm_manager_ready (GObject *source_object, GAsyncResult *res, gpointer user_data) { + PhoshWWanMM *self = PHOSH_WWAN_MM (user_data); g_autoptr (GError) err = NULL; g_autolist (GDBusObject) modems = NULL; MMManager *manager; @@ -608,6 +610,8 @@ phosh_wwan_mm_dispose (GObject *object) g_clear_object (&self->manager); } + g_clear_object (&self->connection); + G_OBJECT_CLASS (phosh_wwan_mm_parent_class)->dispose (object); } @@ -748,8 +752,9 @@ phosh_wwan_mm_interface_init (PhoshWWanInterface *iface) static void -on_bus_get_ready (GObject *source_object, GAsyncResult *res, PhoshWWanMM *self) +on_bus_get_ready (GObject *source_object, GAsyncResult *res, gpointer user_data) { + PhoshWWanMM *self = PHOSH_WWAN_MM (user_data); g_autoptr (GError) err = NULL; GDBusConnection *connection; @@ -759,10 +764,11 @@ on_bus_get_ready (GObject *source_object, GAsyncResult *res, PhoshWWanMM *self) return; } - mm_manager_new (connection, + self->connection = connection; + mm_manager_new (self->connection, G_DBUS_OBJECT_MANAGER_CLIENT_FLAGS_DO_NOT_AUTO_START, self->cancel, - (GAsyncReadyCallback)on_mm_manager_ready, + on_mm_manager_ready, self); } @@ -774,7 +780,7 @@ phosh_wwan_mm_init (PhoshWWanMM *self) g_bus_get (G_BUS_TYPE_SYSTEM, self->cancel, - (GAsyncReadyCallback)on_bus_get_ready, + on_bus_get_ready, self); } diff --git a/tests/meson.build b/tests/meson.build index 3bdb19d7bc87a30edc89deb67816aeb5b4d18340..b219099208129ee53d4e9b493ab80c0b28dd88df 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -24,11 +24,15 @@ test_env_common.set( 'GSETTINGS_SCHEMA_DIR', '@0@/data:@1@'.format(meson.project_build_root(), plugin_schema_path), ) +# Make sure we use Phosh's gsetting prefs +test_env_common.set('XDG_CURRENT_DESKTOP', 'Phosh:GNOME') test_env_common.set('PYTHONDONTWRITEBYTECODE', 'yes') test_env_common.set('MALLOC_CHECK_', '2') test_env_common.set('NO_AT_BRIDGE', '1') # For GTK4 apps running in the tests: test_env_common.set('GTK_A11Y', 'none') +# Make sure gvfs doesn't linger around +test_env_common.set('GIO_USE_VFS', 'local') # For -Db_sanitize=address test_env_common.set(