X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=gtk%2Fxboard.c;h=750e64fefce869eb0a7825b900807096f9c87295;hb=e6e38912837a4fe2464356408d10dee950b3121c;hp=60b50d15487b2215688000fa6499507d795fdd51;hpb=0daaf16c6e5f8323e33d43ab32f90396d801a53f;p=xboard.git diff --git a/gtk/xboard.c b/gtk/xboard.c index 60b50d1..750e64f 100644 --- a/gtk/xboard.c +++ b/gtk/xboard.c @@ -5,7 +5,7 @@ * Massachusetts. * * Enhancements Copyright 1992-2001, 2002, 2003, 2004, 2005, 2006, - * 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc. + * 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Free Software Foundation, Inc. * * The following terms apply to Digital Equipment Corporation's copyright * interest in XBoard: @@ -167,18 +167,22 @@ extern char *getenv(); #include "gettext.h" #include "draw.h" -#ifdef OSX -# include "gtkmacintegration/gtkosxapplication.h" - // prevent pathname of positional file argument provided by OSx being be mistaken for option name +#ifdef __APPLE__ +# include + // prevent pathname of positional file argument provided by OS X being be mistaken for option name // (price is that we won't recognize Windows option format anymore). # define SLASH '-' // redefine some defaults # undef ICS_LOGON # undef SYSCONFDIR +# undef DATADIR # define ICS_LOGON "Library/Preferences/XboardICS.conf" # define SYSCONFDIR "../etc" +# define DATADIR dataDir + char *dataDir; // for expanding ~~ #else # define SLASH '/' +# define DATADIR "~~" #endif #ifdef __EMX__ @@ -726,7 +730,7 @@ SlaveResize (Option *opt) gtk_window_resize(GTK_WINDOW(shells[DummyDlg]), slaveW + opt->max, slaveH + opt->value); } -#ifdef OSX +#ifdef __APPLE__ static char clickedFile[MSG_SIZ]; static int suppress; @@ -770,9 +774,10 @@ main (int argc, char **argv) /* set up GTK */ gtk_init (&argc, &argv); -#ifdef OSX +#ifdef __APPLE__ { // prepare to catch OX OpenFile signal, which will tell us the clicked file GtkosxApplication *theApp = g_object_new(GTKOSX_TYPE_APPLICATION, NULL); + dataDir = gtkosx_application_get_bundle_path(); g_signal_connect(theApp, "NSApplicationOpenFile", G_CALLBACK(StartNewXBoard), NULL); // we must call application ready before we can get the signal, // and supply a (dummy) menu bar before that, to avoid problems with dual apples in it @@ -1777,26 +1782,15 @@ TempForwardProc (Widget w, XEvent *event, String *prms, Cardinal *nprms) ForwardEvent(); TempBackwardActive = False; } - -void -ManInner (Widget w, XEvent *event, String *prms, Cardinal *nprms) -{ // called as key binding - char buf[MSG_SIZ]; - String name; - if (nprms && *nprms > 0) - name = prms[0]; - else - name = "xboard"; - snprintf(buf, sizeof(buf), "xterm -e man %s &", name); - system(buf); -} #endif void ManProc () { // called from menu -#ifdef TODO_GTK - ManInner(NULL, NULL, NULL, NULL); +#ifdef __APPLE__ + system("%s ./man.command", appData.sysOpen); +#else + system("xterm -e man xboard &"); #endif } @@ -2117,7 +2111,7 @@ void FileNamePopUpWrapper(label, def, filter, proc, pathFlag, openMode, name, fp char *cp; /* make a copy of the filter string, so that strtok can work with it*/ - cp = strndup(filter,strlen(filter)); + cp = strdup(filter); /* add filters for file extensions */ gtkfilter = gtk_file_filter_new();