Changeset 5eb392f


Ignore:
Timestamp:
Mar 25, 2011, 3:46:46 AM (14 years ago)
Author:
David Benjamin <davidben@mit.edu>
Children:
cd28517
Parents:
7b2686d
git-author:
David Benjamin <davidben@mit.edu> (02/25/11 22:06:45)
git-committer:
David Benjamin <davidben@mit.edu> (03/25/11 03:46:46)
Message:
Also make owl_process_messages a GSource
File:
1 edited

Legend:

Unmodified
Added
Removed
  • owl.c

    r7b2686d r5eb392f  
    166166 * was ignored due to user settings or otherwise.
    167167 */
    168 int owl_process_message(owl_message *m) {
     168static int owl_process_message(owl_message *m) {
    169169  const owl_filter *f;
    170170  /* if this message it on the puntlist, nuke it and continue */
     
    251251}
    252252
     253static gboolean owl_process_messages_prepare(GSource *source, int *timeout) {
     254  *timeout = -1;
     255  return owl_global_messagequeue_pending(&g);
     256}
     257
     258static gboolean owl_process_messages_check(GSource *source) {
     259  return owl_global_messagequeue_pending(&g);
     260}
     261
    253262/*
    254263 * Process any new messages we have waiting in the message queue.
    255  * Returns 1 if any messages were added to the message list, and 0 otherwise.
    256264 */
    257 int owl_process_messages(owl_ps_action *d, void *p)
    258 {
     265static gboolean owl_process_messages_dispatch(GSource *source, GSourceFunc callback, gpointer user_data) {
    259266  int newmsgs=0;
    260267  int followlast = owl_global_should_followlast(&g);
     
    280287    owl_mainwin_redisplay(owl_global_get_mainwin(&g));
    281288  }
    282   return newmsgs;
    283 }
     289  return TRUE;
     290}
     291
     292static GSourceFuncs owl_process_messages_funcs = {
     293  owl_process_messages_prepare,
     294  owl_process_messages_check,
     295  owl_process_messages_dispatch,
     296  NULL
     297};
    284298
    285299void owl_process_input(const owl_io_dispatch *d, void *data)
     
    573587  g_source_unref(source);
    574588
    575   owl_select_add_pre_select_action(owl_process_messages, NULL, NULL);
     589  source = g_source_new(&owl_process_messages_funcs, sizeof(GSource));
     590  g_source_attach(source, NULL);
     591  g_source_unref(source);
     592
    576593  owl_select_add_pre_select_action(owl_errsignal_pre_select_action, NULL, NULL);
    577594
Note: See TracChangeset for help on using the changeset viewer.