1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-23 00:43:28 +00:00

Update GTK interface from GTK 1.2 to GTK 2.0

Obtained from:	gentoo portage
This commit is contained in:
Emanuel Haupt 2017-05-09 16:48:19 +00:00
parent 8b927e96d9
commit 027a533f11
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=440505
4 changed files with 234 additions and 4 deletions

View File

@ -3,7 +3,7 @@
PORTNAME= aylet
PORTVERSION= 0.5
PORTREVISION= 3
PORTREVISION= 4
CATEGORIES= audio
MASTER_SITES= http://www.worldofspectrum.org/pub/sinclair/music/players-unix/ \
LOCAL/ehaupt
@ -14,13 +14,16 @@ COMMENT= Aylet plays music files in the .ay format
LICENSE= GPLv2
LICENSE_FILE= ${WRKSRC}/COPYING
LIB_DEPENDS= libfontconfig.so:x11-fonts/fontconfig \
libfreetype.so:print/freetype2
USES= gettext-runtime pkgconfig
OPTIONS_DEFINE= GUI
OPTIONS_DEFAULT=GUI
OPTIONS_SUB= yes
GUI_USE= XORG=x11,xext,xi GNOME=gtk12
GUI_USE= XORG=x11,xext,xi GNOME=cairo,gdkpixbuf2,gtk20
ALL_TARGET= aylet
GUI_ALL_TARGET= xaylet

View File

@ -1,6 +1,6 @@
--- Makefile.orig 2005-12-18 03:05:08 UTC
+++ Makefile
@@ -2,7 +2,7 @@
@@ -2,12 +2,12 @@
# You need an ANSI C compiler. gcc is probably best.
#
@ -9,6 +9,12 @@
# Compiler options (and sound driver) to use. This one is for Linux,
# and other OSS-using systems.
#
-CFLAGS=-O -Wall -DDRIVER_OSS
+CFLAGS+=-Wall -DDRIVER_OSS
# for OpenBSD, uncomment this:
#CFLAGS=-O -Wall -DDRIVER_OPENBSD
@@ -19,10 +19,10 @@ CURSES_LIB=-lncurses
# dest for make install
@ -23,7 +29,28 @@
# if you want the X version to be installed in the usual X executables
# directory, uncomment this (altering if necessary):
@@ -52,10 +52,9 @@ installdirs:
@@ -37,25 +37,27 @@ MANDIR=$(PREFIX)/man/man1
OBJS=main.o sound.o ui.o z80.o drv-oss.o drv-obsd.o
XOBJS=main.o sound.o uigtk.o z80.o drv-oss.o drv-obsd.o
+GTK_CFLAGS+= `pkg-config --cflags gtk+-2.0` -DGTK2
+GTK_LDFLAGS+= `pkg-config --libs gtk+-2.0` -DGTK2
+
all: aylet xaylet
aylet: $(OBJS)
- $(CC) -o aylet $(OBJS) $(CURSES_LIB)
+ $(CC) $(LDFLAGS) $(CFLAGS) -o aylet $(OBJS) $(CURSES_LIB)
xaylet: $(XOBJS)
- $(CC) -o xaylet $(XOBJS) `gtk-config --libs`
+ $(CC) $(GTK_CFLAGS) $(GTK_LDFLAGS) $(LDFLAGS) $(CFLAGS) -o xaylet $(XOBJS)
uigtk.o: uigtk.c
- $(CC) $(CFLAGS) `gtk-config --cflags` -c uigtk.c -o uigtk.o
+ $(CC) $(GTK_CFLAGS) $(CFLAGS) $(LDFLAGS) -c uigtk.c -o uigtk.o
installdirs:
/bin/sh ./mkinstalldirs $(BINDIR) $(XBINDIR) $(MANDIR)
install: installdirs

View File

@ -0,0 +1,23 @@
--- ui.c.orig 2003-11-27 19:42:47 UTC
+++ ui.c
@@ -5,7 +5,9 @@
*/
#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
+#include <stdlib.h>
#include <sys/types.h>
#include <signal.h>
#include <curses.h>
@@ -188,8 +190,8 @@ if(need_update)
{
need_update=0;
draw_frame();
- draw_status(ay_filenames[ay_file],aydata.miscstr,aydata.authorstr,
- ay_track+1,aydata.tracks[ay_track].namestr);
+ draw_status(ay_filenames[ay_file],(char *)aydata.miscstr, (char *)aydata.authorstr,
+ ay_track+1, (char *)aydata.tracks[ay_track].namestr);
}
/* update time display */

View File

@ -0,0 +1,177 @@
--- uigtk.c.orig 2002-09-14 15:45:45 UTC
+++ uigtk.c
@@ -14,11 +14,13 @@
#include "ui.h"
/* button pixmaps */
+#ifndef GTK2_6
#include "button1.xpm"
#include "button2.xpm"
#include "button3.xpm"
#include "button4.xpm"
#include "button5.xpm"
+#endif
static GtkWidget *window,*vbox,*detailstbl,*detaillabel[5];
@@ -107,6 +109,11 @@ GtkWidget *pixmap;
GdkBitmap *bitmap,*mask;
int tbl_row,width;
+#ifdef GTK2
+#define gtk_accel_group_get_default() accel
+ GtkAccelGroup *accel;
+#endif
+
window=gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_signal_connect(GTK_OBJECT(window),"destroy",
GTK_SIGNAL_FUNC(cb_doquit),NULL);
@@ -116,6 +123,11 @@ gtk_widget_set_events(window,GDK_KEY_PRE
gtk_window_set_title(GTK_WINDOW(window),"xaylet");
gtk_window_set_policy(GTK_WINDOW(window),FALSE,TRUE,FALSE); /* XXX? */
+#ifdef GTK2
+ accel = gtk_accel_group_new ();
+ gtk_window_add_accel_group (GTK_WINDOW (window), accel);
+#endif
+
/* main vbox */
vbox=gtk_vbox_new(FALSE,0);
gtk_container_add(GTK_CONTAINER(window),vbox);
@@ -194,7 +206,11 @@ DO_TBL_LEFT(statustbl,1, 0,"Time:");
DO_TBL_RIGHT(statustbl,1, 1,2,"");
label_for_time=label;
+#ifdef GTK2
+ highspeed_widget = gtk_check_button_new_with_mnemonic ("_High speed");
+#else
highspeed_widget=gtk_check_button_new_with_label("High-speed");
+#endif
/* don't allow focus, looks too weird and we have shortcut */
GTK_WIDGET_UNSET_FLAGS(highspeed_widget,GTK_CAN_FOCUS);
gtk_table_attach_defaults(GTK_TABLE(statustbl),highspeed_widget, 2,4, 0,2);
@@ -227,6 +243,21 @@ gtk_table_set_row_spacings(GTK_TABLE(but
gtk_container_set_border_width(GTK_CONTAINER(buttontbl),5);
gtk_widget_show(buttontbl);
+#ifdef GTK2_6 /* >= GTK+ 2.6 */
+#define ADD_PIXMAP_TO_BUTTON(button,xpm,stock) \
+ pixmap = gtk_image_new_from_stock (GTK_STOCK_MEDIA_##stock, \
+ GTK_ICON_SIZE_BUTTON); \
+ gtk_container_add (GTK_CONTAINER ((button)), pixmap); \
+ gtk_widget_show (pixmap)
+#else /* < GTK+ 2.6 */
+#define ADD_PIXMAP_TO_BUTTON(button,xpm,stock) \
+ bitmap=gdk_pixmap_create_from_xpm_d(window->window,&mask, \
+ &(window->style->black), \
+ (xpm)); \
+ pixmap=gtk_pixmap_new(bitmap,mask); \
+ gtk_container_add(GTK_CONTAINER(button),pixmap); \
+ gtk_widget_show(pixmap)
+#endif
hbox=gtk_hbox_new(TRUE,5);
gtk_table_attach_defaults(GTK_TABLE(buttontbl),hbox, 0,4, 0,1);
@@ -236,16 +267,8 @@ gtk_widget_show(hbox);
/* XXX this seems to be needed here, but is it ok? */
gtk_widget_realize(window);
-#define ADD_PIXMAP_TO_BUTTON(button,xpm) \
- bitmap=gdk_pixmap_create_from_xpm_d(window->window,&mask, \
- &(window->style->black), \
- (xpm)); \
- pixmap=gtk_pixmap_new(bitmap,mask); \
- gtk_container_add(GTK_CONTAINER(button),pixmap); \
- gtk_widget_show(pixmap)
-
button=gtk_button_new();
-ADD_PIXMAP_TO_BUTTON(button,button1);
+ADD_PIXMAP_TO_BUTTON(button,button1,PREVIOUS);
gtk_box_pack_start(GTK_BOX(hbox),button,TRUE,TRUE,0);
gtk_signal_connect(GTK_OBJECT(button),"clicked",
GTK_SIGNAL_FUNC(cb_button_prev_track),NULL);
@@ -256,7 +279,7 @@ GTK_WIDGET_UNSET_FLAGS(button,GTK_CAN_FO
gtk_widget_show(button);
button=gtk_button_new();
-ADD_PIXMAP_TO_BUTTON(button,button2);
+ADD_PIXMAP_TO_BUTTON(button,button2,PLAY);
gtk_box_pack_start(GTK_BOX(hbox),button,TRUE,TRUE,0);
gtk_signal_connect(GTK_OBJECT(button),"clicked",
GTK_SIGNAL_FUNC(cb_button_play),NULL);
@@ -266,7 +289,7 @@ GTK_WIDGET_UNSET_FLAGS(button,GTK_CAN_FO
gtk_widget_show(button);
button=gtk_button_new();
-ADD_PIXMAP_TO_BUTTON(button,button3);
+ADD_PIXMAP_TO_BUTTON(button,button3,PAUSE);
gtk_box_pack_start(GTK_BOX(hbox),button,TRUE,TRUE,0);
gtk_signal_connect(GTK_OBJECT(button),"clicked",
GTK_SIGNAL_FUNC(cb_button_pause),NULL);
@@ -276,7 +299,7 @@ GTK_WIDGET_UNSET_FLAGS(button,GTK_CAN_FO
gtk_widget_show(button);
button=gtk_button_new();
-ADD_PIXMAP_TO_BUTTON(button,button4);
+ADD_PIXMAP_TO_BUTTON(button,button4,STOP);
gtk_box_pack_start(GTK_BOX(hbox),button,TRUE,TRUE,0);
gtk_signal_connect(GTK_OBJECT(button),"clicked",
GTK_SIGNAL_FUNC(cb_button_stop),NULL);
@@ -286,7 +309,7 @@ GTK_WIDGET_UNSET_FLAGS(button,GTK_CAN_FO
gtk_widget_show(button);
button=gtk_button_new();
-ADD_PIXMAP_TO_BUTTON(button,button5);
+ADD_PIXMAP_TO_BUTTON(button,button5,NEXT);
gtk_box_pack_start(GTK_BOX(hbox),button,TRUE,TRUE,0);
gtk_signal_connect(GTK_OBJECT(button),"clicked",
GTK_SIGNAL_FUNC(cb_button_next_track),NULL);
@@ -295,7 +318,11 @@ gtk_widget_add_accelerator(button,"click
GTK_WIDGET_UNSET_FLAGS(button,GTK_CAN_FOCUS);
gtk_widget_show(button);
+#ifdef GTK2
+ button = gtk_button_new_with_mnemonic ("_Restart");
+#else
button=gtk_button_new_with_label("Restart");
+#endif
gtk_box_pack_start(GTK_BOX(hbox),button,TRUE,TRUE,0);
gtk_signal_connect(GTK_OBJECT(button),"clicked",
GTK_SIGNAL_FUNC(cb_button_restart),NULL);
@@ -304,17 +331,24 @@ gtk_widget_add_accelerator(button,"click
GTK_WIDGET_UNSET_FLAGS(button,GTK_CAN_FOCUS);
gtk_widget_show(button);
-
/* second row, these go straight on the table */
/* backspace/delete/space are dealt with by keypress() */
+#ifdef GTK2
+ button = gtk_button_new_with_mnemonic ("_Previous file");
+#else
button=gtk_button_new_with_label("Prev File");
+#endif
gtk_table_attach_defaults(GTK_TABLE(buttontbl),button, 1,2, 1,2);
gtk_signal_connect(GTK_OBJECT(button),"clicked",
GTK_SIGNAL_FUNC(cb_button_prev_file),NULL);
GTK_WIDGET_UNSET_FLAGS(button,GTK_CAN_FOCUS);
gtk_widget_show(button);
+#ifdef GTK2
+ button = gtk_button_new_with_mnemonic("_Next file");
+#else
button=gtk_button_new_with_label("Next File");
+#endif
gtk_table_attach_defaults(GTK_TABLE(buttontbl),button, 2,3, 1,2);
gtk_signal_connect(GTK_OBJECT(button),"clicked",
GTK_SIGNAL_FUNC(cb_button_next_file),NULL);
@@ -386,8 +420,8 @@ retval=1;
if(need_update)
{
need_update=0;
- ui_draw_status(ay_filenames[ay_file],aydata.miscstr,aydata.authorstr,
- ay_track+1,aydata.tracks[ay_track].namestr);
+ ui_draw_status(ay_filenames[ay_file], (char *)aydata.miscstr, (char *)aydata.authorstr,
+ ay_track+1, (char *)aydata.tracks[ay_track].namestr);
}
/* update time display */