From 403c8104aefc11954398106ab4fa39f9a79233c6 Mon Sep 17 00:00:00 2001 From: Glynn Foster Date: Wed, 20 Apr 2005 03:00:57 +0000 Subject: [PATCH] Clean up the code a little bit. 2005-04-20 Glynn Foster * src/entry.c, src/option.c, src/zenity.h: Clean up the code a little bit. --- ChangeLog | 5 +++++ src/entry.c | 5 +++-- src/option.c | 14 +++++++------- src/zenity.h | 2 +- 4 files changed, 16 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 76c88f1..a2caae2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2005-04-20 Glynn Foster + + * src/entry.c, src/option.c, src/zenity.h: Clean + up the code a little bit. + 2005-04-20 Glynn Foster * src/msg.c, src/option.c, src/zenity.h: Bug fix for diff --git a/src/entry.c b/src/entry.c index 46672f8..2d92f2d 100644 --- a/src/entry.c +++ b/src/entry.c @@ -72,12 +72,13 @@ zenity_entry (ZenityData *data, ZenityEntryData *entry_data) if (entry_data->entry_text) gtk_entry_set_text (GTK_ENTRY (entry), entry_data->entry_text); - if (!entry_data->visible) - g_object_set (G_OBJECT (entry), "visibility", entry_data->visible, NULL); + if (entry_data->hide_text) + g_object_set (G_OBJECT (entry), "visibility", FALSE, NULL); gtk_label_set_mnemonic_widget (GTK_LABEL (text), entry); zenity_util_show_dialog (dialog); + gtk_main (); } diff --git a/src/option.c b/src/option.c index 0835912..44fd74a 100644 --- a/src/option.c +++ b/src/option.c @@ -46,7 +46,7 @@ gchar *zenity_calendar_date_format; /* Entry Dialog Options */ gboolean zenity_entry_active; gchar *zenity_entry_entry_text; -gboolean zenity_entry_visible; +gboolean zenity_entry_hide_text; /* Error Dialog Options */ gboolean zenity_error_active; @@ -225,7 +225,7 @@ GOptionEntry entry_options[] = { '\0', 0, G_OPTION_ARG_NONE, - &zenity_entry_visible, + &zenity_entry_hide_text, N_("Hide the entry text"), NULL }, @@ -770,7 +770,7 @@ zenity_entry_pre_callback (GOptionContext *context, { zenity_entry_active = FALSE; zenity_entry_entry_text = NULL; - zenity_entry_visible = FALSE; + zenity_entry_hide_text = FALSE; return TRUE; } @@ -979,14 +979,14 @@ zenity_entry_post_callback (GOptionContext *context, if (results->mode == MODE_ENTRY) { results->entry_data->dialog_text = zenity_general_dialog_text; results->entry_data->entry_text = zenity_entry_entry_text; - results->entry_data->visible = !zenity_entry_visible; + results->entry_data->hide_text= zenity_entry_hide_text; } else { if (zenity_entry_entry_text) zenity_option_error (zenity_option_get_name (entry_options, &zenity_entry_entry_text), ERROR_SUPPORT); - if (zenity_entry_visible) - zenity_option_error (zenity_option_get_name (entry_options, &zenity_entry_visible), + if (zenity_entry_hide_text) + zenity_option_error (zenity_option_get_name (entry_options, &zenity_entry_hide_text), ERROR_SUPPORT); } @@ -1373,7 +1373,7 @@ zenity_option_error (gchar *string, ZenityError error) { switch (error) { case ERROR_SYNTAX: - g_printerr (_("Syntax error\n")); + g_printerr (_("This option is not available. Please see --help for all possible usages.\n")); zenity_option_free (); exit (-1); case ERROR_SUPPORT: diff --git a/src/zenity.h b/src/zenity.h index 0f821a4..7ab47cb 100644 --- a/src/zenity.h +++ b/src/zenity.h @@ -71,7 +71,7 @@ typedef struct { typedef struct { gchar *dialog_text; gchar *entry_text; - gboolean visible; + gboolean hide_text; } ZenityEntryData; typedef struct {