comparison src/view_file_icon.c @ 787:a2209b1f769d

use new notification in vficon
author nadvornik
date Thu, 05 Jun 2008 18:43:44 +0000
parents d6a7fb4b8e7c
children 6d65167764ea
comparison
equal deleted inserted replaced
786:a20ff446347e 787:a2209b1f769d
63 SelectionType selected; 63 SelectionType selected;
64 gint row; 64 gint row;
65 FileData *fd; 65 FileData *fd;
66 }; 66 };
67 67
68 static void vficon_notify_cb(FileData *fd, gpointer data);
68 static gint vficon_index_by_id(ViewFile *vf, IconData *in_id); 69 static gint vficon_index_by_id(ViewFile *vf, IconData *in_id);
69 70
70 static IconData *vficon_icon_data(ViewFile *vf, FileData *fd) 71 static IconData *vficon_icon_data(ViewFile *vf, FileData *fd)
71 { 72 {
72 IconData *id = NULL; 73 IconData *id = NULL;
2231 void vficon_destroy_cb(GtkWidget *widget, gpointer data) 2232 void vficon_destroy_cb(GtkWidget *widget, gpointer data)
2232 { 2233 {
2233 ViewFile *vf = data; 2234 ViewFile *vf = data;
2234 2235
2235 if (VFICON_INFO(vf, sync_idle_id) != -1) g_source_remove(VFICON_INFO(vf, sync_idle_id)); 2236 if (VFICON_INFO(vf, sync_idle_id) != -1) g_source_remove(VFICON_INFO(vf, sync_idle_id));
2237
2238 file_data_unregister_notify_func(vficon_notify_cb, vf);
2236 2239
2237 tip_unschedule(vf); 2240 tip_unschedule(vf);
2238 2241
2239 vficon_thumb_cleanup(vf); 2242 vficon_thumb_cleanup(vf);
2240 2243
2295 g_signal_connect(G_OBJECT(vf->listview), "leave_notify_event", 2298 g_signal_connect(G_OBJECT(vf->listview), "leave_notify_event",
2296 G_CALLBACK(vficon_leave_cb), vf); 2299 G_CALLBACK(vficon_leave_cb), vf);
2297 2300
2298 /* force VFICON_INFO(vf, columns) to be at least 1 (sane) - this will be corrected in the size_cb */ 2301 /* force VFICON_INFO(vf, columns) to be at least 1 (sane) - this will be corrected in the size_cb */
2299 vficon_populate_at_new_size(vf, 1, 1, FALSE); 2302 vficon_populate_at_new_size(vf, 1, 1, FALSE);
2303
2304 file_data_register_notify_func(vficon_notify_cb, vf);
2300 2305
2301 return vf; 2306 return vf;
2302 } 2307 }
2303 2308
2304 /* 2309 /*
2367 { 2372 {
2368 return row; 2373 return row;
2369 } 2374 }
2370 } 2375 }
2371 2376
2372 gint vficon_maint_renamed(ViewFile *vf, FileData *fd) 2377 static gint vficon_maint_removed(ViewFile *vf, FileData *fd, GList *ignore_list);
2378
2379
2380 static gint vficon_maint_renamed(ViewFile *vf, FileData *fd)
2373 { 2381 {
2374 gint ret = FALSE; 2382 gint ret = FALSE;
2375 gint row; 2383 gint row;
2376 gchar *source_base; 2384 gchar *source_base;
2377 gchar *dest_base; 2385 gchar *dest_base;
2402 g_free(dest_base); 2410 g_free(dest_base);
2403 2411
2404 return ret; 2412 return ret;
2405 } 2413 }
2406 2414
2407 gint vficon_maint_removed(ViewFile *vf, FileData *fd, GList *ignore_list) 2415 static gint vficon_maint_removed(ViewFile *vf, FileData *fd, GList *ignore_list)
2408 { 2416 {
2409 gint row; 2417 gint row;
2410 gint new_row = -1; 2418 gint new_row = -1;
2411 GtkTreeModel *store; 2419 GtkTreeModel *store;
2412 GtkTreeIter iter; 2420 GtkTreeIter iter;
2528 vf_send_update(vf); 2536 vf_send_update(vf);
2529 2537
2530 return TRUE; 2538 return TRUE;
2531 } 2539 }
2532 2540
2533 gint vficon_maint_moved(ViewFile *vf, FileData *fd, GList *ignore_list) 2541 static gint vficon_maint_moved(ViewFile *vf, FileData *fd, GList *ignore_list)
2534 { 2542 {
2535 gint ret = FALSE; 2543 gint ret = FALSE;
2536 gchar *buf; 2544 gchar *buf;
2537 2545
2538 if (!fd->change->source || !vf->dir_fd) return FALSE; 2546 if (!fd->change->source || !vf->dir_fd) return FALSE;
2546 2554
2547 g_free(buf); 2555 g_free(buf);
2548 2556
2549 return ret; 2557 return ret;
2550 } 2558 }
2559
2560 static void vficon_notify_cb(FileData *fd, gpointer data)
2561 {
2562 ViewFile *vf = data;
2563
2564 if (!fd->change) return;
2565
2566 switch(fd->change->type)
2567 {
2568 case FILEDATA_CHANGE_MOVE:
2569 vficon_maint_moved(vf, fd, NULL);
2570 break;
2571 case FILEDATA_CHANGE_COPY:
2572 break;
2573 case FILEDATA_CHANGE_RENAME:
2574 vficon_maint_renamed(vf, fd);
2575 break;
2576 case FILEDATA_CHANGE_DELETE:
2577 vficon_maint_removed(vf, fd, NULL);
2578 break;
2579 case FILEDATA_CHANGE_UNSPECIFIED:
2580 break;
2581 }
2582
2583 }