diff -urNd pcmanfm-0.1.9.8.old/configure.in pcmanfm-0.1.9.8/configure.in --- pcmanfm-0.1.9.8.old/configure.in 2006-02-08 17:13:05.000000000 +0000 +++ pcmanfm-0.1.9.8/configure.in 2006-02-14 22:53:22.000000000 +0000 @@ -10,8 +10,12 @@ AM_PROG_CC_STDC AC_HEADER_STDC -pkg_modules="gtk+-2.0 >= 2.8.0 gthread-2.0" -PKG_CHECK_MODULES(PACKAGE, [$pkg_modules]) +PKG_CHECK_MODULES(PACKAGE, [glib-2.0 >= 2.8.0 gtk+-2.0 >= 2.6.0 gthread-2.0], [ + PKG_CHECK_MODULES(GTK, [gtk+-2.0 >= 2.8.0], have_gtk28=yes, have_gtk28=no) +]) +if test x"$have_gtk28" = x"yes"; then + AC_DEFINE([HAVE_GTK_2_8],,[Define if you have gtk+-2.0 >= 2.8.0]) +fi AC_SUBST(PACKAGE_CFLAGS) AC_SUBST(PACKAGE_LIBS) @@ -38,8 +42,8 @@ LIBS="$LIBS $FAM_LIBS" AC_CHECK_FUNCS([FAMNoExists]) LIBS="$save_LIBS" -else - AC_MSG_ERROR([Fatal Error: no fam or gamin detected.]) +#else +# AC_MSG_ERROR([Fatal Error: no fam or gamin detected.]) fi AC_SUBST([FAM_CFLAGS]) diff -urNd pcmanfm-0.1.9.8.old/src/foldercontent.c pcmanfm-0.1.9.8/src/foldercontent.c --- pcmanfm-0.1.9.8.old/src/foldercontent.c 2006-02-08 18:36:52.000000000 +0000 +++ pcmanfm-0.1.9.8/src/foldercontent.c 2006-02-15 02:51:03.000000000 +0000 @@ -31,9 +31,11 @@ }FolderContentCallback; static GHashTable* folder_hash = NULL; +#ifdef HAVE_FAM_H static FAMConnection fam; static GIOChannel* fam_io_channel = NULL; static guint fam_io_watch = 0; +#endif typedef enum{ FCM_FOLDER_VIEW = 1 << 0, @@ -58,6 +60,9 @@ static FolderContent* folder_content_get( const char* path, FolderContentMode mode, GtkTreeRowReference* tree_parent, +#ifndef HAVE_GTK_2_8 + GtkTreeModel* tree_model, +#endif FolderContentUpdateFunc cb, gpointer user_data ); @@ -72,6 +77,7 @@ static gboolean connect_to_fam() { +#ifdef HAVE_FAM_H if( FAMOpen( &fam ) ) { fam_io_channel = NULL; @@ -100,10 +106,14 @@ /* g_print("Connected to FAM server\n"); */ +#else + return FALSE; +#endif } static void disconnect_from_fam() { +#ifdef HAVE_FAM_H if( fam_io_channel ) { g_io_channel_unref(fam_io_channel); @@ -115,6 +125,7 @@ g_print("Disonnected from FAM server\n"); */ } +#endif } /* @@ -336,7 +347,11 @@ if( ! tree_node ) return; +#ifdef HAVE_GTK_2_8 tree = gtk_tree_row_reference_get_model (tree_node); +#else + tree = folder_content->tree_model; +#endif tree_path = gtk_tree_row_reference_get_path (tree_node); if( !tree || !tree_path ){ return; @@ -428,6 +443,9 @@ FolderContent* folder_content_get( const char* path, FolderContentMode mode, GtkTreeRowReference* tree_node, +#ifndef HAVE_GTK_2_8 + GtkTreeModel* tree_model, +#endif FolderContentUpdateFunc callback, gpointer user_data ) { @@ -467,6 +485,9 @@ */ if( ! folder_content->tree_node ) { +#ifndef HAVE_GTK_2_8 + folder_content->tree_model = tree_model; +#endif folder_content->tree_node = tree_node; dir_tree_sub_folders_new( folder_content ); } @@ -475,10 +496,12 @@ /* First new instance */ if( add_new ){ +#ifdef HAVE_FAM_H FAMMonitorDirectory( &fam, path, &folder_content->request, folder_content ); +#endif } if( callback ) /* Install a callback */ @@ -548,7 +571,9 @@ && 0 >= folder_content->n_ref_tree ) { /* g_print("cancel monitor!\n"); */ +#ifdef HAVE_FAM_H FAMCancelMonitor( &fam, &folder_content->request ); +#endif g_hash_table_remove( folder_hash, folder_content->path ); g_free( folder_content->path ); g_array_free( folder_content->callbacks, TRUE ); @@ -561,6 +586,7 @@ GIOCondition cond, gpointer user_data ) { +#ifdef HAVE_FAM_H FAMEvent evt; FolderContent* content = NULL; GdkPixbuf *folder_icon = get_folder_icon32(); @@ -613,21 +639,36 @@ } } return TRUE; +#else + return FALSE; +#endif } FolderContent* folder_content_list_get( const char* path, FolderContentUpdateFunc cb, gpointer user_data ) { +#ifdef HAVE_GTK_2_8 return folder_content_get( path, FCM_FOLDER_VIEW, NULL, cb, user_data ); +#else + return folder_content_get( path, FCM_FOLDER_VIEW, NULL, NULL, cb, user_data ); +#endif } FolderContent* folder_content_tree_get( const char* path, GtkTreeRowReference* tree_parent, +#ifndef HAVE_GTK_2_8 + GtkTreeModel* tree_model, +#endif FolderContentUpdateFunc cb, gpointer user_data ) { +#ifdef HAVE_GTK_2_8 return folder_content_get( path, FCM_DIR_TREE, tree_parent, cb, user_data ); +#else + return folder_content_get( path, FCM_DIR_TREE, tree_parent, tree_model, cb, + user_data ); +#endif } void folder_content_list_unref( FolderContent* folder_content, @@ -688,7 +729,11 @@ } if( content->tree_node ) { +#ifdef HAVE_GTK_2_8 model = gtk_tree_row_reference_get_model( content->tree_node ); +#else + model = content->tree_model; +#endif tree_path = gtk_tree_row_reference_get_path( content->tree_node ); gtk_tree_model_get_iter( model, &parent_it, tree_path ); @@ -724,7 +769,11 @@ } if( content->tree_node ) { +#ifdef HAVE_GTK_2_8 model = gtk_tree_row_reference_get_model( content->tree_node ); +#else + model = content->tree_model; +#endif tree_path = gtk_tree_row_reference_get_path( content->tree_node ); gtk_tree_model_get_iter( model, &parent_it, tree_path ); @@ -776,7 +825,11 @@ /* There is no need to update the dir tree currently. */ if( content->tree_node ) { +#ifdef HAVE_GTK_2_8 model = gtk_tree_row_reference_get_model( content->tree_node ); +#else + model = content->tree_model; +#endif tree_path = gtk_tree_row_reference_get_path( content->tree_node ); gtk_tree_model_get_iter( model, &parent_it, tree_path ); diff -urNd pcmanfm-0.1.9.8.old/src/foldercontent.h pcmanfm-0.1.9.8/src/foldercontent.h --- pcmanfm-0.1.9.8.old/src/foldercontent.h 2006-02-07 10:26:03.000000000 +0000 +++ pcmanfm-0.1.9.8/src/foldercontent.h 2006-02-15 02:13:40.000000000 +0000 @@ -15,7 +15,12 @@ #include #include +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif +#ifdef HAVE_FAM_H #include +#endif /* Columns of folderView */ enum{ @@ -42,10 +47,20 @@ typedef struct{ GtkListStore* list; /* for Folder View */ int n_ref_list; /* reference counting */ +#ifndef HAVE_GTK_2_8 + GtkTreeModel* tree_model; +#endif GtkTreeRowReference* tree_node; /* for Dir Tree */ int n_ref_tree; +#ifdef HAVE_FAM_H FAMRequest request; +#else + /* A structure the same size as FAMRequest */ + struct unused { + int unused; + }; +#endif gchar* path; int n_files; @@ -82,6 +97,9 @@ FolderContent* folder_content_tree_get( const char* path, GtkTreeRowReference* tree_node, +#ifndef HAVE_GTK_2_8 + GtkTreeModel* tree_model, +#endif FolderContentUpdateFunc callback, gpointer user_data ); diff -urNd pcmanfm-0.1.9.8.old/src/ptk/ptkfilebrowser.c pcmanfm-0.1.9.8/src/ptk/ptkfilebrowser.c --- pcmanfm-0.1.9.8.old/src/ptk/ptkfilebrowser.c 2006-02-09 04:29:32.000000000 +0000 +++ pcmanfm-0.1.9.8/src/ptk/ptkfilebrowser.c 2006-02-15 02:07:16.000000000 +0000 @@ -31,6 +31,9 @@ #include "ptkutils.h" #include "settings.h" +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif /* If set to FALSE, all selection changes in folder_view are prevented. */ @@ -1127,7 +1130,11 @@ } row_ref = gtk_tree_row_reference_new( store, real_path ); +#ifdef HAVE_GTK_2_8 content = folder_content_tree_get( dir_path, row_ref, NULL, NULL ); +#else + content = folder_content_tree_get( dir_path, row_ref, model, NULL, NULL ); +#endif gtk_tree_model_get_iter( model, &it, tree_path ); if( gtk_tree_model_iter_children( model, &child, &it ) ) { @@ -1231,12 +1238,15 @@ model = ptk_icon_view_get_model( PTK_ICON_VIEW(folder_view) ); } else if( file_browser->view_mode == FBVM_LIST_VIEW ) { +#ifdef HAVE_GTK_2_8 if( !gtk_tree_view_get_visible_range ( GTK_TREE_VIEW(folder_view), &start_path, &end_path ) ) return; +#endif model = gtk_tree_view_get_model( GTK_TREE_VIEW(folder_view) ); } +#ifdef HAVE_GTK_2_8 /* NOTE:It seems that this is a bug of gtk+ 2.8. gtk_tree_view_get_visible_range sometimes returns invalid paths. @@ -1252,6 +1262,7 @@ gtk_tree_path_free( end_path ); return; } +#endif model_sorter = PTK_TREE_MODEL_SORT( gtk_tree_model_filter_get_model( GTK_TREE_MODEL_FILTER(model) ) ); diff -urNd pcmanfm-0.1.9.8.old/src/ptk/ptkfileiconrenderer.c pcmanfm-0.1.9.8/src/ptk/ptkfileiconrenderer.c --- pcmanfm-0.1.9.8.old/src/ptk/ptkfileiconrenderer.c 2006-02-03 04:24:09.000000000 +0000 +++ pcmanfm-0.1.9.8/src/ptk/ptkfileiconrenderer.c 2006-02-15 02:09:00.000000000 +0000 @@ -346,7 +346,9 @@ GdkPixbuf *colorized = NULL; GdkRectangle pix_rect; GdkRectangle draw_rect; +#ifdef HAVE_GTK_2_8 cairo_t *cr; +#endif GtkCellRendererClass* parent_renderer_class; @@ -432,16 +434,23 @@ pixbuf = colorized; } } +#ifdef HAVE_GTK_2_8 cr = gdk_cairo_create (window); gdk_cairo_set_source_pixbuf (cr, pixbuf, pix_rect.x, pix_rect.y); gdk_cairo_rectangle (cr, &draw_rect); cairo_fill (cr); +#else + gdk_draw_pixbuf (GDK_DRAWABLE (window), NULL, pixbuf, 0, 0, + pix_rect.x, pix_rect.y, pix_rect.width, pix_rect.height, + GDK_RGB_DITHER_NORMAL, 0, 0); +#endif if( PTK_FILE_ICON_RENDERER(cell)->file_stat ) { if( S_ISLNK(PTK_FILE_ICON_RENDERER(cell)->file_stat->st_mode) ) { +#ifdef HAVE_GTK_2_8 gdk_cairo_set_source_pixbuf (cr, link_icon_large, pix_rect.x - 2, pix_rect.y - 2 ); @@ -449,10 +458,18 @@ draw_rect.y -= 2; gdk_cairo_rectangle (cr, &draw_rect); cairo_fill (cr); +#else + gdk_draw_pixbuf (GDK_DRAWABLE (window), NULL, link_icon_large, 0, 0, + pix_rect.x - 2, pix_rect.y - 2, + -1, -1, GDK_RGB_DITHER_NORMAL, + 0, 0); +#endif } } - + +#ifdef HAVE_GTK_2_8 cairo_destroy (cr); +#endif if (invisible) g_object_unref (invisible);