[eog] Add func to get the close confirmation dialog in an insensitive state



commit d6b1a6351ccb2e87ecdbfb071120247bfc79b79b
Author: Felix Riemann <friemann gnome org>
Date:   Sun Nov 22 12:23:51 2009 +0100

    Add func to get the close confirmation dialog in an insensitive state
    
    This state is special therein that it is not making the whole dialog
    insensitive, but only the buttons and the checkbox column in the
    treeview. That way the main window doesn't need to be made insensitive
    during saving to avoid interaction. Alltogether this should improve the
    situation visually quite a bit.

 src/eog-close-confirmation-dialog.c |   18 +++++++++++++++++-
 src/eog-close-confirmation-dialog.h |    1 +
 src/eog-window.c                    |    3 +--
 3 files changed, 19 insertions(+), 3 deletions(-)
---
diff --git a/src/eog-close-confirmation-dialog.c b/src/eog-close-confirmation-dialog.c
index e56cefa..d303909 100644
--- a/src/eog-close-confirmation-dialog.c
+++ b/src/eog-close-confirmation-dialog.c
@@ -64,6 +64,7 @@ struct _EogCloseConfirmationDialogPrivate
 	GList       *selected_images;
 
 	GtkTreeModel *list_store;
+	GtkCellRenderer *toggle_renderer;
 };
 
 #define EOG_CLOSE_CONFIRMATION_DIALOG_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), \
@@ -492,7 +493,7 @@ create_treeview (EogCloseConfirmationDialogPrivate *priv)
 	priv->list_store = GTK_TREE_MODEL (store);
 	
 	/* Add columns */
-	renderer = gtk_cell_renderer_toggle_new ();
+	priv->toggle_renderer = renderer = gtk_cell_renderer_toggle_new ();
 	g_signal_connect (renderer, "toggled",
 			  G_CALLBACK (save_toggled), store);
 
@@ -645,3 +646,18 @@ eog_close_confirmation_dialog_get_unsaved_images (EogCloseConfirmationDialog *dl
 
 	return dlg->priv->unsaved_images;
 }
+
+void
+eog_close_confirmation_dialog_set_sensitive (EogCloseConfirmationDialog *dlg,
+					     gboolean value)
+{
+	GtkWidget *action_area;
+
+	g_return_if_fail (EOG_IS_CLOSE_CONFIRMATION_DIALOG (dlg));
+
+	action_area = gtk_dialog_get_action_area (GTK_DIALOG (dlg));
+	gtk_widget_set_sensitive (action_area, value);
+
+	if (dlg->priv->toggle_renderer)
+		gtk_cell_renderer_toggle_set_activatable (GTK_CELL_RENDERER_TOGGLE (dlg->priv->toggle_renderer), value);
+}
diff --git a/src/eog-close-confirmation-dialog.h b/src/eog-close-confirmation-dialog.h
index 3a1f8a1..8c5e345 100644
--- a/src/eog-close-confirmation-dialog.h
+++ b/src/eog-close-confirmation-dialog.h
@@ -66,6 +66,7 @@ GtkWidget 	*eog_close_confirmation_dialog_new_single 		(GtkWindow     *parent,
 const GList	*eog_close_confirmation_dialog_get_unsaved_images	(EogCloseConfirmationDialog *dlg);
 
 GList		*eog_close_confirmation_dialog_get_selected_images	(EogCloseConfirmationDialog *dlg);
+void		 eog_close_confirmation_dialog_set_sensitive		(EogCloseConfirmationDialog *dlg, gboolean value);
 
 #endif /* __EOG_CLOSE_CONFIRMATION_DIALOG_H__ */
 
diff --git a/src/eog-window.c b/src/eog-window.c
index b856cdd..f18f9f6 100644
--- a/src/eog-window.c
+++ b/src/eog-window.c
@@ -2470,8 +2470,7 @@ close_confirmation_dialog_response_handler (EogCloseConfirmationDialog *dlg,
 		case GTK_RESPONSE_YES:
 			/* save selected images */
 			selected_images = eog_close_confirmation_dialog_get_selected_images (dlg);
-			gtk_widget_set_sensitive (GTK_WIDGET (dlg), FALSE);
-			gtk_widget_set_sensitive (GTK_WIDGET (window), FALSE);
+			eog_close_confirmation_dialog_set_sensitive (dlg, FALSE);
 			if (eog_window_save_images (window, selected_images)) {
 				g_signal_connect (priv->save_job,
 							  "finished",



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