Fix the list dialog not being able to handle --text to change the text. It

2004-04-29  Glynn Foster  <glynn.foster@sun.com>

	* src/main.c, src/tree.c: Fix the list dialog not being
	able to handle --text to change the text. It was also
	intentional but must have fallen through the gaps.
	* data/zenity.1: Update
	* help/C/zenity.xml: Update.
This commit is contained in:
Glynn Foster 2004-04-28 12:06:02 +00:00 committed by Glynn Foster
parent 5f7b750f39
commit 02955ce70f
5 changed files with 43 additions and 1 deletions

View File

@ -1,3 +1,11 @@
2004-04-29 Glynn Foster <glynn.foster@sun.com>
* src/main.c, src/tree.c: Fix the list dialog not being
able to handle --text to change the text. It was also
intentional but must have fallen through the gaps.
* data/zenity.1: Update
* help/C/zenity.xml: Update.
2004-04-27 Glynn Foster <glynn.foster@sun.com> 2004-04-27 Glynn Foster <glynn.foster@sun.com>
* src/zenity.glade: Untranslate 3 strings again. Thanks * src/zenity.glade: Untranslate 3 strings again. Thanks

View File

@ -129,6 +129,9 @@ Set the dialog text
.PP .PP
List options List options
.TP
.B \-\-text=STRING
Set the dialog text
.TP .TP
.B \-\-column=STRING .B \-\-column=STRING
Set the column header Set the column header

View File

@ -604,6 +604,13 @@
<variablelist> <variablelist>
<varlistentry>
<term><varname>--text</varname>=TEXT</term>
<listitem>
<para>Specifies the text to appear in the List dialog.</para>
</listitem>
</varlistentry>
<varlistentry> <varlistentry>
<term><varname>--column</varname>=COLUMN</term> <term><varname>--column</varname>=COLUMN</term>
<listitem> <listitem>

View File

@ -96,6 +96,7 @@ enum {
OPTION_FILENAME, OPTION_FILENAME,
OPTION_MULTIFILE, OPTION_MULTIFILE,
OPTION_TEXTFILENAME, OPTION_TEXTFILENAME,
OPTION_LISTTEXT,
OPTION_COLUMN, OPTION_COLUMN,
OPTION_SEPERATOR, OPTION_SEPERATOR,
OPTION_LISTEDIT, OPTION_LISTEDIT,
@ -461,6 +462,15 @@ struct poptOption list_options[] = {
NULL, NULL,
NULL NULL
}, },
{
"text",
'\0',
POPT_ARG_STRING,
NULL,
OPTION_LISTTEXT,
N_("Set the dialog text"),
NULL
},
{ {
"column", "column",
'\0', '\0',
@ -959,6 +969,7 @@ zenity_init_parsing_options (void) {
results->progress_data->pulsate = FALSE; results->progress_data->pulsate = FALSE;
results->progress_data->autoclose = FALSE; results->progress_data->autoclose = FALSE;
results->entry_data->visible = TRUE; results->entry_data->visible = TRUE;
results->tree_data->dialog_text = NULL;
results->tree_data->checkbox = FALSE; results->tree_data->checkbox = FALSE;
results->tree_data->radiobox = FALSE; results->tree_data->radiobox = FALSE;
results->tree_data->editable = FALSE; results->tree_data->editable = FALSE;
@ -1004,6 +1015,8 @@ zenity_free_parsing_options (void) {
g_free (results->text_data->uri); g_free (results->text_data->uri);
break; break;
case MODE_LIST: case MODE_LIST:
if (results->tree_data->dialog_text)
g_free (results->tree_data->dialog_text);
if (results->tree_data->columns) if (results->tree_data->columns)
g_slist_foreach (results->tree_data->columns, (GFunc) g_free, NULL); g_slist_foreach (results->tree_data->columns, (GFunc) g_free, NULL);
if (results->tree_data->separator) if (results->tree_data->separator)
@ -1237,6 +1250,7 @@ zenity_parse_options_callback (poptContext ctx,
case OPTION_ERRORTEXT: case OPTION_ERRORTEXT:
case OPTION_QUESTIONTEXT: case OPTION_QUESTIONTEXT:
case OPTION_PROGRESSTEXT: case OPTION_PROGRESSTEXT:
case OPTION_LISTTEXT:
case OPTION_WARNINGTEXT: case OPTION_WARNINGTEXT:
/* FIXME: This is an ugly hack because of the way the poptOptions are /* FIXME: This is an ugly hack because of the way the poptOptions are
@ -1244,7 +1258,7 @@ zenity_parse_options_callback (poptContext ctx,
* parse_options_callback gets called for each option. Suckage * parse_options_callback gets called for each option. Suckage
*/ */
if (parse_option_text > 6) if (parse_option_text > 7)
zenity_error ("--text", ERROR_DUPLICATE); zenity_error ("--text", ERROR_DUPLICATE);
switch (results->mode) { switch (results->mode) {
@ -1267,6 +1281,10 @@ zenity_parse_options_callback (poptContext ctx,
results->progress_data->dialog_text = g_locale_to_utf8 (g_strcompress (arg), results->progress_data->dialog_text = g_locale_to_utf8 (g_strcompress (arg),
-1, NULL, NULL, NULL); -1, NULL, NULL, NULL);
break; break;
case MODE_LIST:
results->tree_data->dialog_text = g_locale_to_utf8 (g_strcompress (arg),
-1, NULL, NULL, NULL);
break;
default: default:
zenity_error ("--text", ERROR_SUPPORT); zenity_error ("--text", ERROR_SUPPORT);
} }

View File

@ -269,6 +269,7 @@ zenity_tree (ZenityData *data, ZenityTreeData *tree_data)
{ {
GtkWidget *dialog; GtkWidget *dialog;
GtkWidget *tree_view; GtkWidget *tree_view;
GtkWidget *text;
GtkTreeViewColumn *column; GtkTreeViewColumn *column;
GtkListStore *model; GtkListStore *model;
GType *column_types; GType *column_types;
@ -303,6 +304,11 @@ zenity_tree (ZenityData *data, ZenityTreeData *tree_data)
if (data->dialog_title) if (data->dialog_title)
gtk_window_set_title (GTK_WINDOW (dialog), data->dialog_title); gtk_window_set_title (GTK_WINDOW (dialog), data->dialog_title);
text = glade_xml_get_widget (glade_dialog, "zenity_tree_text");
if (tree_data->dialog_text)
gtk_label_set_text (GTK_LABEL (text), tree_data->dialog_text);
if (data->window_icon) if (data->window_icon)
zenity_util_set_window_icon (dialog, data->window_icon); zenity_util_set_window_icon (dialog, data->window_icon);
else else