Skip to content

Commit

Permalink
* Limited the number of characters in the "current file" label
Browse files Browse the repository at this point in the history
 * The play option is only available if a symlink was created by setup
 * Added the "nouninstall" product install option
  • Loading branch information
Sam Lantinga committed Apr 10, 2000
1 parent e0eeece commit 1c9a396
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 8 deletions.
6 changes: 6 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@

1.2.2:
Sam Lantinga - Mon Apr 10 13:27:28 PDT 2000
* Limited the number of characters in the "current file" label
Sam Lantinga - Mon Apr 10 10:44:14 PDT 2000
* The play option is only available if a symlink was created by setup
Sam Lantinga - Mon Apr 10 10:23:42 PDT 2000
* Added the "nouninstall" product install option
Sam Lantinga - Fri Apr 7 16:49:45 PDT 2000
* The "arch" attribute for options allows multiple architectures
* Documented the "size" attribute for the option element
Expand Down
3 changes: 3 additions & 0 deletions README.xml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ There are several optional attributes of the install element:
mounted CDROM to see if it is indeed the product CDROM.
If this option is not specified, any mounted CDROM is used.

nouninstall This is an optional flag which, if specified, tells setup
not to generate an uninstall script after it runs.


The OPTION element:

Expand Down
3 changes: 2 additions & 1 deletion console_ui.c
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,8 @@ static install_state console_complete(install_info *info)
printf("Installation complete.\n");

new_state = SETUP_EXIT;
if ( console_prompt("Would you like launch the game now?", RESPONSE_YES)
if ( info->installed_symlink &&
console_prompt("Would you like launch the game now?", RESPONSE_YES)
== RESPONSE_YES ) {
new_state = SETUP_PLAY;
if ( getuid() == 0 ) {
Expand Down
18 changes: 15 additions & 3 deletions gtk_ui.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* GTK-based UI
$Id: gtk_ui.c,v 1.28 2000-04-08 00:34:42 hercules Exp $
$Id: gtk_ui.c,v 1.29 2000-04-10 20:28:49 hercules Exp $
*/

#include <limits.h>
Expand All @@ -23,6 +23,8 @@
#define LICENSE_FONT \
"-misc-fixed-medium-r-semicondensed-*-*-120-*-*-c-*-iso8859-8"

#define MAX_TEXTLEN 40 /* The maximum length of current filename */

/* Globals */

static char *install_paths[] = {
Expand Down Expand Up @@ -855,6 +857,7 @@ static void gtkui_update(install_info *info, const char *path, size_t progress,
{
static gfloat last_update = -1;
GtkWidget *widget;
int textlen;
char text[1024];
char *install_path;
gfloat new_update;
Expand All @@ -868,8 +871,7 @@ static void gtkui_update(install_info *info, const char *path, size_t progress,
}
widget = glade_xml_get_widget(setup_glade, "current_option_label");
if ( widget ) {
sprintf(text, "%s", current);
gtk_label_set_text( GTK_LABEL(widget), text);
gtk_label_set_text( GTK_LABEL(widget), current);
}
widget = glade_xml_get_widget(setup_glade, "current_file_label");
if ( widget ) {
Expand All @@ -879,6 +881,10 @@ static void gtkui_update(install_info *info, const char *path, size_t progress,
if ( strncmp(text, install_path, strlen(install_path)) == 0 ) {
strcpy(text, &text[strlen(install_path)+1]);
}
textlen = strlen(text);
if ( textlen > MAX_TEXTLEN ) {
strcpy(text, text+(textlen-MAX_TEXTLEN));
}
gtk_label_set_text( GTK_LABEL(widget), text);
}
widget = glade_xml_get_widget(setup_glade, "current_file_progress");
Expand Down Expand Up @@ -963,6 +969,12 @@ static install_state gtkui_complete(install_info *info)
}
gtk_label_set_text(GTK_LABEL(widget), text);

/* Hide the play game button if there's no game to play. :) */
widget = glade_xml_get_widget(setup_glade, "play_game_button");
if ( widget && ! info->installed_symlink ) {
gtk_widget_hide(widget);
}

/* TODO: Lots of cleanups here (free() mostly) */
return iterate_for_state();
}
Expand Down
2 changes: 1 addition & 1 deletion image/setup.data/setup.glade
Original file line number Diff line number Diff line change
Expand Up @@ -922,7 +922,7 @@

<widget>
<class>GtkButton</class>
<name>button17</name>
<name>play_game_button</name>
<can_default>True</can_default>
<can_focus>True</can_focus>
<signal>
Expand Down
18 changes: 15 additions & 3 deletions install.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* $Id: install.c,v 1.36 2000-04-08 00:34:42 hercules Exp $ */
/* $Id: install.c,v 1.37 2000-04-10 20:28:49 hercules Exp $ */

#include <sys/types.h>
#include <sys/stat.h>
Expand All @@ -22,7 +22,13 @@ extern char *rpm_root;
/* Functions to retrieve attribution information from the XML tree */
const char *GetProductName(install_info *info)
{
return xmlGetProp(info->config->root, "product");
const char *name;

name = xmlGetProp(info->config->root, "product");
if ( name == NULL ) {
name = "";
}
return name;
}
const char *GetProductDesc(install_info *info)
{
Expand Down Expand Up @@ -134,6 +140,10 @@ const char *GetRuntimeArgs(install_info *info)
}
return args;
}
const char *GetInstallOption(install_info *info, const char *option)
{
return xmlGetProp(info->config->root, option);
}

/* Create the initial installation information */
install_info *create_install(const char *configfile, int log_level)
Expand Down Expand Up @@ -435,7 +445,9 @@ install_state install(install_info *info,
break;
}
}
generate_uninstall(info);
if ( ! GetInstallOption(info, "nouninstall") ) {
generate_uninstall(info);
}

/* Return the new install state */
if ( GetProductURL(info) ) {
Expand Down
1 change: 1 addition & 0 deletions install.h
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ extern const char *GetAutoLaunchURL(install_info *info);
extern const char *GetPreInstall(install_info *info);
extern const char *GetPostInstall(install_info *info);
extern const char *GetRuntimeArgs(install_info *info);
extern const char *GetInstallOption(install_info *info, const char *option);

/* Create the initial installation information */
extern install_info *create_install(const char *configfile, int log_level);
Expand Down

0 comments on commit 1c9a396

Please sign in to comment.