Changeset 10383


Ignore:
Timestamp:
Mar 15, 2010, 2:42:43 PM (12 years ago)
Author:
charles
Message:

(trunk, gtk) rename the slightly-pejorative "minimal view" as "compact view"

Location:
trunk/gtk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/gtk/actions.c

    r9989 r10383  
    9494{
    9595    { "alt-speed-enabled", NULL, N_( "Enable Temporary Speed _Limits" ), NULL, NULL, G_CALLBACK( toggle_pref_cb ), FALSE },
    96     { "minimal-view",      NULL, N_( "_Minimal View" ), "<alt>M", NULL, G_CALLBACK( toggle_pref_cb ), FALSE },
     96    { "compact-view",      NULL, N_( "_Compact View" ), "<alt>C", NULL, G_CALLBACK( toggle_pref_cb ), FALSE },
    9797    { "sort-reversed",     NULL, N_( "Re_verse Sort Order" ), NULL, NULL, G_CALLBACK( toggle_pref_cb ), FALSE },
    9898    { "show-filterbar",    NULL, N_( "_Filterbar" ), NULL, NULL, G_CALLBACK( toggle_pref_cb ), FALSE },
  • trunk/gtk/conf.c

    r10031 r10383  
    202202    tr_bencDictAddStr( d, PREF_KEY_SORT_MODE, "sort-by-name" );
    203203    tr_bencDictAddBool( d, PREF_KEY_SORT_REVERSED, FALSE );
    204     tr_bencDictAddBool( d, PREF_KEY_MINIMAL_VIEW, FALSE );
     204    tr_bencDictAddBool( d, PREF_KEY_COMPACT_VIEW, FALSE );
    205205
    206206    tr_bencDictAddBool( d, PREF_KEY_START, TRUE );
  • trunk/gtk/torrent-cell-renderer.c

    r10289 r10383  
    3030    P_DOWNLOAD_SPEED,
    3131    P_BAR_HEIGHT,
    32     P_MINIMAL
     32    P_COMPACT
    3333};
    3434
    3535#define DEFAULT_BAR_HEIGHT 12
    3636#define SMALL_SCALE 0.9
    37 #define MINIMAL_ICON_SIZE GTK_ICON_SIZE_MENU
     37#define COMPACT_ICON_SIZE GTK_ICON_SIZE_MENU
    3838#define FULL_ICON_SIZE GTK_ICON_SIZE_DND
    3939
     
    315315    double download_speed;
    316316
    317     gboolean minimal;
     317    gboolean compact;
    318318};
    319319
     
    351351
    352352static void
    353 get_size_minimal( TorrentCellRenderer * cell,
     353get_size_compact( TorrentCellRenderer * cell,
    354354                  GtkWidget           * widget,
    355355                  gint                * width,
     
    369369    const tr_stat * st = tr_torrentStatCached( (tr_torrent*)tor );
    370370
    371     icon = get_icon( tor, MINIMAL_ICON_SIZE, widget );
     371    icon = get_icon( tor, COMPACT_ICON_SIZE, widget );
    372372    name = tr_torrentInfo( tor )->name;
    373373    status = getShortStatusString( tor, st, p->upload_speed, p->download_speed );
     
    392392    **/
    393393
     394#define BAR_WIDTH 50
    394395    if( width != NULL )
    395         *width = cell->parent.xpad * 2 + icon_area.width + GUI_PAD + name_area.width + GUI_PAD + stat_area.width;
     396        *width = cell->parent.xpad * 2 + icon_area.width + GUI_PAD + name_area.width + GUI_PAD + BAR_WIDTH + GUI_PAD + stat_area.width;
    396397    if( height != NULL )
    397         *height = cell->parent.ypad * 2 + name_area.height + p->bar_height;
     398        *height = cell->parent.ypad * 2 + MAX( name_area.height, p->bar_height );
    398399
    399400    /* cleanup */
     
    482483        int w, h;
    483484
    484         if( p->minimal )
    485             get_size_minimal( TORRENT_CELL_RENDERER( cell ), widget, &w, &h );
     485        if( p->compact )
     486            get_size_compact( TORRENT_CELL_RENDERER( cell ), widget, &w, &h );
    486487        else
    487488            get_size_full( TORRENT_CELL_RENDERER( cell ), widget, &w, &h );
     
    504505
    505506static void
    506 render_minimal( TorrentCellRenderer   * cell,
     507render_compact( TorrentCellRenderer   * cell,
    507508                GdkDrawable           * window,
    508509                GtkWidget             * widget,
     
    530531    const gboolean sensitive = active || st->error;
    531532
    532     icon = get_icon( tor, MINIMAL_ICON_SIZE, widget );
     533    icon = get_icon( tor, COMPACT_ICON_SIZE, widget );
    533534    name = tr_torrentInfo( tor )->name;
    534535    status = getShortStatusString( tor, st, p->upload_speed, p->download_speed );
     
    548549    stat_area.width = w;
    549550    stat_area.height = h;
     551    prog_area.height = p->bar_height;
     552
     553    h = 1;
     554    h = MAX( h, stat_area.height );
     555    h = MAX( h, name_area.height );
     556    h = MAX( h, icon_area.height );
     557    h = MAX( h, prog_area.height );
    550558
    551559    /**
     
    561569    /* icon */
    562570    icon_area.x = fill_area.x;
    563     icon_area.y = fill_area.y + ( fill_area.height - icon_area.height ) / 2;
     571    icon_area.y = fill_area.y;
     572    icon_area.height = h;
     573
     574    /* progressbar */
     575    prog_area.x = fill_area.x + fill_area.width - BAR_WIDTH;
     576    prog_area.y = fill_area.y;
     577    prog_area.width = BAR_WIDTH;
     578    prog_area.height = h;
    564579
    565580    /* short status (right justified) */
    566     stat_area.x = fill_area.x + fill_area.width - stat_area.width;
    567     stat_area.y = fill_area.y + ( name_area.height - stat_area.height ) / 2;
     581    stat_area.x = prog_area.x - GUI_PAD - stat_area.width;
     582    stat_area.y = fill_area.y + ( h - stat_area.height ) / 2;
    568583
    569584    /* name */
    570585    name_area.x = icon_area.x + icon_area.width + GUI_PAD;
    571     name_area.y = fill_area.y;
     586    name_area.y = fill_area.y + ( h - name_area.height ) / 2;
    572587    name_area.width = stat_area.x - GUI_PAD - name_area.x;
    573 
    574     /* progressbar */
    575     prog_area.x = name_area.x;
    576     prog_area.y = name_area.y + name_area.height;
    577     prog_area.width = name_area.width + GUI_PAD + stat_area.width;
    578     prog_area.height = p->bar_height;
    579588
    580589    /**
     
    584593    g_object_set( p->icon_renderer, "pixbuf", icon, "sensitive", sensitive, NULL );
    585594    gtk_cell_renderer_render( p->icon_renderer, window, widget, &icon_area, &icon_area, &icon_area, flags );
     595    g_object_set( p->progress_renderer, "value", (int)(percentDone*100.0), "text", NULL, "sensitive", sensitive, NULL );
     596    gtk_cell_renderer_render( p->progress_renderer, window, widget, &prog_area, &prog_area, &prog_area, flags );
    586597    g_object_set( text_renderer, "text", status, "scale", SMALL_SCALE, "sensitive", sensitive, "ellipsize", PANGO_ELLIPSIZE_END, NULL );
    587598    gtk_cell_renderer_render( text_renderer, window, widget, &stat_area, &stat_area, &stat_area, flags );
    588599    g_object_set( text_renderer, "text", name, "scale", 1.0, NULL );
    589600    gtk_cell_renderer_render( text_renderer, window, widget, &name_area, &name_area, &name_area, flags );
    590     g_object_set( p->progress_renderer, "value", (int)(percentDone*100.0), "text", "", "sensitive", sensitive, NULL );
    591     gtk_cell_renderer_render( p->progress_renderer, window, widget, &prog_area, &prog_area, &prog_area, flags );
    592601
    593602    /* cleanup */
     
    725734    {
    726735        struct TorrentCellRendererPrivate * p = self->priv;
    727         if( p->minimal )
    728             render_minimal( self, window, widget, background_area, cell_area, expose_area, flags );
     736        if( p->compact )
     737            render_compact( self, window, widget, background_area, cell_area, expose_area, flags );
    729738        else
    730739            render_full( self, window, widget, background_area, cell_area, expose_area, flags );
     
    751760        case P_DOWNLOAD_SPEED: p->download_speed = g_value_get_double( v ); break;
    752761        case P_BAR_HEIGHT:     p->bar_height     = g_value_get_int( v ); break;
    753         case P_MINIMAL:        p->minimal        = g_value_get_boolean( v ); break;
     762        case P_COMPACT:        p->compact        = g_value_get_boolean( v ); break;
    754763        default: G_OBJECT_WARN_INVALID_PROPERTY_ID( object, property_id, pspec ); break;
    755764    }
     
    771780        case P_DOWNLOAD_SPEED: g_value_set_double( v, p->download_speed ); break;
    772781        case P_BAR_HEIGHT:     g_value_set_int( v, p->bar_height ); break;
    773         case P_MINIMAL:        g_value_set_boolean( v, p->minimal ); break;
     782        case P_COMPACT:        g_value_set_boolean( v, p->compact ); break;
    774783        default: G_OBJECT_WARN_INVALID_PROPERTY_ID( object, property_id, pspec ); break;
    775784    }
     
    836845                                                      G_PARAM_READWRITE ) );
    837846
    838     g_object_class_install_property( gobject_class, P_MINIMAL,
    839                                     g_param_spec_boolean( "minimal", NULL,
    840                                                           "Minimal Mode",
     847    g_object_class_install_property( gobject_class, P_COMPACT,
     848                                    g_param_spec_boolean( "compact", NULL,
     849                                                          "Compact Mode",
    841850                                                          FALSE,
    842851                                                          G_PARAM_READWRITE ) );
  • trunk/gtk/tr-prefs.h

    r10081 r10383  
    4040#define PREF_KEY_SORT_REVERSED                     "sort-reversed"
    4141#define PREF_KEY_FILTER_MODE                       "filter-mode"
    42 #define PREF_KEY_MINIMAL_VIEW                      "minimal-view"
     42#define PREF_KEY_COMPACT_VIEW                      "compact-view"
    4343#define PREF_KEY_FILTERBAR                         "show-filterbar"
    4444#define PREF_KEY_STATUSBAR                         "show-statusbar"
  • trunk/gtk/tr-window.c

    r10380 r10383  
    178178    PrivateData * p = get_private_data( GTK_WINDOW( wind ) );
    179179
    180     if( !strcmp( key, PREF_KEY_MINIMAL_VIEW ) )
    181     {
    182         g_object_set( p->renderer, "minimal", pref_flag_get( key ), NULL );
     180    if( !strcmp( key, PREF_KEY_COMPACT_VIEW ) )
     181    {
     182        g_object_set( p->renderer, "compact", pref_flag_get( key ), NULL );
    183183        /* since the cell size has changed, we need gtktreeview to revalidate
    184184         * its fixed-height mode values.  Unfortunately there's not an API call
     
    749749    /* listen for prefs changes that affect the window */
    750750    p->core = core;
    751     prefsChanged( core, PREF_KEY_MINIMAL_VIEW, self );
     751    prefsChanged( core, PREF_KEY_COMPACT_VIEW, self );
    752752    prefsChanged( core, PREF_KEY_FILTERBAR, self );
    753753    prefsChanged( core, PREF_KEY_STATUSBAR, self );
  • trunk/gtk/ui.h

    r9930 r10383  
    3434    "    </menu>\n"
    3535    "    <menu action='view-menu'>\n"
    36     "      <menuitem action='minimal-view'/>\n"
     36    "      <menuitem action='compact-view'/>\n"
    3737    "      <separator/>\n"
    3838    "      <menuitem action='show-toolbar'/>\n"
Note: See TracChangeset for help on using the changeset viewer.