Mercurial > pidgin
comparison console/gntgaim.c @ 15561:d720141d70a2
s/gtk/gnt/g
author | Sadrul Habib Chowdhury <imadil@gmail.com> |
---|---|
date | Thu, 08 Feb 2007 06:15:28 +0000 |
parents | 1c4d0d3f4f5f |
children | 233c4a2f7b77 |
comparison
equal
deleted
inserted
replaced
15560:feee34cfff5f | 15561:d720141d70a2 |
---|---|
68 return &core_ops; | 68 return &core_ops; |
69 } | 69 } |
70 | 70 |
71 /* Anything IO-related is directly copied from gtkgaim's source tree */ | 71 /* Anything IO-related is directly copied from gtkgaim's source tree */ |
72 | 72 |
73 #define GAIM_GTK_READ_COND (G_IO_IN | G_IO_HUP | G_IO_ERR) | 73 #define GAIM_GNT_READ_COND (G_IO_IN | G_IO_HUP | G_IO_ERR) |
74 #define GAIM_GTK_WRITE_COND (G_IO_OUT | G_IO_HUP | G_IO_ERR | G_IO_NVAL) | 74 #define GAIM_GNT_WRITE_COND (G_IO_OUT | G_IO_HUP | G_IO_ERR | G_IO_NVAL) |
75 | 75 |
76 typedef struct _GaimGtkIOClosure { | 76 typedef struct _GaimGntIOClosure { |
77 GaimInputFunction function; | 77 GaimInputFunction function; |
78 guint result; | 78 guint result; |
79 gpointer data; | 79 gpointer data; |
80 | 80 |
81 } GaimGtkIOClosure; | 81 } GaimGntIOClosure; |
82 | 82 |
83 static void gaim_gnt_io_destroy(gpointer data) | 83 static void gaim_gnt_io_destroy(gpointer data) |
84 { | 84 { |
85 g_free(data); | 85 g_free(data); |
86 } | 86 } |
87 | 87 |
88 static gboolean gaim_gnt_io_invoke(GIOChannel *source, GIOCondition condition, gpointer data) | 88 static gboolean gaim_gnt_io_invoke(GIOChannel *source, GIOCondition condition, gpointer data) |
89 { | 89 { |
90 GaimGtkIOClosure *closure = data; | 90 GaimGntIOClosure *closure = data; |
91 GaimInputCondition gaim_cond = 0; | 91 GaimInputCondition gaim_cond = 0; |
92 | 92 |
93 if (condition & GAIM_GTK_READ_COND) | 93 if (condition & GAIM_GNT_READ_COND) |
94 gaim_cond |= GAIM_INPUT_READ; | 94 gaim_cond |= GAIM_INPUT_READ; |
95 if (condition & GAIM_GTK_WRITE_COND) | 95 if (condition & GAIM_GNT_WRITE_COND) |
96 gaim_cond |= GAIM_INPUT_WRITE; | 96 gaim_cond |= GAIM_INPUT_WRITE; |
97 | 97 |
98 #if 0 | 98 #if 0 |
99 gaim_debug(GAIM_DEBUG_MISC, "gtk_eventloop", | 99 gaim_debug(GAIM_DEBUG_MISC, "gtk_eventloop", |
100 "CLOSURE: callback for %d, fd is %d\n", | 100 "CLOSURE: callback for %d, fd is %d\n", |
105 if(! gaim_cond) { | 105 if(! gaim_cond) { |
106 #if DEBUG | 106 #if DEBUG |
107 gaim_debug_misc("gnt_eventloop", | 107 gaim_debug_misc("gnt_eventloop", |
108 "CLOSURE received GIOCondition of 0x%x, which does not" | 108 "CLOSURE received GIOCondition of 0x%x, which does not" |
109 " match 0x%x (READ) or 0x%x (WRITE)\n", | 109 " match 0x%x (READ) or 0x%x (WRITE)\n", |
110 condition, GAIM_GTK_READ_COND, GAIM_GTK_WRITE_COND); | 110 condition, GAIM_GNT_READ_COND, GAIM_GNT_WRITE_COND); |
111 #endif /* DEBUG */ | 111 #endif /* DEBUG */ |
112 | 112 |
113 return TRUE; | 113 return TRUE; |
114 } | 114 } |
115 #endif /* _WIN32 */ | 115 #endif /* _WIN32 */ |
121 } | 121 } |
122 | 122 |
123 static guint gnt_input_add(gint fd, GaimInputCondition condition, GaimInputFunction function, | 123 static guint gnt_input_add(gint fd, GaimInputCondition condition, GaimInputFunction function, |
124 gpointer data) | 124 gpointer data) |
125 { | 125 { |
126 GaimGtkIOClosure *closure = g_new0(GaimGtkIOClosure, 1); | 126 GaimGntIOClosure *closure = g_new0(GaimGntIOClosure, 1); |
127 GIOChannel *channel; | 127 GIOChannel *channel; |
128 GIOCondition cond = 0; | 128 GIOCondition cond = 0; |
129 | 129 |
130 closure->function = function; | 130 closure->function = function; |
131 closure->data = data; | 131 closure->data = data; |
132 | 132 |
133 if (condition & GAIM_INPUT_READ) | 133 if (condition & GAIM_INPUT_READ) |
134 cond |= GAIM_GTK_READ_COND; | 134 cond |= GAIM_GNT_READ_COND; |
135 if (condition & GAIM_INPUT_WRITE) | 135 if (condition & GAIM_INPUT_WRITE) |
136 cond |= GAIM_GTK_WRITE_COND; | 136 cond |= GAIM_GNT_WRITE_COND; |
137 | 137 |
138 channel = g_io_channel_unix_new(fd); | 138 channel = g_io_channel_unix_new(fd); |
139 closure->result = g_io_add_watch_full(channel, G_PRIORITY_DEFAULT, cond, | 139 closure->result = g_io_add_watch_full(channel, G_PRIORITY_DEFAULT, cond, |
140 gaim_gnt_io_invoke, closure, gaim_gnt_io_destroy); | 140 gaim_gnt_io_invoke, closure, gaim_gnt_io_destroy); |
141 | 141 |