[gnome-bluetooth] sendto: keep the "Retry" button always visible and make it sensitive when needed



commit 69ed87ba048346975fa2e0380be7aa0c87a03fc2
Author: Daniele Forsi <dforsi src gnome org>
Date:   Wed May 9 12:07:48 2012 +0200

    sendto: keep the "Retry" button always visible and make it sensitive when needed
    
    It is less surprising for the user if it is visible from the start instead of
    appearing after an error and pushing the "Cancel" button to the left.
    It also follows the advice in GNOME HIG:
    "It is usually better to make a control insensitive than to hide it altogether.
    This way, the user can learn about functionality they may be able to use later,
    even if it is not available right now."
    http://developer.gnome.org/hig-book/3.0/controls-sensitivity.html.en

 sendto/main.c |   21 +++++----------------
 1 files changed, 5 insertions(+), 16 deletions(-)
---
diff --git a/sendto/main.c b/sendto/main.c
index 043d3f8..4846a78 100644
--- a/sendto/main.c
+++ b/sendto/main.c
@@ -178,18 +178,6 @@ static gchar *format_time(gint seconds)
 				"approximately %'d hours", hours), hours);
 }
 
-static void
-set_response_visible (GtkDialog *dialog,
-		      int response_id,
-		      gboolean visible)
-{
-	GtkWidget *widget;
-
-	widget = gtk_dialog_get_widget_for_response (dialog, response_id);
-	gtk_widget_set_no_show_all (widget, TRUE);
-	gtk_widget_set_visible (widget, visible);
-}
-
 static void response_callback(GtkWidget *dialog,
 					gint response, gpointer user_data)
 {
@@ -197,7 +185,7 @@ static void response_callback(GtkWidget *dialog,
 		setup_agent ();
 
 		/* Reset buttons */
-		set_response_visible (GTK_DIALOG (dialog), RESPONSE_RETRY, FALSE);
+		gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog), RESPONSE_RETRY, FALSE);
 
 		/* Reset status and progress bar */
 		gtk_progress_bar_set_text (GTK_PROGRESS_BAR (progress),
@@ -245,7 +233,7 @@ static void create_window(void)
 				GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
 				_("_Retry"), RESPONSE_RETRY,
 				NULL);
-	set_response_visible (GTK_DIALOG (dialog), RESPONSE_RETRY, FALSE);
+	gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog), RESPONSE_RETRY, FALSE);
 	gtk_window_set_type_hint(GTK_WINDOW(dialog),
 						GDK_WINDOW_TYPE_HINT_NORMAL);
 	gtk_window_set_position(GTK_WINDOW(dialog), GTK_WIN_POS_CENTER);
@@ -575,7 +563,7 @@ static gboolean error_callback(GDBusMethodInvocation *invocation,
 	gtk_widget_show (image_status);
 	gtk_label_set_markup(GTK_LABEL(label_status), message);
 
-	set_response_visible (GTK_DIALOG (dialog), RESPONSE_RETRY, TRUE);
+	gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog), RESPONSE_RETRY, TRUE);
 
 	g_object_unref (current_transfer);
 	current_transfer = NULL;
@@ -608,7 +596,8 @@ send_notify (GDBusProxy   *proxy,
 		gtk_label_set_markup(GTK_LABEL(label_status), message);
 		g_free (message);
 
-		set_response_visible (GTK_DIALOG (dialog), RESPONSE_RETRY, TRUE);
+		gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog), RESPONSE_RETRY, TRUE);
+
 		return;
 	}
 



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