diff --git a/data/meson.build b/data/meson.build index 7830a7a..24e5f9f 100644 --- a/data/meson.build +++ b/data/meson.build @@ -1,4 +1,7 @@ -install_data(['80xapp-gtk3-module.sh'], - install_dir: join_paths(get_option('sysconfdir'), 'X11', 'xinit', 'xinitrc.d'), - install_mode: 'rwxr-xr-x' -) + +if not app_lib_only + install_data(['80xapp-gtk3-module.sh'], + install_dir: join_paths(get_option('sysconfdir'), 'X11', 'xinit', 'xinitrc.d'), + install_mode: 'rwxr-xr-x' + ) +endif \ No newline at end of file diff --git a/libxapp/favorite-vfs-file-monitor.c b/libxapp/favorite-vfs-file-monitor.c index c35c39c..10d9b74 100644 --- a/libxapp/favorite-vfs-file-monitor.c +++ b/libxapp/favorite-vfs-file-monitor.c @@ -206,6 +206,7 @@ XAppFavoriteInfo *info = (XAppFavoriteInfo *) ptr_a; const gchar *uri = (gchar *) ptr_b; + // GCompareFunc returns 0 when there's a match. return g_strcmp0 (info->uri, uri); } @@ -252,6 +253,23 @@ { added = g_list_prepend (added, new_info); } + } + + for (iter = removed; iter != NULL; iter = iter->next) + { + XAppFavoriteInfo *removed_info = (XAppFavoriteInfo *) iter->data; + + GFile *file = _favorite_vfs_file_new_for_info (removed_info); + + g_file_monitor_emit_event (G_FILE_MONITOR (monitor), + file, + NULL, + G_FILE_MONITOR_EVENT_DELETED); + g_file_monitor_emit_event (G_FILE_MONITOR (monitor), + file, + NULL, + G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT); + g_object_unref (file); } for (iter = added; iter != NULL; iter = iter->next) @@ -271,23 +289,6 @@ g_object_unref (file); } - for (iter = removed; iter != NULL; iter = iter->next) - { - XAppFavoriteInfo *removed_info = (XAppFavoriteInfo *) iter->data; - - GFile *file = _favorite_vfs_file_new_for_info (removed_info); - - g_file_monitor_emit_event (G_FILE_MONITOR (monitor), - file, - NULL, - G_FILE_MONITOR_EVENT_DELETED); - g_file_monitor_emit_event (G_FILE_MONITOR (monitor), - file, - NULL, - G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT); - g_object_unref (file); - } - g_list_free (added); g_list_free (removed); diff --git a/libxapp/meson.build b/libxapp/meson.build index 24fa2ce..888d447 100644 --- a/libxapp/meson.build +++ b/libxapp/meson.build @@ -147,10 +147,12 @@ install: true ) -gtk3_module = shared_module( - 'xapp-gtk3-module', ['xapp-gtk3-module.c'], - include_directories: [top_inc], - dependencies: [gtk3_dep, libxapp_dep], - install: true, - install_dir: join_paths(gtk3_dep.get_pkgconfig_variable('libdir'),'gtk-3.0','modules') -) \ No newline at end of file +if not app_lib_only + gtk3_module = shared_module( + 'xapp-gtk3-module', ['xapp-gtk3-module.c'], + include_directories: [top_inc], + dependencies: [gtk3_dep, libxapp_dep], + install: true, + install_dir: join_paths(gtk3_dep.get_pkgconfig_variable('libdir'),'gtk-3.0','modules') + ) +endif diff --git a/libxapp/xapp-favorites.c b/libxapp/xapp-favorites.c index cd35c5d..6c4b8a1 100644 --- a/libxapp/xapp-favorites.c +++ b/libxapp/xapp-favorites.c @@ -402,6 +402,8 @@ real_uri = g_strdup (uri); } + g_return_if_fail (real_uri != NULL); + g_debug ("XAppFavorites: remove favorite: %s", real_uri); // It may be orphaned for some reason.. even if it's not in gsettings, still try diff --git a/libxapp/xapp-util.c b/libxapp/xapp-util.c index 1807395..1cef67f 100644 --- a/libxapp/xapp-util.c +++ b/libxapp/xapp-util.c @@ -44,3 +44,63 @@ return g_strstr_len (contents, -1, "on-demand") != NULL; } + +// Copied from cinnamon:main.c +/** + * xapp_util_get_session_is_running: + * + * Check if the Session Manager is currently in the "Running" phase. + * + * Returns: %TRUE if the session is running. + * + * Since: 2.0 + */ +gboolean +xapp_util_get_session_is_running (void) +{ + GDBusConnection *session_bus; + GError *error; + GVariant *session_result; + gboolean session_running; + + error = NULL; + + session_bus = g_bus_get_sync (G_BUS_TYPE_SESSION, + NULL, + &error); + + if (error != NULL) + { + g_critical ("Unable to determine if session is running, could not get session bus: %s\n", error->message); + g_clear_error (&error); + + return FALSE; + } + + session_result = g_dbus_connection_call_sync (session_bus, + "org.gnome.SessionManager", + "/org/gnome/SessionManager", + "org.gnome.SessionManager", + "IsSessionRunning", + NULL, + G_VARIANT_TYPE ("(b)"), + G_DBUS_CALL_FLAGS_NONE, + 1000, + NULL, + &error); + + if (session_result != NULL) + { + g_variant_get (session_result, "(b)", &session_running); + g_variant_unref (session_result); + } + else + { + session_running = FALSE; + g_clear_error (&error); + } + + g_object_unref (session_bus); + + return session_running; +} diff --git a/libxapp/xapp-util.h b/libxapp/xapp-util.h index 970cda2..87d1675 100644 --- a/libxapp/xapp-util.h +++ b/libxapp/xapp-util.h @@ -6,6 +6,7 @@ G_BEGIN_DECLS gboolean xapp_util_gpu_offload_supported (void); +gboolean xapp_util_get_session_is_running (void); G_END_DECLS #endif /* __XAPP_UTIL_H__ */ diff --git a/meson.build b/meson.build index d029732..7d50f79 100644 --- a/meson.build +++ b/meson.build @@ -1,6 +1,6 @@ project('xapp', 'c', - version : '2.0.6', + version : '2.0.7', default_options : [ 'buildtype=debugoptimized' ], ) diff --git a/xapp-sn-watcher/xapp-sn-watcher.c b/xapp-sn-watcher/xapp-sn-watcher.c index 802bd8c..2983b05 100644 --- a/xapp-sn-watcher/xapp-sn-watcher.c +++ b/xapp-sn-watcher/xapp-sn-watcher.c @@ -3,6 +3,7 @@ #include #include +#include #include #include "sn-watcher-interface.h" @@ -672,7 +673,16 @@ gboolean should_start; int status; - sleep (1); + if (xapp_util_get_session_is_running ()) + { + // The session manager tries to restart this immediately in the event of a crash, + // and we need a small delay between instances of xapp-sn-watcher to allow dbus and + // status-notifier apps to cleanly process removal of the old one. + // + // Skip this at startup, as it would cause a delay during login, and there's no + // existing process to replace anyhow. + sleep (2); + } current_desktop = g_getenv ("XDG_CURRENT_DESKTOP"); xapp_settings = g_settings_new (STATUS_ICON_SCHEMA);