Changeset 9528


Ignore:
Timestamp:
Nov 18, 2009, 6:21:01 AM (13 years ago)
Author:
charles
Message:

(trunk gtk) #2587: speed display isn't the same in the main window and in the system tray icon's tooltip

Location:
trunk/gtk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/gtk/main.c

    r9439 r9528  
    11521152
    11531153        /* update the main window's statusbar and toolbar buttons */
    1154         if( data->wind )
     1154        if( data->wind != NULL )
    11551155            tr_window_update( data->wind );
    11561156
    11571157        /* update the actions */
    11581158        refreshActions( data );
     1159
     1160        /* update the status tray icon */
     1161        if( data->icon != NULL )
     1162            tr_icon_refresh( data->icon );
    11591163    }
    11601164
  • trunk/gtk/tr-icon.c

    r8889 r9528  
    2525}
    2626
     27void
     28tr_icon_refresh( gpointer vicon UNUSED )
     29{
     30}
     31
    2732#else
    28 
    29 #define UPDATE_INTERVAL_SECONDS 2
    3033
    3134static void
     
    4952}
    5053
    51 static gboolean
    52 refresh_tooltip_cb( gpointer data )
     54void
     55tr_icon_refresh( gpointer vicon )
    5356{
    5457    double d;
     
    6063    char tip[1024];
    6164    const char * idle = _( "Idle" );
    62     GtkStatusIcon * icon = GTK_STATUS_ICON( data );
     65    GtkStatusIcon * icon = GTK_STATUS_ICON( vicon );
    6366    tr_session * session = tr_core_session( g_object_get_data( G_OBJECT( icon ), "tr-core" ) );
    6467
     
    104107    gtk_status_icon_set_tooltip( GTK_STATUS_ICON( icon ), tip );
    105108#endif
    106 
    107     return TRUE;
    108 }
    109 
    110 static void
    111 closeTag( gpointer tag )
    112 {
    113     g_source_remove( GPOINTER_TO_UINT( tag ) );
    114109}
    115110
     
    117112tr_icon_new( TrCore * core )
    118113{
    119     guint           id;
    120114    GtkStatusIcon * icon = gtk_status_icon_new_from_icon_name(
    121115        "transmission" );
     
    123117    g_signal_connect( icon, "activate", G_CALLBACK( activated ), NULL );
    124118    g_signal_connect( icon, "popup-menu", G_CALLBACK( popup ), NULL );
    125     id = gtr_timeout_add_seconds( UPDATE_INTERVAL_SECONDS, refresh_tooltip_cb, icon );
    126119    g_object_set_data( G_OBJECT( icon ), "tr-core", core );
    127     g_object_set_data_full( G_OBJECT(
    128                                 icon ), "update-tag", GUINT_TO_POINTER(
    129                                 id ), closeTag );
    130120    return icon;
    131121}
  • trunk/gtk/tr-icon.h

    r8637 r9528  
    2323gpointer tr_icon_new( TrCore * core );
    2424
     25void tr_icon_refresh( gpointer );
     26
    2527#endif
Note: See TracChangeset for help on using the changeset viewer.