summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNP-Hardass <NP-Hardass@gentoo.org>2016-12-08 10:17:55 -0500
committerNP-Hardass <NP-Hardass@gentoo.org>2016-12-12 09:50:45 -0500
commit49e5e31aabe16db2ee990d5e50701905ae2b4938 (patch)
tree0fff483aa9c1c59784a10f77a24bb0aa48363e78 /games-puzzle/sgt-puzzles/files
parentdev-python/spyder: bump to 3.0.2 (diff)
downloadgentoo-49e5e31aabe16db2ee990d5e50701905ae2b4938.tar.gz
gentoo-49e5e31aabe16db2ee990d5e50701905ae2b4938.tar.bz2
gentoo-49e5e31aabe16db2ee990d5e50701905ae2b4938.zip
games-puzzle/sgt-puzzles: Large changeset, fixes #593480
Drop games eclass support Bump to EAPI=6 Rename binaries to avoid filename collisions Sort xdg menu entries In app help options Various ebuild improvements Package-Manager: portage-2.3.0
Diffstat (limited to 'games-puzzle/sgt-puzzles/files')
-rw-r--r--games-puzzle/sgt-puzzles/files/sgt-puzzles-20161207-builtin-help.patch107
-rw-r--r--games-puzzle/sgt-puzzles/files/sgt-puzzles.directory4
-rw-r--r--games-puzzle/sgt-puzzles/files/sgt-puzzles.menu18
3 files changed, 129 insertions, 0 deletions
diff --git a/games-puzzle/sgt-puzzles/files/sgt-puzzles-20161207-builtin-help.patch b/games-puzzle/sgt-puzzles/files/sgt-puzzles-20161207-builtin-help.patch
new file mode 100644
index 00000000000..a5c3a3695bd
--- /dev/null
+++ b/games-puzzle/sgt-puzzles/files/sgt-puzzles-20161207-builtin-help.patch
@@ -0,0 +1,107 @@
+Based on http://sources.debian.net/patches/sgt-puzzles/20160429.b31155b-1/202_online-help.diff/
+Simply opens HTML help files with xdg-open
+
+Author: Ben Hutchings <ben@decadent.org.uk>
+Description: Add HTML-based online help
+
+This works along the same lines as the Windows implementation,
+though we have to try a bit harder to find a help browser.
+
+--- a/gtk.c 2016-12-08 07:53:06.812409184 -0500
++++ b/gtk.c 2016-12-08 07:58:06.426415886 -0500
+@@ -2,6 +2,10 @@
+ * gtk.c: GTK front end for my puzzle collection.
+ */
+
++#ifndef _POSIX_C_SOURCE
++#define _POSIX_C_SOURCE 1 /* for PATH_MAX */
++#endif
++
+ #include <stdio.h>
+ #include <assert.h>
+ #include <stdlib.h>
+@@ -10,6 +14,9 @@
+ #include <string.h>
+ #include <errno.h>
+ #include <math.h>
++#include <limits.h>
++#include <unistd.h>
++#include <locale.h>
+
+ #include <sys/time.h>
+ #include <sys/resource.h>
+@@ -2270,6 +2277,37 @@
+ resize_fe(fe);
+ }
+
++static void show_help(frontend *fe, const char *topic)
++{
++ char path[PATH_MAX + 1];
++
++ sprintf(path, "%s/%s.html", HTMLDIR, topic);
++ if (access(path, R_OK) != 0) {
++ error_box(fe->window, "Help file could not be found");
++ return;
++ }
++
++ const char *argv[3];
++
++ argv[0] = "xdg-open";
++ argv[1] = path;
++ argv[2] = NULL;
++ if (! g_spawn_async(NULL, (char **)argv, NULL,
++ G_SPAWN_SEARCH_PATH,
++ NULL, NULL, NULL, NULL))
++ error_box(fe->window, "Failed to open help file");
++}
++
++static void menu_help_contents_event(GtkMenuItem *menuitem, gpointer data)
++{
++ show_help((frontend *)data, "index");
++}
++
++static void menu_help_specific_event(GtkMenuItem *menuitem, gpointer data)
++{
++ show_help((frontend *)data, thegame.htmlhelp_topic);
++}
++
+ static void menu_about_event(GtkMenuItem *menuitem, gpointer data)
+ {
+ frontend *fe = (frontend *)data;
+@@ -2590,6 +2628,25 @@
+ menu = gtk_menu_new();
+ gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), menu);
+
++ menuitem = gtk_menu_item_new_with_label("Contents");
++ gtk_container_add(GTK_CONTAINER(menu), menuitem);
++ g_signal_connect(G_OBJECT(menuitem), "activate",
++ G_CALLBACK(menu_help_contents_event), fe);
++ gtk_widget_show(menuitem);
++
++ if (thegame.htmlhelp_topic) {
++ char *item;
++ assert(thegame.name);
++ item = snewn(9+strlen(thegame.name), char); /*ick*/
++ sprintf(item, "Help on %s", thegame.name);
++ menuitem = gtk_menu_item_new_with_label(item);
++ sfree(item);
++ gtk_container_add(GTK_CONTAINER(menu), menuitem);
++ g_signal_connect(G_OBJECT(menuitem), "activate",
++ G_CALLBACK(menu_help_specific_event), fe);
++ gtk_widget_show(menuitem);
++ }
++
+ menuitem = gtk_menu_item_new_with_label("About");
+ gtk_container_add(GTK_CONTAINER(menu), menuitem);
+ g_signal_connect(G_OBJECT(menuitem), "activate",
+--- a/Recipe
++++ b/Recipe
+@@ -95,6 +95,7 @@ Puzzles.dmg: Puzzles
+
+ !begin am
+ bin_PROGRAMS = $(GAMES)
++GTK_CFLAGS += -DHTMLDIR="\"$(htmldir)\""
+ !end
+ !begin am_begin
+ GAMES =
+
diff --git a/games-puzzle/sgt-puzzles/files/sgt-puzzles.directory b/games-puzzle/sgt-puzzles/files/sgt-puzzles.directory
new file mode 100644
index 00000000000..25aa1aefbf5
--- /dev/null
+++ b/games-puzzle/sgt-puzzles/files/sgt-puzzles.directory
@@ -0,0 +1,4 @@
+[Desktop Entry]
+Type=Directory
+Name=Puzzles
+Icon=sgt-puzzles_map
diff --git a/games-puzzle/sgt-puzzles/files/sgt-puzzles.menu b/games-puzzle/sgt-puzzles/files/sgt-puzzles.menu
new file mode 100644
index 00000000000..ddcb2df5b6a
--- /dev/null
+++ b/games-puzzle/sgt-puzzles/files/sgt-puzzles.menu
@@ -0,0 +1,18 @@
+<!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
+"http://www.freedesktop.org/standards/menu-spec/menu-1.0.dtd">
+<Menu>
+ <Name>Applications</Name>
+ <Menu>
+ <Name>Games</Name>
+ <Menu>
+ <Name>Puzzles</Name>
+ <Directory>sgt-puzzles.directory</Directory>
+ <Include>
+ <And>
+ <All></All>
+ <Category>sgt-puzzles</Category>
+ </And>
+ </Include>
+ </Menu> <!-- End Puzzles -->
+ </Menu> <!-- End Games -->
+</Menu> <!-- End Applications -->