annotate src/gtkmenutray.h @ 12116:e75ef7aa913e

[gaim-migrate @ 14416] " This patch implements a replacement for the queuing system from 1.x. It also obsoletes a previous patch [#1338873] I submitted to prioritize the unseen states in gtk conversations. The attached envelope.png is ripped from the msgunread.png already included in gaim. It should be dropped in the pixmaps directory (Makefile.am is updated accordingly in this patch). The two separate queuing preferences from 1.x, queuing messages while away and queuing all new messages (from docklet), are replaced with a single 3-way preference for conversations. The new preference is "Hide new IM conversations". This preference can be set to never, away and always. When a gtk conversation is created, it may be placed in a hidden conversation window instead of being placed normally. This decision is based upon the preference and possibly the away state of the account the conversation is being created for. This *will* effect conversations the user explicitly requests to be created, so in these cases the caller must be sure to present the conversation to the user, using gaim_gtkconv_present_conversation(). This is done already in gtkdialogs.c which handles creating conversations requested by the user from gaim proper (menus, double-clicking on budy in blist, etc.). The main advantage to not queuing messages is that the conversations exist, the message is written to the conversation (and logged if appropriate) and the unseen state is set on the conversation. This means no additional features are needed to track whether there are queued messages or not, just use the unseen state on conversations. Since conversations may not be visible (messages "queued"), gaim proper needs some notification that there are messages waiting. I opted for a menutray icon that shows up when an im conversation has an unseen message. Clicking this icon will focus (and show if hidden) the first conversation with an unseen message. This is essentially the same behavior of the docklet in cvs right now, except that the icon is only visible when there is a conversation with an unread message. The api that is added is flexible enough to allow either the docklet or the new blist menutray icon to be visible for conversations of any/all types and for unseen messages >= any state. Currently they are set to only IM conversations and only unseen states >= TEXT (system messages and no log messages will not trigger blinking the docklet or showing the blist tray icon), but these could be made preferences relatively easily in the future. Other plugins could probably benefit as well: gaim_gtk_conversations_get_first_unseen(). There is probably some limit to comment size, so I'll stop rambling now. If anyone has more questions/comments, catch me in #gaim, here or on gaim-devel." committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Wed, 16 Nov 2005 18:17:01 +0000
parents 34ea75bdd0c9
children fc464a0abccc
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
11553
5c8210f7cbe2 [gaim-migrate @ 13813]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
1 /**
5c8210f7cbe2 [gaim-migrate @ 13813]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
2 * @file gtkmenutray.h GTK+ Tray menu item
5c8210f7cbe2 [gaim-migrate @ 13813]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
3 * @ingroup gtkui
5c8210f7cbe2 [gaim-migrate @ 13813]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
4 *
5c8210f7cbe2 [gaim-migrate @ 13813]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
5 * Gaim is the legal property of its developers, whose names are too numerous
5c8210f7cbe2 [gaim-migrate @ 13813]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
6 * to list here. Please refer to the COPYRIGHT file distributed with this
5c8210f7cbe2 [gaim-migrate @ 13813]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
7 * source distribution.
5c8210f7cbe2 [gaim-migrate @ 13813]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
8 *
5c8210f7cbe2 [gaim-migrate @ 13813]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
9 * This program is free software; you can redistribute it and/or modify
5c8210f7cbe2 [gaim-migrate @ 13813]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
10 * under the terms of the GNU General Public License as published by
5c8210f7cbe2 [gaim-migrate @ 13813]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
11 * the Free Software Foundation; either version 2 of the License, or
5c8210f7cbe2 [gaim-migrate @ 13813]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
12 * (at your option) any later version.
5c8210f7cbe2 [gaim-migrate @ 13813]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
13 *
5c8210f7cbe2 [gaim-migrate @ 13813]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
14 * This program is distributed in the hope that it will be useful,
5c8210f7cbe2 [gaim-migrate @ 13813]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
5c8210f7cbe2 [gaim-migrate @ 13813]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5c8210f7cbe2 [gaim-migrate @ 13813]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
17 * GNU General Public License for more details.
5c8210f7cbe2 [gaim-migrate @ 13813]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
18 *
5c8210f7cbe2 [gaim-migrate @ 13813]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
19 * You should have received a copy of the GNU General Public License
5c8210f7cbe2 [gaim-migrate @ 13813]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
20 * along with this program; if not, write to the Free Software
5c8210f7cbe2 [gaim-migrate @ 13813]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
5c8210f7cbe2 [gaim-migrate @ 13813]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
22 */
5c8210f7cbe2 [gaim-migrate @ 13813]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
23 #ifndef GAIM_GTK_MENU_TRAY_H
5c8210f7cbe2 [gaim-migrate @ 13813]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
24 #define GAIM_GTK_MENU_TRAY_H
5c8210f7cbe2 [gaim-migrate @ 13813]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
25
5c8210f7cbe2 [gaim-migrate @ 13813]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
26 #include <gtk/gtkhbox.h>
5c8210f7cbe2 [gaim-migrate @ 13813]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
27 #include <gtk/gtkmenuitem.h>
11908
34ea75bdd0c9 [gaim-migrate @ 14199]
Richard Laager <rlaager@wiktel.com>
parents: 11599
diff changeset
28 #include <gtk/gtktooltips.h>
11553
5c8210f7cbe2 [gaim-migrate @ 13813]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
29
5c8210f7cbe2 [gaim-migrate @ 13813]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
30 #define GAIM_GTK_TYPE_MENU_TRAY (gaim_gtk_menu_tray_get_gtype())
5c8210f7cbe2 [gaim-migrate @ 13813]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
31 #define GAIM_GTK_MENU_TRAY(obj) (GTK_CHECK_CAST((obj), GAIM_GTK_TYPE_MENU_TRAY, GaimGtkMenuTray))
5c8210f7cbe2 [gaim-migrate @ 13813]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
32 #define GAIM_GTK_MENU_TRAY_CLASS(klass) (GTK_CHECK_CLASS_CAST((klass), GAIM_GTK_TYPE_MENU_TRAY, GaimGtkMenuTrayClass))
5c8210f7cbe2 [gaim-migrate @ 13813]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
33 #define GAIM_GTK_IS_MENU_TRAY(obj) (GTK_CHECK_TYPE((obj), GAIM_GTK_TYPE_MENU_TRAY))
5c8210f7cbe2 [gaim-migrate @ 13813]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
34 #define GAIM_GTK_IS_MENU_TRAY_CLASS(klass) (GTK_CHECK_CLASS_TYPE((klass), GAIM_GTK_TYPE_MENU_TRAY))
5c8210f7cbe2 [gaim-migrate @ 13813]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
35 #define GAIM_GTK_MENU_TRAY_GET_CLASS(obj) (GTK_CHECK_GET_CLASS((obj), GAIM_GTK_TYPE_MENU_TRAY, GaimGtkMenuTrayClass))
5c8210f7cbe2 [gaim-migrate @ 13813]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
36
5c8210f7cbe2 [gaim-migrate @ 13813]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
37 typedef struct _GaimGtkMenuTray GaimGtkMenuTray;
5c8210f7cbe2 [gaim-migrate @ 13813]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
38 typedef struct _GaimGtkMenuTrayClass GaimGtkMenuTrayClass;
5c8210f7cbe2 [gaim-migrate @ 13813]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
39
5c8210f7cbe2 [gaim-migrate @ 13813]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
40 /** A GaimGtkMenuTray */
5c8210f7cbe2 [gaim-migrate @ 13813]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
41 struct _GaimGtkMenuTray {
5c8210f7cbe2 [gaim-migrate @ 13813]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
42 GtkMenuItem gparent; /**< The parent instance */
11599
767e3c0c5062 [gaim-migrate @ 13869]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
43 GtkWidget *tray; /**< The tray */
11908
34ea75bdd0c9 [gaim-migrate @ 14199]
Richard Laager <rlaager@wiktel.com>
parents: 11599
diff changeset
44 GtkTooltips *tooltips; /**< Tooltips */
11553
5c8210f7cbe2 [gaim-migrate @ 13813]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
45 };
5c8210f7cbe2 [gaim-migrate @ 13813]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
46
5c8210f7cbe2 [gaim-migrate @ 13813]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
47 /** A GaimGtkMenuTrayClass */
5c8210f7cbe2 [gaim-migrate @ 13813]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
48 struct _GaimGtkMenuTrayClass {
5c8210f7cbe2 [gaim-migrate @ 13813]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
49 GtkMenuItemClass gparent; /**< The parent class */
5c8210f7cbe2 [gaim-migrate @ 13813]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
50 };
5c8210f7cbe2 [gaim-migrate @ 13813]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
51
5c8210f7cbe2 [gaim-migrate @ 13813]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
52 G_BEGIN_DECLS
5c8210f7cbe2 [gaim-migrate @ 13813]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
53
5c8210f7cbe2 [gaim-migrate @ 13813]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
54 /**
5c8210f7cbe2 [gaim-migrate @ 13813]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
55 * Registers the GaimGtkMenuTray class if necessary and returns the
5c8210f7cbe2 [gaim-migrate @ 13813]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
56 * type ID assigned to it.
5c8210f7cbe2 [gaim-migrate @ 13813]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
57 *
5c8210f7cbe2 [gaim-migrate @ 13813]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
58 * @return The GaimGtkMenuTray type ID
5c8210f7cbe2 [gaim-migrate @ 13813]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
59 */
5c8210f7cbe2 [gaim-migrate @ 13813]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
60 GType gaim_gtk_menu_tray_get_gtype(void);
5c8210f7cbe2 [gaim-migrate @ 13813]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
61
5c8210f7cbe2 [gaim-migrate @ 13813]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
62 /**
5c8210f7cbe2 [gaim-migrate @ 13813]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
63 * Creates a new GaimGtkMenuTray
5c8210f7cbe2 [gaim-migrate @ 13813]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
64 *
5c8210f7cbe2 [gaim-migrate @ 13813]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
65 * @return A new GaimGtkMenuTray
5c8210f7cbe2 [gaim-migrate @ 13813]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
66 */
5c8210f7cbe2 [gaim-migrate @ 13813]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
67 GtkWidget *gaim_gtk_menu_tray_new();
5c8210f7cbe2 [gaim-migrate @ 13813]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
68
5c8210f7cbe2 [gaim-migrate @ 13813]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
69 /**
5c8210f7cbe2 [gaim-migrate @ 13813]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
70 * Gets the box for the GaimGtkMenuTray
5c8210f7cbe2 [gaim-migrate @ 13813]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
71 *
5c8210f7cbe2 [gaim-migrate @ 13813]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
72 * @param menu_tray The GaimGtkMenuTray
5c8210f7cbe2 [gaim-migrate @ 13813]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
73 *
5c8210f7cbe2 [gaim-migrate @ 13813]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
74 * @return The box that this menu tray is using
5c8210f7cbe2 [gaim-migrate @ 13813]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
75 */
5c8210f7cbe2 [gaim-migrate @ 13813]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
76 GtkWidget *gaim_gtk_menu_tray_get_box(GaimGtkMenuTray *menu_tray);
5c8210f7cbe2 [gaim-migrate @ 13813]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
77
5c8210f7cbe2 [gaim-migrate @ 13813]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
78 /**
5c8210f7cbe2 [gaim-migrate @ 13813]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
79 * Appends a widget into the tray
5c8210f7cbe2 [gaim-migrate @ 13813]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
80 *
5c8210f7cbe2 [gaim-migrate @ 13813]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
81 * @param menu_tray The tray
5c8210f7cbe2 [gaim-migrate @ 13813]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
82 * @param widget The widget
11908
34ea75bdd0c9 [gaim-migrate @ 14199]
Richard Laager <rlaager@wiktel.com>
parents: 11599
diff changeset
83 * @param tooltip The tooltip for this widget (widget requires its own X-window)
11553
5c8210f7cbe2 [gaim-migrate @ 13813]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
84 */
11908
34ea75bdd0c9 [gaim-migrate @ 14199]
Richard Laager <rlaager@wiktel.com>
parents: 11599
diff changeset
85 void gaim_gtk_menu_tray_append(GaimGtkMenuTray *menu_tray, GtkWidget *widget, const char *tooltip);
11553
5c8210f7cbe2 [gaim-migrate @ 13813]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
86
5c8210f7cbe2 [gaim-migrate @ 13813]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
87 /**
5c8210f7cbe2 [gaim-migrate @ 13813]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
88 * Prepends a widget into the tray
5c8210f7cbe2 [gaim-migrate @ 13813]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
89 *
11908
34ea75bdd0c9 [gaim-migrate @ 14199]
Richard Laager <rlaager@wiktel.com>
parents: 11599
diff changeset
90 * @param menu_tray The tray
11553
5c8210f7cbe2 [gaim-migrate @ 13813]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
91 * @param widget The widget
11908
34ea75bdd0c9 [gaim-migrate @ 14199]
Richard Laager <rlaager@wiktel.com>
parents: 11599
diff changeset
92 * @param tooltip The tooltip for this widget (widget requires its own X-window)
11553
5c8210f7cbe2 [gaim-migrate @ 13813]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
93 */
11908
34ea75bdd0c9 [gaim-migrate @ 14199]
Richard Laager <rlaager@wiktel.com>
parents: 11599
diff changeset
94 void gaim_gtk_menu_tray_prepend(GaimGtkMenuTray *menu_tray, GtkWidget *widget, const char *tooltip);
34ea75bdd0c9 [gaim-migrate @ 14199]
Richard Laager <rlaager@wiktel.com>
parents: 11599
diff changeset
95
34ea75bdd0c9 [gaim-migrate @ 14199]
Richard Laager <rlaager@wiktel.com>
parents: 11599
diff changeset
96 /**
34ea75bdd0c9 [gaim-migrate @ 14199]
Richard Laager <rlaager@wiktel.com>
parents: 11599
diff changeset
97 * Set the tooltip for a widget
34ea75bdd0c9 [gaim-migrate @ 14199]
Richard Laager <rlaager@wiktel.com>
parents: 11599
diff changeset
98 *
34ea75bdd0c9 [gaim-migrate @ 14199]
Richard Laager <rlaager@wiktel.com>
parents: 11599
diff changeset
99 * @param menu_tray The tray
34ea75bdd0c9 [gaim-migrate @ 14199]
Richard Laager <rlaager@wiktel.com>
parents: 11599
diff changeset
100 * @param widget The widget
34ea75bdd0c9 [gaim-migrate @ 14199]
Richard Laager <rlaager@wiktel.com>
parents: 11599
diff changeset
101 * @param tooltip The tooltip to set for the widget (widget requires its own X-window)
34ea75bdd0c9 [gaim-migrate @ 14199]
Richard Laager <rlaager@wiktel.com>
parents: 11599
diff changeset
102 */
34ea75bdd0c9 [gaim-migrate @ 14199]
Richard Laager <rlaager@wiktel.com>
parents: 11599
diff changeset
103 void gaim_gtk_menu_tray_set_tooltip(GaimGtkMenuTray *menu_tray, GtkWidget *widget, const char *tooltip);
11553
5c8210f7cbe2 [gaim-migrate @ 13813]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
104
5c8210f7cbe2 [gaim-migrate @ 13813]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
105 G_END_DECLS
5c8210f7cbe2 [gaim-migrate @ 13813]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
106
5c8210f7cbe2 [gaim-migrate @ 13813]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
107 #endif /* GAIM_GTK_MENU_TRAY_H */