Bug 593926 - --progress needs a --nocancel option
This commit is contained in:
parent
078ff02362
commit
3c17a5a887
17
src/option.c
17
src/option.c
@ -86,6 +86,7 @@ static int zenity_progress_percentage;
|
|||||||
static gboolean zenity_progress_pulsate;
|
static gboolean zenity_progress_pulsate;
|
||||||
static gboolean zenity_progress_auto_close;
|
static gboolean zenity_progress_auto_close;
|
||||||
static gboolean zenity_progress_auto_kill;
|
static gboolean zenity_progress_auto_kill;
|
||||||
|
static gboolean zenity_progress_no_cancel;
|
||||||
|
|
||||||
/* Question Dialog Options */
|
/* Question Dialog Options */
|
||||||
static gboolean zenity_question_active;
|
static gboolean zenity_question_active;
|
||||||
@ -607,6 +608,16 @@ static GOptionEntry progress_options[] = {
|
|||||||
N_("Kill parent process if cancel button is pressed"),
|
N_("Kill parent process if cancel button is pressed"),
|
||||||
NULL
|
NULL
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"no-cancel",
|
||||||
|
'\0',
|
||||||
|
0,
|
||||||
|
G_OPTION_ARG_NONE,
|
||||||
|
&zenity_progress_no_cancel,
|
||||||
|
/* xgettext: no-c-format */
|
||||||
|
N_("Hide cancel button"),
|
||||||
|
NULL
|
||||||
|
},
|
||||||
{
|
{
|
||||||
NULL
|
NULL
|
||||||
}
|
}
|
||||||
@ -1050,7 +1061,7 @@ zenity_progress_pre_callback (GOptionContext *context,
|
|||||||
zenity_progress_pulsate = FALSE;
|
zenity_progress_pulsate = FALSE;
|
||||||
zenity_progress_auto_close = FALSE;
|
zenity_progress_auto_close = FALSE;
|
||||||
zenity_progress_auto_kill = FALSE;
|
zenity_progress_auto_kill = FALSE;
|
||||||
|
zenity_progress_no_cancel = FALSE;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1370,6 +1381,7 @@ zenity_progress_post_callback (GOptionContext *context,
|
|||||||
results->progress_data->autoclose = zenity_progress_auto_close;
|
results->progress_data->autoclose = zenity_progress_auto_close;
|
||||||
results->progress_data->autokill = zenity_progress_auto_kill;
|
results->progress_data->autokill = zenity_progress_auto_kill;
|
||||||
results->progress_data->percentage = zenity_progress_percentage;
|
results->progress_data->percentage = zenity_progress_percentage;
|
||||||
|
results->progress_data->no_cancel = zenity_progress_no_cancel;
|
||||||
} else {
|
} else {
|
||||||
if (zenity_progress_pulsate)
|
if (zenity_progress_pulsate)
|
||||||
zenity_option_error (zenity_option_get_name (progress_options, &zenity_progress_pulsate),
|
zenity_option_error (zenity_option_get_name (progress_options, &zenity_progress_pulsate),
|
||||||
@ -1386,6 +1398,9 @@ zenity_progress_post_callback (GOptionContext *context,
|
|||||||
if (zenity_progress_auto_kill)
|
if (zenity_progress_auto_kill)
|
||||||
zenity_option_error (zenity_option_get_name (progress_options, &zenity_progress_auto_kill),
|
zenity_option_error (zenity_option_get_name (progress_options, &zenity_progress_auto_kill),
|
||||||
ERROR_SUPPORT);
|
ERROR_SUPPORT);
|
||||||
|
if (zenity_progress_no_cancel)
|
||||||
|
zenity_option_error (zenity_option_get_name (progress_options, &zenity_progress_no_cancel),
|
||||||
|
ERROR_SUPPORT);
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -38,6 +38,8 @@ static GIOChannel *channel;
|
|||||||
|
|
||||||
static gint pulsate_timeout = -1;
|
static gint pulsate_timeout = -1;
|
||||||
static gboolean autokill;
|
static gboolean autokill;
|
||||||
|
static gboolean no_cancel;
|
||||||
|
static gboolean auto_close;
|
||||||
|
|
||||||
gint zenity_progress_timeout (gpointer data);
|
gint zenity_progress_timeout (gpointer data);
|
||||||
gint zenity_progress_pulsate_timeout (gpointer data);
|
gint zenity_progress_pulsate_timeout (gpointer data);
|
||||||
@ -227,6 +229,7 @@ zenity_progress (ZenityData *data, ZenityProgressData *progress_data)
|
|||||||
GtkWidget *dialog;
|
GtkWidget *dialog;
|
||||||
GObject *text;
|
GObject *text;
|
||||||
GObject *progress_bar;
|
GObject *progress_bar;
|
||||||
|
GObject *cancel_button,*ok_button;
|
||||||
|
|
||||||
zen_data = data;
|
zen_data = data;
|
||||||
builder = zenity_util_load_ui_file ("zenity_progress_dialog", NULL);
|
builder = zenity_util_load_ui_file ("zenity_progress_dialog", NULL);
|
||||||
@ -265,6 +268,20 @@ zenity_progress (ZenityData *data, ZenityProgressData *progress_data)
|
|||||||
|
|
||||||
autokill = progress_data->autokill;
|
autokill = progress_data->autokill;
|
||||||
|
|
||||||
|
auto_close = progress_data->autoclose;
|
||||||
|
ok_button = gtk_builder_get_object (builder, "zenity_progress_ok_button");
|
||||||
|
|
||||||
|
no_cancel = progress_data->no_cancel;
|
||||||
|
cancel_button = gtk_builder_get_object (builder, "zenity_progress_cancel_button");
|
||||||
|
|
||||||
|
if (no_cancel) {
|
||||||
|
gtk_widget_hide (GTK_WIDGET(cancel_button));
|
||||||
|
gtk_window_set_deletable (GTK_WINDOW (dialog), FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (no_cancel && auto_close)
|
||||||
|
gtk_widget_hide(GTK_WIDGET(ok_button));
|
||||||
|
|
||||||
zenity_util_show_dialog (dialog);
|
zenity_util_show_dialog (dialog);
|
||||||
zenity_progress_read_info (progress_data);
|
zenity_progress_read_info (progress_data);
|
||||||
|
|
||||||
|
@ -98,6 +98,7 @@ typedef struct {
|
|||||||
gboolean autoclose;
|
gboolean autoclose;
|
||||||
gboolean autokill;
|
gboolean autokill;
|
||||||
gdouble percentage;
|
gdouble percentage;
|
||||||
|
gboolean no_cancel;
|
||||||
} ZenityProgressData;
|
} ZenityProgressData;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
Reference in New Issue
Block a user