Skip to content

Commit

Permalink
used new notification in search.c
Browse files Browse the repository at this point in the history
  • Loading branch information
nadvornik committed Jun 7, 2008
1 parent 7637e23 commit f745066
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 20 deletions.
31 changes: 18 additions & 13 deletions src/search.c
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ static gint search_result_count(SearchData *sd, gint64 *bytes);

static void search_window_close(SearchData *sd);

static void search_notify_cb(FileData *fd, NotifyType type, gpointer data);

/*
*-------------------------------------------------------------------
Expand Down Expand Up @@ -2530,6 +2531,8 @@ static void search_window_destroy_cb(GtkWidget *widget, gpointer data)
g_free(sd->search_similarity_path);
string_list_free(sd->search_keyword_list);

file_data_unregister_notify_func(search_notify_cb, sd);

g_free(sd);
}

Expand Down Expand Up @@ -2817,6 +2820,8 @@ void search_new(FileData *dir_fd, FileData *example_file)

search_window_list = g_list_append(search_window_list, sd);

file_data_register_notify_func(search_notify_cb, sd, NOTIFY_PRIORITY_MEDIUM);

gtk_widget_show(sd->window);
}

Expand Down Expand Up @@ -2859,21 +2864,21 @@ static void search_result_change_path(SearchData *sd, FileData *fd)
}
}

void search_maint_renamed(FileData *fd)
static void search_notify_cb(FileData *fd, NotifyType type, gpointer data)
{
GList *work;
SearchData *sd = data;

work = search_window_list;
while (work)
if (!fd->change) return;

switch(fd->change->type)
{
SearchData *sd = work->data;
work = work->next;

search_result_change_path(sd, fd);
case FILEDATA_CHANGE_MOVE:
case FILEDATA_CHANGE_RENAME:
case FILEDATA_CHANGE_DELETE:
search_result_change_path(sd, fd);
break;
case FILEDATA_CHANGE_COPY:
case FILEDATA_CHANGE_UNSPECIFIED:
break;
}
}

void search_maint_removed(FileData *fd)
{
search_maint_renamed(fd);
}
4 changes: 0 additions & 4 deletions src/search.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,4 @@
void search_new(FileData *dir_fd, FileData *example_file);


void search_maint_renamed(FileData *fd);
void search_maint_removed(FileData *fd);


#endif
3 changes: 0 additions & 3 deletions src/utilops.c
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,6 @@ void file_data_notify_ci(FileData *fd)

layout_maint_moved(fd, NULL);
view_window_maint_moved(fd);
search_maint_renamed(fd);
break;
case FILEDATA_CHANGE_COPY:
break;
Expand All @@ -256,12 +255,10 @@ void file_data_notify_ci(FileData *fd)

layout_maint_renamed(fd);
view_window_maint_moved(fd);
search_maint_renamed(fd);
break;
case FILEDATA_CHANGE_DELETE:
layout_maint_removed(fd, NULL);
view_window_maint_removed(fd, NULL);
search_maint_removed(fd);

collection_maint_removed(fd);
break;
Expand Down

0 comments on commit f745066

Please sign in to comment.