Changeset 12400
- Timestamp:
- Apr 29, 2011, 9:36:44 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gtk/details.c
r12356 r12400 29 29 #include "util.h" 30 30 31 #define DETAILS_KEY "details-data" 31 static GQuark ARG_KEY = 0; 32 static GQuark DETAILS_KEY = 0; 33 static GQuark TORRENT_ID_KEY = 0; 34 static GQuark TEXT_BUFFER_KEY = 0; 35 static GQuark URL_ENTRY_KEY = 0; 32 36 33 37 struct DetailsImpl … … 430 434 static void refresh( struct DetailsImpl * di ); 431 435 432 #define ARG_KEY "arg-key"433 434 436 static void 435 437 onComboEnumChanged( GtkComboBox * combo_box, struct DetailsImpl * di ) 436 438 { 437 const char * key = g_object_get_ data( G_OBJECT( combo_box ), ARG_KEY );439 const char * key = g_object_get_qdata( G_OBJECT( combo_box ), ARG_KEY ); 438 440 torrent_set_int( di, key, gtr_combo_box_get_active_enum( combo_box ) ); 439 441 refresh( di ); … … 448 450 _( "Stop seeding at ratio:" ), TR_RATIOLIMIT_SINGLE, 449 451 NULL ); 450 g_object_set_ data_full( G_OBJECT( w ), ARG_KEY, g_strdup( "seedRatioMode" ), g_free);452 g_object_set_qdata( G_OBJECT( w ), ARG_KEY, (gpointer)"seedRatioMode" ); 451 453 return w; 452 454 } … … 460 462 _( "Stop seeding if idle for N minutes:" ), TR_IDLELIMIT_SINGLE, 461 463 NULL ); 462 g_object_set_ data_full( G_OBJECT( w ), ARG_KEY, g_strdup( "seedIdleMode" ), g_free);464 g_object_set_qdata( G_OBJECT( w ), ARG_KEY, (gpointer)"seedIdleMode" ); 463 465 return w; 464 466 } … … 2112 2114 int tier; 2113 2115 GtkTextIter start, end; 2114 const int torrent_id = GPOINTER_TO_INT( g_object_get_ data( G_OBJECT( dialog ), "torrent-id") );2115 GtkTextBuffer * text_buffer = g_object_get_ data( G_OBJECT( dialog ), "text-buffer");2116 const int torrent_id = GPOINTER_TO_INT( g_object_get_qdata( G_OBJECT( dialog ), TORRENT_ID_KEY ) ); 2117 GtkTextBuffer * text_buffer = g_object_get_qdata( G_OBJECT( dialog ), TEXT_BUFFER_KEY ); 2116 2118 tr_torrent * tor = gtr_core_find_torrent( di->core, torrent_id ); 2117 2119 … … 2237 2239 gtr_dialog_set_content( GTK_DIALOG( d ), t ); 2238 2240 2239 g_object_set_ data( G_OBJECT( d ), "torrent-id", GINT_TO_POINTER( torrent_id ) );2240 g_object_set_ data( G_OBJECT( d ), "text-buffer", gtk_text_view_get_buffer( GTK_TEXT_VIEW( w ) ) );2241 g_object_set_qdata( G_OBJECT( d ), TORRENT_ID_KEY, GINT_TO_POINTER( torrent_id ) ); 2242 g_object_set_qdata( G_OBJECT( d ), TEXT_BUFFER_KEY, gtk_text_view_get_buffer( GTK_TEXT_VIEW( w ) ) ); 2241 2243 gtk_widget_show( d ); 2242 2244 } … … 2263 2265 { 2264 2266 struct DetailsImpl * di = gdi; 2265 GtkWidget * e = GTK_WIDGET( g_object_get_ data( G_OBJECT( dialog ), "url-entry") );2266 const int torrent_id = GPOINTER_TO_INT( g_object_get_ data( G_OBJECT( dialog ), "torrent-id") );2267 GtkWidget * e = GTK_WIDGET( g_object_get_qdata( G_OBJECT( dialog ), URL_ENTRY_KEY ) ); 2268 const int torrent_id = GPOINTER_TO_INT( g_object_get_qdata( G_OBJECT( dialog ), TORRENT_ID_KEY ) ); 2267 2269 char * url = g_strdup( gtk_entry_get_text( GTK_ENTRY( e ) ) ); 2268 2270 g_strstrip( url ); … … 2329 2331 gtk_widget_set_size_request( e, 400, -1 ); 2330 2332 gtr_paste_clipboard_url_into_entry( e ); 2331 g_object_set_ data( G_OBJECT( w ), "url-entry", e );2332 g_object_set_ data( G_OBJECT( w ), "torrent-id", GINT_TO_POINTER( tr_torrentId( tor ) ) );2333 g_object_set_qdata( G_OBJECT( w ), URL_ENTRY_KEY, e ); 2334 g_object_set_qdata( G_OBJECT( w ), TORRENT_ID_KEY, GINT_TO_POINTER( tr_torrentId( tor ) ) ); 2333 2335 hig_workarea_add_row( t, &row, _( "_Announce URL:" ), e, NULL ); 2334 2336 gtr_dialog_set_content( GTK_DIALOG( w ), t ); … … 2515 2517 struct DetailsImpl * di = g_new0( struct DetailsImpl, 1 ); 2516 2518 2519 /* one-time setup */ 2520 if( ARG_KEY == 0 ) 2521 { 2522 ARG_KEY = g_quark_from_static_string( "tr-arg-key" ); 2523 DETAILS_KEY = g_quark_from_static_string( "tr-details-data-key" ); 2524 TORRENT_ID_KEY = g_quark_from_static_string( "tr-torrent-id-key" ); 2525 TEXT_BUFFER_KEY = g_quark_from_static_string( "tr-text-buffer-key" ); 2526 URL_ENTRY_KEY = g_quark_from_static_string( "tr-url-entry-key" ); 2527 } 2528 2517 2529 /* create the dialog */ 2518 2530 di->core = core; … … 2526 2538 G_CALLBACK( gtk_widget_destroy ), d ); 2527 2539 gtk_container_set_border_width( GTK_CONTAINER( d ), GUI_PAD ); 2528 g_object_set_ data_full( G_OBJECT( d ), DETAILS_KEY, di, details_free );2540 g_object_set_qdata_full( G_OBJECT( d ), DETAILS_KEY, di, details_free ); 2529 2541 2530 2542 n = gtk_notebook_new( ); … … 2567 2579 char title[256]; 2568 2580 const int len = g_slist_length( ids ); 2569 struct DetailsImpl * di = g_object_get_ data( G_OBJECT( w ), DETAILS_KEY );2581 struct DetailsImpl * di = g_object_get_qdata( G_OBJECT( w ), DETAILS_KEY ); 2570 2582 2571 2583 g_slist_free( di->ids );
Note: See TracChangeset
for help on using the changeset viewer.