x11-misc/openbox-menu: Switch to GTK3

0.8.1-makefile.patch: Fix BINDIR path, add DESTDIR, adapt to GTK3 change

Bug: https://bugs.gentoo.org/739808
Package-Manager: Portage-3.0.17, Repoman-3.0.2
Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
This commit is contained in:
Andreas Sturmlechner
2021-03-15 16:23:35 +01:00
parent fb3b6fa6ed
commit 4d2d5a69a8
3 changed files with 119 additions and 25 deletions
@@ -0,0 +1,91 @@
From 8fe1e7fa9239ed8b604a59ef2202f183f1f56eb6 Mon Sep 17 00:00:00 2001
From: Fabrice THIROUX <fabrice.thiroux@net-c.com>
Date: Sat, 13 Feb 2021 14:46:53 +0100
Subject: [PATCH] Updated for gtk3. Remove icon_theme annoying variable
---
Makefile | 4 ++--
src/menu.c | 1 -
src/openbox-menu.h | 1 +
src/utils.c | 16 ++++++----------
4 files changed, 9 insertions(+), 13 deletions(-)
diff --git a/Makefile b/Makefile
index 5d8af49..5e09ef2 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,5 @@
-LIBS= `pkg-config --libs glib-2.0 gtk+-2.0 libmenu-cache`
-CFLAGS+= -g -Wall `pkg-config --cflags glib-2.0 gtk+-2.0 libmenu-cache`
+LIBS= `pkg-config --libs glib-2.0 gtk+-3.0 libmenu-cache`
+CFLAGS+= -g -Wall `pkg-config --cflags glib-2.0 gtk+-3.0 libmenu-cache`
CC=gcc
#-DG_DISABLE_DEPRECATED
diff --git a/src/menu.c b/src/menu.c
index 5b7e8f8..3b752d9 100644
--- a/src/menu.c
+++ b/src/menu.c
@@ -240,7 +240,6 @@ main (int argc, char **argv)
#ifdef WITH_ICONS
gtk_init (&argc, &argv);
- icon_theme = gtk_icon_theme_get_default ();
#endif
if ((ob_context = configure (argc, argv)) == NULL)
diff --git a/src/openbox-menu.h b/src/openbox-menu.h
index 7035e9d..f5a7bce 100644
--- a/src/openbox-menu.h
+++ b/src/openbox-menu.h
@@ -19,6 +19,7 @@
#ifndef __OPENBOXMENU_APP__
#define __OPENBOXMENU_APP__
+
#include <menu-cache.h>
#ifdef WITH_ICONS
diff --git a/src/utils.c b/src/utils.c
index 7a68316..2f4f95b 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -169,8 +169,6 @@ clean_exec (MenuCacheApp *app)
#if WITH_ICONS
-extern GtkIconTheme *icon_theme;
-
/****f* utils/item_icon_path
* OUTPUT
* return the path for the themed icon if item.
@@ -199,23 +197,21 @@ item_icon_path (MenuCacheItem *item)
if (g_path_is_absolute (name))
return g_strdup (name);
- /* We remove the file extension as gtk_icon_theme_lookup_icon can't
- * lookup a theme icon for, ie, 'geany.png'. It has to be 'geany'.
- */
- tmp_name = strndup (name, strrchr (name, '.') - name);
#ifdef WITH_SVG
- icon_info = gtk_icon_theme_lookup_icon (icon_theme, tmp_name, 16, GTK_ICON_LOOKUP_GENERIC_FALLBACK);
+ icon_info = gtk_icon_theme_lookup_icon (gtk_icon_theme_get_default(), name, 16, GTK_ICON_LOOKUP_GENERIC_FALLBACK);
#else
- icon_info = gtk_icon_theme_lookup_icon (icon_theme, tmp_name, 16, GTK_ICON_LOOKUP_NO_SVG | GTK_ICON_LOOKUP_GENERIC_FALLBACK);
+ icon_info = gtk_icon_theme_lookup_icon (gtk_icon_theme_get_default(), name, 16, GTK_ICON_LOOKUP_NO_SVG | GTK_ICON_LOOKUP_GENERIC_FALLBACK);
#endif
g_free (tmp_name);
}
+
+
if (!icon_info) /* 2nd fallback */
- icon_info = gtk_icon_theme_lookup_icon (icon_theme, "empty", 16, GTK_ICON_LOOKUP_NO_SVG);
+ icon_info = gtk_icon_theme_lookup_icon (gtk_icon_theme_get_default (), "empty", 16, GTK_ICON_LOOKUP_NO_SVG);
icon = g_strdup (gtk_icon_info_get_filename (icon_info));
- gtk_icon_info_free (icon_info);
+ g_object_unref (icon_info);
return icon;
}
@@ -6,25 +6,21 @@ Subject: [PATCH 2/2] Update Makefile build
Introduce CC and PKG_CONFIG variables that can be redefined by user.
Added variables WITH_ICONS and WITH_SVG that can be also redefined by user.
Misc enhancements to file globbing.
---
Makefile | 36 ++++++++++++++++++++++++++----------
README.md | 8 ++++----
2 files changed, 30 insertions(+), 14 deletions(-)
diff --git a/Makefile b/Makefile
index 5d8af49..e40e611 100644
* 2021-03-15 asturm: Fix BINDIR path, add DESTDIR, adapt to GTK3 change
--- a/Makefile
+++ b/Makefile
@@ -1,19 +1,32 @@
-LIBS= `pkg-config --libs glib-2.0 gtk+-2.0 libmenu-cache`
-CFLAGS+= -g -Wall `pkg-config --cflags glib-2.0 gtk+-2.0 libmenu-cache`
@@ -1,19 +1,31 @@
-LIBS= `pkg-config --libs glib-2.0 gtk+-3.0 libmenu-cache`
-CFLAGS+= -g -Wall `pkg-config --cflags glib-2.0 gtk+-3.0 libmenu-cache`
-CC=gcc
+CC ?= gcc
+PKG_CONFIG ?= pkg-config
+
+CFLAGS ?= -O2 -g
+CFLAGS += -Wall $(shell $(PKG_CONFIG) --cflags glib-2.0 gtk+-2.0 libmenu-cache)
+LIBS += $(shell $(PKG_CONFIG) --libs glib-2.0 gtk+-2.0 libmenu-cache)
+CFLAGS += -Wall $(shell $(PKG_CONFIG) --cflags glib-2.0 gtk+-3.0 libmenu-cache)
+LIBS += $(shell $(PKG_CONFIG) --libs glib-2.0 gtk+-3.0 libmenu-cache)
+
#-DG_DISABLE_DEPRECATED
@@ -42,22 +38,23 @@ index 5d8af49..e40e611 100644
# Check SVG support with '$ ldd /usr/bin/openbox | grep svg', librsvg must appear..
-# CFLAGS+=-DWITH_SVG
+WITH_SVG=0
-prefix= /usr/local
+
+ifeq ($(WITH_SVG),1)
+CFLAGS += -DWITH_SVG
+endif
+
+prefix = /usr/local
DESTDIR ?= $(prefix)
BINDIR= ${DESTDIR}/bin
-prefix= /usr/local
-DESTDIR ?= $(prefix)
-BINDIR= ${DESTDIR}/bin
+prefix = /usr
+BINDIR = ${prefix}/bin
-SRC= $(shell ls src/*.c 2> /dev/null)
+SRC= $(wildcard src/*.c)
OBJ= $(SRC:.c=.o)
all: $(OBJ) check openbox-menu
@@ -25,13 +38,16 @@ all: $(OBJ) check openbox-menu
@@ -25,15 +37,18 @@
openbox-menu: $(OBJ)
$(CC) $(OBJ) -o openbox-menu $(LDFLAGS) $(LIBS)
@@ -69,14 +66,17 @@ index 5d8af49..e40e611 100644
@rm -rf doc
install:
+ @install -Dm 755 openbox-menu $(BINDIR)/openbox-menu
+ @install -Dm 755 openbox-menu "$(DESTDIR)$(BINDIR)/openbox-menu"
+
+install-strip:
@strip -s openbox-menu
@install -Dm 755 openbox-menu $(BINDIR)/openbox-menu
- @install -Dm 755 openbox-menu $(BINDIR)/openbox-menu
+ @install -Dm 755 openbox-menu "$(DESTDIR)$(BINDIR)/openbox-menu"
doc:
robodoc --src . --doc doc/ --multidoc --index --html --cmode
diff --git a/README.md b/README.md
index 748e684..4db7074 100644
--- a/README.md
+++ b/README.md
@@ -6,17 +6,17 @@ Type `make` then, with superuser privileges, `make install` to install it. openb
@@ -1,7 +1,8 @@
# Copyright 1999-2020 Gentoo Authors
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
inherit toolchain-funcs
DESCRIPTION="Another dynamic menu generator for Openbox"
@@ -17,16 +18,18 @@ REQUIRED_USE="svg? ( icons )"
DEPEND="
dev-libs/glib:2
lxde-base/menu-cache
x11-libs/gtk+:2
x11-libs/gtk+:3
"
RDEPEND="
${DEPEND}
RDEPEND="${DEPEND}
icons? ( x11-wm/openbox[imlib,svg?] )
!icons? ( x11-wm/openbox )
"
BDEPEND="virtual/pkgconfig"
PATCHES=(
# git master
"${FILESDIR}/${P}-gtk3.patch"
# downstream patches
"${FILESDIR}/${P}-build.patch"
"${FILESDIR}/${P}-makefile.patch"
)