Game command entry expands to full path, docs update

git-svn-id: http://svn.code.sf.net/p/xqf/code/trunk@351 d2ac09be-c843-0410-8b1f-f8a84130e0ec
This commit is contained in:
Alex Burger 2002-10-30 16:16:24 +00:00 committed by alex_b
parent 67ec8a0215
commit 69f4fcdcf9
4 changed files with 48 additions and 7 deletions

View File

@ -1,3 +1,7 @@
Oct 30, 2002: Alex Burger <alex_b@users.sourceforge.net>
- Modify game command entry field to expand command line into full path if
command is in the path. Also executes guess_dir
Oct 30, 2002: Ludwig Nussel <l-n@users.sourceforge.net>
- fix some memleaks
- update german translation

View File

@ -594,21 +594,41 @@ tabs. &nbsp;<br>
<blockquote>Command to execute the game
<p><b>Example:</b> quake2<br>
<p><b>Example with game in your path:</b> quake2<br>
<p><b>Example with game not in your path:</b> /usr/bin/quake2<br>
</p>
<p>The Suggest button will search for the game in the path and is
found, will populate the command line. &nbsp;Does not work with all games.<br>
<p>
Note: If the command you enter is in your path, it will be expanded to the full path when you click <b>OK</b>, if you press <b>&ltenter&gt</b> inside the text box, or you click on the <b>Guess</b> button.
</p>
<p>The <b>Suggest</b> button will search for the game in the search path and if
found, will populate the command line. This should work with Quake1, QuakeWorld, Quake2, Quake3, Return to Castle Wolfenstein, Soldier of Fortune, Descent3, Tribes 2, Unreal Tournament 1 / 2003 and Rune.<br>
</p>
</blockquote>
<b>Working directory:</b>
<blockquote>Directory to run the game from
<p><b>Example:</b> /games/quake2</p>
</blockquote>
<p>The <b>Guess</b> button will try to determine the correct directory for the game. This is done by using the following rules: <br><br>
<blockquote>
<li>If Command Line is a symbolic link, use path of the directory of the file it is linked to</li><br>
<li>If Command Line is NOT a symbolic link, use path of the defined Command Line</li><br><br>
</blockquote>
For example:
<blockquote>
<li><b>quake2</b> is in your path and is a sym link to <b>/games/quake2/quake2</b> would result in <b>/games/quake2/</b></li><br>
<li><b>/usr/bin/quake2</b> sym linked to <b>/games/quake2/quake2</b> would result in <b>/games/quake2/</b></li><br>
<li>à<b>/games/quake2/quake2</b> (not a sym link) would result in <b>/games/quake2/</b></li><br>
</blockquote>
Note: If the Command Line does not contain a path and is not in your search path, or a symbolic link contains any '..'s (such as <b>../../games/quake2</b>) then nothing is returned.<br><br>
</p>
</blockquote>
</blockquote>
<blockquote><b>Disable sound:</b></blockquote>

View File

@ -2222,7 +2222,8 @@ static GtkWidget *generic_game_frame (enum server_type type) {
// translator: button for directory guess
button = gtk_button_new_with_label (_("Guess"));
gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
GTK_SIGNAL_FUNC (pref_guess_dir), (gpointer)type);
GTK_SIGNAL_FUNC (game_file_activate_callback), (gpointer)type);
// GTK_SIGNAL_FUNC (pref_guess_dir), (gpointer)type);
gtk_box_pack_start (GTK_BOX (hbox),button , FALSE, FALSE, 0);
gtk_tooltips_set_tip (tooltips, button, _("Tries to guess the working directory based on the command line"), NULL);
@ -4551,7 +4552,22 @@ void game_file_dialog_ok_callback (GtkWidget *widget, GtkFileSelection *fs)
void game_file_activate_callback (enum server_type type)
{
pref_guess_dir (type);
char *temp = NULL;
char *file = NULL;
temp = g_strdup(gtk_entry_get_text (GTK_ENTRY (genprefs[type].cmd_entry)));
if (temp) {
file = find_file_in_path(temp);
if (file)
gtk_entry_set_text (GTK_ENTRY (genprefs[type].cmd_entry), file);
}
pref_guess_dir (type);
if (temp)
g_free (temp);
if (file)
g_free (file);
}
void game_dir_dialog_ok_callback (GtkWidget *widget, GtkFileSelection *fs)

View File

@ -727,6 +727,7 @@ char* resolve_path(const char* path)
ptr = strrchr(path, '/');
if (ptr) { // contains a /
dir = g_strndup(path, ptr-path+1);
printf("blah\n");
}
}
}