summaryrefslogtreecommitdiffstats
path: root/meta/packages/pcmanfm/files/no-fam-gtk2.6.patch
blob: 40ced49d2c4f752030306a80f260029f5d80f343 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
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 <gtk/gtk.h>
 #include <glib.h>
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+#ifdef HAVE_FAM_H
 #include <fam.h>
+#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);