Changeset 11074


Ignore:
Timestamp:
Jul 31, 2010, 3:43:12 AM (12 years ago)
Author:
charles
Message:

(trunk gtk) simplify the compact mode rendering code a bit

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gtk/torrent-cell-renderer.c

    r10937 r11074  
    540540                GtkCellRendererState    flags )
    541541{
    542     int w, h;
    543542    GdkRectangle icon_area;
    544543    GdkRectangle name_area;
     
    562561    status = getShortStatusString( tor, st, p->upload_speed_KBps, p->download_speed_KBps );
    563562
    564     /* get the cell dimensions */
    565     g_object_set( p->icon_renderer, "pixbuf", icon, NULL );
    566     gtk_cell_renderer_get_size( p->icon_renderer, widget, NULL, NULL, NULL, &w, &h );
    567     icon_area.width = w;
    568     icon_area.height = h;
    569     text_renderer = get_text_renderer( st, cell );
    570     g_object_set( text_renderer, "text", name, "ellipsize", PANGO_ELLIPSIZE_NONE, "scale", 1.0, NULL );
    571     gtk_cell_renderer_get_size( text_renderer, widget, NULL, NULL, NULL, &w, &h );
    572     name_area.width = w;
    573     name_area.height = h;
    574     g_object_set( text_renderer, "text", status, "scale", SMALL_SCALE, NULL );
    575     gtk_cell_renderer_get_size( text_renderer, widget, NULL, NULL, NULL, &w, &h );
    576     stat_area.width = w;
    577     stat_area.height = h;
    578     prog_area.height = p->bar_height;
    579 
    580     h = 1;
    581     h = MAX( h, stat_area.height );
    582     h = MAX( h, name_area.height );
    583     h = MAX( h, icon_area.height );
    584     h = MAX( h, prog_area.height );
    585 
    586     /**
    587     *** LAYOUT
    588     **/
    589 
    590563    fill_area = *background_area;
    591564    fill_area.x += cell->parent.xpad;
     
    593566    fill_area.width -= cell->parent.xpad * 2;
    594567    fill_area.height -= cell->parent.ypad * 2;
    595 
    596     /* icon */
     568    icon_area = name_area = stat_area = prog_area = fill_area;
     569
     570    g_object_set( p->icon_renderer, "pixbuf", icon, NULL );
     571    gtk_cell_renderer_get_size( p->icon_renderer, widget, NULL, NULL, NULL, &icon_area.width, NULL );
     572    text_renderer = get_text_renderer( st, cell );
     573    g_object_set( text_renderer, "text", name, "ellipsize", PANGO_ELLIPSIZE_NONE, "scale", 1.0, NULL );
     574    gtk_cell_renderer_get_size( text_renderer, widget, NULL, NULL, NULL, &name_area.width, NULL );
     575    g_object_set( text_renderer, "text", status, "scale", SMALL_SCALE, NULL );
     576    gtk_cell_renderer_get_size( text_renderer, widget, NULL, NULL, NULL, &stat_area.width, NULL );
     577
    597578    icon_area.x = fill_area.x;
    598     icon_area.y = fill_area.y;
    599     icon_area.height = h;
    600 
    601     /* progressbar */
    602579    prog_area.x = fill_area.x + fill_area.width - BAR_WIDTH;
    603     prog_area.y = fill_area.y;
    604580    prog_area.width = BAR_WIDTH;
    605     prog_area.height = h;
    606 
    607     /* short status (right justified) */
    608581    stat_area.x = prog_area.x - GUI_PAD - stat_area.width;
    609     stat_area.y = fill_area.y + ( h - stat_area.height ) / 2;
    610 
    611     /* name */
    612582    name_area.x = icon_area.x + icon_area.width + GUI_PAD;
    613     name_area.y = fill_area.y + ( h - name_area.height ) / 2;
     583    name_area.y = fill_area.y;
    614584    name_area.width = stat_area.x - GUI_PAD - name_area.x;
    615585
Note: See TracChangeset for help on using the changeset viewer.