Changeset 10382
Legend:
- Unmodified
- Added
- Removed
-
trunk/gtk/favicon.c
r10380 r10382 11 11 */ 12 12 13 #include <glib/gstdio.h> /* g_remove */13 #include <glib/gstdio.h> /* g_remove() */ 14 14 #include <gtk/gtk.h> 15 15 16 16 #include <libtransmission/transmission.h> 17 #include <libtransmission/web.h> /* tr_webRun */17 #include <libtransmission/web.h> /* tr_webRun() */ 18 18 19 19 #include "favicon.h" … … 36 36 if( dir == NULL ) 37 37 { 38 dir = g_build_filename( g_get_user_cache_dir(), "transmission", "favicons", NULL ); 38 dir = g_build_filename( g_get_user_cache_dir(), 39 "transmission", 40 "favicons", 41 NULL ); 39 42 gtr_mkdir_with_parents( dir, 0777 ); 40 43 } … … 64 67 if( len > 0 ) 65 68 { 66 GInputStream * i nput_stream= g_memory_input_stream_new_from_data( data, len, NULL );67 pixbuf = gdk_pixbuf_new_from_stream_at_scale( i nput_stream, 16, 16, TRUE, NULL, NULL );68 g_object_unref( i nput_stream);69 GInputStream * i = g_memory_input_stream_new_from_data( data, len, NULL ); 70 pixbuf = gdk_pixbuf_new_from_stream_at_scale( i, 16, 16, TRUE, NULL, NULL ); 71 g_object_unref( i ); 69 72 } 70 73 … … 124 127 125 128 void 126 gtr_get_favicon( tr_session * session,127 const char * host,128 GFunc pixbuf_ready_func,129 gpointer pixbuf_ready_func_data )129 gtr_get_favicon( tr_session * session, 130 const char * host, 131 GFunc pixbuf_ready_func, 132 gpointer pixbuf_ready_func_data ) 130 133 { 131 134 GdkPixbuf * pixbuf = favicon_load_from_file( host ); -
trunk/gtk/filter.c
r10381 r10382 17 17 #include <libtransmission/utils.h> 18 18 19 #include "favicon.h" 19 #include "favicon.h" /* gtr_get_favicon() */ 20 20 #include "filter.h" 21 21 #include "hig.h" /* GUI_PAD */ 22 #include "tr-core.h" 22 #include "tr-core.h" /* MC_TORRENT_RAW */ 23 23 #include "util.h" /* gtr_idle_add() */ 24 24 25 #define DIRTY_KEY "tr-filter-dirty "25 #define DIRTY_KEY "tr-filter-dirty-key" 26 26 #define SESSION_KEY "tr-session-key" 27 #define TEXT_KEY "tr-filter-text "28 #define TEXT_MODE_KEY "tr-filter-text-mode "27 #define TEXT_KEY "tr-filter-text-key" 28 #define TEXT_MODE_KEY "tr-filter-text-mode-key" 29 29 #define TORRENT_MODEL_KEY "tr-filter-torrent-model-key" 30 30 … … 72 72 } 73 73 74 /* pattern-matching text; ie, legaltorrents.com */ 74 75 static char* 75 76 get_host_from_url( const char * url ) … … 93 94 } 94 95 96 /* human-readable name; ie, Legaltorrents */ 95 97 static char* 96 98 get_name_from_host( const char * host ) … … 131 133 132 134 if( gtk_tree_model_get_iter( model, &iter, path ) ) 133 gtk_tree_store_set( GTK_TREE_STORE( model ), &iter, CAT_FILTER_COL_PIXBUF, pixbuf, -1 ); 135 gtk_tree_store_set( GTK_TREE_STORE( model ), &iter, 136 CAT_FILTER_COL_PIXBUF, pixbuf, 137 -1 ); 134 138 135 139 gtk_tree_path_free( path ); … … 156 160 GtkTreeModel * model = GTK_TREE_MODEL( store ); 157 161 GPtrArray * hosts = g_ptr_array_new( ); 158 GHashTable * hosts_hash = g_hash_table_new_full( g_str_hash, g_str_equal, g_free, g_free ); 162 GHashTable * hosts_hash = g_hash_table_new_full( g_str_hash, g_str_equal, 163 g_free, g_free ); 159 164 GObject * o = G_OBJECT( store ); 160 165 GtkTreeModel * tmodel = GTK_TREE_MODEL( … … 229 234 category_model_update_count( store, &iter, all ); 230 235 231 /* update the "public" count*/236 /* update the "public" subtree */ 232 237 gtk_tree_model_iter_nth_child( model, &parent, NULL, 2 ); 233 238 gtk_tree_model_iter_nth_child( model, &iter, &parent, 0 ); … … 247 252 /* update the "hosts" subtree */ 248 253 gtk_tree_model_iter_nth_child( model, &parent, NULL, 4 ); 249 i = 0; 250 n = hosts->len; 251 store_pos = 0; 252 for( ;; ) 254 for( i=store_pos=0, n=hosts->len ; ; ) 253 255 { 254 256 const gboolean new_hosts_done = i >= n; … … 391 393 392 394 static gboolean 393 is_it_a_separator( GtkTreeModel * m odel, GtkTreeIter * iter, gpointer data UNUSED )395 is_it_a_separator( GtkTreeModel * m, GtkTreeIter * iter, gpointer data UNUSED ) 394 396 { 395 397 int type; 396 gtk_tree_model_get( m odel, iter, CAT_FILTER_COL_TYPE, &type, -1 );398 gtk_tree_model_get( m, iter, CAT_FILTER_COL_TYPE, &type, -1 ); 397 399 return type == CAT_FILTER_TYPE_SEPARATOR; 398 400 } … … 402 404 { 403 405 GObject * o = G_OBJECT( category_model ); 404 gboolean pending = GPOINTER_TO_INT( g_object_get_data( o, DIRTY_KEY ) );406 const gboolean pending = g_object_get_data( o, DIRTY_KEY ) != NULL; 405 407 if( !pending ) 406 408 { … … 440 442 } 441 443 static void 442 render_ hit_count_func( GtkCellLayout * cell_layout UNUSED,443 444 445 446 444 render_number_func( GtkCellLayout * cell_layout UNUSED, 445 GtkCellRenderer * cell_renderer, 446 GtkTreeModel * tree_model, 447 GtkTreeIter * iter, 448 gpointer data UNUSED ) 447 449 { 448 450 int count; … … 503 505 r = number_renderer_new( ); 504 506 gtk_cell_layout_pack_end( GTK_CELL_LAYOUT( c ), r, TRUE ); 505 gtk_cell_layout_set_cell_data_func( GTK_CELL_LAYOUT( c ), r, render_ hit_count_func, NULL, NULL );507 gtk_cell_layout_set_cell_data_func( GTK_CELL_LAYOUT( c ), r, render_number_func, NULL, NULL ); 506 508 507 509 g_signal_connect( tmodel, "row-changed", … … 514 516 return c; 515 517 } 516 517 /***518 ****519 ***/520 518 521 519 static gboolean … … 627 625 case STATE_FILTER_ACTIVE: 628 626 return ( st->peersSendingToUs > 0 ) 629 || ( st->peersGettingFromUs > 0 ) ;627 || ( st->peersGettingFromUs > 0 ) 630 628 || ( st->activity == TR_STATUS_CHECK ); 631 629 … … 668 666 { 669 667 int count; 670 gtk_tree_model_get( GTK_TREE_MODEL( store ), iter, STATE_FILTER_COL_COUNT, &count, -1 ); 668 GtkTreeModel * model = GTK_TREE_MODEL( store ); 669 gtk_tree_model_get( model, iter, STATE_FILTER_COL_COUNT, &count, -1 ); 671 670 if( n != count ) 672 671 gtk_list_store_set( store, iter, STATE_FILTER_COL_COUNT, n, -1 ); … … 719 718 { STATE_FILTER_PAUSED, N_( "Paused" ) }, 720 719 { STATE_FILTER_QUEUED, N_( "Queued" ) }, 721 { STATE_FILTER_ CHECKING, N_( "Verifying" ) },720 { STATE_FILTER_VERIFYING, N_( "Verifying" ) }, 722 721 { STATE_FILTER_ERROR, N_( "Error" ) } 723 722 }; 724 723 GtkListStore * store; 725 724 726 store = gtk_list_store_new( STATE_FILTER_N_COLS, G_TYPE_STRING, G_TYPE_INT, G_TYPE_INT ); 725 store = gtk_list_store_new( STATE_FILTER_N_COLS, 726 G_TYPE_STRING, 727 G_TYPE_INT, 728 G_TYPE_INT ); 727 729 for( i=0, n=G_N_ELEMENTS(types); i<n; ++i ) 728 730 gtk_list_store_insert_with_values( store, NULL, -1, … … 740 742 { 741 743 GObject * o = G_OBJECT( state_model ); 742 gboolean pending = GPOINTER_TO_INT( g_object_get_data( o, DIRTY_KEY ) );744 const gboolean pending = g_object_get_data( o, DIRTY_KEY ) != NULL; 743 745 if( !pending ) 744 746 { … … 785 787 r = number_renderer_new( ); 786 788 gtk_cell_layout_pack_end( GTK_CELL_LAYOUT( c ), r, TRUE ); 787 gtk_cell_layout_set_cell_data_func( GTK_CELL_LAYOUT( c ), r, render_ hit_count_func, NULL, NULL );789 gtk_cell_layout_set_cell_data_func( GTK_CELL_LAYOUT( c ), r, render_number_func, NULL, NULL ); 788 790 789 791 g_signal_connect( tmodel, "row-changed", … … 971 973 g_object_set_data( G_OBJECT( gtk_combo_box_get_model( GTK_COMBO_BOX( data->category ) ) ), SESSION_KEY, session ); 972 974 973 gtk_tree_model_filter_set_visible_func( GTK_TREE_MODEL_FILTER( data->filter_model ), 974 is_row_visible, data, g_free ); 975 gtk_tree_model_filter_set_visible_func( 976 GTK_TREE_MODEL_FILTER( data->filter_model ), 977 is_row_visible, data, g_free ); 975 978 976 979 g_signal_connect( data->category, "changed", G_CALLBACK( selection_changed_cb ), data );
Note: See TracChangeset
for help on using the changeset viewer.