comparison src/view_file_list.c @ 775:85253619d522

vflist_maint(): only allocate memory and compare strings if needed.
author zas_
date Tue, 03 Jun 2008 07:37:24 +0000
parents f53c2bb5b1b1
children 44128da39e13
comparison
equal deleted inserted replaced
774:e095a66b428f 775:85253619d522
1860 *----------------------------------------------------------------------------- 1860 *-----------------------------------------------------------------------------
1861 */ 1861 */
1862 1862
1863 void vflist_maint(ViewFile *vf, FileData *fd) 1863 void vflist_maint(ViewFile *vf, FileData *fd)
1864 { 1864 {
1865 gchar *source_base; 1865 gboolean refresh;
1866 gchar *dest_base; 1866
1867
1868 if (vf->refresh_idle_id != -1) return; 1867 if (vf->refresh_idle_id != -1) return;
1869 1868
1870 source_base = remove_level_from_path(fd->change->source); 1869 refresh = (strcmp(fd->path, vf->path) == 0);
1871 dest_base = remove_level_from_path(fd->change->dest); 1870
1872 1871 if (!refresh)
1873 if (strcmp(source_base, vf->path) == 0 || 1872 {
1874 strcmp(dest_base, vf->path) == 0 || 1873 gchar *dest_base = remove_level_from_path(fd->change->dest);
1875 strcmp(fd->path, vf->path) == 0) 1874 refresh = (strcmp(dest_base, vf->path) == 0);
1875 g_free(dest_base);
1876 }
1877
1878 if (!refresh)
1879 {
1880 gchar *source_base = remove_level_from_path(fd->change->source);
1881 refresh = (strcmp(source_base, vf->path) == 0);
1882 g_free(source_base);
1883 }
1884
1885 if (refresh)
1876 { 1886 {
1877 vf->refresh_idle_id = g_idle_add(vflist_refresh_idle_cb, vf); 1887 vf->refresh_idle_id = g_idle_add(vflist_refresh_idle_cb, vf);
1878 } 1888 }
1879 g_free(source_base);
1880 g_free(dest_base);
1881 } 1889 }
1882 1890
1883 /* the plan is to drop these functions and use vflist_maint directly */ 1891 /* the plan is to drop these functions and use vflist_maint directly */
1884 1892
1885 gint vflist_maint_renamed(ViewFile *vf, FileData *fd) 1893 gint vflist_maint_renamed(ViewFile *vf, FileData *fd)