Changeset 13958 for branches


Ignore:
Timestamp:
Feb 4, 2013, 6:42:52 PM (9 years ago)
Author:
jordan
Message:

(2.7x) backport r13956 to fix bug #5271 in 2.7x

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.7x/gtk/main.c

    r13953 r13958  
    233233refresh_actions (gpointer gdata)
    234234{
    235   int canUpdate;
    236   struct counts_data sel_counts;
    237235  struct cbdata * data = gdata;
    238   const size_t total = gtr_core_get_torrent_count (data->core);
    239   const size_t active = gtr_core_get_active_torrent_count (data->core);
    240   const int torrent_count = gtk_tree_model_iter_n_children (gtr_core_model (data->core), NULL);
    241   bool has_selection;
    242 
    243   get_selected_torrent_counts (data, &sel_counts);
    244   has_selection = sel_counts.total_count > 0;
    245 
    246   gtr_action_set_sensitive ("select-all", torrent_count != 0);
    247   gtr_action_set_sensitive ("deselect-all", torrent_count != 0);
    248   gtr_action_set_sensitive ("pause-all-torrents", active != 0);
    249   gtr_action_set_sensitive ("start-all-torrents", active != total);
    250 
    251   gtr_action_set_sensitive ("torrent-stop", (sel_counts.stopped_count < sel_counts.total_count));
    252   gtr_action_set_sensitive ("torrent-start", (sel_counts.stopped_count) > 0);
    253   gtr_action_set_sensitive ("torrent-start-now", (sel_counts.stopped_count + sel_counts.queued_count) > 0);
    254   gtr_action_set_sensitive ("torrent-verify",          has_selection);
    255   gtr_action_set_sensitive ("remove-torrent",          has_selection);
    256   gtr_action_set_sensitive ("delete-torrent",          has_selection);
    257   gtr_action_set_sensitive ("relocate-torrent",        has_selection);
    258   gtr_action_set_sensitive ("queue-move-top",          has_selection);
    259   gtr_action_set_sensitive ("queue-move-up",           has_selection);
    260   gtr_action_set_sensitive ("queue-move-down",         has_selection);
    261   gtr_action_set_sensitive ("queue-move-bottom",       has_selection);
    262   gtr_action_set_sensitive ("show-torrent-properties", has_selection);
    263   gtr_action_set_sensitive ("open-torrent-folder", sel_counts.total_count == 1);
    264   gtr_action_set_sensitive ("copy-magnet-link-to-clipboard", sel_counts.total_count == 1);
    265 
    266   canUpdate = 0;
    267   gtk_tree_selection_selected_foreach (data->sel, count_updatable_foreach, &canUpdate);
    268   gtr_action_set_sensitive ("torrent-reannounce", canUpdate != 0);
     236  if (!data->is_closing)
     237    {
     238      int canUpdate;
     239      struct counts_data sel_counts;
     240      const size_t total = gtr_core_get_torrent_count (data->core);
     241      const size_t active = gtr_core_get_active_torrent_count (data->core);
     242      const int torrent_count = gtk_tree_model_iter_n_children (gtr_core_model (data->core), NULL);
     243      bool has_selection;
     244
     245      get_selected_torrent_counts (data, &sel_counts);
     246      has_selection = sel_counts.total_count > 0;
     247
     248      gtr_action_set_sensitive ("select-all", torrent_count != 0);
     249      gtr_action_set_sensitive ("deselect-all", torrent_count != 0);
     250      gtr_action_set_sensitive ("pause-all-torrents", active != 0);
     251      gtr_action_set_sensitive ("start-all-torrents", active != total);
     252
     253      gtr_action_set_sensitive ("torrent-stop", (sel_counts.stopped_count < sel_counts.total_count));
     254      gtr_action_set_sensitive ("torrent-start", (sel_counts.stopped_count) > 0);
     255      gtr_action_set_sensitive ("torrent-start-now", (sel_counts.stopped_count + sel_counts.queued_count) > 0);
     256      gtr_action_set_sensitive ("torrent-verify",          has_selection);
     257      gtr_action_set_sensitive ("remove-torrent",          has_selection);
     258      gtr_action_set_sensitive ("delete-torrent",          has_selection);
     259      gtr_action_set_sensitive ("relocate-torrent",        has_selection);
     260      gtr_action_set_sensitive ("queue-move-top",          has_selection);
     261      gtr_action_set_sensitive ("queue-move-up",           has_selection);
     262      gtr_action_set_sensitive ("queue-move-down",         has_selection);
     263      gtr_action_set_sensitive ("queue-move-bottom",       has_selection);
     264      gtr_action_set_sensitive ("show-torrent-properties", has_selection);
     265      gtr_action_set_sensitive ("open-torrent-folder", sel_counts.total_count == 1);
     266      gtr_action_set_sensitive ("copy-magnet-link-to-clipboard", sel_counts.total_count == 1);
     267
     268      canUpdate = 0;
     269      gtk_tree_selection_selected_foreach (data->sel, count_updatable_foreach, &canUpdate);
     270      gtr_action_set_sensitive ("torrent-reannounce", canUpdate != 0);
     271    }
    269272
    270273  data->refresh_actions_tag = 0;
    271   return FALSE;
     274  return G_SOURCE_REMOVE;
    272275}
    273276
Note: See TracChangeset for help on using the changeset viewer.