r394 - in trunk: . examples/duke3d/scripts scripts
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Fri Jan 11 20:20:54 EST 2008
Author: icculus
Date: 2008-01-11 20:20:54 -0500 (Fri, 11 Jan 2008)
New Revision: 394
Modified:
trunk/examples/duke3d/scripts/config.lua
trunk/gui_gtkplus2.c
trunk/scripts/mojosetup_init.lua
Log:
More work on option tooltips.
Modified: trunk/examples/duke3d/scripts/config.lua
===================================================================
--- trunk/examples/duke3d/scripts/config.lua 2008-01-11 23:48:24 UTC (rev 393)
+++ trunk/examples/duke3d/scripts/config.lua 2008-01-12 01:20:54 UTC (rev 394)
@@ -50,6 +50,9 @@
{
description = _("Installation type"),
+ -- This is a kind of useless tooltip; I'm just using it for testing.
+ tooltip = _("Pick your installation type"),
+
Setup.Option
{
value = true,
@@ -57,6 +60,7 @@
disabled = false,
bytes = 31102768,
description = _("Install Shareware version"),
+ tooltip = _("This does not need a retail copy of the game. It's free!"),
Setup.File
{
@@ -83,6 +87,7 @@
disabled = false,
bytes = 64525364,
description = _("Install full game from Atomic Edition disc"),
+ tooltip = _("Pick this if you have a retail game disc from 3DRealms."),
Setup.File
{
Modified: trunk/gui_gtkplus2.c
===================================================================
--- trunk/gui_gtkplus2.c 2008-01-11 23:48:24 UTC (rev 393)
+++ trunk/gui_gtkplus2.c 2008-01-12 01:20:54 UTC (rev 394)
@@ -605,12 +605,27 @@
} // new_option_level
+// use this to generate a tooltip only as needed.
+static GtkTooltips *get_tip(GtkTooltips **_tip)
+{
+ if (*_tip == NULL)
+ {
+ GtkTooltips *tip = gtk_tooltips_new();
+ gtk_tooltips_enable(tip);
+ *_tip = tip;
+ } // if
+
+ return *_tip;
+} // get_tip
+
+
static void build_options(MojoGuiSetupOptions *opts, GtkWidget *box,
gboolean sensitive)
{
if (opts != NULL)
{
- GtkWidget *widget;
+ GtkTooltips *tip = NULL;
+ GtkWidget *widget = NULL;
if (opts->is_group_parent)
{
@@ -627,6 +642,9 @@
gtk_container_add(GTK_CONTAINER(alignment), widget);
gtk_box_pack_start(GTK_BOX(box), alignment, FALSE, TRUE, 0);
+ if (opts->tooltip != NULL)
+ gtk_tooltips_set_tip(get_tip(&tip), widget, opts->tooltip, 0);
+
widget = NULL;
childbox = new_option_level(box);
while (kids)
@@ -642,6 +660,10 @@
gtk_box_pack_start(GTK_BOX(childbox), widget, FALSE, TRUE, 0);
gtk_signal_connect(GTK_OBJECT(widget), "toggled",
GTK_SIGNAL_FUNC(signal_option_toggled), kids);
+
+ if (kids->tooltip != NULL)
+ gtk_tooltips_set_tip(get_tip(&tip),widget,kids->tooltip,0);
+
if (kids->child != NULL)
{
build_options(kids->child, new_option_level(childbox),
@@ -664,10 +686,7 @@
GTK_SIGNAL_FUNC(signal_option_toggled), opts);
if (opts->tooltip != NULL)
- {
- GtkTooltips *tip = gtk_tooltips_new();
- gtk_tooltips_set_tip(tip, widget, opts->tooltip, NULL);
- } // if
+ gtk_tooltips_set_tip(get_tip(&tip), widget, opts->tooltip, 0);
if (opts->child != NULL)
{
Modified: trunk/scripts/mojosetup_init.lua
===================================================================
--- trunk/scripts/mojosetup_init.lua 2008-01-11 23:48:24 UTC (rev 393)
+++ trunk/scripts/mojosetup_init.lua 2008-01-12 01:20:54 UTC (rev 394)
@@ -440,6 +440,7 @@
{
{ "disabled", nil, mustBeBool },
{ "description", nil, mustExist, mustBeString, cantBeEmpty },
+ { "tooltip", nil, mustBeString, cantBeEmpty },
})
end
More information about the mojosetup-commits
mailing list