comparison plugins/docklet/docklet.c @ 9813:81a9ddc3f415

[gaim-migrate @ 10684] See the ChangeLog. This is patch 1012676. It works around a WinGTK bug. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Sun, 22 Aug 2004 03:23:31 +0000
parents 4a15962c344a
children 8053a00136ea
comparison
equal deleted inserted replaced
9812:d56f24cc4dad 9813:81a9ddc3f415
83 { 83 {
84 gaim_accounts_auto_login(GAIM_GTK_UI); 84 gaim_accounts_auto_login(GAIM_GTK_UI);
85 } 85 }
86 86
87 #ifdef _WIN32 87 #ifdef _WIN32
88 /* This is workaround for a bug in windows GTK+. Clicking outside of the
89 parent menu (including on a submenu-item) close the whole menu before
90 the "activate" event is thrown for the given submenu-item. Fixed by
91 replacing "activate" by "button-release-event". */
92 static gboolean
93 docklet_menu_do_away_message(GtkWidget *widget, GdkEventButton *event, gpointer user_data)
94 {
95 do_away_message(widget, user_data);
96 return FALSE;
97 }
98
99 static gboolean
100 docklet_menu_create_away_mess(GtkWidget *widget, GdkEventButton *event, gpointer user_data)
101 {
102 create_away_mess(widget, user_data);
103 return FALSE;
104 }
105
88 /* This is a workaround for a bug in windows GTK+. Clicking outside of the 106 /* This is a workaround for a bug in windows GTK+. Clicking outside of the
89 menu does not get rid of it, so instead we get rid of it as soon as the 107 menu does not get rid of it, so instead we get rid of it as soon as the
90 pointer leaves the menu. */ 108 pointer leaves the menu. */
91 static gboolean 109 static gboolean
92 docklet_menu_leave(GtkWidget *menu, GdkEventCrossing *event, void *data) 110 docklet_menu_leave(GtkWidget *menu, GdkEventCrossing *event, void *data)
136 154
137 while (awy) { 155 while (awy) {
138 a = (struct away_message *)awy->data; 156 a = (struct away_message *)awy->data;
139 157
140 entry = gtk_menu_item_new_with_label(a->name); 158 entry = gtk_menu_item_new_with_label(a->name);
159 #ifdef _WIN32
160 g_signal_connect(G_OBJECT(entry), "button-release-event", G_CALLBACK(docklet_menu_do_away_message), a);
161 #else
141 g_signal_connect(G_OBJECT(entry), "activate", G_CALLBACK(do_away_message), a); 162 g_signal_connect(G_OBJECT(entry), "activate", G_CALLBACK(do_away_message), a);
163 #endif
142 gtk_menu_shell_append(GTK_MENU_SHELL(docklet_awaymenu), entry); 164 gtk_menu_shell_append(GTK_MENU_SHELL(docklet_awaymenu), entry);
143 165
144 awy = g_slist_next(awy); 166 awy = g_slist_next(awy);
145 } 167 }
146 168
147 if (away_messages) 169 if (away_messages)
148 gaim_separator(docklet_awaymenu); 170 gaim_separator(docklet_awaymenu);
149 171
150 entry = gtk_menu_item_new_with_label(_("New...")); 172 entry = gtk_menu_item_new_with_label(_("New..."));
173 #ifdef _WIN32
174 g_signal_connect(G_OBJECT(entry), "button-release-event", G_CALLBACK(docklet_menu_create_away_mess), NULL);
175 #else
151 g_signal_connect(G_OBJECT(entry), "activate", G_CALLBACK(create_away_mess), NULL); 176 g_signal_connect(G_OBJECT(entry), "activate", G_CALLBACK(create_away_mess), NULL);
177 #endif
152 gtk_menu_shell_append(GTK_MENU_SHELL(docklet_awaymenu), entry); 178 gtk_menu_shell_append(GTK_MENU_SHELL(docklet_awaymenu), entry);
153 179
154 entry = gtk_menu_item_new_with_label(_("Away")); 180 entry = gtk_menu_item_new_with_label(_("Away"));
155 gtk_menu_item_set_submenu(GTK_MENU_ITEM(entry), docklet_awaymenu); 181 gtk_menu_item_set_submenu(GTK_MENU_ITEM(entry), docklet_awaymenu);
156 gtk_menu_shell_append(GTK_MENU_SHELL(menu), entry); 182 gtk_menu_shell_append(GTK_MENU_SHELL(menu), entry);