Accepting request 1234107 from X11:MATE:Factory

- Add patches: brisk-menu-gsettings-icon-properties.patch and 
- Add a patch: brisk-menu-fix-crash-on-desktop-file-changes-5f0be5741b5b37221fc8911c11f394ec498cd53d.patch. 
  Backport upstream patch to fix crashes in odd cases when .desktop files are
  changed. (forwarded request 1234106 from hillwood)

OBS-URL: https://build.opensuse.org/request/show/1234107
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/brisk-menu?expand=0&rev=8
This commit is contained in:
Ana Guerrero 2025-01-01 22:07:44 +00:00 committed by Git OBS Bridge
commit 8fa069c951
5 changed files with 328 additions and 3 deletions

View File

@ -0,0 +1,161 @@
From 5f0be5741b5b37221fc8911c11f394ec498cd53d Mon Sep 17 00:00:00 2001
From: fadeev <anton.fadeev@red-soft.ru>
Date: Thu, 18 Feb 2021 15:13:45 +0300
Subject: [PATCH] Fix brisk-menu crash in some random cases and when
update/add/remove .desktop files
---
src/backend/apps/apps-backend.c | 4 ++++
src/backend/favourites/favourites-backend.c | 7 +++++++
src/backend/favourites/favourites-desktop.c | 4 ++++
src/frontend/menu-settings.c | 4 +++-
src/frontend/menu-window.c | 3 +++
5 files changed, 21 insertions(+), 1 deletion(-)
diff --git a/src/backend/apps/apps-backend.c b/src/backend/apps/apps-backend.c
index a85e307..26578d6 100644
--- a/src/backend/apps/apps-backend.c
+++ b/src/backend/apps/apps-backend.c
@@ -80,6 +80,8 @@ DEF_AUTOFREE(MateMenuTree, g_object_unref)
DEF_AUTOFREE(GDesktopAppInfo, g_object_unref)
DEF_AUTOFREE(GError, g_error_free)
+BriskAppsBackend * BriskAppsBackendInstance = NULL;
+
/**
* Due to a glib weirdness we must fully invalidate the monitor's cache
* to force reload events to work again.
@@ -213,6 +215,7 @@ static void brisk_apps_backend_init(BriskAppsBackend *self)
"changed",
G_CALLBACK(brisk_apps_backend_changed),
self);
+ BriskAppsBackendInstance = self;
}
/**
@@ -258,6 +261,7 @@ static gint brisk_apps_backend_sort_section(gconstpointer a, gconstpointer b)
*/
static gboolean brisk_apps_backend_init_menus(BriskAppsBackend *self)
{
+ self = BriskAppsBackendInstance;
brisk_apps_backend_reset_pending(self);
/* Now load them again */
diff --git a/src/backend/favourites/favourites-backend.c b/src/backend/favourites/favourites-backend.c
index 52cecde..eb36e94 100644
--- a/src/backend/favourites/favourites-backend.c
+++ b/src/backend/favourites/favourites-backend.c
@@ -37,6 +37,8 @@ static void brisk_favourites_backend_pin_item(GSimpleAction *action, GVariant *p
static void brisk_favourites_backend_unpin_item(GSimpleAction *action, GVariant *parameter,
BriskFavouritesBackend *self);
+BriskFavouritesBackend * BriskFavouritesBackendInstance = NULL;
+
/**
* Tell the frontends what we are
*/
@@ -130,6 +132,7 @@ static void brisk_favourites_backend_class_init(BriskFavouritesBackendClass *kla
static void brisk_favourites_backend_changed(GSettings *settings, const gchar *key,
BriskFavouritesBackend *self)
{
+ self = BriskFavouritesBackendInstance;
autofree(gstrv) *favs = g_settings_get_strv(settings, key);
g_hash_table_remove_all(self->favourites);
@@ -168,6 +171,8 @@ static void brisk_favourites_backend_init(BriskFavouritesBackend *self)
brisk_favourites_backend_init_desktop(self);
+ BriskFavouritesBackendInstance = self;
+
/* Allow O(1) lookup for the "is pinned" logic */
self->favourites = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL);
@@ -206,6 +211,7 @@ static void brisk_favourites_backend_pin_item(__brisk_unused__ GSimpleAction *ac
__brisk_unused__ GVariant *parameter,
BriskFavouritesBackend *self)
{
+ self = BriskFavouritesBackendInstance;
autofree(gstrv) *old = NULL;
autofree(GArray) *array = NULL;
@@ -239,6 +245,7 @@ static void brisk_favourites_backend_unpin_item(__brisk_unused__ GSimpleAction *
__brisk_unused__ GVariant *parameter,
BriskFavouritesBackend *self)
{
+ self = BriskFavouritesBackendInstance;
autofree(gstrv) *old = NULL;
autofree(GArray) *array = NULL;
diff --git a/src/backend/favourites/favourites-desktop.c b/src/backend/favourites/favourites-desktop.c
index b982d28..a123eea 100644
--- a/src/backend/favourites/favourites-desktop.c
+++ b/src/backend/favourites/favourites-desktop.c
@@ -32,6 +32,8 @@ typedef enum {
PIN_STATUS_UNPINNED = 2,
} DesktopPinStatus;
+extern BriskFavouritesBackend * BriskFavouritesBackendInstance;
+
/**
* get_desktop_item_source:
*
@@ -89,6 +91,7 @@ static void brisk_favourites_backend_action_desktop_pin(__brisk_unused__ GSimple
__brisk_unused__ GVariant *parameter,
BriskFavouritesBackend *self)
{
+ self = BriskFavouritesBackendInstance;
autofree(GFile) *source = NULL;
autofree(GFile) *dest = NULL;
autofree(GError) *error = NULL;
@@ -135,6 +138,7 @@ static void brisk_favourites_backend_action_desktop_unpin(__brisk_unused__ GSimp
__brisk_unused__ GVariant *parameter,
BriskFavouritesBackend *self)
{
+ self = BriskFavouritesBackendInstance;
autofree(GFile) *source = NULL;
autofree(GFile) *dest = NULL;
autofree(GError) *error = NULL;
diff --git a/src/frontend/menu-settings.c b/src/frontend/menu-settings.c
index 626ecef..172fcf1 100644
--- a/src/frontend/menu-settings.c
+++ b/src/frontend/menu-settings.c
@@ -19,6 +19,8 @@ BRISK_END_PEDANTIC
static void brisk_menu_window_settings_changed(GSettings *settings, const gchar *key, gpointer v);
+extern BriskMenuWindow * BriskMenuWindowInstance;
+
void brisk_menu_window_init_settings(BriskMenuWindow *self)
{
GtkSettings *gtk_settings = NULL;
@@ -50,7 +52,7 @@ void brisk_menu_window_pump_settings(BriskMenuWindow *self)
static void brisk_menu_window_settings_changed(GSettings *settings, const gchar *key, gpointer v)
{
- BriskMenuWindow *self = v;
+ BriskMenuWindow *self = BriskMenuWindowInstance;
autofree(gchar) *value = NULL;
if (g_str_equal(key, "search-position")) {
diff --git a/src/frontend/menu-window.c b/src/frontend/menu-window.c
index 9dc505f..466f247 100644
--- a/src/frontend/menu-window.c
+++ b/src/frontend/menu-window.c
@@ -29,6 +29,8 @@ static GParamSpec *obj_properties[N_PROPS] = {
NULL,
};
+BriskMenuWindow * BriskMenuWindowInstance = NULL;
+
/**
* brisk_menu_window_dispose:
*
@@ -98,6 +100,7 @@ static void brisk_menu_window_init(BriskMenuWindow *self)
self->launcher = brisk_menu_launcher_new();
brisk_menu_window_init_settings(self);
+ BriskMenuWindowInstance = self;
}
static void brisk_menu_window_set_property(GObject *object, guint id, const GValue *value,

View File

@ -0,0 +1,32 @@
commit 0e175ab7243e8cffc5cd7acda7c9494dae6592f3
Author: Mihai Moldovan <ionic@ionic.de>
Date: Tue Jun 28 02:13:58 2022 +0200
gsettings schema: add properties icon-name and icon-symbolic.
We will use them later.
The icon-name property shall select the icon used in the menu button,
while the icon-symbolic property determines whether the icon will be
used in its symbolic or default variant.
diff --git a/data/com.solus-project.brisk-menu.gschema.xml b/data/com.solus-project.brisk-menu.gschema.xml
index d9806a6..40a1aea 100644
--- a/data/com.solus-project.brisk-menu.gschema.xml
+++ b/data/com.solus-project.brisk-menu.gschema.xml
@@ -56,5 +56,15 @@
<summary>Button label visibility</summary>
<description>Control the visibility of the main button label</description>
</key>
+ <key type="s" name="icon-name">
+ <default>'start-here'</default>
+ <summary>Icon to show in menu button</summary>
+ <description>Set the theme icon name to use in menu button.</description>
+ </key>
+ <key type="b" name="icon-symbolic">
+ <default>true</default>
+ <summary>Menu button uses symbolic icon</summary>
+ <description>Use a symbolic, i.e., low-color, icon variant in menu button.</description>
+ </key>
</schema>
</schemalist>

View File

@ -0,0 +1,115 @@
commit bb72aa006278c4efb960577360b95a66015a265f
Author: Mihai Moldovan <ionic@ionic.de>
Date: Tue Jun 28 02:18:12 2022 +0200
mate-applet: make menu button icon configurable.
The actual icon can now be changed via the icon-name gsettings key.
By default, the applet will load a symbolic version of the icon. This
behavior can be changed via the icon-symbolic key.
Changes to any of these keys should directly be visible.
diff --git a/src/mate-applet/applet.c b/src/mate-applet/applet.c
index 8465dbb..e4dcfa9 100644
--- a/src/mate-applet/applet.c
+++ b/src/mate-applet/applet.c
@@ -45,6 +45,7 @@ static void brisk_menu_applet_create_window(BriskMenuApplet *self);
/* Handle applet settings */
void brisk_menu_applet_init_settings(BriskMenuApplet *self);
+static void brisk_menu_applet_update_icon(BriskMenuApplet *self);
static void brisk_menu_applet_settings_changed(GSettings *settings, const gchar *key, gpointer v);
static void brisk_menu_applet_notify_fail(const gchar *title, const gchar *body);
@@ -107,6 +108,16 @@ void brisk_menu_applet_init_settings(BriskMenuApplet *self)
"changed::window-type",
G_CALLBACK(brisk_menu_applet_settings_changed),
self);
+
+ g_signal_connect(self->settings,
+ "changed::icon-name",
+ G_CALLBACK(brisk_menu_applet_settings_changed),
+ self);
+
+ g_signal_connect(self->settings,
+ "changed::icon-symbolic",
+ G_CALLBACK(brisk_menu_applet_settings_changed),
+ self);
}
/**
@@ -159,6 +170,9 @@ static void brisk_menu_applet_init(BriskMenuApplet *self)
/* Pump the label setting */
brisk_menu_applet_settings_changed(self->settings, "label-text", self);
+ /* Update the icon with the requested value. */
+ brisk_menu_applet_settings_changed(self->settings, "icon-name", self);
+
/* Fix label alignment */
gtk_widget_set_halign(label, GTK_ALIGN_START);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
@@ -239,6 +253,23 @@ static gboolean button_press_cb(BriskMenuApplet *self, GdkEvent *event, __brisk_
return GDK_EVENT_STOP;
}
+static void brisk_menu_applet_update_icon(BriskMenuApplet *self) {
+ autofree(gchar) *icon_name = NULL,
+ *icon_name_tmp = NULL;
+
+ icon_name = g_settings_get_string(self->settings, "icon-name");
+ if (g_str_equal(icon_name, "")) {
+ g_free(icon_name);
+ icon_name = g_strdup("start-here");
+ }
+ if (g_settings_get_boolean(self->settings, "icon-symbolic")) {
+ icon_name_tmp = g_strdup(icon_name);
+ g_free(icon_name);
+ icon_name = g_strconcat(icon_name_tmp, "-symbolic", NULL);
+ }
+ gtk_image_set_from_icon_name(GTK_IMAGE(self->image), icon_name, GTK_ICON_SIZE_MENU);
+}
+
/**
* Callback for changing applet settings
*/
@@ -259,6 +290,10 @@ static void brisk_menu_applet_settings_changed(GSettings *settings, const gchar
gtk_widget_hide(self->menu);
g_clear_pointer(&self->menu, gtk_widget_destroy);
brisk_menu_applet_create_window(self);
+ } else if (g_str_equal(key, "icon-name")) {
+ brisk_menu_applet_update_icon(self);
+ } else if (g_str_equal(key, "icon-symbolic")) {
+ brisk_menu_applet_update_icon(self);
}
}
@@ -368,9 +403,17 @@ static void brisk_menu_applet_notify_fail(const gchar *title, const gchar *body)
}
void brisk_menu_applet_show_about(__brisk_unused__ GtkAction *action,
- __brisk_unused__ BriskMenuApplet *applet)
+ BriskMenuApplet *applet)
{
static const gchar *copyright_string = "Copyright © 2016-2020 Brisk Menu Developers";
+ autofree(gchar) *icon_name = NULL;
+
+ icon_name = g_settings_get_string(applet->settings, "icon-name");
+ if (g_str_equal(icon_name, "")) {
+ g_free(icon_name);
+ icon_name = g_strdup("start-here");
+ }
+
gtk_show_about_dialog(NULL,
"authors",
brisk_developers,
@@ -379,7 +422,7 @@ void brisk_menu_applet_show_about(__brisk_unused__ GtkAction *action,
"license-type",
GTK_LICENSE_GPL_2_0,
"logo-icon-name",
- "start-here",
+ icon_name,
"version",
PACKAGE_VERSION,
"website",

View File

@ -1,3 +1,14 @@
-------------------------------------------------------------------
Mon Dec 27 07:31:00 UTC 2024 - Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
- Add patches: brisk-menu-gsettings-icon-properties.patch and
brisk-menu-runtime-icon-updates.patch. Add support for runtime icon
configuration.
- Add a patch: brisk-menu-fix-crash-on-desktop-file-changes-5f0be5741b5b37221fc8911c11f394ec498cd53d.patch.
Backport upstream patch to fix crashes in odd cases when .desktop files are
changed.
- Use %autosetup macro to apply patches.
-------------------------------------------------------------------
Mon Aug 31 13:43:30 UTC 2020 - Hillwood Yang <hillwood@opensuse.org>

View File

@ -1,7 +1,7 @@
#
# spec file for package brisk-menu
#
# Copyright (c) 2020 SUSE LLC
# Copyright (c) 2024 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -20,11 +20,17 @@ Name: brisk-menu
Version: 0.6.2
Release: 0
Summary: Modern, efficient menu for MATE
License: GPL-2.0-or-later AND CC-BY-SA-4.0
License: CC-BY-SA-4.0 AND GPL-2.0-or-later
URL: https://github.com/getsolus/brisk-menu
Source: https://github.com/getsolus/brisk-menu/releases/download/v%{version}/%{name}-v%{version}.tar.xz
Source1: https://github.com/getsolus/brisk-menu/releases/download/v%{version}/%{name}-v%{version}.tar.xz.asc
Source2: %{name}.keyring
# PATCH-FIX-UPSTREAM brisk-menu-gsettings-icon-properties.patch ionic@ionic.de -- Add icon properties to the gsettings schema for runtime configuration.
Patch0: %{name}-gsettings-icon-properties.patch
# PATCH-FIX-UPSTREAM brisk-menu-runtime-icon-updates.patch ionic@ionic.de -- Add support for runtime icon configuration.
Patch1: %{name}-runtime-icon-updates.patch
# PATCH-FIX-UPSTREAM brisk-menu-fix-crash-on-desktop-file-changes-5f0be5741b5b37221fc8911c11f394ec498cd53d.patch anton.fadeev@red-soft.ru -- Fix crash in some random cases when .desktop files are changed.
Patch2: %{name}-fix-crash-on-desktop-file-changes-5f0be5741b5b37221fc8911c11f394ec498cd53d.patch
BuildRequires: hicolor-icon-theme
BuildRequires: meson
BuildRequires: pkgconfig
@ -42,7 +48,7 @@ Recommends: %{name}-lang
Modern, efficient menu for the MATE Desktop Environment.
%prep
%setup -q -n %{name}-%{version}
%autosetup -p1 -n %{name}-%{version}
%lang_package