diff options
author | Xavier Claessens <xclaesse@src.gnome.org> | 2008-11-22 00:23:50 +0800 |
---|---|---|
committer | Xavier Claessens <xclaesse@src.gnome.org> | 2008-11-22 00:23:50 +0800 |
commit | b108897d4392e2ce0f0baae2a8aea52276e5bc89 (patch) | |
tree | 09c34c8ef1e6e7774b95c99bf8910ca03d59828b /src | |
parent | 921e862b7b56d76a1d11fcaa2edcd4d5aafab6c5 (diff) | |
download | gsoc2013-empathy-b108897d4392e2ce0f0baae2a8aea52276e5bc89.tar gsoc2013-empathy-b108897d4392e2ce0f0baae2a8aea52276e5bc89.tar.gz gsoc2013-empathy-b108897d4392e2ce0f0baae2a8aea52276e5bc89.tar.bz2 gsoc2013-empathy-b108897d4392e2ce0f0baae2a8aea52276e5bc89.tar.lz gsoc2013-empathy-b108897d4392e2ce0f0baae2a8aea52276e5bc89.tar.xz gsoc2013-empathy-b108897d4392e2ce0f0baae2a8aea52276e5bc89.tar.zst gsoc2013-empathy-b108897d4392e2ce0f0baae2a8aea52276e5bc89.zip |
Simplify the code to set sensibility of buttons
svn path=/trunk/; revision=1892
Diffstat (limited to 'src')
-rw-r--r-- | src/empathy-ft-manager.c | 29 |
1 files changed, 8 insertions, 21 deletions
diff --git a/src/empathy-ft-manager.c b/src/empathy-ft-manager.c index 2092aa10d..2febb5cbc 100644 --- a/src/empathy-ft-manager.c +++ b/src/empathy-ft-manager.c @@ -168,6 +168,7 @@ ft_manager_update_buttons (EmpathyFTManager *ft_manager) GtkTreeModel *model; GtkTreeIter iter; EmpathyTpFile *tp_file; + EmpFileTransferState state; gboolean open_enabled = FALSE; gboolean abort_enabled = FALSE; @@ -176,29 +177,15 @@ ft_manager_update_buttons (EmpathyFTManager *ft_manager) 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; + /* 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)); - } - 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 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); |