r393 - in trunk: . scripts
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Fri Jan 11 18:48:24 EST 2008
Author: icculus
Date: 2008-01-11 18:48:24 -0500 (Fri, 11 Jan 2008)
New Revision: 393
Modified:
trunk/gui.h
trunk/gui_gtkplus2.c
trunk/lua_glue.c
trunk/scripts/mojosetup_init.lua
Log:
Tooltip support for options page in GTK+ ui (thanks, Nemo!)
Modified: trunk/gui.h
===================================================================
--- trunk/gui.h 2008-01-11 23:44:37 UTC (rev 392)
+++ trunk/gui.h 2008-01-11 23:48:24 UTC (rev 393)
@@ -45,6 +45,7 @@
struct MojoGuiSetupOptions
{
const char *description;
+ const char *tooltip;
boolean value;
boolean is_group_parent;
uint64 size;
Modified: trunk/gui_gtkplus2.c
===================================================================
--- trunk/gui_gtkplus2.c 2008-01-11 23:44:37 UTC (rev 392)
+++ trunk/gui_gtkplus2.c 2008-01-11 23:48:24 UTC (rev 393)
@@ -611,6 +611,7 @@
if (opts != NULL)
{
GtkWidget *widget;
+
if (opts->is_group_parent)
{
MojoGuiSetupOptions *kids = opts->child;
@@ -661,6 +662,13 @@
gtk_box_pack_start(GTK_BOX(box), widget, FALSE, TRUE, 0);
gtk_signal_connect(GTK_OBJECT(widget), "toggled",
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
+
if (opts->child != NULL)
{
build_options(opts->child, new_option_level(box),
Modified: trunk/lua_glue.c
===================================================================
--- trunk/lua_glue.c 2008-01-11 23:44:37 UTC (rev 392)
+++ trunk/lua_glue.c 2008-01-11 23:48:24 UTC (rev 393)
@@ -1115,6 +1115,11 @@
lua_getfield(L, -1, "description");
newopt->description = xstrdup(lua_tostring(L, -1));
lua_pop(L, 1);
+
+ lua_getfield(L, -1, "tooltip");
+ if (!lua_isnil(L, -1))
+ newopt->tooltip = xstrdup(lua_tostring(L, -1));
+ lua_pop(L, 1);
if (!is_option_group)
{
@@ -1134,6 +1139,7 @@
if ((is_option_group) && (!newopt->child)) // skip empty groups.
{
free((void *) newopt->description);
+ free((void *) newopt->tooltip);
free(newopt);
newopt = NULL;
} // if
@@ -1249,6 +1255,7 @@
} // if
free((void *) opts->description);
+ free((void *) opts->tooltip);
free(opts);
} // if
} // done_gui_options
Modified: trunk/scripts/mojosetup_init.lua
===================================================================
--- trunk/scripts/mojosetup_init.lua 2008-01-11 23:44:37 UTC (rev 392)
+++ trunk/scripts/mojosetup_init.lua 2008-01-11 23:48:24 UTC (rev 393)
@@ -431,6 +431,7 @@
{ "disabled", false, mustBeBool },
{ "bytes", nil, mustExist, mustBeNumber },
{ "description", nil, mustExist, mustBeString, cantBeEmpty },
+ { "tooltip", nil, mustBeString, cantBeEmpty },
})
end
More information about the mojosetup-commits
mailing list