Fri, 06 Jan 2006 04:46:00 +0000
[gaim-migrate @ 15091]
" Adds an emblem to a buddy if they have a queued message
(hidden conversation). In the large buddy list it is
added in the northwest corner, sliding the existing
northwest emblem (if specified) to the northeast
position and discarding the northeast emblem. In the
small buddy list, the emblem is added to the southeast.
Attached is a patch and an emblem image to be dropped
in pixmaps/status/default/. The emblem image is a
scaled down version of the send-im.png image." -- Casey Harkins
as I asked for this patch, and since there don't seem to be objections to
it (yet), I'm going ahead and applying it.
committer: Luke Schierer <lschiere@pidgin.im>
| 8273 | 1 | /** |
| 2 | * @file gtk_eventloop.c Gaim Event Loop API (gtk implementation) | |
| 3 | * @ingroup gtkui | |
| 4 | * | |
| 5 | * gaim | |
| 6 | * | |
| 7 | * Gaim is the legal property of its developers, whose names are too numerous | |
| 8 | * to list here. Please refer to the COPYRIGHT file distributed with this | |
| 9 | * source distribution. | |
| 10 | * | |
| 11 | * This program is free software; you can redistribute it and/or modify | |
| 12 | * it under the terms of the GNU General Public License as published by | |
| 13 | * the Free Software Foundation; either version 2 of the License, or | |
| 14 | * (at your option) any later version. | |
| 15 | * | |
| 16 | * This program is distributed in the hope that it will be useful, | |
| 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 19 | * GNU General Public License for more details. | |
| 20 | * | |
| 21 | * You should have received a copy of the GNU General Public License | |
| 22 | * along with this program; if not, write to the Free Software | |
| 23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| 24 | */ | |
| 25 | ||
| 26 | #include <glib.h> | |
| 27 | #include "gtkeventloop.h" | |
| 28 | #include "eventloop.h" | |
| 29 | ||
| 30 | #define GAIM_GTK_READ_COND (G_IO_IN | G_IO_HUP | G_IO_ERR) | |
| 31 | #define GAIM_GTK_WRITE_COND (G_IO_OUT | G_IO_HUP | G_IO_ERR | G_IO_NVAL) | |
| 32 | ||
| 33 | typedef struct _GaimGtkIOClosure { | |
| 34 | GaimInputFunction function; | |
| 35 | guint result; | |
| 36 | gpointer data; | |
| 37 | ||
| 38 | } GaimGtkIOClosure; | |
| 39 | ||
| 40 | static void gaim_gtk_io_destroy(gpointer data) | |
| 41 | { | |
| 42 | g_free(data); | |
| 43 | } | |
| 44 | ||
| 45 | static gboolean gaim_gtk_io_invoke(GIOChannel *source, GIOCondition condition, gpointer data) | |
| 46 | { | |
| 47 | GaimGtkIOClosure *closure = data; | |
| 48 | GaimInputCondition gaim_cond = 0; | |
| 49 | ||
| 50 | if (condition & GAIM_GTK_READ_COND) | |
| 51 | gaim_cond |= GAIM_INPUT_READ; | |
| 52 | if (condition & GAIM_GTK_WRITE_COND) | |
| 53 | gaim_cond |= GAIM_INPUT_WRITE; | |
| 54 | ||
| 55 | #if 0 | |
| 56 | gaim_debug(GAIM_DEBUG_MISC, "gtk_eventloop", | |
| 57 | "CLOSURE: callback for %d, fd is %d\n", | |
| 58 | closure->result, g_io_channel_unix_get_fd(source)); | |
| 59 | #endif | |
| 60 | ||
|
11065
895342350443
[gaim-migrate @ 13046]
Christopher O'Brien <siege@pidgin.im>
parents:
8807
diff
changeset
|
61 | #ifdef _WIN32 |
|
895342350443
[gaim-migrate @ 13046]
Christopher O'Brien <siege@pidgin.im>
parents:
8807
diff
changeset
|
62 | if(! gaim_cond) { |
|
895342350443
[gaim-migrate @ 13046]
Christopher O'Brien <siege@pidgin.im>
parents:
8807
diff
changeset
|
63 | #if DEBUG |
|
895342350443
[gaim-migrate @ 13046]
Christopher O'Brien <siege@pidgin.im>
parents:
8807
diff
changeset
|
64 | gaim_debug(GAIM_DEBUG_MISC, "gtk_eventloop", |
|
895342350443
[gaim-migrate @ 13046]
Christopher O'Brien <siege@pidgin.im>
parents:
8807
diff
changeset
|
65 | "CLOSURE received GIOCondition of 0x%x, which does not" |
|
895342350443
[gaim-migrate @ 13046]
Christopher O'Brien <siege@pidgin.im>
parents:
8807
diff
changeset
|
66 | " match 0x%x (READ) or 0x%x (WRITE)\n", |
|
895342350443
[gaim-migrate @ 13046]
Christopher O'Brien <siege@pidgin.im>
parents:
8807
diff
changeset
|
67 | condition, GAIM_GTK_READ_COND, GAIM_GTK_WRITE_COND); |
|
895342350443
[gaim-migrate @ 13046]
Christopher O'Brien <siege@pidgin.im>
parents:
8807
diff
changeset
|
68 | #endif /* DEBUG */ |
|
895342350443
[gaim-migrate @ 13046]
Christopher O'Brien <siege@pidgin.im>
parents:
8807
diff
changeset
|
69 | |
|
895342350443
[gaim-migrate @ 13046]
Christopher O'Brien <siege@pidgin.im>
parents:
8807
diff
changeset
|
70 | return TRUE; |
|
895342350443
[gaim-migrate @ 13046]
Christopher O'Brien <siege@pidgin.im>
parents:
8807
diff
changeset
|
71 | } |
|
895342350443
[gaim-migrate @ 13046]
Christopher O'Brien <siege@pidgin.im>
parents:
8807
diff
changeset
|
72 | #endif /* _WIN32 */ |
|
895342350443
[gaim-migrate @ 13046]
Christopher O'Brien <siege@pidgin.im>
parents:
8807
diff
changeset
|
73 | |
|
895342350443
[gaim-migrate @ 13046]
Christopher O'Brien <siege@pidgin.im>
parents:
8807
diff
changeset
|
74 | closure->function(closure->data, g_io_channel_unix_get_fd(source), |
|
895342350443
[gaim-migrate @ 13046]
Christopher O'Brien <siege@pidgin.im>
parents:
8807
diff
changeset
|
75 | gaim_cond); |
| 8273 | 76 | |
| 77 | return TRUE; | |
| 78 | } | |
| 79 | ||
| 8280 | 80 | static guint gaim_gtk_input_add(gint fd, GaimInputCondition condition, GaimInputFunction function, |
| 8273 | 81 | gpointer data) |
| 82 | { | |
| 83 | GaimGtkIOClosure *closure = g_new0(GaimGtkIOClosure, 1); | |
| 84 | GIOChannel *channel; | |
| 85 | GIOCondition cond = 0; | |
| 86 | ||
| 87 | closure->function = function; | |
| 88 | closure->data = data; | |
| 89 | ||
| 90 | if (condition & GAIM_INPUT_READ) | |
| 91 | cond |= GAIM_GTK_READ_COND; | |
| 92 | if (condition & GAIM_INPUT_WRITE) | |
| 93 | cond |= GAIM_GTK_WRITE_COND; | |
| 94 | ||
| 8280 | 95 | channel = g_io_channel_unix_new(fd); |
| 8273 | 96 | closure->result = g_io_add_watch_full(channel, G_PRIORITY_DEFAULT, cond, |
| 97 | gaim_gtk_io_invoke, closure, gaim_gtk_io_destroy); | |
| 98 | ||
| 99 | #if 0 | |
| 100 | gaim_debug(GAIM_DEBUG_MISC, "gtk_eventloop", | |
| 101 | "CLOSURE: adding input watcher %d for fd %d\n", | |
| 8280 | 102 | closure->result, fd); |
| 8273 | 103 | #endif |
| 104 | ||
| 105 | g_io_channel_unref(channel); | |
| 106 | return closure->result; | |
| 107 | } | |
| 108 | ||
| 109 | static GaimEventLoopUiOps eventloop_ops = | |
| 110 | { | |
| 111 | g_timeout_add, | |
|
8470
100fc1feea95
[gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents:
8287
diff
changeset
|
112 | (guint (*)(guint))g_source_remove, |
| 8273 | 113 | gaim_gtk_input_add, |
| 8807 | 114 | (guint (*)(guint))g_source_remove |
| 8273 | 115 | }; |
| 116 | ||
| 117 | GaimEventLoopUiOps * | |
| 118 | gaim_gtk_eventloop_get_ui_ops(void) | |
| 119 | { | |
| 120 | return &eventloop_ops; | |
| 121 | } |