[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#400124: Buttons in the GTK frontend are not properly setup



package: cdebconf-gtk-udeb
severity: minor
tags: patch

Currently the screenshot and cancel buttons are setup sensitive in
gtk_initialize(), so if a long time should pass between frontend_intialize()
and frontend_go(), the user may be able to click them.
As the gtk_main() loop is already running there should be no risk of
crashing anything, but anyway this patch disables those buttons in
gtk_initialize(), like it's already done for back and cancel buttons.
Hiding them, as it's done now, has no effect, and this should be fixed
because it's wrong.
The attached patch also takes care of hiding ok, back and screenshot
buttons while the progressbar is running and CAPB progresscancel is not set (it makes no sense, IMHO, displaying disabled buttons)

cheers

Attilio


Index: gtk.c
===================================================================
--- gtk.c	(revisione 42838)
+++ gtk.c	(copia locale)
@@ -1315,11 +1315,12 @@
     gtk_button_box_set_layout (GTK_BUTTON_BOX(actionbox), GTK_BUTTONBOX_END);
     gtk_box_set_spacing (GTK_BOX(actionbox), DEFAULT_PADDING);
 
-    /* button to take screenshots of the frontend */
+    /* Screenshot button is set insensitive by default */
     button_screenshot = gtk_button_new_with_label (get_text(obj, "debconf/gtk-button-screenshot", "Screenshot"));
     g_signal_connect (G_OBJECT (button_screenshot), "clicked", G_CALLBACK (screenshot_button_callback), obj );
     gtk_box_pack_start (GTK_BOX(actionbox), button_screenshot, TRUE, TRUE, DEFAULT_PADDING);
     ((struct frontend_data*) obj->data)->button_screenshot = button_screenshot;
+    gtk_widget_set_sensitive (button_screenshot, FALSE);
 
     /* Here are the back and forward buttons */
     button_prev = gtk_button_new_with_label (get_text(obj, "debconf/button-goback", "Go Back"));
@@ -1344,7 +1345,7 @@
     gtk_widget_set_sensitive (button_prev, FALSE);
     gtk_widget_set_sensitive (button_next, FALSE);
 
-    /* Cancel button is not displayed by default */
+    /* Cancel button is set insensitive by default */
     button_cancel = gtk_button_new_with_label (get_text(obj, "debconf/button-cancel", "Cancel"));
     ret_val = NEW(int);
     *ret_val = DC_GOBACK;
@@ -1353,7 +1354,7 @@
                       G_CALLBACK(cancel_button_callback), obj);
     gtk_box_pack_start (GTK_BOX(actionbox), button_cancel, TRUE, TRUE, DEFAULT_PADDING);
     ((struct frontend_data*) obj->data)->button_cancel = button_cancel;
-    gtk_widget_hide(button_cancel);
+    gtk_widget_set_sensitive (button_cancel, FALSE);
 
     /* focus order inside actionbox */
     focus_chain = g_list_append(focus_chain, button_next);
@@ -1679,13 +1680,14 @@
         gtk_widget_hide(data->button_prev);
         gtk_widget_hide(data->button_next);
         gtk_widget_show(data->button_cancel);
+        gtk_widget_set_sensitive (data->button_cancel, TRUE);
         GTK_WIDGET_SET_FLAGS (GTK_WIDGET(data->button_cancel), GTK_CAN_DEFAULT);
         gtk_widget_grab_default (GTK_WIDGET(data->button_cancel));    
     }
     else {
-        gtk_widget_set_sensitive (data->button_screenshot, FALSE);
-        gtk_widget_set_sensitive (data->button_prev, FALSE);
-        gtk_widget_set_sensitive (data->button_next, FALSE);
+        gtk_widget_hide(data->button_screenshot);
+        gtk_widget_hide(data->button_prev);
+        gtk_widget_hide(data->button_next);
         gtk_widget_hide(data->button_cancel);
     }
 

Reply to: