comparison src/view_file_icon.c @ 812:d29c2d191c58

use vficon_refresh for updating
author nadvornik
date Mon, 09 Jun 2008 19:41:37 +0000
parents f1ce59985518
children 721c2bbaceec
comparison
equal deleted inserted replaced
811:f1ce59985518 812:d29c2d191c58
82 if (chk->fd == fd) id = chk; 82 if (chk->fd == fd) id = chk;
83 } 83 }
84 return id; 84 return id;
85 } 85 }
86 86
87 87 #if 0
88 /* not used */
88 static gint iconlist_read(FileData *dir_fd, GList **list) 89 static gint iconlist_read(FileData *dir_fd, GList **list)
89 { 90 {
90 GList *temp; 91 GList *temp;
91 GList *work; 92 GList *work;
92 93
112 113
113 *list = temp; 114 *list = temp;
114 115
115 return TRUE; 116 return TRUE;
116 } 117 }
118 #endif
117 119
118 static void iconlist_free(GList *list) 120 static void iconlist_free(GList *list)
119 { 121 {
120 GList *work = list; 122 GList *work = list;
121 while (work) 123 while (work)
1746 VFICON_INFO(vf, rows) = r; 1748 VFICON_INFO(vf, rows) = r;
1747 1749
1748 vficon_update_focus(vf); 1750 vficon_update_focus(vf);
1749 } 1751 }
1750 1752
1751 static gint vficon_sync_idle_cb(gpointer data) 1753 static gint vficon_refresh_idle_cb(gpointer data)
1752 { 1754 {
1753 ViewFile *vf = data; 1755 ViewFile *vf = data;
1754 1756
1755 if (VFICON_INFO(vf, sync_idle_id) == -1) return FALSE; 1757 vficon_refresh(vf);
1756 VFICON_INFO(vf, sync_idle_id) = -1; 1758 vf->refresh_idle_id = -1;
1757
1758 vficon_sync(vf);
1759 return FALSE; 1759 return FALSE;
1760 } 1760 }
1761 1761
1762 static void vficon_refresh_idle_cancel(ViewFile *vf)
1763 {
1764 if (vf->refresh_idle_id != -1) g_source_remove(vf->refresh_idle_id);
1765 vf->refresh_idle_id = -1;
1766 }
1767
1768 #if 0
1762 static void vficon_sync_idle(ViewFile *vf) 1769 static void vficon_sync_idle(ViewFile *vf)
1763 { 1770 {
1764 if (VFICON_INFO(vf, sync_idle_id) == -1) 1771 if (VFICON_INFO(vf, sync_idle_id) == -1)
1765 { 1772 {
1766 /* high priority, the view needs to be resynced before a redraw 1773 /* high priority, the view needs to be resynced before a redraw
1767 * may contain invalid pointers at this time 1774 * may contain invalid pointers at this time
1768 */ 1775 */
1769 VFICON_INFO(vf, sync_idle_id) = g_idle_add_full(G_PRIORITY_HIGH, vficon_sync_idle_cb, vf, NULL); 1776 VFICON_INFO(vf, sync_idle_id) = g_idle_add_full(G_PRIORITY_HIGH, vficon_sync_idle_cb, vf, NULL);
1770 } 1777 }
1771 } 1778 }
1779 #endif
1772 1780
1773 static void vficon_sized_cb(GtkWidget *widget, GtkAllocation *allocation, gpointer data) 1781 static void vficon_sized_cb(GtkWidget *widget, GtkAllocation *allocation, gpointer data)
1774 { 1782 {
1775 ViewFile *vf = data; 1783 ViewFile *vf = data;
1776 1784
2331 2339
2332 void vficon_destroy_cb(GtkWidget *widget, gpointer data) 2340 void vficon_destroy_cb(GtkWidget *widget, gpointer data)
2333 { 2341 {
2334 ViewFile *vf = data; 2342 ViewFile *vf = data;
2335 2343
2336 if (VFICON_INFO(vf, sync_idle_id) != -1) g_source_remove(VFICON_INFO(vf, sync_idle_id)); 2344 vficon_refresh_idle_cancel(vf);
2337 2345
2338 file_data_unregister_notify_func(vficon_notify_cb, vf); 2346 file_data_unregister_notify_func(vficon_notify_cb, vf);
2339 2347
2340 tip_unschedule(vf); 2348 tip_unschedule(vf);
2341 2349
2363 VFICON_INFO(vf, focus_column) = 0; 2371 VFICON_INFO(vf, focus_column) = 0;
2364 VFICON_INFO(vf, focus_id) = NULL; 2372 VFICON_INFO(vf, focus_id) = NULL;
2365 2373
2366 VFICON_INFO(vf, show_text) = options->show_icon_names; 2374 VFICON_INFO(vf, show_text) = options->show_icon_names;
2367 2375
2368 VFICON_INFO(vf, sync_idle_id) = -1; 2376 vf->refresh_idle_id = -1;
2369 2377
2370 store = gtk_list_store_new(1, G_TYPE_POINTER); 2378 store = gtk_list_store_new(1, G_TYPE_POINTER);
2371 vf->listview = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store)); 2379 vf->listview = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store));
2372 g_object_unref(store); 2380 g_object_unref(store);
2373 2381
2410 *----------------------------------------------------------------------------- 2418 *-----------------------------------------------------------------------------
2411 * maintenance (for rename, move, remove) 2419 * maintenance (for rename, move, remove)
2412 *----------------------------------------------------------------------------- 2420 *-----------------------------------------------------------------------------
2413 */ 2421 */
2414 2422
2423 static void vficon_notify_cb(FileData *fd, NotifyType type, gpointer data)
2424 {
2425 ViewFile *vf = data;
2426 gboolean refresh;
2427
2428 if (vf->refresh_idle_id != -1) return;
2429
2430 refresh = (fd == vf->dir_fd);
2431
2432 if (!refresh)
2433 {
2434 gchar *base = remove_level_from_path(fd->path);
2435 refresh = (strcmp(base, vf->dir_fd->path) == 0);
2436 g_free(base);
2437 }
2438
2439 if (type == NOTIFY_TYPE_CHANGE && fd->change)
2440 {
2441 if (!refresh && fd->change->dest)
2442 {
2443 gchar *dest_base = remove_level_from_path(fd->change->dest);
2444 refresh = (strcmp(dest_base, vf->dir_fd->path) == 0);
2445 g_free(dest_base);
2446 }
2447
2448 if (!refresh && fd->change->source)
2449 {
2450 gchar *source_base = remove_level_from_path(fd->change->source);
2451 refresh = (strcmp(source_base, vf->dir_fd->path) == 0);
2452 g_free(source_base);
2453 }
2454 }
2455
2456 if (refresh && vf->refresh_idle_id == -1)
2457 {
2458 vf->refresh_idle_id = g_idle_add(vficon_refresh_idle_cb, vf);
2459 }
2460 }
2461
2462
2463 #if 0
2415 static gint vficon_maint_find_closest(ViewFile *vf, gint row, gint count, GList *ignore_list) 2464 static gint vficon_maint_find_closest(ViewFile *vf, gint row, gint count, GList *ignore_list)
2416 { 2465 {
2417 GList *list = NULL; 2466 GList *list = NULL;
2418 GList *work; 2467 GList *work;
2419 gint rev = row - 1; 2468 gint rev = row - 1;
2679 case FILEDATA_CHANGE_UNSPECIFIED: 2728 case FILEDATA_CHANGE_UNSPECIFIED:
2680 break; 2729 break;
2681 } 2730 }
2682 2731
2683 } 2732 }
2733 #endif