Ignore:
Timestamp:
Feb 1, 2013, 8:58:55 PM (10 years ago)
Author:
jordan
Message:

in the Qt and GTK+ clients, move the torrent count indicator from the statusbar to the filterbar

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gtk/tr-window.c

    r13897 r13927  
    5757    GtkLabel           * freespace_lb;
    5858    GtkWidget          * freespace_icon;
    59     GtkLabel           * count_lb;
    6059    GtkWidget          * alt_speed_image;
    6160    GtkWidget          * alt_speed_button;
     
    717716  sibling = w;
    718717
    719   /* torrent count */
    720   w = gtk_label_new ("N Torrents");
    721   p->count_lb = GTK_LABEL (w);
    722   gtk_label_set_single_line_mode (p->count_lb, TRUE);
    723   gtk_grid_attach_next_to (grid, w, sibling, GTK_POS_RIGHT, 1, 1);
    724   sibling = w;
    725 
    726718  /* freespace */
     719  w = gtk_image_new_from_stock (GTK_STOCK_HARDDISK, GTK_ICON_SIZE_MENU);
     720  p->freespace_icon = w;
     721  g_object_set (G_OBJECT(w), "margin-left", GUI_PAD, NULL);
     722  gtk_grid_attach_next_to (grid, w, sibling, GTK_POS_RIGHT, 1, 1);
     723  sibling = w;
    727724  w = gtk_label_new (NULL);
    728725  g_object_set (G_OBJECT(w), "margin-left", GUI_PAD_BIG*2, NULL);
    729726  p->freespace_lb = GTK_LABEL (w);
    730727  gtk_label_set_single_line_mode (p->freespace_lb, TRUE);
    731   gtk_grid_attach_next_to (grid, w, sibling, GTK_POS_RIGHT, 1, 1);
    732   sibling = w;
    733   w = gtk_image_new_from_stock (GTK_STOCK_HARDDISK, GTK_ICON_SIZE_MENU);
    734   p->freespace_icon = w;
    735   g_object_set (G_OBJECT(w), "margin-left", GUI_PAD, NULL);
    736728  gtk_grid_attach_next_to (grid, w, sibling, GTK_POS_RIGHT, 1, 1);
    737729  sibling = w;
     
    831823
    832824static void
    833 updateTorrentCount (PrivateData * p)
    834 {
    835   bool visible = false;
    836 
    837   g_return_if_fail (p != NULL);
    838 
    839   if (p->core != NULL)
    840     {
    841       const int torrentCount = gtk_tree_model_iter_n_children (gtr_core_model (p->core), NULL);
    842       const int visibleCount = gtk_tree_model_iter_n_children (p->filter_model, NULL);
    843 
    844       visible = torrentCount > 0;
    845 
    846       if (visible)
    847         {
    848           char countStr[512];
    849 
    850           if (torrentCount != visibleCount)
    851             g_snprintf (countStr, sizeof (countStr),
    852                         ngettext ("%1$'d of %2$'d Torrent",
    853                                   "%1$'d of %2$'d Torrents",
    854                                   torrentCount),
    855                         visibleCount, torrentCount);
    856           else
    857             g_snprintf (countStr, sizeof (countStr),
    858                         ngettext ("%'d Torrent", "%'d Torrents", torrentCount),
    859                         torrentCount);
    860 
    861           gtr_label_set_text (p->count_lb, countStr);
    862         }
    863     }
    864 
    865   gtk_widget_set_visible (GTK_WIDGET(p->count_lb), visible);
    866 }
    867 
    868 static void
    869825updateFreeSpace (PrivateData * p)
    870826{
     
    888844          char * tip;
    889845          char sizeStr[32];
     846
    890847          tr_strlsize (sizeStr, n, sizeof(sizeStr));
    891848          gtk_label_set_text (p->freespace_lb, sizeStr);
     849
    892850          tip = tr_strdup_printf (_("Download folder \"%1$s\" has %2$s free"), downloadDir, sizeStr);
    893851          gtk_widget_set_tooltip_text (w, tip);
     
    990948    {
    991949      updateSpeeds (p);
    992       updateTorrentCount (p);
    993950      updateStats (p);
    994951      updateFreeSpace (p);
Note: See TracChangeset for help on using the changeset viewer.