After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 593926 - --progress needs a --nocancel option.
--progress needs a --nocancel option.
Status: RESOLVED FIXED
Product: zenity
Classification: Core
Component: general
2.16.x
Other Linux
: Normal enhancement
: ---
Assigned To: Zenity Maintainers
Zenity Maintainers
Depends on:
Blocks:
 
 
Reported: 2009-09-02 14:54 UTC by George Sullivan
Modified: 2010-08-06 15:39 UTC
See Also:
GNOME target: ---
GNOME version: 2.15/2.16


Attachments
patch to add nocancel to zenity progress dialog (3.26 KB, patch)
2010-01-27 11:03 UTC, Huzaifa Sidhpurwala (Red Hat Security Response)
needs-work Details | Review
--no-cancel patch with corrections (3.50 KB, patch)
2010-02-01 07:45 UTC, Huzaifa Sidhpurwala (Red Hat Security Response)
none Details | Review
--no-cancel with all the corrections (3.50 KB, patch)
2010-02-01 07:48 UTC, Huzaifa Sidhpurwala (Red Hat Security Response)
committed Details | Review

Description George Sullivan 2009-09-02 14:54:43 UTC
We use zenity to display our login banner with --question.  If the users click Cancel he/she is moved to a point in the /etc/gdm/PreSession/Default script that uses zenity's --progess with --auto-close an --text.  When the Progess Bar comes up it also has a Cancel Button.  Can there be an --nocancel option added so that a user can't cancel the logout process i.e. --progess bar?  As it is now, if the hit the Progess Bar's Cancel, they are logged in anyway.
Comment 1 André Klapper 2009-09-02 16:37:39 UTC
Please file enhancement requests as enhancement, and please NEVER set the target mielstone yourself.

What exact version of zenity do you have installed?
Comment 2 George Sullivan 2009-09-02 16:44:17 UTC
Sorry for the incorrect reporting procedure and target use.  This was my first ever attempt and as you can see I fumbled through.  Thank you for your support and help.

I am using Red Hat Enterprise Linux's AS 5.1 32bit x86 version from rpm
Zenity-2.16.0-2.el5.
Comment 3 André Klapper 2009-09-02 17:28:49 UTC
Hi, no problem. :-)

Keeping this opened as it is an enhancement request, but in general we close reports from such old versions immediately. Nobody works on GNOME 2.16 anymore and it's up to ypur distributor to provide updates, if at all.
Comment 4 George Sullivan 2009-09-02 18:21:17 UTC
Thanks Andre' for keeping it in the request queue.  If and when this enhancement is provided in a future release I can download and install it in place of the Red Hat rpm.
Comment 5 Huzaifa Sidhpurwala (Red Hat Security Response) 2010-01-27 11:03:00 UTC
Created attachment 152389 [details] [review]
patch to add nocancel to zenity progress dialog
Comment 6 Lucas Rocha 2010-01-30 23:31:51 UTC
Review of attachment 152389 [details] [review]:

Some minor nitpicks.

::: src/option.c
@@ +87,3 @@
 static gboolean zenity_progress_auto_kill;
 static gboolean zenity_progress_auto_close;
+static gboolean zenity_progress_nocancel;

Rename to zenity_progress_no_cancel

@@ +610,3 @@
     NULL
+   "nocancel",
+  {

Should probably be 'no-cancel'

@@ +616,3 @@
+   '\0',
+   "nocancel",
+  {

A better description should probably be 'Hide cancel button'.

@@ +1382,3 @@
     results->progress_data->percentage = zenity_progress_percentage;
     results->progress_data->autokill = zenity_progress_auto_kill;
+    results->progress_data->nocancel = zenity_progress_nocancel;

Call it no_cancel

::: src/progress.c
@@ +38,3 @@
 static gint pulsate_timeout = -1;
 
+static gboolean autokill,nocancel;

Declare the new variable in a new line. Call it no_cancel

@@ +227,3 @@
   GObject *text;
   GtkWidget *dialog;
+  GObject *progress_bar,*cancel_button;

Declare cancel_button in a new line

@@ +270,3 @@
+
+  cancel_button = gtk_builder_get_object (builder, "zenity_progress_cancel_button");
+  nocancel = progress_data->nocancel;

I guess the feature request was about hiding (not disabling) the cancel button?

Additionally, if using --no-cancel and --auto-close, what about hiding all buttons (ok and cancel)?

::: src/zenity.h
@@ +99,3 @@
   gdouble  percentage;
   gboolean autokill;
+  gboolean nocancel;

Rename to no_cancel
Comment 7 Huzaifa Sidhpurwala (Red Hat Security Response) 2010-02-01 07:44:05 UTC
(In reply to comment #6)
> Review of attachment 152389 [details] [review]:
> 
> Some minor nitpicks.

Take care of all of these now

> I guess the feature request was about hiding (not disabling) the cancel button?
> 
> Additionally, if using --no-cancel and --auto-close, what about hiding all
> buttons (ok and cancel)?
> 
Yes, that really makes sense.

Modified the patch so that:
If you use --no-cancel =  Cancel button is hidden
If you use --no-cancel and --auto-close = Both Cancel and Ok buttons are hidden

Also if you choose --no-cancel : The Dialog Window is now set to be non-deletable.

This is because if you hide the cancel button , but if the user can still use delete option from the window tool bar, the purpose is not achieved.

Re-attaching the newer patch.
Comment 8 Huzaifa Sidhpurwala (Red Hat Security Response) 2010-02-01 07:45:10 UTC
Created attachment 152710 [details] [review]
--no-cancel patch with corrections
Comment 9 Huzaifa Sidhpurwala (Red Hat Security Response) 2010-02-01 07:48:59 UTC
Created attachment 152711 [details] [review]
--no-cancel with all the corrections
Comment 10 Lucas Rocha 2010-02-08 12:17:23 UTC
Review of attachment 152711 [details] [review]:

Looks good! Let me just branch for 2.30 before pushing that to master as we're feature frozen now.
Comment 11 Lucas Rocha 2010-02-23 18:09:02 UTC
Comment on attachment 152711 [details] [review]
--no-cancel with all the corrections

Pushed to master. Thanks!
Comment 12 pcboard 2010-08-06 15:35:13 UTC
Hi,

how I can patch zenity 2.22.1-2.
I use Debian Lenny with Gnome 2.22.3
Thanks a lot for more info.

Regards
Comment 13 André Klapper 2010-08-06 15:39:44 UTC
pcboard: For such general questions please ask in a forum instead, e.g. of Debian.