Clean up the code a little bit.
2005-04-20 Glynn Foster <glynn.foster@sun.com> * src/entry.c, src/option.c, src/zenity.h: Clean up the code a little bit.
This commit is contained in:
parent
6e6eeaf79c
commit
403c8104ae
@ -1,3 +1,8 @@
|
|||||||
|
2005-04-20 Glynn Foster <glynn.foster@sun.com>
|
||||||
|
|
||||||
|
* src/entry.c, src/option.c, src/zenity.h: Clean
|
||||||
|
up the code a little bit.
|
||||||
|
|
||||||
2005-04-20 Glynn Foster <glynn.foster@sun.com>
|
2005-04-20 Glynn Foster <glynn.foster@sun.com>
|
||||||
|
|
||||||
* src/msg.c, src/option.c, src/zenity.h: Bug fix for
|
* src/msg.c, src/option.c, src/zenity.h: Bug fix for
|
||||||
|
@ -72,12 +72,13 @@ zenity_entry (ZenityData *data, ZenityEntryData *entry_data)
|
|||||||
if (entry_data->entry_text)
|
if (entry_data->entry_text)
|
||||||
gtk_entry_set_text (GTK_ENTRY (entry), entry_data->entry_text);
|
gtk_entry_set_text (GTK_ENTRY (entry), entry_data->entry_text);
|
||||||
|
|
||||||
if (!entry_data->visible)
|
if (entry_data->hide_text)
|
||||||
g_object_set (G_OBJECT (entry), "visibility", entry_data->visible, NULL);
|
g_object_set (G_OBJECT (entry), "visibility", FALSE, NULL);
|
||||||
|
|
||||||
gtk_label_set_mnemonic_widget (GTK_LABEL (text), entry);
|
gtk_label_set_mnemonic_widget (GTK_LABEL (text), entry);
|
||||||
|
|
||||||
zenity_util_show_dialog (dialog);
|
zenity_util_show_dialog (dialog);
|
||||||
|
|
||||||
gtk_main ();
|
gtk_main ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
14
src/option.c
14
src/option.c
@ -46,7 +46,7 @@ gchar *zenity_calendar_date_format;
|
|||||||
/* Entry Dialog Options */
|
/* Entry Dialog Options */
|
||||||
gboolean zenity_entry_active;
|
gboolean zenity_entry_active;
|
||||||
gchar *zenity_entry_entry_text;
|
gchar *zenity_entry_entry_text;
|
||||||
gboolean zenity_entry_visible;
|
gboolean zenity_entry_hide_text;
|
||||||
|
|
||||||
/* Error Dialog Options */
|
/* Error Dialog Options */
|
||||||
gboolean zenity_error_active;
|
gboolean zenity_error_active;
|
||||||
@ -225,7 +225,7 @@ GOptionEntry entry_options[] = {
|
|||||||
'\0',
|
'\0',
|
||||||
0,
|
0,
|
||||||
G_OPTION_ARG_NONE,
|
G_OPTION_ARG_NONE,
|
||||||
&zenity_entry_visible,
|
&zenity_entry_hide_text,
|
||||||
N_("Hide the entry text"),
|
N_("Hide the entry text"),
|
||||||
NULL
|
NULL
|
||||||
},
|
},
|
||||||
@ -770,7 +770,7 @@ zenity_entry_pre_callback (GOptionContext *context,
|
|||||||
{
|
{
|
||||||
zenity_entry_active = FALSE;
|
zenity_entry_active = FALSE;
|
||||||
zenity_entry_entry_text = NULL;
|
zenity_entry_entry_text = NULL;
|
||||||
zenity_entry_visible = FALSE;
|
zenity_entry_hide_text = FALSE;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@ -979,14 +979,14 @@ zenity_entry_post_callback (GOptionContext *context,
|
|||||||
if (results->mode == MODE_ENTRY) {
|
if (results->mode == MODE_ENTRY) {
|
||||||
results->entry_data->dialog_text = zenity_general_dialog_text;
|
results->entry_data->dialog_text = zenity_general_dialog_text;
|
||||||
results->entry_data->entry_text = zenity_entry_entry_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 {
|
} else {
|
||||||
if (zenity_entry_entry_text)
|
if (zenity_entry_entry_text)
|
||||||
zenity_option_error (zenity_option_get_name (entry_options, &zenity_entry_entry_text),
|
zenity_option_error (zenity_option_get_name (entry_options, &zenity_entry_entry_text),
|
||||||
ERROR_SUPPORT);
|
ERROR_SUPPORT);
|
||||||
|
|
||||||
if (zenity_entry_visible)
|
if (zenity_entry_hide_text)
|
||||||
zenity_option_error (zenity_option_get_name (entry_options, &zenity_entry_visible),
|
zenity_option_error (zenity_option_get_name (entry_options, &zenity_entry_hide_text),
|
||||||
ERROR_SUPPORT);
|
ERROR_SUPPORT);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1373,7 +1373,7 @@ zenity_option_error (gchar *string, ZenityError error)
|
|||||||
{
|
{
|
||||||
switch (error) {
|
switch (error) {
|
||||||
case ERROR_SYNTAX:
|
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 ();
|
zenity_option_free ();
|
||||||
exit (-1);
|
exit (-1);
|
||||||
case ERROR_SUPPORT:
|
case ERROR_SUPPORT:
|
||||||
|
@ -71,7 +71,7 @@ typedef struct {
|
|||||||
typedef struct {
|
typedef struct {
|
||||||
gchar *dialog_text;
|
gchar *dialog_text;
|
||||||
gchar *entry_text;
|
gchar *entry_text;
|
||||||
gboolean visible;
|
gboolean hide_text;
|
||||||
} ZenityEntryData;
|
} ZenityEntryData;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
Reference in New Issue
Block a user