Merge lp:~cyphermox/evolution-indicator/apply-patches into lp:evolution-indicator
- apply-patches
- Merge into trunk
Proposed by
Mathieu Trudel-Lapierre
Status: | Rejected |
---|---|
Rejected by: | Mathieu Trudel-Lapierre |
Proposed branch: | lp:~cyphermox/evolution-indicator/apply-patches |
Merge into: | lp:evolution-indicator |
Diff against target: |
666 lines (+115/-297) 2 files modified
configure.ac (+1/-1) src/evolution-indicator.c (+114/-296) |
To merge this branch: | bzr merge lp:~cyphermox/evolution-indicator/apply-patches |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Lars Karlitski (community) | Needs Fixing | ||
Review via email:
|
Commit message
Description of the change
Apply patches from the packaging branch.
To post a comment you must log in.
Unmerged revisions
- 88. By Mathieu Trudel-Lapierre
-
Port to evolution-
data-server API for 3.6; also port to libmessaging-menu. Thanks to Sebastien NOEL for the patch.
- 87. By Mathieu Trudel-Lapierre
-
Don't spam xsession-errors with debug level messages when starting the plugin.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'configure.ac' |
2 | --- configure.ac 2012-05-25 21:05:11 +0000 |
3 | +++ configure.ac 2012-11-19 14:10:27 +0000 |
4 | @@ -70,7 +70,6 @@ |
5 | AC_SUBST(GCC_FLAGS) |
6 | |
7 | PKG_CHECK_MODULES(DEPS, |
8 | - indicate-0.7 >= 0.6.90 |
9 | $EVOLUTION_PLUGIN |
10 | dbus-1 |
11 | dbus-glib-1 |
12 | @@ -81,6 +80,7 @@ |
13 | libebackend-1.2 |
14 | libsoup-2.4 |
15 | gconf-2.0 |
16 | + messaging-menu |
17 | ) |
18 | AC_SUBST(DEPS_CFLAGS) |
19 | AC_SUBST(DEPS_LIBS) |
20 | |
21 | === modified file 'src/evolution-indicator.c' |
22 | --- src/evolution-indicator.c 2012-05-25 21:05:11 +0000 |
23 | +++ src/evolution-indicator.c 2012-11-19 14:10:27 +0000 |
24 | @@ -28,6 +28,7 @@ |
25 | #include <glib/gprintf.h> |
26 | |
27 | #include <gconf/gconf.h> |
28 | +#include <gconf/gconf-client.h> |
29 | |
30 | #include <canberra.h> |
31 | #include <libnotify/notify.h> |
32 | @@ -44,9 +45,7 @@ |
33 | |
34 | #include <camel/camel.h> |
35 | |
36 | -#include <libindicate/server.h> |
37 | -#include <libindicate/indicator.h> |
38 | -#include <libindicate/indicator-messages.h> |
39 | +#include <messaging-menu.h> |
40 | |
41 | #include <unity.h> |
42 | |
43 | @@ -58,9 +57,6 @@ |
44 | #define SHOW_BUBBLE CONF_DIR"/show_bubble" |
45 | #define SHOW_NEW_IN_PANEL CONF_DIR"/show_new_messages_in_panel" |
46 | |
47 | -#define ACCOUNT_DIR "/apps/evolution/mail" |
48 | -#define ACCOUNTS ACCOUNT_DIR"/accounts" |
49 | - |
50 | #define EVOLUTION_DESKTOP_FILE "/usr/share/applications/evolution.desktop" |
51 | |
52 | #define UNREAD_DATA "unread" |
53 | @@ -71,7 +67,7 @@ |
54 | static GStaticMutex mlock = G_STATIC_MUTEX_INIT; |
55 | static GConfClient *client = NULL; |
56 | |
57 | -static IndicateServer *server = NULL; |
58 | +static MessagingMenuApp *mmapp = NULL; |
59 | static GSList *indicators = NULL; |
60 | static gint n_accounts = 0; |
61 | |
62 | @@ -91,7 +87,6 @@ |
63 | static guint play_sound_id = 0; |
64 | static guint show_bubble_id = 0; |
65 | static guint show_count_id = 0; |
66 | -static guint accounts_id = 0; |
67 | |
68 | static gint message_count = 0; |
69 | |
70 | @@ -101,29 +96,11 @@ |
71 | int e_plugin_lib_enable (EPlugin *ep, int enable); |
72 | GtkWidget * e_plugin_lib_get_configure_widget (EPlugin *ep); |
73 | |
74 | -static void show_evolution (gpointer arg0, guint timestamp, gpointer arg1); |
75 | +static void show_evolution (MessagingMenuApp *mmapp, const gchar *url, gpointer user_data); |
76 | |
77 | static void show_evolution_in_indicator_applet (void); |
78 | static void hide_evolution_in_indicator_applet (void); |
79 | |
80 | -typedef struct { |
81 | - gchar *url; |
82 | - gchar *name; |
83 | - gchar *parent; |
84 | - gchar *last_parent; |
85 | - |
86 | - gint reap_type; |
87 | - |
88 | - gboolean enabled; |
89 | - |
90 | -} ParserData; |
91 | - |
92 | -enum { |
93 | - REAP_NONE = 0, |
94 | - REAP_URL, |
95 | - REAP_NAME |
96 | -}; |
97 | - |
98 | static GtkWidget * |
99 | get_cfg_widget (void) |
100 | { |
101 | @@ -195,29 +172,6 @@ |
102 | return FALSE; |
103 | } |
104 | |
105 | -static gint |
106 | -get_indicator_unread_count (IndicateIndicator *indicator) |
107 | -{ |
108 | - return GPOINTER_TO_INT (g_object_get_data (G_OBJECT (indicator), |
109 | - UNREAD_DATA)); |
110 | -} |
111 | - |
112 | -static void |
113 | -set_indicator_unread_count (IndicateIndicator *indicator, gint count) |
114 | -{ |
115 | - gchar *count_str; |
116 | - |
117 | - count_str = g_strdup_printf ("%d", count); |
118 | - indicate_indicator_set_property (indicator, |
119 | - INDICATE_INDICATOR_MESSAGES_PROP_COUNT, |
120 | - count_str); |
121 | - g_object_set_data (G_OBJECT (indicator), |
122 | - UNREAD_DATA, |
123 | - GINT_TO_POINTER (count)); |
124 | - |
125 | - g_free (count_str); |
126 | -} |
127 | - |
128 | void |
129 | org_gnome_mail_new_notify (EPlugin *ep, EMEventTargetFolder *t) |
130 | { |
131 | @@ -240,50 +194,29 @@ |
132 | } |
133 | |
134 | if (evolution_is_focused ()) |
135 | -{ |
136 | + { |
137 | g_debug ("EI: Evolution is focused"); |
138 | return; |
139 | } |
140 | |
141 | - g_static_mutex_lock (&mlock); |
142 | + g_static_mutex_lock (&mlock); |
143 | |
144 | g_debug ("EI:mail_new_notify: %s", url); |
145 | |
146 | message_count += t->new; |
147 | - |
148 | + |
149 | if (show_count) |
150 | { |
151 | - IndicateIndicator *indicator = NULL; |
152 | - GSList *i; |
153 | - |
154 | - for (i = indicators; i; i = i->next) |
155 | - { |
156 | - IndicateIndicator *indi = i->data; |
157 | - |
158 | - if (g_strstr_len (url, |
159 | - -1, |
160 | - indicate_indicator_get_property (indi, "url"))) |
161 | - { |
162 | - indicator = indi; |
163 | - break; |
164 | - } |
165 | - } |
166 | - if (indicator) |
167 | - { |
168 | - gint count; |
169 | - |
170 | - count = get_indicator_unread_count (indicator); |
171 | - set_indicator_unread_count (indicator, count + t->new); |
172 | - |
173 | - indicate_indicator_set_property (indicator, |
174 | - INDICATE_INDICATOR_MESSAGES_PROP_ATTENTION, |
175 | - "true"); |
176 | - } |
177 | - else |
178 | - { |
179 | - g_warning ("EI: Unable to find account that matches %s", url); |
180 | - } |
181 | - } |
182 | + if (messaging_menu_app_has_source(MESSAGING_MENU_APP (mmapp), url)) |
183 | + { |
184 | + messaging_menu_app_set_source_count (MESSAGING_MENU_APP (mmapp), url, message_count); |
185 | + } |
186 | + else { |
187 | +// g_warning ("EI: Unable to find account that matches %s", url); |
188 | + messaging_menu_app_append_source_with_count (MESSAGING_MENU_APP (mmapp), url, NULL, camel_service_get_display_name(CAMEL_SERVICE (t->store)), message_count); |
189 | + } |
190 | + messaging_menu_app_draw_attention (MESSAGING_MENU_APP (mmapp), url); |
191 | + } |
192 | |
193 | update_unity_launcher_count (); |
194 | |
195 | @@ -356,16 +289,17 @@ |
196 | |
197 | for (i = indicators; i; i = i->next) |
198 | { |
199 | - IndicateIndicator *indicator = i->data; |
200 | - |
201 | - set_indicator_unread_count (indicator, 0); |
202 | - indicate_indicator_set_property (indicator, |
203 | - INDICATE_INDICATOR_MESSAGES_PROP_ATTENTION, |
204 | - "false"); |
205 | - |
206 | - g_debug ("EI: Setting %s to 0 unread messages", |
207 | - indicate_indicator_get_property (indicator, "name")); |
208 | - |
209 | + gchar *url = i->data; |
210 | + |
211 | + if (messaging_menu_app_has_source(MESSAGING_MENU_APP (mmapp), url)) |
212 | + { |
213 | + messaging_menu_app_remove_attention(MESSAGING_MENU_APP (mmapp), url); |
214 | + messaging_menu_app_set_source_count (MESSAGING_MENU_APP (mmapp), url, 0); |
215 | + g_debug ("EI: Setting %s to 0 unread messages", url); |
216 | + } |
217 | + else { |
218 | + g_warning ("EI: Unable to find account that matches %s", url); |
219 | + } |
220 | } |
221 | message_count = 0; |
222 | |
223 | @@ -377,22 +311,10 @@ |
224 | void |
225 | update_unity_launcher_count () |
226 | { |
227 | - GSList *i; |
228 | - int count = 0; |
229 | - |
230 | g_debug ("EI: update_unity_launcher_count"); |
231 | |
232 | - for (i = indicators; i; i = i->next) |
233 | - { |
234 | - IndicateIndicator *indicator = i->data; |
235 | - |
236 | - count = count + get_indicator_unread_count (indicator); |
237 | - |
238 | - g_debug ("EI: Setting count to %d unread messages", count); |
239 | - |
240 | - } |
241 | - unity_launcher_entry_set_count (launcher, count); |
242 | - if (count > 0) |
243 | + unity_launcher_entry_set_count (launcher, message_count); |
244 | + if (message_count > 0) |
245 | { |
246 | unity_launcher_entry_set_count_visible (launcher, TRUE); |
247 | } else { |
248 | @@ -447,12 +369,10 @@ |
249 | |
250 | if (show_count) |
251 | { |
252 | - indicate_server_show (server); |
253 | show_evolution_in_indicator_applet (); |
254 | } |
255 | else |
256 | { |
257 | - indicate_server_hide (server); |
258 | hide_evolution_in_indicator_applet (); |
259 | } |
260 | |
261 | @@ -475,130 +395,34 @@ |
262 | g_debug ("EI: Show Bubbles %s", show_bubble ? "true" : "false"); |
263 | } |
264 | |
265 | -static IndicateIndicator * |
266 | -find_indicator_for_url (GSList *indicator_list, const gchar *url) |
267 | +static gchar * |
268 | +find_indicator_url (GSList *indicator_list, const gchar *url) |
269 | { |
270 | GSList *i; |
271 | |
272 | for (i = indicator_list; i; i = i->next) |
273 | { |
274 | - IndicateIndicator *indicator = i->data; |
275 | + gchar *i_url = i->data; |
276 | |
277 | - if (g_strcmp0 (indicate_indicator_get_property (indicator, "url"), url) |
278 | + if (g_strcmp0 (i_url, url) |
279 | == 0) |
280 | - return indicator; |
281 | + return i_url; |
282 | } |
283 | return NULL; |
284 | } |
285 | |
286 | -static IndicateIndicator * |
287 | -create_indicator (const gchar *url, const gchar *name) |
288 | -{ |
289 | - IndicateIndicator *indicator; |
290 | - |
291 | - indicator = indicate_indicator_new (); |
292 | - indicate_indicator_set_property (indicator, |
293 | - INDICATE_INDICATOR_MESSAGES_PROP_NAME, |
294 | - name); |
295 | - indicate_indicator_set_property (indicator, |
296 | - "url", |
297 | - url); |
298 | - set_indicator_unread_count (indicator, 0); |
299 | - indicate_indicator_show (indicator); |
300 | - |
301 | - /* FIXME: I need to find a way to show a mailbox individually */ |
302 | - g_signal_connect (indicator, "user-display", |
303 | - G_CALLBACK (show_evolution), NULL); |
304 | - |
305 | - g_debug ("EI: New Indicator: %s %s", name, url); |
306 | - |
307 | - return indicator; |
308 | -} |
309 | - |
310 | -static void |
311 | -start_element_handler (GMarkupParseContext *context, |
312 | - const gchar *element_name, |
313 | - const gchar **attribute_names, |
314 | - const gchar **attribute_values, |
315 | - gpointer user_data, |
316 | - GError **error) |
317 | -{ |
318 | - ParserData *data = (ParserData *)user_data; |
319 | - |
320 | - if (g_strcmp0 (element_name, "account") == 0) |
321 | - { |
322 | - gint i = 0; |
323 | - |
324 | - while (attribute_names[i] != NULL) |
325 | - { |
326 | - if (g_strcmp0 (attribute_names[i], "name") == 0) |
327 | - { |
328 | - data->name = g_strdup (attribute_values[i]); |
329 | - } |
330 | - else if (g_strcmp0 (attribute_names[i], "enabled") == 0) |
331 | - { |
332 | - if (g_strcmp0 (attribute_values[i], "false") == 0) |
333 | - data->enabled = FALSE; |
334 | - } |
335 | - i++; |
336 | - } |
337 | - } |
338 | - else if (g_strcmp0 (element_name, "url") == 0) |
339 | - data->reap_type = REAP_URL; |
340 | - else |
341 | - data->reap_type = REAP_NONE; |
342 | - |
343 | - if (data->last_parent) |
344 | - g_free (data->last_parent); |
345 | - |
346 | - data->last_parent = data->parent; |
347 | - data->parent = g_strdup (element_name); |
348 | -} |
349 | - |
350 | -static void |
351 | -text_handler (GMarkupParseContext *context, |
352 | - const gchar *text, |
353 | - gsize text_len, |
354 | - gpointer user_data, |
355 | - GError **error) |
356 | -{ |
357 | - ParserData *data = (ParserData *)user_data; |
358 | - |
359 | - if (!data->url |
360 | - && data->reap_type == REAP_URL |
361 | - && g_strcmp0(data->last_parent, "source") == 0) |
362 | - { |
363 | - gchar **tokens; |
364 | - |
365 | - tokens = g_strsplit (text, ";", 2); |
366 | - |
367 | - data->url = g_strdup (tokens[0]); |
368 | - |
369 | - /* Accounts with no configured way to receive mail will not have a URL */ |
370 | - if (!data->url) |
371 | - data->enabled = FALSE; |
372 | - |
373 | - g_strfreev (tokens); |
374 | - } |
375 | -} |
376 | - |
377 | static void |
378 | update_accounts (void) |
379 | { |
380 | - GSList *accounts; |
381 | + ESourceRegistry * registry = NULL; |
382 | GError *error = NULL; |
383 | - gint i = 1; |
384 | - GTimeVal timeval = { 0 }; |
385 | - |
386 | - g_get_current_time (&timeval); |
387 | - accounts = gconf_client_get_list (client, |
388 | - ACCOUNTS, |
389 | - GCONF_VALUE_STRING, |
390 | - &error); |
391 | - if (accounts == NULL || error) |
392 | + |
393 | + registry = e_source_registry_new_sync (NULL, &error); |
394 | + |
395 | + if (!registry || error) |
396 | { |
397 | - g_warning ("EI: Unable to determine number of accounts, " |
398 | - "defaulting to '1' (%s)", |
399 | + g_warning ("Failed to get access to source registry: %s\n" |
400 | + "defaulting number of account to '1'", |
401 | error ? error->message : "unknown"); |
402 | if (error) |
403 | g_error_free (error); |
404 | @@ -610,83 +434,75 @@ |
405 | } |
406 | else |
407 | { |
408 | + GSList *accounts = e_source_registry_list_sources (registry, E_SOURCE_EXTENSION_MAIL_ACCOUNT); |
409 | GSList *old_list; |
410 | GSList *a; |
411 | - static GMarkupParser parser = { |
412 | - start_element_handler, |
413 | - NULL, |
414 | - text_handler, |
415 | - NULL, |
416 | - NULL |
417 | - }; |
418 | + struct accountData { |
419 | + gchar *name; |
420 | + gchar *protocol; |
421 | + gchar *user; |
422 | + gchar *host; |
423 | + guint16 port; |
424 | + gchar *url; |
425 | + } data; |
426 | |
427 | old_list = indicators; |
428 | indicators = NULL; |
429 | |
430 | for (a = accounts; a; a = a->next) |
431 | { |
432 | - gchar *account_info = a->data; |
433 | - GMarkupParseContext *context; |
434 | - ParserData data = { NULL, NULL, NULL, NULL, 0, TRUE }; |
435 | - IndicateIndicator *indicator; |
436 | - |
437 | - /* Parse account XML to get some useful details about the account */ |
438 | - context = g_markup_parse_context_new (&parser, 0, &data, NULL); |
439 | - g_markup_parse_context_parse (context, |
440 | - account_info, |
441 | - strlen (account_info), |
442 | - NULL); |
443 | + gchar *url; |
444 | + ESource *source = E_SOURCE (a->data); |
445 | + if (e_source_get_removable(source) && e_source_get_enabled(source)) |
446 | + { |
447 | + ESourceExtension *extension; |
448 | + |
449 | + extension = e_source_get_extension(source, E_SOURCE_EXTENSION_MAIL_ACCOUNT); |
450 | + data.protocol = e_source_backend_dup_backend_name ((ESourceBackend *)extension); |
451 | + extension = e_source_get_extension(source, E_SOURCE_EXTENSION_AUTHENTICATION); |
452 | + data.user = e_source_authentication_dup_user ((ESourceAuthentication *)extension); |
453 | + data.host = e_source_authentication_dup_host ((ESourceAuthentication *)extension); |
454 | + data.port = e_source_authentication_get_port ((ESourceAuthentication *)extension); |
455 | + |
456 | + if(g_str_has_prefix (data.protocol, "pop")) { |
457 | + data.name = g_dgettext (EVO_I18N_DOMAIN, "Inbox"); |
458 | + data.url = g_strdup_printf("%s", "pop:"); |
459 | + } else { |
460 | + data.name = e_source_dup_display_name(source); |
461 | + data.url = g_strdup_printf("%s://%s@%s:%d", data.protocol, g_uri_escape_string(data.user, NULL, FALSE), data.host, data.port); |
462 | + } |
463 | |
464 | /* Check to see account already exists and, if not, create it */ |
465 | - indicator = find_indicator_for_url (indicators, data.url); |
466 | - if (indicator) |
467 | + url = find_indicator_url (indicators, data.url); |
468 | + if (url) |
469 | { |
470 | - old_list = g_slist_remove (old_list, indicator); |
471 | - indicators = g_slist_append (indicators, indicator); |
472 | + old_list = g_slist_remove (old_list, url); |
473 | + indicators = g_slist_append (indicators, url); |
474 | } |
475 | else |
476 | { |
477 | - if (data.url && g_str_has_prefix (data.url, "pop:")) |
478 | - { |
479 | - indicator = create_indicator ("pop:", |
480 | - g_dgettext (EVO_I18N_DOMAIN, |
481 | - "Inbox")); |
482 | - } |
483 | - else |
484 | - { |
485 | - indicator = create_indicator (data.url, data.name); |
486 | - } |
487 | - indicators = g_slist_append (indicators, indicator); |
488 | - |
489 | + messaging_menu_app_append_source (MESSAGING_MENU_APP (mmapp), data.url, NULL, data.name); |
490 | + indicators = g_slist_append (indicators, g_strdup(data.url)); |
491 | g_debug ("EI: New account: %s (%s)", data.name, data.url); |
492 | } |
493 | |
494 | - if (!data.enabled) |
495 | - indicate_indicator_hide (indicator); |
496 | - |
497 | - /* Fake a time */ |
498 | - g_time_val_add (&timeval, -1000000 * 60 * i); |
499 | - indicate_indicator_set_property_time (indicator, |
500 | - INDICATE_INDICATOR_MESSAGES_PROP_TIME, |
501 | - &timeval); |
502 | - |
503 | - i++; |
504 | + messaging_menu_app_set_source_time (MESSAGING_MENU_APP (mmapp), |
505 | + data.url, g_get_real_time ()); |
506 | |
507 | /* Clean up */ |
508 | g_free (data.url); |
509 | g_free (data.name); |
510 | - g_free (data.parent); |
511 | - g_free (data.last_parent); |
512 | - data.reap_type = REAP_NONE; |
513 | - data.enabled = TRUE; |
514 | - |
515 | - g_markup_parse_context_free (context); |
516 | + g_free (data.protocol); |
517 | + g_free (data.user); |
518 | + g_free (data.host); |
519 | + |
520 | + } |
521 | } |
522 | |
523 | g_slist_foreach (old_list, (GFunc)g_object_unref, NULL); |
524 | g_slist_free (old_list); |
525 | |
526 | - n_accounts = g_slist_length (accounts); |
527 | + n_accounts = g_slist_length (indicators); |
528 | g_slist_free (accounts); |
529 | } |
530 | |
531 | @@ -715,11 +531,19 @@ |
532 | return; |
533 | } |
534 | |
535 | +void no_debug_log (const gchar *log_domain, GLogLevelFlags log_level, |
536 | + const gchar *message, gpointer user_data) |
537 | +{ |
538 | + return; |
539 | +} |
540 | + |
541 | int |
542 | e_plugin_lib_enable (EPlugin *ep, int enable) |
543 | { |
544 | is_active = enable; |
545 | |
546 | + g_log_set_default_handler (no_debug_log, NULL); |
547 | + |
548 | if (is_active) |
549 | { |
550 | if (notification == NULL) |
551 | @@ -748,11 +572,9 @@ |
552 | } |
553 | } |
554 | |
555 | - server = indicate_server_ref_default (); |
556 | - indicate_server_set_type (server, "message"); |
557 | - indicate_server_set_desktop_file (server, EVOLUTION_DESKTOP_FILE); |
558 | - g_signal_connect (server, "server-display", |
559 | - G_CALLBACK (show_evolution), NULL); |
560 | + mmapp = messaging_menu_app_new ("evolution.desktop"); |
561 | + messaging_menu_app_register (MESSAGING_MENU_APP (mmapp)); |
562 | + g_signal_connect (mmapp, "activate-source", G_CALLBACK (show_evolution), NULL); |
563 | |
564 | DbusmenuServer * menu_server = dbusmenu_server_new("/messaging/commands"); |
565 | DbusmenuMenuitem * root = dbusmenu_menuitem_new(); |
566 | @@ -768,7 +590,6 @@ |
567 | dbusmenu_menuitem_child_append(root, mi); |
568 | |
569 | dbusmenu_server_set_root(menu_server, root); |
570 | - indicate_server_set_menu(server, menu_server); |
571 | |
572 | launcher = unity_launcher_entry_get_for_desktop_file (EVOLUTION_DESKTOP_FILE); |
573 | |
574 | @@ -797,20 +618,20 @@ |
575 | show_count_id = gconf_client_notify_add (client, SHOW_NEW_IN_PANEL, |
576 | show_new_in_panel_changed, NULL, NULL, NULL); |
577 | |
578 | - gconf_client_add_dir (client, ACCOUNT_DIR,GCONF_CLIENT_PRELOAD_NONE, NULL); |
579 | update_accounts (); |
580 | +/* |
581 | + TODO: find a way to be notify on account update |
582 | accounts_id = gconf_client_notify_add (client, ACCOUNTS, |
583 | on_accounts_changed, NULL, |
584 | NULL, NULL); |
585 | +*/ |
586 | |
587 | if (show_count) |
588 | { |
589 | - indicate_server_show (server); |
590 | show_evolution_in_indicator_applet (); |
591 | } |
592 | else |
593 | { |
594 | - indicate_server_hide (server); |
595 | hide_evolution_in_indicator_applet (); |
596 | } |
597 | } |
598 | @@ -820,20 +641,16 @@ |
599 | gconf_client_notify_remove (client, play_sound_id); |
600 | gconf_client_notify_remove (client, show_bubble_id); |
601 | gconf_client_notify_remove (client, show_count_id); |
602 | - gconf_client_notify_remove (client, accounts_id); |
603 | |
604 | g_object_unref (client); |
605 | client = NULL; |
606 | - |
607 | + |
608 | /* Free indicators */ |
609 | g_slist_foreach (indicators, (GFunc)g_object_unref, NULL); |
610 | g_slist_free (indicators); |
611 | indicators = NULL; |
612 | |
613 | - /* Free server */ |
614 | - indicate_server_hide (server); |
615 | - g_object_unref (server); |
616 | - server = NULL; |
617 | + g_object_unref (mmapp); |
618 | |
619 | /* Remove evolution from indicator menu */ |
620 | hide_evolution_in_indicator_applet (); |
621 | @@ -995,7 +812,7 @@ |
622 | */ |
623 | |
624 | static void |
625 | -show_evolution (gpointer arg0, guint timestamp, gpointer arg1) |
626 | +show_evolution (MessagingMenuApp *mmapp, const gchar *url, gpointer user_data) |
627 | { |
628 | #define MAIL_ICON "evolution-mail" |
629 | EShell *shell = e_shell_get_default (); |
630 | @@ -1014,7 +831,7 @@ |
631 | shell_window = E_SHELL_WINDOW (e_shell_get_active_window (shell)); |
632 | if (!evolution_is_focused ()) |
633 | { |
634 | - gtk_window_present_with_time (GTK_WINDOW (shell_window), timestamp); |
635 | + gtk_window_present (GTK_WINDOW (shell_window)); |
636 | } |
637 | |
638 | /* Switch to the mail view. */ |
639 | @@ -1025,16 +842,17 @@ |
640 | /* Setup the indicators */ |
641 | for (i = indicators; i; i = i->next) |
642 | { |
643 | - IndicateIndicator *indicator = i->data; |
644 | - |
645 | - set_indicator_unread_count (indicator, 0); |
646 | - indicate_indicator_set_property (indicator, |
647 | - INDICATE_INDICATOR_MESSAGES_PROP_ATTENTION, |
648 | - "false"); |
649 | - |
650 | - g_debug ("EI: Setting %s to 0 unread messages", |
651 | - indicate_indicator_get_property (indicator, "name")); |
652 | - |
653 | + gchar *url = i->data; |
654 | + |
655 | + if (messaging_menu_app_has_source(MESSAGING_MENU_APP (mmapp), url)) |
656 | + { |
657 | + messaging_menu_app_remove_attention(MESSAGING_MENU_APP (mmapp), url); |
658 | + messaging_menu_app_set_source_count (MESSAGING_MENU_APP (mmapp), url, 0); |
659 | + g_debug ("EI: Setting %s to 0 unread messages", url); |
660 | + } |
661 | + else { |
662 | + g_warning ("EI: Unable to find account that matches %s", url); |
663 | + } |
664 | } |
665 | message_count = 0; |
666 | update_unity_launcher_count (); |
I'm only commenting on the messagingmenu parts:
* in update_accounts(): don't add a source for each account. Sources should only be added when new messages are available
* in show_evolution(): there's no need to set source count to 0 (and in fact, that's wrong). Sources are removed by the messaging menu when the user activates them (same goes for draws-attention)
* in e_plugin_ lib_enable: messaging_ menu_app_ register is called when the plugin is disabled, but the call to _unregister when the plugin is disabled is missing. This way, evolution will stay in the messaging menu after disabling the plugin