commit b4eb131d8902d7d4551566ceb1eb21b926734683 Author: phantomjinx <p.g.richard...@phantomjinx.co.uk> Date: Tue Aug 31 21:40:01 2010 +0100
Better implementation of handling backward compatibility of gtk version * As recommended by Maia Kozheva (si...@ubuntu.com), put the pre-processing directives in one place. libgtkpod/misc.h | 3 +++ plugins/cover_display/display_coverart.c | 4 ---- plugins/details_editor/details.c | 4 ---- plugins/photo_editor/display_photo.c | 8 -------- src/anjuta-app.c | 8 -------- 5 files changed, 3 insertions(+), 24 deletions(-) --- diff --git a/libgtkpod/misc.h b/libgtkpod/misc.h index f3852a7..6206a54 100644 --- a/libgtkpod/misc.h +++ b/libgtkpod/misc.h @@ -42,6 +42,9 @@ #include "gp_itdb.h" #include "time.h" +#if !GTK_CHECK_VERSION(2, 20, 0) + #define gtk_widget_get_realized GTK_WIDGET_REALIZED +#endif #define C_FREE(a) {g_free(a); a=NULL;} diff --git a/plugins/cover_display/display_coverart.c b/plugins/cover_display/display_coverart.c index 60dfd40..6d0bbab 100644 --- a/plugins/cover_display/display_coverart.c +++ b/plugins/cover_display/display_coverart.c @@ -284,11 +284,7 @@ static void set_display_window_dimensions() { * */ void coverart_block_change(gboolean val) { -#if GTK_CHECK_VERSION(2,20,0) if (gtk_widget_get_realized(GTK_WIDGET(gtkpod_app))) { -#else - if GTK_WIDGET_REALIZED(gtkpod_app) { -#endif if (val) { GdkCursor *cursor = gdk_cursor_new(GDK_WATCH); gdk_window_set_cursor(gtk_widget_get_window(GTK_WIDGET(gtkpod_app)), cursor); diff --git a/plugins/details_editor/details.c b/plugins/details_editor/details.c index b022ccb..2a08cf3 100644 --- a/plugins/details_editor/details.c +++ b/plugins/details_editor/details.c @@ -1533,11 +1533,7 @@ void details_edit(GList *selected_tracks) { if (!details_view || !details_view->window) { create_details_editor_view(); } -#if GTK_CHECK_VERSION(2,20,0) else if (! gtk_widget_get_realized(details_view->window)) { -#else - else if (! GTK_WIDGET_REALIZED(details_view->window)) { -#endif gtkpod_display_widget(details_view->window); } details_set_tracks(selected_tracks); diff --git a/plugins/photo_editor/display_photo.c b/plugins/photo_editor/display_photo.c index 7ad75e6..e2534d0 100644 --- a/plugins/photo_editor/display_photo.c +++ b/plugins/photo_editor/display_photo.c @@ -297,11 +297,7 @@ static void gphoto_create_albumview() { /* create tree view */ photo_editor->album_view = GTK_TREE_VIEW (gtk_tree_view_new ()); -#if GTK_CHECK_VERSION(2,20,0) if (!gtk_widget_get_realized(GTK_WIDGET(photo_editor->album_view))) -#else - if (!GTK_WIDGET_REALIZED(GTK_WIDGET(photo_editor->album_view))) -#endif gtk_widget_set_events(GTK_WIDGET(photo_editor->album_view), GDK_KEY_PRESS_MASK); renderer = gtk_cell_renderer_text_new(); gtk_tree_view_insert_column_with_attributes(photo_editor->album_view, -1, _("Photo Albums"), renderer, "text", COL_ALBUM_NAME, NULL); @@ -360,11 +356,7 @@ static void gphoto_create_thumbnailview() { if (photo_editor->thumbnail_view == NULL) photo_editor->thumbnail_view = GTK_ICON_VIEW (gtk_icon_view_new ()); -#if GTK_CHECK_VERSION(2,20,0) if (!gtk_widget_get_realized(GTK_WIDGET(photo_editor->thumbnail_view))) -#else - if (!GTK_WIDGET_REALIZED(GTK_WIDGET(photo_editor->thumbnail_view))) -#endif gtk_widget_set_events(GTK_WIDGET(photo_editor->thumbnail_view), GDK_KEY_PRESS_MASK); gtk_container_add(GTK_CONTAINER (photo_editor->photo_thumb_window), GTK_WIDGET(photo_editor->thumbnail_view)); diff --git a/src/anjuta-app.c b/src/anjuta-app.c index d04d3b5..71e862d 100644 --- a/src/anjuta-app.c +++ b/src/anjuta-app.c @@ -566,11 +566,7 @@ void anjuta_app_set_geometry(AnjutaApp *app, const gchar *geometry) { DEBUG_PRINT ("Setting geometry: %s", geometry); if (sscanf(geometry, "%dx%d+%d+%d", &width, &height, &posx, &posy) == 4) { -#if GTK_CHECK_VERSION(2,20,0) if (gtk_widget_get_realized (GTK_WIDGET (app))) { -#else - if (GTK_WIDGET_REALIZED (app)) { -#endif gtk_window_resize(GTK_WINDOW (app), width, height); } else { @@ -590,11 +586,7 @@ void anjuta_app_set_geometry(AnjutaApp *app, const gchar *geometry) { height = gdk_screen_height() - 25; width = (width < 790) ? width : 790; height = (height < 575) ? width : 575; -#if GTK_CHECK_VERSION(2,20,0) if (gtk_widget_get_realized (GTK_WIDGET (app)) == FALSE) { -#else - if (GTK_WIDGET_REALIZED (GTK_WIDGET (app)) == FALSE) { -#endif gtk_window_set_default_size(GTK_WINDOW (app), width, height); gtk_window_move(GTK_WINDOW (app), posx, posy); } ------------------------------------------------------------------------------ This SF.net Dev2Dev email is sponsored by: Show off your parallel programming skills. Enter the Intel(R) Threading Challenge 2010. http://p.sf.net/sfu/intel-thread-sfd _______________________________________________ gtkpod-cvs2 mailing list gtkpod-cvs2@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gtkpod-cvs2