Changeset 5536
- Timestamp:
- Apr 6, 2008, 2:07:41 PM (14 years ago)
- Location:
- trunk/gtk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gtk/actions.c
r5496 r5536 48 48 { "sort-by-name", NULL, N_("Sort by _Name"), NULL, NULL, 1 }, 49 49 { "sort-by-progress", NULL, N_("Sort by _Progress"), NULL, NULL, 2 }, 50 { "sort-by-state", NULL, N_("Sort by _State"), NULL, NULL, 3 }, 51 { "sort-by-tracker", NULL, N_("Sort by _Tracker"), NULL, NULL, 4 } 50 { "sort-by-ratio", NULL, N_("Sort by _Ratio"), NULL, NULL, 3 }, 51 { "sort-by-state", NULL, N_("Sort by _State"), NULL, NULL, 4 }, 52 { "sort-by-tracker", NULL, N_("Sort by _Tracker"), NULL, NULL, 5 } 52 53 }; 53 54 -
trunk/gtk/makemeta-ui.c
r5455 r5536 115 115 116 116 case TR_MAKEMETA_IO_WRITE: { 117 char * tmp = g_strdup_printf( _( "Couldn't write \"%s\": %s" ), ui->builder->errfile, g_strerror( ui->builder->my_errno ) );117 char * tmp = g_strdup_printf( _( "Couldn't create \"%1$s\": %2$s" ), ui->builder->errfile, g_strerror( ui->builder->my_errno ) ); 118 118 txt = g_strdup_printf( _( "Torrent creation failed: %s" ), tmp ); 119 119 g_free( tmp ); -
trunk/gtk/tr-core.c
r5517 r5536 168 168 169 169 static int 170 compareRatio( double a, double b ) 171 { 172 if( (int)a == TR_RATIO_INF && (int)b == TR_RATIO_INF ) return 0; 173 if( (int)a == TR_RATIO_INF ) return 1; 174 if( (int)b == TR_RATIO_INF ) return -1; 175 return compareDouble( a, b ); 176 } 177 178 static int 179 compareByRatio( GtkTreeModel * model, 180 GtkTreeIter * a, 181 GtkTreeIter * b, 182 gpointer user_data UNUSED ) 183 { 184 tr_torrent *ta, *tb; 185 const tr_stat *sa, *sb; 186 187 gtk_tree_model_get( model, a, MC_TORRENT_RAW, &ta, -1 ); 188 gtk_tree_model_get( model, b, MC_TORRENT_RAW, &tb, -1 ); 189 190 sa = tr_torrentStatCached( ta ); 191 sb = tr_torrentStatCached( tb ); 192 193 return compareRatio( sa->ratio, sb->ratio ); 194 } 195 196 static int 170 197 compareByActivity( GtkTreeModel * model, 171 198 GtkTreeIter * a, … … 224 251 ret = compareDouble( sa->percentDone, sb->percentDone ); 225 252 if( !ret ) 226 ret = compare Double( sa->ratio, sb->ratio );253 ret = compareRatio( sa->ratio, sb->ratio ); 227 254 return ret; 228 255 } … … 264 291 setSort( TrCore * core, const char * mode, gboolean isReversed ) 265 292 { 266 int col = MC_TORRENT_RAW; 293 const int col = MC_TORRENT_RAW; 294 GtkTreeIterCompareFunc sort_func; 267 295 GtkSortType type = isReversed ? GTK_SORT_ASCENDING : GTK_SORT_DESCENDING; 268 GtkTreeModel * model = tr_core_model( core ); 269 GtkTreeSortable * sortable = GTK_TREE_SORTABLE( model ); 296 GtkTreeSortable * sortable = GTK_TREE_SORTABLE( tr_core_model( core ) ); 270 297 271 298 if( !strcmp( mode, "sort-by-activity" ) ) 272 gtk_tree_sortable_set_sort_func( sortable, col, compareByActivity, NULL, NULL );299 sort_func = compareByActivity; 273 300 else if( !strcmp( mode, "sort-by-progress" ) ) 274 gtk_tree_sortable_set_sort_func( sortable, col, compareByProgress, NULL, NULL ); 301 sort_func = compareByProgress; 302 else if( !strcmp( mode, "sort-by-ratio" ) ) 303 sort_func = compareByRatio; 275 304 else if( !strcmp( mode, "sort-by-state" ) ) 276 gtk_tree_sortable_set_sort_func( sortable, col, compareByState, NULL, NULL );305 sort_func = compareByState; 277 306 else if( !strcmp( mode, "sort-by-tracker" ) ) 278 gtk_tree_sortable_set_sort_func( sortable, col, compareByTracker, NULL, NULL );307 sort_func = compareByTracker; 279 308 else { 309 sort_func = compareByName; 280 310 type = isReversed ? GTK_SORT_DESCENDING : GTK_SORT_ASCENDING; 281 gtk_tree_sortable_set_sort_func( sortable, col, compareByName, NULL, NULL );282 }283 311 } 312 313 gtk_tree_sortable_set_sort_func( sortable, col, sort_func, NULL, NULL ); 284 314 gtk_tree_sortable_set_sort_column_id( sortable, col, type ); 285 315 } -
trunk/gtk/tr-prefs.c
r5496 r5536 462 462 hig_workarea_add_wide_control( t, &row, h ); 463 463 464 s = _(" Ignore _unencrypted peers");464 s = _("_Ignore unencrypted peers"); 465 465 w = new_check_button( s, PREF_KEY_ENCRYPTED_ONLY, core ); 466 466 hig_workarea_add_wide_control( t, &row, w ); -
trunk/gtk/ui.h
r5496 r5536 33 33 " <menuitem action='sort-by-name'/>\n" 34 34 " <menuitem action='sort-by-progress'/>\n" 35 " <menuitem action='sort-by-ratio'/>\n" 35 36 " <menuitem action='sort-by-state'/>\n" 36 37 " <menuitem action='sort-by-tracker'/>\n"
Note: See TracChangeset
for help on using the changeset viewer.