x11/gxkb: update the port to version 0.9.2

Several people asked to make GTK3 the default (which matches upstream),
so be it.  Retain the option to build against GTK2 though.  While here,
make port description text GTK version-agnostic.

Reported by:	portscout
This commit is contained in:
Alexey Dokuchaev 2021-08-28 08:51:52 +00:00
parent f9de3e93d6
commit c03a6c9e70
5 changed files with 123 additions and 128 deletions

View file

@ -1,7 +1,7 @@
# Created by: Alexey Dokuchaev <danfe@FreeBSD.org>
PORTNAME= gxkb
PORTVERSION= 0.8.2
PORTVERSION= 0.9.2
CATEGORIES= x11
MASTER_SITES= SF/${PORTNAME}
@ -16,19 +16,17 @@ USES= gnome pkgconfig
GNU_CONFIGURE= yes
USE_GNOME= gdkpixbuf2 glib20
PORTSCOUT= skipv:0.9.0 # same as 0.8.2, but GTK3 is the default
PORTDOCS= AUTHORS NEWS
OPTIONS_DEFINE= DOCS GTK3
GTK3_DESC= Build against GTK version 3, not 2
OPTIONS_DEFINE= DOCS GTK2
GTK2_DESC= Build against GTK version 2, not 3
GTK3_EXTRA_PATCHES= ${FILESDIR}/extra-patch-gtk3
GTK3_LIB_DEPENDS= libwnck-3.so:x11-toolkits/libwnck3
GTK3_LIB_DEPENDS_OFF= libwnck-1.so:x11-toolkits/libwnck
GTK3_USES= autoreconf
GTK3_USE= GNOME=gtk30
GTK3_USE_OFF= GNOME=gtk20
GTK2_EXTRA_PATCHES= ${FILESDIR}/extra-patch-gtk2
GTK2_LIB_DEPENDS= libwnck-1.so:x11-toolkits/libwnck
GTK2_LIB_DEPENDS_OFF= libwnck-3.so:x11-toolkits/libwnck3
GTK2_USES= autoreconf
GTK2_USE= GNOME=gtk20
GTK2_USE_OFF= GNOME=gtk30
post-patch-DOCS-on:
@${REINPLACE_CMD} -e '/^doc_DATA/s, C[^ ]*,,g' \

View file

@ -1,3 +1,3 @@
TIMESTAMP = 1594112130
SHA256 (gxkb-0.8.2.tar.gz) = 3683881bf2cf02846a746c4ddf6dc44adde01ab4a829e5e1a3b49aa22c89c24f
SIZE (gxkb-0.8.2.tar.gz) = 175889
TIMESTAMP = 1620127745
SHA256 (gxkb-0.9.2.tar.gz) = 58b02052ba92dc3b5527108d641c1019464e58471f5cf6d2bc9d4dd4fb140eaf
SIZE (gxkb-0.9.2.tar.gz) = 176074

View file

@ -0,0 +1,105 @@
--- configure.ac.orig 2021-05-04 11:24:32 UTC
+++ configure.ac
@@ -7,9 +7,9 @@ AC_PROG_RANLIB
AM_PROG_CC_C_O
AC_HEADER_STDC
PKG_PROG_PKG_CONFIG([0.20])
-PKG_CHECK_MODULES(GTK, [gtk+-3.0])
+PKG_CHECK_MODULES(GTK, [gtk+-2.0 >= 2.12.0])
PKG_CHECK_MODULES(GLIB, [glib-2.0 >= 2.16.0])
-PKG_CHECK_MODULES(LIBWNCK, [libwnck-3.0])
+PKG_CHECK_MODULES(LIBWNCK, [libwnck-1.0 >= 2.22.0])
PKG_CHECK_MODULES(LIBXKLAVIER, [libxklavier >= 3.0])
AC_SUBST(GTK_CFLAGS)
AC_SUBST(GTK_LIBS)
--- src/statusicon.c.orig 2021-04-18 16:21:09 UTC
+++ src/statusicon.c
@@ -74,7 +74,9 @@ gtk_status_icon_clicked( GtkStatusIcon *status_icon, g
if( xkb_config_get_group_count() > 2 )
{
- gtk_menu_popup_at_pointer( GTK_MENU( lb_mouse_popup ), NULL );
+ gtk_menu_popup( GTK_MENU( lb_mouse_popup ), NULL, NULL,
+ gtk_status_icon_position_menu, status_icon,
+ 0, gtk_get_current_event_time() );
}
else
{
@@ -114,7 +116,9 @@ gtk_status_icon_popup_menu( GtkStatusIcon *status_icon
if( status_icon == NULL )
return;
- gtk_menu_popup_at_pointer( GTK_MENU( rb_mouse_popup ), NULL );
+ gtk_menu_popup( GTK_MENU( rb_mouse_popup ),
+ NULL, NULL, gtk_status_icon_position_menu, status_icon, button,
+ activate_time );
}
void
@@ -150,7 +154,7 @@ statusicon_update_current_image( void )
}
gtk_status_icon_set_from_pixbuf( trayicon, pixmap );
- gtk_status_icon_set_tooltip_text( trayicon, g_ascii_strup( group_name, -1 ) );
+ gtk_status_icon_set_tooltip( trayicon, g_ascii_strup( group_name, -1 ) );
}
else if( icon_type == APPINDICATOR )
{
@@ -218,7 +222,7 @@ statusicon_update_menu( void )
if( icon_type == APPINDICATOR )
{
// Separator
- mi = gtk_separator_menu_item_new();
+ mi = gtk_menu_item_new();
gtk_widget_show( mi );
gtk_menu_shell_append( GTK_MENU_SHELL( lb_mouse_popup ), mi );
gtk_widget_set_sensitive( mi, FALSE );
@@ -229,21 +233,20 @@ statusicon_update_menu( void )
rb_mouse_popup = gtk_menu_new();
}
- mi = gtk_image_menu_item_new_from_stock( "gtk-about", NULL );
+ mi = gtk_image_menu_item_new_from_stock( GTK_STOCK_ABOUT, NULL );
g_signal_connect( G_OBJECT( mi ), "activate", (GCallback)xkb_about, NULL );
gtk_menu_shell_append( GTK_MENU_SHELL( rb_mouse_popup ), mi );
gtk_widget_show( mi );
if( icon_type == SYSTRAY )
{
- // Separator
- mi = gtk_separator_menu_item_new();
+ mi = gtk_menu_item_new();
gtk_widget_show( mi );
gtk_menu_shell_append( GTK_MENU_SHELL( rb_mouse_popup ), mi );
gtk_widget_set_sensitive( mi, FALSE );
}
- mi = gtk_image_menu_item_new_from_stock( "gtk-quit", NULL );
+ mi = gtk_image_menu_item_new_from_stock( GTK_STOCK_QUIT, NULL );
g_signal_connect( G_OBJECT( mi ), "activate", (GCallback)xkb_main_quit, NULL );
gtk_menu_shell_append( GTK_MENU_SHELL( rb_mouse_popup ), mi );
gtk_widget_show( mi );
--- src/xkb-callbacks.c.orig 2020-11-05 20:09:34 UTC
+++ src/xkb-callbacks.c
@@ -74,18 +74,12 @@ xkb_about( void )
GtkWidget* about_dialog = gtk_about_dialog_new();
gtk_window_set_icon(
(GtkWindow*)about_dialog,
- gtk_icon_theme_load_icon(
- gtk_icon_theme_get_default(),
- "gtk-about",
- GTK_ICON_SIZE_DIALOG,
- 0,
- NULL
- )
+ gtk_widget_render_icon(about_dialog, GTK_STOCK_ABOUT, GTK_ICON_SIZE_DIALOG, NULL)
);
- const gchar** authors = (const gchar**) g_strsplit( AUTHORS, "\n", -1 );
+ const gchar* authors[] = { AUTHORS, NULL };
gtk_about_dialog_set_authors( (GtkAboutDialog*)about_dialog, authors );
- gtk_about_dialog_set_program_name( (GtkAboutDialog*)about_dialog, PACKAGE );
+ gtk_about_dialog_set_name( (GtkAboutDialog*)about_dialog, PACKAGE );
gtk_about_dialog_set_version( (GtkAboutDialog*)about_dialog, VERSION );
gtk_about_dialog_set_comments( (GtkAboutDialog*)about_dialog, DESCRIPTION );
gtk_about_dialog_set_website( (GtkAboutDialog*)about_dialog, PACKAGE_URL );

View file

@ -1,108 +0,0 @@
GTK3 support, courtesy of Mateusz Łukasik <mati75@linuxmint.pl>
--- configure.ac.orig 2020-07-07 08:50:37 UTC
+++ configure.ac
@@ -7,10 +7,10 @@ AC_PROG_RANLIB
AM_PROG_CC_C_O
AC_HEADER_STDC
PKG_PROG_PKG_CONFIG([0.20])
-PKG_CHECK_MODULES(GTK, [gtk+-2.0 >= 2.12.0])
+PKG_CHECK_MODULES(GTK, [gtk+-3.0])
PKG_CHECK_MODULES(GLIB, [glib-2.0 >= 2.16.0])
PKG_CHECK_MODULES(LIBXKLAVIER, [libxklavier >= 3.0])
-PKG_CHECK_MODULES(LIBWNCK, [libwnck-1.0 >= 2.22.0])
+PKG_CHECK_MODULES(LIBWNCK, [libwnck-3.0])
AC_SUBST(GTK_CFLAGS)
AC_SUBST(GTK_LIBS)
AC_SUBST(GLIB_CFLAGS)
--- src/statusicon.c.orig 2020-07-07 08:50:37 UTC
+++ src/statusicon.c
@@ -74,9 +74,7 @@ gtk_status_icon_clicked( GtkStatusIcon *status_icon, g
if( xkb_config_get_group_count() > 2 )
{
- gtk_menu_popup( GTK_MENU( lb_mouse_popup ), NULL, NULL,
- gtk_status_icon_position_menu, status_icon,
- 0, gtk_get_current_event_time() );
+ gtk_menu_popup_at_pointer( GTK_MENU( lb_mouse_popup ), NULL );
}
else
{
@@ -116,9 +114,7 @@ gtk_status_icon_popup_menu( GtkStatusIcon *status_icon
if( status_icon == NULL )
return;
- gtk_menu_popup( GTK_MENU( rb_mouse_popup ),
- NULL, NULL, gtk_status_icon_position_menu, status_icon, button,
- activate_time );
+ gtk_menu_popup_at_pointer( GTK_MENU( rb_mouse_popup ), NULL );
}
void
@@ -153,7 +149,7 @@ statusicon_update_current_image( void )
}
gtk_status_icon_set_from_pixbuf( trayicon, pixmap );
- gtk_status_icon_set_tooltip( trayicon, g_ascii_strup( group_name, -1 ) );
+ gtk_status_icon_set_tooltip_text( trayicon, g_ascii_strup( group_name, -1 ) );
}
else if( icon_type == APPINDICATOR )
{
@@ -220,7 +216,7 @@ statusicon_update_menu( void )
if( icon_type == APPINDICATOR )
{
// Separator
- mi = gtk_menu_item_new();
+ mi = gtk_separator_menu_item_new();
gtk_widget_show( mi );
gtk_menu_shell_append( GTK_MENU_SHELL( lb_mouse_popup ), mi );
gtk_widget_set_sensitive( mi, FALSE );
@@ -231,20 +227,21 @@ statusicon_update_menu( void )
rb_mouse_popup = gtk_menu_new();
}
- mi = gtk_image_menu_item_new_from_stock( GTK_STOCK_ABOUT, NULL );
+ mi = gtk_image_menu_item_new_from_stock( "gtk-about", NULL );
g_signal_connect( G_OBJECT( mi ), "activate", (GCallback)xkb_about, NULL );
gtk_menu_shell_append( GTK_MENU_SHELL( rb_mouse_popup ), mi );
gtk_widget_show( mi );
if( icon_type == SYSTRAY )
{
- mi = gtk_menu_item_new();
+ // Separator
+ mi = gtk_separator_menu_item_new();
gtk_widget_show( mi );
gtk_menu_shell_append( GTK_MENU_SHELL( rb_mouse_popup ), mi );
gtk_widget_set_sensitive( mi, FALSE );
}
- mi = gtk_image_menu_item_new_from_stock( GTK_STOCK_QUIT, NULL );
+ mi = gtk_image_menu_item_new_from_stock( "gtk-quit", NULL );
g_signal_connect( G_OBJECT( mi ), "activate", (GCallback)xkb_main_quit, NULL );
gtk_menu_shell_append( GTK_MENU_SHELL( rb_mouse_popup ), mi );
gtk_widget_show( mi );
--- src/xkb-callbacks.c.orig 2019-08-09 18:09:51 UTC
+++ src/xkb-callbacks.c
@@ -74,12 +74,18 @@ xkb_about( void )
GtkWidget* about_dialog = gtk_about_dialog_new();
gtk_window_set_icon(
(GtkWindow*)about_dialog,
- gtk_widget_render_icon(about_dialog, GTK_STOCK_ABOUT, GTK_ICON_SIZE_DIALOG, NULL)
+ gtk_icon_theme_load_icon(
+ gtk_icon_theme_get_default(),
+ "gtk-about",
+ GTK_ICON_SIZE_DIALOG,
+ 0,
+ NULL
+ )
);
- const gchar* authors[] = { AUTHORS, NULL };
+ const gchar** authors = (const gchar**) g_strsplit( AUTHORS, "\n", -1 );
gtk_about_dialog_set_authors( (GtkAboutDialog*)about_dialog, authors );
- gtk_about_dialog_set_name( (GtkAboutDialog*)about_dialog, PACKAGE );
+ gtk_about_dialog_set_program_name( (GtkAboutDialog*)about_dialog, PACKAGE );
gtk_about_dialog_set_version( (GtkAboutDialog*)about_dialog, VERSION );
gtk_about_dialog_set_comments( (GtkAboutDialog*)about_dialog, DESCRIPTION );
gtk_about_dialog_set_website( (GtkAboutDialog*)about_dialog, PACKAGE_URL );

View file

@ -1,9 +1,9 @@
gxkb is a little indicator applet which allows one to quickly switch
between different keyboard layouts in X11. A flag corresponding to
the country of the active layout is shown in the system tray area.
gxkb is a little indicator applet which allows to quickly switch between
different X11 keyboard layouts. A flag corresponding to the country of
the active layout is shown in the system tray area.
The applet is written in C and uses GTK+ 2.0 library (and therefore
does not depend on any GNOME components) and can maintain separate
per-window, per-application, or global layout states.
The applet is written in C and uses just the GTK+ library, not any other
GNOME components, and can maintain separate per-window, per-application,
or global layout states.
WWW: https://zen-tools.github.io/gxkb/