Skip to content

Commit

Permalink
call notify functions in in an idle call
Browse files Browse the repository at this point in the history
  • Loading branch information
nadvornik committed Oct 2, 2011
1 parent 5276a3f commit 78cde69
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions src/filedata.c
Original file line number Diff line number Diff line change
Expand Up @@ -2524,6 +2524,12 @@ GList *file_data_process_groups_in_selection(GList *list, gboolean ungroup, GLis
implementation in view_file_list.c */


typedef struct _NotifyIdleData NotifyIdleData;

struct _NotifyIdleData {
FileData *fd;
NotifyType type;
};


typedef struct _NotifyData NotifyData;
Expand Down Expand Up @@ -2597,17 +2603,29 @@ gboolean file_data_unregister_notify_func(FileDataNotifyFunc func, gpointer data
}


void file_data_send_notification(FileData *fd, NotifyType type)
gboolean file_data_send_notification_idle_cb(gpointer data)
{
NotifyIdleData *nid = (NotifyIdleData *)data;
GList *work = notify_func_list;

while (work)
{
NotifyData *nd = (NotifyData *)work->data;

nd->func(fd, type, nd->data);
nd->func(nid->fd, nid->type, nd->data);
work = work->next;
}
file_data_unref(nid->fd);
g_free(nid);
return FALSE;
}

void file_data_send_notification(FileData *fd, NotifyType type)
{
NotifyIdleData *nid = g_new0(NotifyIdleData, 1);
nid->fd = file_data_ref(fd);
nid->type = type;
g_idle_add_full(G_PRIORITY_HIGH, file_data_send_notification_idle_cb, nid, NULL);
}

static GHashTable *file_data_monitor_pool = NULL;
Expand Down

0 comments on commit 78cde69

Please sign in to comment.