(trunk gtk) since we're bumping glib's requirement to 2.26 (27 Sept 2010), it's a good time to bump the gtk+ requirement to 2.22 (32 Sept 2010).

This commit is contained in:
Jordan Lee 2011-08-07 18:41:13 +00:00
parent 270126820a
commit 0e48418f26
14 changed files with 24 additions and 280 deletions

View File

@ -50,7 +50,7 @@ AC_SUBST(OPENSSL_MINIMUM)
## MANDATORY for the GTK+ client
##
##
GTK_MINIMUM=2.8.0
GTK_MINIMUM=2.22.0
AC_SUBST(GTK_MINIMUM)
GLIB_MINIMUM=2.26.0
AC_SUBST(GLIB_MINIMUM)
@ -240,7 +240,7 @@ dnl detection for the GTK+ client
PKG_CHECK_MODULES(GTK,
[gtk+-2.0 >= $GTK_MINIMUM
glib-2.0 >= $GLIB_MINIMUM
gio-2.0 >= $GIO_MINIMUM],
gio-2.0 >= $GIO_MINIMUM,
gmodule-2.0 >= $GLIB_MINIMUM
gthread-2.0 >= $GLIB_MINIMUM],
[have_gtk=yes],

View File

@ -40,10 +40,6 @@ action_cb( GtkAction * a, gpointer user_data )
gtr_actions_handler( gtk_action_get_name( a ), user_data );
}
#if !GTK_CHECK_VERSION( 2, 10, 0 )
#define GTK_STOCK_SELECT_ALL NULL
#endif
static GtkRadioActionEntry sort_radio_entries[] =
{
{ "sort-by-activity", NULL, N_( "Sort by _Activity" ), NULL, NULL, 0 },

View File

@ -1445,7 +1445,6 @@ refreshPeers( struct DetailsImpl * di, tr_torrent ** torrents, int n )
refreshWebseedList( di, torrents, n );
}
#if GTK_CHECK_VERSION( 2,12,0 )
static gboolean
onPeerViewQueryTooltip( GtkWidget * widget,
gint x,
@ -1513,7 +1512,6 @@ onPeerViewQueryTooltip( GtkWidget * widget,
return show_tip;
}
#endif
static void
setPeerViewColumns( GtkTreeView * peer_view )
@ -1710,24 +1708,15 @@ peer_page_new( struct DetailsImpl * di )
gtk_tree_sortable_set_sort_column_id( GTK_TREE_SORTABLE( m ),
PEER_COL_PROGRESS,
GTK_SORT_DESCENDING );
#if GTK_CHECK_VERSION( 2,12,0 )
v = GTK_WIDGET( g_object_new( GTK_TYPE_TREE_VIEW,
"model", m,
"rules-hint", TRUE,
"has-tooltip", TRUE,
NULL ) );
#else
v = GTK_WIDGET( g_object_new( GTK_TYPE_TREE_VIEW,
"model", m,
"rules-hint", TRUE,
NULL ) );
#endif
di->peer_view = v;
#if GTK_CHECK_VERSION( 2,12,0 )
g_signal_connect( v, "query-tooltip",
G_CALLBACK( onPeerViewQueryTooltip ), di );
#endif
g_object_unref( store );
g_signal_connect( v, "button-release-event",
G_CALLBACK( on_tree_view_button_released ), NULL );

View File

@ -446,7 +446,6 @@ buildTree( GNode * node, gpointer gdata )
tr_strlsize( size_str, child_data->length, sizeof size_str );
#if GTK_CHECK_VERSION(2,10,0)
gtk_tree_store_insert_with_values( build->store, &child_iter, build->iter, INT_MAX,
FC_INDEX, child_data->index,
FC_LABEL, child_data->name,
@ -456,18 +455,6 @@ buildTree( GNode * node, gpointer gdata )
FC_PRIORITY, priority,
FC_ENABLED, enabled,
-1 );
#else
gtk_tree_store_append( build->store, &child_iter, build->iter );
gtk_tree_store_set( build->store, &child_iter,
FC_INDEX, child_data->index,
FC_LABEL, child_data->name,
FC_SIZE, child_data->length,
FC_SIZE_STR, size_str,
FC_ICON, icon,
FC_PRIORITY, priority,
FC_ENABLED, enabled,
-1 );
#endif
if( !isLeaf )
{

View File

@ -1002,21 +1002,10 @@ gtr_filter_bar_new( tr_session * session, GtkTreeModel * tmodel, GtkTreeModel **
gtk_box_pack_start( GTK_BOX( h ), w, FALSE, FALSE, 0 );
/* add the entry field */
#if GTK_CHECK_VERSION( 2,16,0 )
s = gtk_entry_new( );
gtk_entry_set_icon_from_stock( GTK_ENTRY( s ), GTK_ENTRY_ICON_SECONDARY, GTK_STOCK_CLEAR );
g_signal_connect( s, "icon-release", G_CALLBACK( entry_clear ), NULL );
gtk_box_pack_start( GTK_BOX( h ), s, TRUE, TRUE, 0 );
#else
s = gtk_entry_new( );
gtk_box_pack_start( GTK_BOX( h ), s, TRUE, TRUE, 0 );
w = gtk_button_new( );
gtk_button_set_relief( GTK_BUTTON( w ), GTK_RELIEF_NONE );
l = gtk_image_new_from_stock( GTK_STOCK_CLEAR, GTK_ICON_SIZE_MENU );
gtk_button_set_image( GTK_BUTTON( w ), l );
gtk_box_pack_start( GTK_BOX( h ), w, FALSE, FALSE, 0 );
g_signal_connect_swapped( w, "clicked", G_CALLBACK( entry_clear ), s );
#endif
g_signal_connect( s, "changed", G_CALLBACK( filter_entry_changed ), data->filter_model );
selection_changed_cb( NULL, data );

View File

@ -9,19 +9,11 @@
#include <string.h> /* strcmp */
#include <glib.h>
#include <gtk/gtk.h>
#include <gio/gio.h>
#include "icons.h"
#if GTK_CHECK_VERSION( 2, 12, 0 )
#define USE_GIO_ICONS
#endif
#ifdef USE_GIO_ICONS
#include <gio/gio.h>
#endif
#define VOID_PIXBUF_KEY "void-pixbuf"
#ifdef USE_GIO_ICONS
static const char *
get_static_string( const char *s )
{
@ -35,8 +27,6 @@ get_static_string( const char *s )
return g_string_chunk_insert_const( static_strings, s );
}
#endif
typedef struct {
GtkIconTheme * icon_theme;
@ -96,7 +86,6 @@ icon_cache_new (GtkWidget * for_widget, int icon_size)
return icon_cache;
}
#ifdef USE_GIO_ICONS
static const char *
_icon_cache_get_icon_key( GIcon * icon )
{
@ -220,40 +209,6 @@ icon_cache_get_mime_type_icon( IconCache * icon_cache, const char * mime_type )
return pixbuf;
}
#else /* USE_GIO_ICONS */
static GdkPixbuf *
icon_cache_get_mime_type_icon( IconCache * icon_cache, const char * mime_type )
{
GdkPixbuf * pixbuf;
const char * stock_name;
if( !strcmp( mime_type, UNKNOWN_MIME_TYPE ) )
stock_name = GTK_STOCK_MISSING_IMAGE;
else if( !strcmp( mime_type, DIRECTORY_MIME_TYPE ) )
stock_name = GTK_STOCK_DIRECTORY;
else
stock_name = GTK_STOCK_FILE;
pixbuf = g_hash_table_lookup( icon_cache->cache, stock_name );
if( pixbuf != NULL )
{
g_object_ref( pixbuf );
return pixbuf;
}
pixbuf = gtk_icon_theme_load_icon( icon_cache->icon_theme,
stock_name,
icon_cache->icon_size,
0, NULL );
g_hash_table_insert( icon_cache->cache, (gpointer) stock_name, g_object_ref( pixbuf ));
return pixbuf;
}
#endif
GdkPixbuf *
gtr_get_mime_type_icon( const char * mime_type,
GtkIconSize icon_size,
@ -281,12 +236,8 @@ gtr_get_mime_type_icon( const char * mime_type,
const char *
gtr_get_mime_type_from_filename( const char * file G_GNUC_UNUSED )
{
#ifdef USE_GIO_ICONS
char * tmp = g_content_type_guess( file, NULL, 0, NULL );
const char * ret = get_static_string( tmp );
g_free( tmp );
return ret;
#else
return "uncertain";
#endif
}

View File

@ -394,7 +394,7 @@ on_main_window_size_allocated( GtkWidget * gtk_window,
GtkAllocation * alloc UNUSED,
gpointer gdata UNUSED )
{
GdkWindow * gdk_window = gtr_widget_get_window( gtk_window );
GdkWindow * gdk_window = gtk_widget_get_window( gtk_window );
const gboolean isMaximized = ( gdk_window != NULL )
&& ( gdk_window_get_state( gdk_window ) & GDK_WINDOW_STATE_MAXIMIZED );
@ -1458,19 +1458,6 @@ update_model_loop( gpointer gdata )
return !done;
}
/* GTK+ versions before 2.18.0 don't have a default URI hook... */
#if !GTK_CHECK_VERSION(2,18,0)
#define NEED_URL_HOOK
#endif
#ifdef NEED_URL_HOOK
static void
on_uri_clicked( GtkAboutDialog * u UNUSED, const gchar * uri, gpointer u2 UNUSED )
{
gtr_open_uri( uri );
}
#endif
static void
show_about_dialog( GtkWindow * parent )
{
@ -1482,10 +1469,6 @@ show_about_dialog( GtkWindow * parent )
NULL
};
#ifdef NEED_URL_HOOK
gtk_about_dialog_set_url_hook( on_uri_clicked, NULL, NULL );
#endif
d = g_object_new( GTK_TYPE_ABOUT_DIALOG,
"authors", authors,
"comments", _( "A fast and easy BitTorrent client" ),

View File

@ -514,12 +514,10 @@ gtr_torrent_open_from_url_dialog_new( GtkWindow * parent, TrCore * core )
gtr_dialog_set_content( GTK_DIALOG( w ), t );
#if GTK_CHECK_VERSION(2,20,0)
if( gtk_entry_get_text_length( GTK_ENTRY( e ) ) == 0 )
gtk_widget_grab_focus( e );
else
gtk_widget_grab_focus( gtk_dialog_get_widget_for_response( GTK_DIALOG( w ), GTK_RESPONSE_ACCEPT ) );
#endif
return w;
}

View File

@ -39,22 +39,6 @@ enum
****
***/
/* backwards-compatible wrapper around gtk_cell_renderer_get_padding() */
static void
gtr_cell_renderer_get_padding( GtkCellRenderer * cell, gint * xpad, gint * ypad )
{
#if GTK_CHECK_VERSION( 2,18,0 )
gtk_cell_renderer_get_padding( cell, xpad, ypad );
#else
if( xpad != NULL ) *xpad = cell->xpad;
if( ypad != NULL ) *ypad = cell->ypad;
#endif
}
/***
****
***/
static void
getProgressString( GString * gstr,
const tr_torrent * tor,
@ -422,7 +406,7 @@ get_size_compact( TorrentCellRenderer * cell,
name = tr_torrentName( tor );
g_string_truncate( gstr_stat, 0 );
getShortStatusString( gstr_stat, tor, st, p->upload_speed_KBps, p->download_speed_KBps );
gtr_cell_renderer_get_padding( GTK_CELL_RENDERER( cell ), &xpad, &ypad );
gtk_cell_renderer_get_padding( GTK_CELL_RENDERER( cell ), &xpad, &ypad );
/* get the idealized cell dimensions */
g_object_set( p->icon_renderer, "pixbuf", icon, NULL );
@ -475,7 +459,7 @@ get_size_full( TorrentCellRenderer * cell,
getStatusString( gstr_stat, tor, st, p->upload_speed_KBps, p->download_speed_KBps );
g_string_truncate( gstr_prog, 0 );
getProgressString( gstr_prog, tor, inf, st );
gtr_cell_renderer_get_padding( GTK_CELL_RENDERER( cell ), &xpad, &ypad );
gtk_cell_renderer_get_padding( GTK_CELL_RENDERER( cell ), &xpad, &ypad );
/* get the idealized cell dimensions */
g_object_set( p->icon_renderer, "pixbuf", icon, NULL );
@ -537,7 +521,7 @@ torrent_cell_renderer_get_size( GtkCellRenderer * cell,
if( y_offset ) {
int xpad, ypad;
gtr_cell_renderer_get_padding( cell, &xpad, &ypad );
gtk_cell_renderer_get_padding( cell, &xpad, &ypad );
*y_offset = cell_area ? (int)((cell_area->height - (ypad*2 +h)) / 2.0) : 0;
}
}
@ -649,7 +633,7 @@ render_compact( TorrentCellRenderer * cell,
name = tr_torrentName( tor );
g_string_truncate( gstr_stat, 0 );
getShortStatusString( gstr_stat, tor, st, p->upload_speed_KBps, p->download_speed_KBps );
gtr_cell_renderer_get_padding( GTK_CELL_RENDERER( cell ), &xpad, &ypad );
gtk_cell_renderer_get_padding( GTK_CELL_RENDERER( cell ), &xpad, &ypad );
get_text_color( widget, st, &text_color );
fill_area = *background_area;
@ -687,7 +671,7 @@ render_compact( TorrentCellRenderer * cell,
"sensitive", sensitive,
#if GTK_CHECK_VERSION( 3,0,0 )
"inverted", seed,
#elif GTK_CHECK_VERSION( 2,6,0 )
#else
"orientation", (seed ? GTK_PROGRESS_RIGHT_TO_LEFT : GTK_PROGRESS_LEFT_TO_RIGHT),
#endif
NULL );
@ -738,7 +722,7 @@ render_full( TorrentCellRenderer * cell,
getProgressString( gstr_prog, tor, inf, st );
g_string_truncate( gstr_stat, 0 );
getStatusString( gstr_stat, tor, st, p->upload_speed_KBps, p->download_speed_KBps );
gtr_cell_renderer_get_padding( GTK_CELL_RENDERER( cell ), &xpad, &ypad );
gtk_cell_renderer_get_padding( GTK_CELL_RENDERER( cell ), &xpad, &ypad );
get_text_color( widget, st, &text_color );
/* get the idealized cell dimensions */
@ -807,7 +791,7 @@ render_full( TorrentCellRenderer * cell,
g_object_set( p->progress_renderer, "value", (int)(percentDone*100.0), "text", "", "sensitive", sensitive,
#if GTK_CHECK_VERSION( 3,0,0 )
"inverted", seed,
#elif GTK_CHECK_VERSION( 2,6,0 )
#else
"orientation", (seed ? GTK_PROGRESS_RIGHT_TO_LEFT : GTK_PROGRESS_LEFT_TO_RIGHT),
#endif
NULL );

View File

@ -113,11 +113,7 @@ gtr_icon_refresh( gpointer vicon )
* %4$s: current download limit, if any */
g_snprintf( tip, sizeof( tip ), _( "Transmission\nUp: %1$s %2$s\nDown: %3$s %4$s" ), up, upLimit, down, downLimit );
#if GTK_CHECK_VERSION( 2,16,0 )
gtk_status_icon_set_tooltip_text( GTK_STATUS_ICON( icon ), tip );
#else
gtk_status_icon_set_tooltip( GTK_STATUS_ICON( icon ), tip );
#endif
}
#endif

View File

@ -577,19 +577,19 @@ privacyPage( GObject * core )
s = _( "Use PE_X to find more peers" );
w = new_check_button( s, TR_PREFS_KEY_PEX_ENABLED, core );
s = _( "PEX is a tool for exchanging peer lists with the peers you're connected to." );
gtr_widget_set_tooltip_text( w, s );
gtk_widget_set_tooltip_text( w, s );
hig_workarea_add_wide_control( t, &row, w );
s = _( "Use _DHT to find more peers" );
w = new_check_button( s, TR_PREFS_KEY_DHT_ENABLED, core );
s = _( "DHT is a tool for finding peers without a tracker." );
gtr_widget_set_tooltip_text( w, s );
gtk_widget_set_tooltip_text( w, s );
hig_workarea_add_wide_control( t, &row, w );
s = _( "Use _Local Peer Discovery to find more peers" );
w = new_check_button( s, TR_PREFS_KEY_LPD_ENABLED, core );
s = _( "LPD is a tool for finding peers on your local network." );
gtr_widget_set_tooltip_text( w, s );
gtk_widget_set_tooltip_text( w, s );
hig_workarea_add_wide_control( t, &row, w );
hig_workarea_finish( t, &row );
@ -875,7 +875,7 @@ webPage( GObject * core )
page->whitelist_widgets = g_slist_append( page->whitelist_widgets, w );
v = page->view = GTK_TREE_VIEW( w );
gtr_widget_set_tooltip_text( w, _( "IP addresses may use wildcards, such as 192.168.*.*" ) );
gtk_widget_set_tooltip_text( w, _( "IP addresses may use wildcards, such as 192.168.*.*" ) );
sel = gtk_tree_view_get_selection( v );
g_signal_connect( sel, "changed",
G_CALLBACK( onWhitelistSelectionChanged ), page );
@ -1246,7 +1246,7 @@ networkPage( GObject * core )
s = _( "Enable _uTP for peer communication" );
w = new_check_button( s, TR_PREFS_KEY_UTP_ENABLED, core );
s = _( "uTP is a tool for reducing network congestion." );
gtr_widget_set_tooltip_text( w, s );
gtk_widget_set_tooltip_text( w, s );
hig_workarea_add_wide_control( t, &row, w );
#endif

View File

@ -267,7 +267,7 @@ syncAltSpeedButton( PrivateData * p )
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( w ), b );
gtk_image_set_from_stock( GTK_IMAGE( p->alt_speed_image ), stock, -1 );
gtk_button_set_alignment( GTK_BUTTON( w ), 0.5, 0.5 );
gtr_widget_set_tooltip_text( w, str );
gtk_widget_set_tooltip_text( w, str );
g_free( str );
}
@ -284,8 +284,6 @@ alt_speed_toggled_cb( GtkToggleButton * button, gpointer vprivate )
**** FILTER
***/
#if GTK_CHECK_VERSION( 2, 12, 0 )
static void
findMaxAnnounceTime( GtkTreeModel * model,
GtkTreePath * path UNUSED,
@ -334,8 +332,6 @@ onAskTrackerQueryTooltip( GtkWidget * widget UNUSED,
}
}
#endif
static gboolean
onAltSpeedToggledIdle( gpointer vp )
{
@ -597,10 +593,7 @@ gtr_window_new( GtkUIManager * ui_mgr, TrCore * core )
/* main menu */
mainmenu = gtr_action_get_widget( "/main-window-menu" );
w = gtr_action_get_widget( "/main-window-menu/torrent-menu/torrent-reannounce" );
#if GTK_CHECK_VERSION( 2, 12, 0 )
g_signal_connect( w, "query-tooltip",
G_CALLBACK( onAskTrackerQueryTooltip ), p );
#endif
g_signal_connect( w, "query-tooltip", G_CALLBACK( onAskTrackerQueryTooltip ), p );
/* toolbar */
toolbar = p->toolbar = gtr_action_get_widget( "/main-window-toolbar" );
@ -639,7 +632,7 @@ gtr_window_new( GtkUIManager * ui_mgr, TrCore * core )
w = gtk_button_new( );
gtk_container_add( GTK_CONTAINER( w ), gtk_image_new_from_stock( "utilities", -1 ) );
gtr_widget_set_tooltip_text( w, _( "Options" ) );
gtk_widget_set_tooltip_text( w, _( "Options" ) );
gtk_box_pack_start( GTK_BOX( h ), w, 0, 0, 0 );
gtk_button_set_relief( GTK_BUTTON( w ), GTK_RELIEF_NONE );
p->options_menu = createOptionsMenu( p );
@ -680,7 +673,7 @@ gtr_window_new( GtkUIManager * ui_mgr, TrCore * core )
hbox = gtk_hbox_new( FALSE, GUI_PAD );
w = gtk_button_new( );
gtr_widget_set_tooltip_text( w, _( "Statistics" ) );
gtk_widget_set_tooltip_text( w, _( "Statistics" ) );
gtk_container_add( GTK_CONTAINER( w ), gtk_image_new_from_stock( "ratio", -1 ) );
gtk_button_set_relief( GTK_BUTTON( w ), GTK_RELIEF_NONE );
g_signal_connect( w, "clicked", G_CALLBACK( onYinYangReleased ), p );
@ -864,16 +857,16 @@ gtr_window_get_selection( TrWindow * w )
void
gtr_window_set_busy( TrWindow * w, gboolean isBusy )
{
if( w && gtr_widget_get_realized( GTK_WIDGET( w ) ) )
if( w && gtk_widget_get_realized( GTK_WIDGET( w ) ) )
{
GdkDisplay * display = gtk_widget_get_display( GTK_WIDGET( w ) );
GdkCursor * cursor = isBusy ? gdk_cursor_new_for_display( display, GDK_WATCH ) : NULL;
gdk_window_set_cursor( gtr_widget_get_window( GTK_WIDGET( w ) ), cursor );
gdk_window_set_cursor( gtk_widget_get_window( GTK_WIDGET( w ) ), cursor );
gdk_display_flush( display );
if( cursor ) {
#if GTK_CHECK_VERSION(3,0,0)
#if GTK_CHECK_VERSION( 3,0,0 )
g_object_unref( cursor );
#else
gdk_cursor_unref( cursor );

View File

@ -415,10 +415,8 @@ gtr_open_uri( const char * uri )
{
gboolean opened = FALSE;
#if GTK_CHECK_VERSION(2,14,0)
if( !opened )
opened = gtk_show_uri( NULL, uri, GDK_CURRENT_TIME, NULL );
#endif
if( !opened )
opened = g_app_info_launch_default_for_uri( uri, NULL, NULL );
@ -589,39 +587,6 @@ gtr_priority_combo_new( void )
****
***/
void
gtr_widget_set_tooltip_text( GtkWidget * w, const char * tip )
{
#if GTK_CHECK_VERSION( 2,12,0 )
gtk_widget_set_tooltip_text( w, tip );
#else
static GtkTooltips * tips = NULL;
if( tips == NULL )
tips = gtk_tooltips_new( );
gtk_tooltips_set_tip( tips, w, tip, NULL );
#endif
}
GdkWindow*
gtr_widget_get_window( GtkWidget * w )
{
#if GTK_CHECK_VERSION( 2,14,0 )
return gtk_widget_get_window( w );
#else
return w->window;
#endif
}
gboolean
gtr_widget_get_realized( GtkWidget * w )
{
#if GTK_CHECK_VERSION( 2,20,0 )
return gtk_widget_get_realized( w );
#else
return GTK_WIDGET_REALIZED( w ) != 0;
#endif
}
void
gtr_widget_set_visible( GtkWidget * w, gboolean b )
{
@ -640,30 +605,13 @@ gtr_widget_set_visible( GtkWidget * w, gboolean b )
g_list_free( windows );
}
#if GTK_CHECK_VERSION( 2,18,0 )
gtk_widget_set_visible( w, b );
#else
if( b )
gtk_widget_show( w );
else
gtk_widget_hide( w );
#endif
}
static GtkWidget*
gtr_dialog_get_content_area( GtkDialog * dialog )
{
#if GTK_CHECK_VERSION( 2,14,0 )
return gtk_dialog_get_content_area( dialog );
#else
return dialog->vbox;
#endif
}
void
gtr_dialog_set_content( GtkDialog * dialog, GtkWidget * content )
{
GtkWidget * vbox = gtr_dialog_get_content_area( dialog );
GtkWidget * vbox = gtk_dialog_get_content_area( dialog );
gtk_box_pack_start( GTK_BOX( vbox ), content, TRUE, TRUE, 0 );
gtk_widget_show_all( content );
}
@ -672,77 +620,16 @@ gtr_dialog_set_content( GtkDialog * dialog, GtkWidget * content )
****
***/
#if !GTK_CHECK_VERSION( 2,12,0 )
struct gtr_func_data
{
GSourceFunc function;
gpointer data;
};
static void
gtr_func_data_free( gpointer data )
{
#if GTK_CHECK_VERSION( 2,10,0 )
g_slice_free( struct gtr_func_data, data );
#else
g_free( data );
#endif
}
static struct gtr_func_data *
gtr_func_data_new( GSourceFunc function, gpointer data )
{
#if GTK_CHECK_VERSION( 2,10,0 )
struct gtr_func_data * d = g_slice_new( struct gtr_func_data );
#else
struct gtr_func_data * d = g_new( struct gtr_func_data, 1 );
#endif
d->function = function;
d->data = data;
return d;
}
static gboolean
gtr_thread_func( gpointer data )
{
gboolean more;
struct gtr_func_data * idle_data = data;
gdk_threads_enter( );
more = idle_data->function( idle_data->data );
gdk_threads_leave( );
return more;
}
#endif
guint
gtr_idle_add( GSourceFunc function, gpointer data )
{
#if GTK_CHECK_VERSION( 2,12,0 )
return gdk_threads_add_idle( function, data );
#else
return g_idle_add_full( G_PRIORITY_DEFAULT,
gtr_thread_func,
gtr_func_data_new( function, data ),
gtr_func_data_free );
#endif
}
guint
gtr_timeout_add_seconds( guint seconds, GSourceFunc function, gpointer data )
{
#if GTK_CHECK_VERSION( 2,14,0 )
return gdk_threads_add_timeout_seconds( seconds, function, data );
#elif GTK_CHECK_VERSION( 2,12,0 )
return gdk_threads_add_timeout( seconds*1000, function, data );
#else
return g_timeout_add_full( G_PRIORITY_DEFAULT,
seconds * 1000,
gtr_thread_func,
gtr_func_data_new( function, data ),
gtr_func_data_free );
#endif
}
void

View File

@ -114,15 +114,6 @@ guint gtr_timeout_add_seconds( guint seconds, GSourceFunc func, gpointer data );
/* backwards-compatible wrapper around gdk_threads_add_idle() */
guint gtr_idle_add( GSourceFunc func, gpointer data );
/* backwards-compatible wrapper around gtk_widget_set_tooltip_text() */
void gtr_widget_set_tooltip_text( GtkWidget * w, const char * tip );
/* backwards-compatible wrapper around gtk_widget_get_window() */
GdkWindow* gtr_widget_get_window( GtkWidget * w );
/* backwards-compatible wrapper around gtk_widget_get_realized() */
gboolean gtr_widget_get_realized( GtkWidget * w );
/* backwards-compatible wrapper around gtk_widget_set_visible() */
void gtr_widget_set_visible( GtkWidget *, gboolean );