empathy r1892 - trunk/src
- From: xclaesse svn gnome org
- To: svn-commits-list gnome org
- Subject: empathy r1892 - trunk/src
- Date: Fri, 21 Nov 2008 16:23:51 +0000 (UTC)
Author: xclaesse
Date: Fri Nov 21 16:23:50 2008
New Revision: 1892
URL: http://svn.gnome.org/viewvc/empathy?rev=1892&view=rev
Log:
Simplify the code to set sensibility of buttons
Modified:
trunk/src/empathy-ft-manager.c
Modified: trunk/src/empathy-ft-manager.c
==============================================================================
--- trunk/src/empathy-ft-manager.c (original)
+++ trunk/src/empathy-ft-manager.c Fri Nov 21 16:23:50 2008
@@ -168,6 +168,7 @@
GtkTreeModel *model;
GtkTreeIter iter;
EmpathyTpFile *tp_file;
+ EmpFileTransferState state;
gboolean open_enabled = FALSE;
gboolean abort_enabled = FALSE;
@@ -176,29 +177,15 @@
if (gtk_tree_selection_get_selected (selection, &model, &iter))
{
gtk_tree_model_get (model, &iter, COL_FT_OBJECT, &tp_file, -1);
+ state = empathy_tp_file_get_state (tp_file, NULL);
- if (empathy_tp_file_get_state (tp_file, NULL)
- == EMP_FILE_TRANSFER_STATE_COMPLETED)
- {
- if (empathy_tp_file_is_incoming (tp_file))
- open_enabled = TRUE;
- else
- open_enabled = FALSE;
-
- abort_enabled = FALSE;
-
- }
- else if (empathy_tp_file_get_state (tp_file, NULL) ==
- EMP_FILE_TRANSFER_STATE_CANCELLED)
- {
- open_enabled = FALSE;
- abort_enabled = FALSE;
- }
- else
- {
- open_enabled = FALSE;
- abort_enabled = TRUE;
- }
+ /* I can open the file if the transfer is completed and was incoming */
+ open_enabled = (state == EMP_FILE_TRANSFER_STATE_COMPLETED &&
+ empathy_tp_file_is_incoming (tp_file));
+
+ /* I can abort if the transfer is not already finished */
+ abort_enabled = (state != EMP_FILE_TRANSFER_STATE_CANCELLED &&
+ state != EMP_FILE_TRANSFER_STATE_COMPLETED);
}
gtk_widget_set_sensitive (ft_manager->priv->open_button, open_enabled);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]