Changeset 5050


Ignore:
Timestamp:
Feb 16, 2008, 7:36:07 PM (14 years ago)
Author:
charles
Message:

(gtk) #703: fix right-to-left locale issues in the details dialog

Location:
trunk/gtk
Files:
2 edited

Legend:

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

    r5048 r5050  
    2020#include "tr_torrent.h"
    2121#include "util.h"
     22
     23/* #define TEST_RTL */
    2224
    2325enum
     
    516518{
    517519    TorrentCellRenderer * self = TORRENT_CELL_RENDERER( cell );
     520
     521#ifdef TEST_RTL
     522    GtkTextDirection real_dir = gtk_widget_get_direction( widget );
     523    gtk_widget_set_direction( widget, GTK_TEXT_DIR_RTL );
     524#endif
     525
    518526    if( self && self->priv->tor )
    519527    {
     
    650658        }
    651659    }
     660
     661#ifdef TEST_RTL
     662    gtk_widget_set_direction( widget, real_dir );
     663#endif
    652664}
    653665
  • trunk/gtk/torrent-inspector.c

    r5036 r5050  
    6464
    6565static gboolean
    66 refresh_pieces (GtkWidget * da, GdkEventExpose * event UNUSED, gpointer gtor)
     66refresh_pieces( GtkWidget * da, GdkEventExpose * event UNUSED, gpointer gtor )
    6767{
    6868  tr_torrent * tor = tr_torrent_handle( TR_TORRENT(gtor) );
     
    8080  const int piece_w_int = (int) (piece_w + 1); /* pad for roundoff */
    8181  const int piece_h_int = (int) (piece_h + 1); /* pad for roundoff */
     82  const gboolean rtl = gtk_widget_get_direction( da ) == GTK_TEXT_DIR_RTL;
     83
    8284  guint8 * prev_color = NULL;
    8385  gboolean first_time = FALSE;
     
    158160  for (y=0; y<n_rows; ++y) {
    159161    for (x=0; x<n_cols; ++x) {
    160       const int draw_x = grid_bounds.x + (int)(x * piece_w);
    161       const int draw_y = grid_bounds.y + (int)(y * piece_h);
     162      int draw_x = grid_bounds.x + (int)(x * piece_w);
     163      int draw_y = grid_bounds.y + (int)(y * piece_h);
    162164      int color = BLACK;
    163165      int border = BLACK;
     166
     167      if( rtl )
     168          draw_x = grid_bounds.x + grid_bounds.width - (int)((x+1) * piece_w);
     169      else
     170          draw_x = grid_bounds.x + (int)(x * piece_w);
     171      draw_y = grid_bounds.y + (int)(y * piece_h);
    164172
    165173      if (i < n_cells)
Note: See TracChangeset for help on using the changeset viewer.