From 542f6639fcae91f188099092e249dfe34df35aa5 Mon Sep 17 00:00:00 2001 From: Michael Webster Date: Wed, 7 Sep 2022 12:12:28 -0400 Subject: [PATCH 1/6] Add missing build dependency. We need to use the gi module to reliably find the overrides directory. --- debian/control | 1 + 1 file changed, 1 insertion(+) diff --git a/debian/control b/debian/control index ea2fbbf0..a6d11437 100644 --- a/debian/control +++ b/debian/control @@ -19,6 +19,7 @@ Build-Depends: libxkbfile-dev, meson, python3, + python3-gi, python-gi-dev, valac, Standards-Version: 3.9.6 From ea00e7f537d73279550014ec2df998e487c7da38 Mon Sep 17 00:00:00 2001 From: Michael Webster Date: Wed, 7 Sep 2022 12:00:00 -0400 Subject: [PATCH 2/6] Use github actions for CI builds. --- .circleci/config.yml | 56 ------------------------------------- .github/workflows/build.yml | 20 +++++++++++++ README.md | 2 ++ debian/control | 1 - pygobject/meson.build | 7 +++-- 5 files changed, 27 insertions(+), 59 deletions(-) delete mode 100644 .circleci/config.yml create mode 100644 .github/workflows/build.yml diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 84572bf8..00000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,56 +0,0 @@ -version: 2.0 - -shared: &shared - - steps: - - - checkout - - - run: - name: Prepare environment - command: apt-get update - - - run: - name: Build project - command: mint-build -i - - - run: - name: Prepare packages - command: | - if [ -z $CI_PULL_REQUEST ]; then - mkdir /packages - mv /root/*.deb /packages/ - git log > /packages/git.log - cd / - tar zcvf packages.tar.gz packages - fi - - - run: - name: Deploy packages to Github - command: | - if [ -z $CI_PULL_REQUEST ]; then - wget https://github.com/tcnksm/ghr/releases/download/v0.5.4/ghr_v0.5.4_linux_amd64.zip - apt-get install --yes unzip - unzip ghr_v0.5.4_linux_amd64.zip - TAG="master".$CIRCLE_JOB - ./ghr -t $GITHUB_TOKEN -u $CIRCLE_PROJECT_USERNAME -r $CIRCLE_PROJECT_REPONAME -replace $TAG /packages.tar.gz - ./ghr -t $GITHUB_TOKEN -u $CIRCLE_PROJECT_USERNAME -r $CIRCLE_PROJECT_REPONAME -recreate -b "Latest unstable packages" $TAG /packages.tar.gz - fi - -jobs: - "mint21": - <<: *shared - docker: - - image: linuxmintd/mint21-amd64 - - "lmde5": - <<: *shared - docker: - - image: linuxmintd/lmde5-amd64 - -workflows: - version: 2 - build: - jobs: - - "mint21" - - "lmde5" diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..c921e866 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,20 @@ +name: Build + +on: + push: + branches: + - master + pull_request: + branches: + - master + workflow_dispatch: + +jobs: + build: + uses: linuxmint/github-actions/.github/workflows/do-builds.yml@master + with: + commit_id: master + ############################## Comma separated list - like 'linuxmint/xapp, linuxmint/cinnamon-desktop' + dependencies: + ############################## + diff --git a/README.md b/README.md index 2a632ee2..3213f9ba 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +![build](https://github.com/linuxmint/xapp/actions/workflows/build.yml/badge.svg) + This project gathers the components which are common to multiple GTK desktop environments (Cinnamon, MATE and Xfce) and required to implement cross-DE solutions. # libxapp diff --git a/debian/control b/debian/control index a6d11437..ea2fbbf0 100644 --- a/debian/control +++ b/debian/control @@ -19,7 +19,6 @@ Build-Depends: libxkbfile-dev, meson, python3, - python3-gi, python-gi-dev, valac, Standards-Version: 3.9.6 diff --git a/pygobject/meson.build b/pygobject/meson.build index 049b5653..da219f76 100644 --- a/pygobject/meson.build +++ b/pygobject/meson.build @@ -4,10 +4,11 @@ pygobject = dependency('pygobject-3.0', ) override_dir = get_option('py-overrides-dir') -exec = find_program(['python3', 'python']) if override_dir == '' - r = run_command(exec, '-c', 'import gi;print(gi._overridesdir)') + exec = find_program(['python3', 'python']) + + r = run_command(exec, '-c', 'import gi;print(gi._overridesdir)', check: false) if r.returncode() != 0 error('Error getting the GObject Introspection override directory: ' + r.stderr()) @@ -16,6 +17,8 @@ if override_dir == '' override_dir = r.stdout().strip() endif +message('PyGObject overrides dir: ' + override_dir) + install_data(['XApp.py'], install_dir: override_dir, ) From 5dc2fc621815d070b705fed81ffa4416fbea05fd Mon Sep 17 00:00:00 2001 From: Michael Webster Date: Fri, 7 Oct 2022 14:46:11 -0400 Subject: [PATCH 3/6] sn-item: Don't update the icon name if the tooltip was also updated. The tooltip update also calls assign_sortable_name (appindicator apps don't have real tooltips, we set it to their names). In fallback mode, this ends up calling gtk_status_icon_set_name, which re-embeds the GtkStatusIcon, causing a recursive loop. --- xapp-sn-watcher/sn-item.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/xapp-sn-watcher/sn-item.c b/xapp-sn-watcher/sn-item.c index dc7adf85..ebf78296 100644 --- a/xapp-sn-watcher/sn-item.c +++ b/xapp-sn-watcher/sn-item.c @@ -920,8 +920,7 @@ get_all_properties_callback (GObject *source_object, { update_icon (item, new_props); } - - if (new_props->update_id || new_props->update_status) + if ((new_props->update_id || new_props->update_status) && !new_props->update_tooltip) { assign_sortable_name (item, new_props->id); } From 1520996a80445768ff8194ec8167c2e308b95116 Mon Sep 17 00:00:00 2001 From: Michael Webster Date: Fri, 7 Oct 2022 14:49:33 -0400 Subject: [PATCH 4/6] sn-item: Don't update the id property unless it has changed. This can also cause extra updates (though not recursive), which causes visual issues with apps that provide frequent graphic updates to the icons (like indicator-multiload). --- xapp-sn-watcher/sn-item.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/xapp-sn-watcher/sn-item.c b/xapp-sn-watcher/sn-item.c index ebf78296..29f4420a 100644 --- a/xapp-sn-watcher/sn-item.c +++ b/xapp-sn-watcher/sn-item.c @@ -894,7 +894,10 @@ get_all_properties_callback (GObject *source_object, if (g_strcmp0 (name, "Id") == 0) { new_props->id = null_or_string_from_variant (value); - new_props->update_id = TRUE; + if (g_strcmp0 (new_props->id, item->current_props->id) != 0) + { + new_props->update_id = TRUE; + } } } From d5d7c37ecc38eb3d819fb514ffdd7f9feaf07504 Mon Sep 17 00:00:00 2001 From: Michael Webster Date: Fri, 7 Oct 2022 14:51:24 -0400 Subject: [PATCH 5/6] xapp-status-icon.c: Update all icons when we lose or regain our identity on dbus. xapp-sn-watcher spawns multiple icons from a single process. It only has a single name on the bus but exports multiple paths for the icons. If the name is lost or gained, all icons should react. --- libxapp/xapp-status-icon.c | 56 ++++++++++++++++++++++++++++++-------- 1 file changed, 45 insertions(+), 11 deletions(-) diff --git a/libxapp/xapp-status-icon.c b/libxapp/xapp-status-icon.c index a469ef40..9f55dd80 100644 --- a/libxapp/xapp-status-icon.c +++ b/libxapp/xapp-status-icon.c @@ -780,13 +780,27 @@ on_name_lost (GDBusConnection *connection, const gchar *name, gpointer user_data) { - XAppStatusIcon *self = XAPP_STATUS_ICON (user_data); - g_warning ("XAppStatusIcon: lost or could not acquire presence on dbus. Refreshing."); - self->priv->fail_counter++; + GList *instances = g_dbus_object_manager_get_objects (G_DBUS_OBJECT_MANAGER (obj_server)); + GList *l; - refresh_icon (self); + for (l = instances; l != NULL; l = l->next) + { + GObject *instance = G_OBJECT (l->data); + XAppStatusIcon *icon = XAPP_STATUS_ICON (g_object_get_data (instance, "xapp-status-icon-instance")); + + if (icon == NULL) + { + g_warning ("on_name_lost: Could not retrieve xapp-status-icon-instance data: %s", name); + continue; + } + + icon->priv->fail_counter++; + refresh_icon (icon); + } + + g_list_free_full (instances, g_object_unref); } static void @@ -816,15 +830,31 @@ on_name_acquired (GDBusConnection *connection, const gchar *name, gpointer user_data) { - XAppStatusIcon *self = XAPP_STATUS_ICON (user_data); - process_icon_state = XAPP_STATUS_ICON_STATE_NATIVE; - sync_skeleton (self); + GList *instances = g_dbus_object_manager_get_objects (G_DBUS_OBJECT_MANAGER (obj_server)); + GList *l; - DEBUG ("Name acquired on dbus, state is now: %s", - state_to_str (process_icon_state)); - g_signal_emit (self, signals[STATE_CHANGED], 0, process_icon_state); + for (l = instances; l != NULL; l = l->next) + { + GObject *instance = G_OBJECT (l->data); + XAppStatusIcon *icon = XAPP_STATUS_ICON (g_object_get_data (instance, "xapp-status-icon-instance")); + + if (icon == NULL) + { + g_warning ("on_name_aquired: Could not retrieve xapp-status-icon-instance data: %s", name); + continue; + } + + sync_skeleton (icon); + + DEBUG ("Name acquired on dbus, state is now: %s", + state_to_str (process_icon_state)); + + g_signal_emit (icon, signals[STATE_CHANGED], 0, process_icon_state); + } + + g_list_free_full (instances, g_object_unref); } typedef struct @@ -890,6 +920,8 @@ export_icon_interface (XAppStatusIcon *self) xapp_object_skeleton_set_status_icon_interface (self->priv->object_skeleton, self->priv->interface_skeleton); + g_object_set_data (G_OBJECT (self->priv->object_skeleton), "xapp-status-icon-instance", self); + g_dbus_object_manager_server_export_uniquely (obj_server, G_DBUS_OBJECT_SKELETON (self->priv->object_skeleton)); @@ -942,7 +974,7 @@ connect_with_status_applet (XAppStatusIcon *self) G_BUS_NAME_OWNER_FLAGS_DO_NOT_QUEUE, on_name_acquired, on_name_lost, - self, + NULL, NULL); } @@ -1298,7 +1330,9 @@ remove_icon_path_from_bus (XAppStatusIcon *self) DEBUG ("Removing interface at path '%s'", path); + g_object_set_data (G_OBJECT (self->priv->object_skeleton), "xapp-status-icon-instance", NULL); g_dbus_object_manager_server_unexport (obj_server, path); + self->priv->interface_skeleton = NULL; self->priv->object_skeleton = NULL; From 074607efec55d0a70f1a206683fcbb589307a0e9 Mon Sep 17 00:00:00 2001 From: Michael Webster Date: Mon, 10 Oct 2022 09:41:56 -0400 Subject: [PATCH 6/6] sn-item: Silence warning caused when an app exits without notice. Slack stops processing dbus traffic before it actually stops advertising itself. --- xapp-sn-watcher/sn-item.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xapp-sn-watcher/sn-item.c b/xapp-sn-watcher/sn-item.c index 29f4420a..5631ce2b 100644 --- a/xapp-sn-watcher/sn-item.c +++ b/xapp-sn-watcher/sn-item.c @@ -733,12 +733,12 @@ get_all_properties_callback (GObject *source_object, GVariantIter *iter = NULL; const gchar *name; GVariant *value; - properties = g_dbus_proxy_call_finish (G_DBUS_PROXY (source_object), res, &error); if (error != NULL) { - if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) + if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED) && + !g_error_matches (error, G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_METHOD)) { g_critical ("Could not get properties for %s: %s\n", g_dbus_proxy_get_name (item->sn_item_proxy),