added timeout option to all dialogs (Fixes bug #160654). Based on patch
2007-08-13 Lucas Rocha <lucasr@gnome.org> * src/*.c: added timeout option to all dialogs (Fixes bug #160654). Based on patch from Muthiah Annamalai <gnumuthu@users.sf.net>. svn path=/trunk/; revision=1231
This commit is contained in:
parent
ae3e8d1496
commit
8b16d4d412
@ -1,3 +1,8 @@
|
|||||||
|
2007-08-13 Lucas Rocha <lucasr@gnome.org>
|
||||||
|
|
||||||
|
* src/*.c: added timeout option to all dialogs (Fixes bug #160654).
|
||||||
|
Based on patch from Muthiah Annamalai <gnumuthu@users.sf.net>.
|
||||||
|
|
||||||
2007-08-13 Lucas Rocha <lucasr@gnome.org>
|
2007-08-13 Lucas Rocha <lucasr@gnome.org>
|
||||||
|
|
||||||
* src/tree.c: fix critical warning when using checkbox and radiobox in
|
* src/tree.c: fix critical warning when using checkbox and radiobox in
|
||||||
|
@ -86,6 +86,11 @@ zenity_calendar (ZenityData *data, ZenityCalendarData *cal_data)
|
|||||||
|
|
||||||
gtk_label_set_mnemonic_widget (GTK_LABEL (text), calendar);
|
gtk_label_set_mnemonic_widget (GTK_LABEL (text), calendar);
|
||||||
zenity_util_show_dialog (dialog);
|
zenity_util_show_dialog (dialog);
|
||||||
|
|
||||||
|
if(data->timeout_delay > 0) {
|
||||||
|
g_timeout_add (data->timeout_delay * 1000, (GSourceFunc) zenity_util_timeout_handle, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
gtk_main ();
|
gtk_main ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -120,6 +120,10 @@ zenity_entry (ZenityData *data, ZenityEntryData *entry_data)
|
|||||||
|
|
||||||
zenity_util_show_dialog (dialog);
|
zenity_util_show_dialog (dialog);
|
||||||
|
|
||||||
|
if(data->timeout_delay > 0) {
|
||||||
|
g_timeout_add (data->timeout_delay * 1000, (GSourceFunc) zenity_util_timeout_handle, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
gtk_main ();
|
gtk_main ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,6 +86,11 @@ void zenity_fileselection (ZenityData *data, ZenityFileData *file_data)
|
|||||||
gtk_file_chooser_set_select_multiple (GTK_FILE_CHOOSER (dialog), TRUE);
|
gtk_file_chooser_set_select_multiple (GTK_FILE_CHOOSER (dialog), TRUE);
|
||||||
|
|
||||||
zenity_util_show_dialog (dialog);
|
zenity_util_show_dialog (dialog);
|
||||||
|
|
||||||
|
if(data->timeout_delay > 0) {
|
||||||
|
g_timeout_add (data->timeout_delay * 1000, (GSourceFunc) zenity_util_timeout_handle, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
gtk_main ();
|
gtk_main ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -116,6 +116,11 @@ zenity_msg (ZenityData *data, ZenityMsgData *msg_data)
|
|||||||
gtk_label_set_line_wrap (GTK_LABEL (text), FALSE);
|
gtk_label_set_line_wrap (GTK_LABEL (text), FALSE);
|
||||||
|
|
||||||
zenity_util_show_dialog (dialog);
|
zenity_util_show_dialog (dialog);
|
||||||
|
|
||||||
|
if(data->timeout_delay > 0) {
|
||||||
|
g_timeout_add (data->timeout_delay * 1000, (GSourceFunc) zenity_util_timeout_handle, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
gtk_main ();
|
gtk_main ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -280,6 +280,11 @@ zenity_notification (ZenityData *data, ZenityNotificationData *notification_data
|
|||||||
|
|
||||||
/* Show icon and wait */
|
/* Show icon and wait */
|
||||||
gtk_status_icon_set_visible (status_icon, TRUE);
|
gtk_status_icon_set_visible (status_icon, TRUE);
|
||||||
|
|
||||||
|
if(data->timeout_delay > 0) {
|
||||||
|
g_timeout_add (data->timeout_delay * 1000, (GSourceFunc) zenity_util_timeout_handle, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
gtk_main ();
|
gtk_main ();
|
||||||
|
|
||||||
/* Cleanup */
|
/* Cleanup */
|
||||||
|
13
src/option.c
13
src/option.c
@ -40,6 +40,7 @@ static gboolean zenity_general_multiple;
|
|||||||
static gboolean zenity_general_editable;
|
static gboolean zenity_general_editable;
|
||||||
static gchar *zenity_general_uri;
|
static gchar *zenity_general_uri;
|
||||||
static gboolean zenity_general_dialog_no_wrap;
|
static gboolean zenity_general_dialog_no_wrap;
|
||||||
|
static guint zenity_general_timeout_delay;
|
||||||
|
|
||||||
/* Calendar Dialog Options */
|
/* Calendar Dialog Options */
|
||||||
static gboolean zenity_calendar_active;
|
static gboolean zenity_calendar_active;
|
||||||
@ -143,6 +144,15 @@ static GOptionEntry general_options[] = {
|
|||||||
N_("Set the height"),
|
N_("Set the height"),
|
||||||
N_("HEIGHT")
|
N_("HEIGHT")
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"timeout",
|
||||||
|
'\0',
|
||||||
|
0,
|
||||||
|
G_OPTION_ARG_INT,
|
||||||
|
&zenity_general_timeout_delay,
|
||||||
|
N_("Set dialog timeout in seconds"),
|
||||||
|
NULL
|
||||||
|
},
|
||||||
{
|
{
|
||||||
NULL
|
NULL
|
||||||
}
|
}
|
||||||
@ -879,6 +889,7 @@ zenity_general_pre_callback (GOptionContext *context,
|
|||||||
zenity_general_editable = FALSE;
|
zenity_general_editable = FALSE;
|
||||||
zenity_general_uri = NULL;
|
zenity_general_uri = NULL;
|
||||||
zenity_general_dialog_no_wrap = FALSE;
|
zenity_general_dialog_no_wrap = FALSE;
|
||||||
|
zenity_general_timeout_delay = -1;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@ -1065,7 +1076,7 @@ zenity_general_post_callback (GOptionContext *context,
|
|||||||
results->data->window_icon = zenity_general_window_icon;
|
results->data->window_icon = zenity_general_window_icon;
|
||||||
results->data->width = zenity_general_width;
|
results->data->width = zenity_general_width;
|
||||||
results->data->height = zenity_general_height;
|
results->data->height = zenity_general_height;
|
||||||
|
results->data->timeout_delay=zenity_general_timeout_delay;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -219,6 +219,10 @@ zenity_progress (ZenityData *data, ZenityProgressData *progress_data)
|
|||||||
zenity_util_show_dialog (dialog);
|
zenity_util_show_dialog (dialog);
|
||||||
zenity_progress_read_info (progress_data);
|
zenity_progress_read_info (progress_data);
|
||||||
|
|
||||||
|
if(data->timeout_delay > 0) {
|
||||||
|
g_timeout_add (data->timeout_delay * 1000, (GSourceFunc) zenity_util_timeout_handle, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
gtk_main ();
|
gtk_main ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,6 +93,11 @@ zenity_scale (ZenityData *data, ZenityScaleData *scale_data)
|
|||||||
gtk_scale_set_draw_value (GTK_SCALE (scale), FALSE);
|
gtk_scale_set_draw_value (GTK_SCALE (scale), FALSE);
|
||||||
|
|
||||||
zenity_util_show_dialog (dialog);
|
zenity_util_show_dialog (dialog);
|
||||||
|
|
||||||
|
if(data->timeout_delay > 0) {
|
||||||
|
g_timeout_add (data->timeout_delay * 1000, (GSourceFunc) zenity_util_timeout_handle, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
gtk_main ();
|
gtk_main ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -152,6 +152,10 @@ zenity_text (ZenityData *data, ZenityTextData *text_data)
|
|||||||
if (glade_dialog)
|
if (glade_dialog)
|
||||||
g_object_unref (glade_dialog);
|
g_object_unref (glade_dialog);
|
||||||
|
|
||||||
|
if(data->timeout_delay > 0) {
|
||||||
|
g_timeout_add (data->timeout_delay * 1000, (GSourceFunc) zenity_util_timeout_handle, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
gtk_main ();
|
gtk_main ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -493,6 +493,11 @@ zenity_tree (ZenityData *data, ZenityTreeData *tree_data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
zenity_util_show_dialog (dialog);
|
zenity_util_show_dialog (dialog);
|
||||||
|
|
||||||
|
if(data->timeout_delay > 0) {
|
||||||
|
g_timeout_add (data->timeout_delay * 1000, (GSourceFunc) zenity_util_timeout_handle, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
gtk_main ();
|
gtk_main ();
|
||||||
|
|
||||||
if (glade_dialog)
|
if (glade_dialog)
|
||||||
|
@ -350,6 +350,7 @@ transient_get_xterm_toplevel (void)
|
|||||||
static void
|
static void
|
||||||
zenity_util_make_transient (GdkWindow *window)
|
zenity_util_make_transient (GdkWindow *window)
|
||||||
{
|
{
|
||||||
|
#if 0
|
||||||
Window xterm = transient_get_xterm_toplevel ();
|
Window xterm = transient_get_xterm_toplevel ();
|
||||||
if (xterm != None) {
|
if (xterm != None) {
|
||||||
GdkWindow *gdkxterm = gdk_window_foreign_new (xterm);
|
GdkWindow *gdkxterm = gdk_window_foreign_new (xterm);
|
||||||
@ -358,6 +359,7 @@ zenity_util_make_transient (GdkWindow *window)
|
|||||||
g_object_unref (G_OBJECT (gdkxterm));
|
g_object_unref (G_OBJECT (gdkxterm));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* GDK_WINDOWING_X11 */
|
#endif /* GDK_WINDOWING_X11 */
|
||||||
@ -373,3 +375,10 @@ zenity_util_show_dialog (GtkWidget *dialog)
|
|||||||
gtk_widget_show (dialog);
|
gtk_widget_show (dialog);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
zenity_util_timeout_handle (void)
|
||||||
|
{
|
||||||
|
gtk_main_quit();
|
||||||
|
exit(ZENITY_TIMEOUT);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
@ -27,7 +27,9 @@ GdkPixbuf * zenity_util_pixbuf_new_from_file (GtkWidget *widget,
|
|||||||
void zenity_util_show_help (GError **error);
|
void zenity_util_show_help (GError **error);
|
||||||
gint zenity_util_return_exit_code (ZenityExitCode value);
|
gint zenity_util_return_exit_code (ZenityExitCode value);
|
||||||
void zenity_util_show_dialog (GtkWidget *widget);
|
void zenity_util_show_dialog (GtkWidget *widget);
|
||||||
|
|
||||||
|
gboolean zenity_util_timeout_handle (void);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
#endif /* UTIL_H */
|
#endif /* UTIL_H */
|
||||||
|
@ -29,6 +29,7 @@ typedef struct {
|
|||||||
gint width;
|
gint width;
|
||||||
gint height;
|
gint height;
|
||||||
gint exit_code;
|
gint exit_code;
|
||||||
|
guint timeout_delay;
|
||||||
} ZenityData;
|
} ZenityData;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
@ -36,7 +37,8 @@ typedef enum {
|
|||||||
ZENITY_CANCEL,
|
ZENITY_CANCEL,
|
||||||
ZENITY_ESC,
|
ZENITY_ESC,
|
||||||
ZENITY_ERROR,
|
ZENITY_ERROR,
|
||||||
ZENITY_EXTRA
|
ZENITY_EXTRA,
|
||||||
|
ZENITY_TIMEOUT
|
||||||
} ZenityExitCode;
|
} ZenityExitCode;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
Reference in New Issue
Block a user