Merge lp:~xnox/ubuntu/raring/liferea/messaging-menu into lp:~xnox/ubuntu/raring/liferea/original

Proposed by Dimitri John Ledkov
Status: Needs review
Proposed branch: lp:~xnox/ubuntu/raring/liferea/messaging-menu
Merge into: lp:~xnox/ubuntu/raring/liferea/original
Diff against target: 1218 lines (+895/-101)
14 files modified
.pc/applied-patches (+1/-0)
.pc/port-to-messaging-menu.patch/configure.ac (+181/-0)
.pc/port-to-messaging-menu.patch/src/Makefile.am (+90/-0)
.pc/port-to-messaging-menu.patch/src/ui/Makefile.am (+37/-0)
.pc/port-to-messaging-menu.patch/src/ui/ui_indicator.c (+236/-0)
configure.ac (+15/-15)
debian/changelog (+6/-0)
debian/control (+1/-2)
debian/patches/port-to-messaging-menu.patch (+289/-0)
debian/patches/series (+1/-0)
debian/rules (+1/-1)
src/Makefile.am (+2/-2)
src/ui/Makefile.am (+1/-1)
src/ui/ui_indicator.c (+34/-80)
To merge this branch: bzr merge lp:~xnox/ubuntu/raring/liferea/messaging-menu
Reviewer Review Type Date Requested Status
Lars Karlitski (community) Needs Fixing
Dimitri John Ledkov Pending
Review via email: mp+155161@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Dimitri John Ledkov (xnox) wrote :

Seems to work, but have no idea if this is roughly correct or not.
Also package branches are out of date, hence this crazy merge-proposal, if it looks ok I'll just upload it into raring.

Revision history for this message
Dimitri John Ledkov (xnox) wrote :
3. By Dimitri John Ledkov

use correct sprintf

Revision history for this message
Lars Karlitski (larsu) wrote :

It is roughly correct, but only very roughly ;)

You don't get a callback when the user clicks the application name any more. Instead, the app is launched again through its desktop file. This means that all applications that support the messaging menu must be single instance (which liferea is). Thus, on_indicator_server_clicked can be removed.

I recommend against hooking on_indicator_clicked up to the detailed signals only to pass the node as user data (if you're doing it like that, you would also need to disconnect the signals in the handler). Instead, hook the function up once, and lookup the node through its id in on_indicator_clicked.

The arguments to on_indicator_clicked are wrong, they should be

  static void
  on_indicator_clicked (MessagingMenuApp *mmapp, const gchar *source_id, gpointer user_data)

What did you intend to do here:

  messaging_menu_app_remove_source (indicator_priv->server, (char *)(indicator));

Casting the MessagingMenuApp pointer to a string?! You probably want 'source_id' in there.

review: Needs Fixing
Revision history for this message
Dimitri John Ledkov (xnox) wrote :

> It is roughly correct, but only very roughly ;)
>
> You don't get a callback when the user clicks the application name any more.
> Instead, the app is launched again through its desktop file. This means that
> all applications that support the messaging menu must be single instance
> (which liferea is). Thus, on_indicator_server_clicked can be removed.
>

Dead code -> gone! thanks.

> I recommend against hooking on_indicator_clicked up to the detailed signals
> only to pass the node as user data (if you're doing it like that, you would
> also need to disconnect the signals in the handler). Instead, hook the
> function up once, and lookup the node through its id in on_indicator_clicked.
>

I see, makes sense. Will switch to using one handler to rule them all.

> The arguments to on_indicator_clicked are wrong, they should be
>
> static void
> on_indicator_clicked (MessagingMenuApp *mmapp, const gchar *source_id,
> gpointer user_data)
>

Missing const added.

> What did you intend to do here:
>
> messaging_menu_app_remove_source (indicator_priv->server, (char
> *)(indicator));
>
> Casting the MessagingMenuApp pointer to a string?! You probably want
> 'source_id' in there.

I can see how the terminology is confusing. So there is indicator_priv which has a GPtrArray of node->id's. Confusingly that GPtrArray is called "indicators" and the pointers to node->id's are "indicator", thus it actually is casting 'source_id' from a gpointer to char.

Does messaging menu "rate-limit" at the moment? Cause that indicator_priv is mostly to keep track of how many source_ids are displayed (no more than 6 at the moment)

Unmerged revisions

3. By Dimitri John Ledkov

use correct sprintf

2. By Dimitri John Ledkov

Port to messaging-menu. (LP: #1040259)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file '.pc/applied-patches'
2--- .pc/applied-patches 2013-03-25 02:10:13 +0000
3+++ .pc/applied-patches 2013-03-25 03:54:20 +0000
4@@ -5,3 +5,4 @@
5 add_X-Ubuntu-Gettext-Domain
6 libunity.patch
7 port-to-libindicate-0.7.patch
8+port-to-messaging-menu.patch
9
10=== added directory '.pc/port-to-messaging-menu.patch'
11=== added file '.pc/port-to-messaging-menu.patch/configure.ac'
12--- .pc/port-to-messaging-menu.patch/configure.ac 1970-01-01 00:00:00 +0000
13+++ .pc/port-to-messaging-menu.patch/configure.ac 2013-03-25 03:54:20 +0000
14@@ -0,0 +1,181 @@
15+dnl Process this file with autoconf to produce a configure script.
16+
17+AC_INIT([liferea],[1.8.10],[liferea-devel@lists.sourceforge.net])
18+AC_CANONICAL_HOST
19+AC_CONFIG_SRCDIR([src/feedlist.c])
20+
21+AC_CONFIG_HEADERS([config.h])
22+AM_INIT_AUTOMAKE([1.11 foreign std-options -Wall -Werror])
23+AM_SILENT_RULES([yes])
24+
25+dnl Needed for automake 1.12
26+m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
27+
28+AC_PREREQ(2.59)
29+
30+LT_INIT
31+IT_PROG_INTLTOOL([0.35.0])
32+
33+AC_PROG_CC
34+AM_PROG_CC_C_O
35+AC_HEADER_STDC
36+AC_PROG_INSTALL
37+AC_PROG_MAKE_SET
38+AC_SYS_LARGEFILE
39+
40+AC_ARG_ENABLE(sm, AS_HELP_STRING([--disable-sm],[compile without X session management support]),,enable_sm=yes)
41+AC_ARG_ENABLE(libnotify, AS_HELP_STRING([--disable-libnotify],[compile without libnotify support]),,enable_libnotify=yes)
42+AC_ARG_ENABLE(libindicate, AS_HELP_STRING([--disable-libindicate],[compile without libindicate support]),,enable_libindicate=yes)
43+AC_ARG_ENABLE(libunity, AS_HELP_STRING([--disable-libunity],[compile without libunity support]),,enable_libunity=yes)
44+
45+AC_CHECK_FUNCS([strsep])
46+
47+PKG_PROG_PKG_CONFIG()
48+
49+dnl #######################################################################
50+dnl # Check for X session management libs
51+dnl #######################################################################
52+
53+if test "x$enable_sm" = "xyes"; then
54+ PKG_CHECK_MODULES([SM], [sm ice], [AC_DEFINE(USE_SM, 1, [Define if we're using X Session Management.])],[enable_sm=no])
55+fi
56+
57+dnl *********
58+dnl libnotify
59+dnl *********
60+
61+if test "x$enable_libnotify" = "xyes"; then
62+ PKG_CHECK_MODULES([LIBNOTIFY], libnotify >= 0.7,enable_libnotify=yes,enable_libnotify=no)
63+ if test "x$enable_libnotify" = "xyes"; then
64+ AC_DEFINE(HAVE_LIBNOTIFY, 4, [Define if libnotify.so.4 support is enabled])
65+ fi
66+ if test "x$enable_libnotify" = "xno"; then
67+ PKG_CHECK_MODULES([LIBNOTIFY], libnotify >= 0.3.2,enable_libnotify=yes,enable_libnotify=no)
68+ if test "x$enable_libnotify" = "xyes"; then
69+ AC_DEFINE(HAVE_LIBNOTIFY, 1, [Define if libnotify.so.1 support is enabled])
70+ fi
71+ fi
72+ AC_SUBST(LIBNOTIFY_CFLAGS)
73+ AC_SUBST(LIBNOTIFY_LIBS)
74+else
75+ enable_libnotify=no
76+fi
77+
78+AM_CONDITIONAL(WITH_LIBNOTIFY, test "x$enable_libnotify" = "xyes")
79+
80+dnl *********
81+dnl libindicate
82+dnl *********
83+
84+if test "x$enable_libindicate" = "xyes"; then
85+ PKG_CHECK_MODULES([LIBINDICATE], indicate-0.7 indicate-gtk-0.7,enable_libindicate=yes,enable_libindicate=no)
86+ AC_SUBST(LIBINDICATE_CFLAGS)
87+ AC_SUBST(LIBINDICATE_LIBS)
88+else
89+ enable_libindicate=no
90+fi
91+
92+if test "x$enable_libindicate" = "xyes"; then
93+ AC_DEFINE(HAVE_LIBINDICATE, 1, [Define if libindicate support is enabled])
94+fi
95+
96+AM_CONDITIONAL(WITH_LIBINDICATE, test "x$enable_libindicate" = "xyes")
97+
98+dnl *********
99+dnl libunity
100+dnl *********
101+
102+if test "x$enable_libunity" = "xyes"; then
103+ PKG_CHECK_MODULES([LIBUNITY], unity >= 3.4.2,enable_libunity=yes,enable_libunity=no)
104+ AC_SUBST(LIBUNITY_CFLAGS)
105+ AC_SUBST(LIBUNITY_LIBS)
106+else
107+ enable_libunity=no
108+fi
109+
110+if test "x$enable_libunity" = "xyes"; then
111+ AC_DEFINE(HAVE_LIBUNITY, 1, [Define if libunity support is enabled])
112+fi
113+
114+AM_CONDITIONAL(WITH_LIBUNITY, test "x$enable_libunity" = "xyes")
115+
116+dnl Checking for gconftool-2
117+AC_PATH_PROG(GCONFTOOL, gconftool-2, no)
118+
119+if test "x$GCONFTOOL" = xno; then
120+ AC_MSG_ERROR([gconftool-2 executable not found in your path - should be installed with GConf])
121+fi
122+
123+AM_GCONF_SOURCE_2
124+
125+pkg_modules=" gtk+-2.0 >= 2.18.0
126+ glib-2.0 >= 2.24.0
127+ gio-2.0 >= 2.26.0
128+ pango >= 1.4.0
129+ gconf-2.0 >= 1.1.9
130+ libxml-2.0 >= 2.6.27
131+ libxslt >= 1.1.19
132+ sqlite3 >= 3.7.0
133+ gmodule-2.0 >= 2.0.0
134+ gthread-2.0
135+ libsoup-2.4 >= 2.28.2
136+ unique-1.0
137+ webkit-1.0 >= 1.2.2
138+ json-glib-1.0"
139+
140+PKG_CHECK_MODULES(PACKAGE, [$pkg_modules])
141+
142+AC_SUBST(PACKAGE_CFLAGS)
143+AC_SUBST(PACKAGE_LIBS)
144+
145+uname=`uname`
146+AC_DEFINE_UNQUOTED(OS, $uname, [defines a OS version string, used for OS specific code])
147+AC_DEFINE_UNQUOTED(OSNAME, "$uname", [defines a OS version string, used for the user agent string])
148+AC_MSG_RESULT(user agent OS = $uname)
149+
150+AM_GLIB_GNU_GETTEXT
151+
152+GETTEXT_PACKAGE=liferea
153+AC_SUBST(GETTEXT_PACKAGE)
154+AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE], ["${GETTEXT_PACKAGE}"], [gettext domain])
155+
156+
157+AC_CONFIG_FILES([
158+Makefile
159+src/Makefile
160+src/webkit/Makefile
161+src/parsers/Makefile
162+src/fl_sources/Makefile
163+src/notification/Makefile
164+src/ui/Makefile
165+doc/Makefile
166+doc/html/Makefile
167+xslt/Makefile
168+man/Makefile
169+man/pl/Makefile
170+pixmaps/Makefile
171+pixmaps/16x16/Makefile
172+pixmaps/22x22/Makefile
173+pixmaps/24x24/Makefile
174+pixmaps/32x32/Makefile
175+pixmaps/48x48/Makefile
176+pixmaps/scalable/Makefile
177+opml/Makefile
178+glade/Makefile
179+po/Makefile.in
180+src/liferea-add-feed
181+])
182+AC_OUTPUT
183+
184+echo
185+echo "$PACKAGE $VERSION"
186+echo
187+echo "Use X Session Management........ : $enable_sm"
188+echo "Use libnotify................... : $enable_libnotify"
189+echo "Use libindicate................. : $enable_libindicate"
190+echo "Use libunity.................... : $enable_libunity"
191+echo
192+eval eval echo Liferea will be installed in $bindir.
193+echo
194+echo configure complete, now type \'make\'
195+echo
196
197=== added directory '.pc/port-to-messaging-menu.patch/src'
198=== added file '.pc/port-to-messaging-menu.patch/src/Makefile.am'
199--- .pc/port-to-messaging-menu.patch/src/Makefile.am 1970-01-01 00:00:00 +0000
200+++ .pc/port-to-messaging-menu.patch/src/Makefile.am 2013-03-25 03:54:20 +0000
201@@ -0,0 +1,90 @@
202+## Process this file with automake to produce Makefile.in
203+
204+SUBDIRS = parsers notification ui fl_sources webkit .
205+
206+AM_CPPFLAGS = \
207+ -DPACKAGE_DATA_DIR=\""$(datadir)"\" \
208+ -DPACKAGE_LIB_DIR=\""$(pkglibdir)"\" \
209+ -DPACKAGE_LOCALE_DIR=\""$(prefix)/$(DATADIRNAME)/locale"\" \
210+ -DBIN_DIR=\""$(bindir)"\" \
211+ -I$(top_srcdir)/src \
212+ $(PACKAGE_CFLAGS) \
213+ $(SM_CFLAGS)
214+
215+bin_PROGRAMS = liferea
216+bin_SCRIPTS = liferea-add-feed
217+
218+liferea_SOURCES = \
219+ browser.c browser.h \
220+ comments.c comments.h \
221+ common.c common.h \
222+ conf.c conf.h \
223+ date.c date.h \
224+ db.c db.h \
225+ dbus.c dbus.h \
226+ debug.c debug.h \
227+ e-date.c e-date.h \
228+ enclosure.c enclosure.h \
229+ export.c export.h \
230+ favicon.c favicon.h \
231+ feed.c feed.h \
232+ feed_parser.c feed_parser.h \
233+ feedlist.c feedlist.h \
234+ folder.c folder.h \
235+ html.c html.h \
236+ htmlview.c htmlview.h \
237+ item.c item.h \
238+ item_loader.c item_loader.h \
239+ item_state.c item_state.h \
240+ itemset.c itemset.h \
241+ itemlist.c itemlist.h \
242+ json.c json.h \
243+ metadata.c metadata.h \
244+ migrate.c migrate.h \
245+ net.c net.h \
246+ net_monitor.c net_monitor.h \
247+ newsbin.c newsbin.h \
248+ node.c node.h \
249+ node_type.c node_type.h \
250+ node_view.h \
251+ render.c render.h \
252+ rule.c rule.h \
253+ social.c social.h \
254+ subscription.c subscription.h \
255+ subscription_type.h \
256+ update.c update.h \
257+ main.c \
258+ vfolder.c vfolder.h \
259+ vfolder_loader.c vfolder_loader.h \
260+ xml.c xml.h
261+
262+liferea_LDADD = parsers/libliparsers.a \
263+ fl_sources/libliflsources.a \
264+ ui/libliui.a \
265+ webkit/libwebkit.a \
266+ $(SYNC_LIB) \
267+ $(PACKAGE_LIBS) $(SM_LIBS) \
268+ $(INTLLIBS) $(AVAHI_LIBS) \
269+ $(WEBKIT_LIBS) $(LIBNOTIFY_LIBS)
270+
271+EXTRA_DIST = $(srcdir)/liferea-add-feed.in
272+DISTCLEANFILES = $(srcdir)/liferea-add-feed
273+AM_INSTALLCHECK_STD_OPTIONS_EXEMPT = liferea-add-feed
274+
275+if WITH_LIBNOTIFY
276+
277+liferea_LDADD += notification/libnotify.a $(LIBNOTIFY_LIBS)
278+
279+endif
280+
281+if WITH_LIBINDICATE
282+
283+liferea_LDADD += $(LIBINDICATE_LIBS)
284+
285+endif
286+
287+if WITH_LIBUNITY
288+
289+liferea_LDADD += $(LIBUNITY_LIBS)
290+
291+endif
292
293=== added directory '.pc/port-to-messaging-menu.patch/src/ui'
294=== added file '.pc/port-to-messaging-menu.patch/src/ui/Makefile.am'
295--- .pc/port-to-messaging-menu.patch/src/ui/Makefile.am 1970-01-01 00:00:00 +0000
296+++ .pc/port-to-messaging-menu.patch/src/ui/Makefile.am 2013-03-25 03:54:20 +0000
297@@ -0,0 +1,37 @@
298+## Process this file with automake to produce Makefile.in
299+
300+AM_CPPFLAGS = \
301+ -DPACKAGE_DATA_DIR=\""$(datadir)"\" \
302+ -DPACKAGE_LIB_DIR=\""$(pkglibdir)"\" \
303+ -DPACKAGE_LOCALE_DIR=\""$(prefix)/$(DATADIRNAME)/locale"\" \
304+ -I$(top_srcdir)/src
305+
306+noinst_LIBRARIES = libliui.a
307+
308+libliui_a_CFLAGS = $(PACKAGE_CFLAGS) $(LIBINDICATE_CFLAGS) $(LIBUNITY_CFLAGS)
309+libliui_a_SOURCES = \
310+ auth_dialog.c auth_dialog.h \
311+ browser_tabs.c browser_tabs.h \
312+ enclosure_list_view.c enclosure_list_view.h \
313+ feed_list_view.c feed_list_view.h \
314+ icons.c icons.h \
315+ item_list_view.c item_list_view.h \
316+ itemview.c itemview.h \
317+ liferea_dialog.c liferea_dialog.h \
318+ liferea_htmlview.c liferea_htmlview.h \
319+ liferea_shell.c liferea_shell.h \
320+ popup_menu.c popup_menu.h \
321+ rule_editor.c rule_editor.h \
322+ search_dialog.c search_dialog.h \
323+ search_folder_dialog.c search_folder_dialog.h \
324+ subscription_dialog.c subscription_dialog.h \
325+ ui_common.c ui_common.h \
326+ ui_dnd.c ui_dnd.h \
327+ ui_folder.c ui_folder.h \
328+ ui_indicator.c ui_indicator.h \
329+ ui_node.c ui_node.h \
330+ ui_prefs.c ui_prefs.h \
331+ ui_session.c ui_session.h \
332+ ui_tray.c ui_tray.h \
333+ ui_unity.c ui_unity.h \
334+ ui_update.c ui_update.h
335
336=== added file '.pc/port-to-messaging-menu.patch/src/ui/ui_indicator.c'
337--- .pc/port-to-messaging-menu.patch/src/ui/ui_indicator.c 1970-01-01 00:00:00 +0000
338+++ .pc/port-to-messaging-menu.patch/src/ui/ui_indicator.c 2013-03-25 03:54:20 +0000
339@@ -0,0 +1,236 @@
340+/*
341+ * @file ui_indicator.c libindicate support
342+ *
343+ * Copyright (C) 2010-2011 Maia Kozheva <sikon@ubuntu.com>
344+ *
345+ * This program is free software; you can redistribute it and/or modify
346+ * it under the terms of the GNU General Public License as published by
347+ * the Free Software Foundation; either version 2 of the License, or
348+ * (at your option) any later version.
349+ *
350+ * This program is distributed in the hope that it will be useful,
351+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
352+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
353+ * GNU Library General Public License for more details.
354+ *
355+ * You should have received a copy of the GNU General Public License
356+ * along with this program; if not, write to the Free Software
357+ * Foundation, Inc., 51 Franklin Street, Fifth Floor Boston, MA 02110-1301, USA
358+ */
359+
360+#ifdef HAVE_CONFIG_H
361+# include <config.h>
362+#endif
363+
364+#include "ui_indicator.h"
365+
366+#ifdef HAVE_LIBINDICATE
367+
368+#include <gtk/gtk.h>
369+#include <libindicate/server.h>
370+#include <libindicate/indicator.h>
371+#include <libindicate-gtk/indicator.h>
372+#include <libindicate/interests.h>
373+#include "feedlist.h"
374+#include "feed_list_view.h"
375+#include "liferea_shell.h"
376+#include "ui_tray.h"
377+#include "vfolder.h"
378+
379+/* The maximum number of feeds to display in the indicator menu. */
380+#define MAX_INDICATORS 6
381+/* Whether Liferea should set the indicator menu to attention
382+ status whenever new feed items are downloaded. Since news feeds
383+ do not typically require the user's urgent attention, unlike
384+ mail and IM messages, this is set to false by default. */
385+#define SET_DRAW_ATTENTION FALSE
386+
387+static struct indicator_priv {
388+ IndicateServer *server;
389+ gboolean visible;
390+ GPtrArray *indicators;
391+} *indicator_priv = NULL;
392+
393+/*
394+ The desktop file to initialize the indicator menu with. Resolves to
395+ a string like "/usr/share/applications/liferea.desktop".
396+*/
397+static const char *DESKTOP_FILE = PACKAGE_DATA_DIR G_DIR_SEPARATOR_S "applications" G_DIR_SEPARATOR_S "liferea.desktop";
398+
399+static void
400+remove_all_indicators () {
401+ g_ptr_array_set_size (indicator_priv->indicators, 0);
402+}
403+
404+/*
405+ Called when the main "Liferea" entry in the indicator menu is clicked.
406+*/
407+static void
408+on_indicator_server_clicked (IndicateServer *server, gchar *type, gpointer user_data)
409+{
410+ liferea_shell_present ();
411+ remove_all_indicators ();
412+}
413+
414+/*
415+ Called when the indicator container applet is shown.
416+*/
417+static void
418+on_indicator_interest_added (IndicateServer *server, guint interest, gpointer user_data)
419+{
420+ if (interest != INDICATE_INTEREST_SERVER_SIGNAL)
421+ return;
422+
423+ indicator_priv->visible = TRUE;
424+ ui_tray_update ();
425+}
426+
427+/*
428+ Called when the indicator container applet is hidden.
429+*/
430+static void
431+on_indicator_interest_removed (IndicateServer *server, guint interest, gpointer user_data)
432+{
433+ if (interest != INDICATE_INTEREST_SERVER_SIGNAL)
434+ return;
435+
436+ indicator_priv->visible = FALSE;
437+ ui_tray_update ();
438+}
439+
440+/*
441+ Called when the indicator menu entry for a specific feed
442+ is clicked, meaning Liferea should switch to that feed.
443+*/
444+static void
445+on_indicator_clicked (IndicateIndicator *indicator, guint timestamp, gpointer user_data)
446+{
447+ feed_list_view_select ((nodePtr) user_data);
448+ liferea_shell_present ();
449+ remove_all_indicators ();
450+}
451+
452+static void
453+destroy_indicator (gpointer indicator)
454+{
455+ if (indicator_priv->server == NULL || indicator == NULL)
456+ return;
457+
458+ indicate_server_remove_indicator (indicator_priv->server, INDICATE_INDICATOR(indicator));
459+ g_object_unref (G_OBJECT (indicator));
460+}
461+
462+void
463+ui_indicator_init ()
464+{
465+ if (indicator_priv != NULL)
466+ return;
467+
468+ indicator_priv = g_new0 (struct indicator_priv, 1);
469+ indicator_priv->visible = FALSE;
470+ indicator_priv->indicators = g_ptr_array_new_with_free_func (destroy_indicator);
471+
472+ indicator_priv->server = indicate_server_ref_default();
473+ indicate_server_set_type (indicator_priv->server, "message.im");
474+ indicate_server_set_desktop_file (indicator_priv->server, DESKTOP_FILE);
475+
476+ g_signal_connect (G_OBJECT (indicator_priv->server), "server-display", G_CALLBACK (on_indicator_server_clicked), NULL);
477+ g_signal_connect (G_OBJECT (indicator_priv->server), "interest-added", G_CALLBACK (on_indicator_interest_added), NULL);
478+ g_signal_connect (G_OBJECT (indicator_priv->server), "interest-removed", G_CALLBACK (on_indicator_interest_removed), NULL);
479+
480+ indicate_server_show (indicator_priv->server);
481+ ui_indicator_update ();
482+}
483+
484+void
485+ui_indicator_destroy ()
486+{
487+ if (indicator_priv == NULL)
488+ return;
489+
490+ remove_all_indicators ();
491+ g_object_unref (indicator_priv->server);
492+ indicator_priv->server = NULL;
493+ g_ptr_array_free (indicator_priv->indicators, TRUE);
494+ g_free (indicator_priv);
495+ indicator_priv = NULL;
496+}
497+
498+static void
499+add_node_indicator (nodePtr node)
500+{
501+ IndicateIndicator *indicator;
502+ GdkPixbuf *pixbuf;
503+ gchar count[10];
504+
505+ if (indicator_priv->indicators->len >= MAX_INDICATORS)
506+ return;
507+
508+ if (IS_VFOLDER(node) || g_slist_length (node->children) > 0) {
509+ /* Not a feed - walk children and do nothing more */
510+ node_foreach_child (node, add_node_indicator);
511+ return;
512+ }
513+
514+ /* Skip feeds with no unread items */
515+ if (node->unreadCount == 0)
516+ return;
517+
518+ indicator = indicate_indicator_new_with_server (indicator_priv->server);
519+ g_signal_connect (indicator, "user-display", G_CALLBACK (on_indicator_clicked), node);
520+
521+ /* load favicon */
522+ pixbuf = gdk_pixbuf_new_from_file (node->iconFile, NULL);
523+
524+ /* display favicon */
525+ indicate_gtk_indicator_set_property_icon (indicator, "icon", pixbuf);
526+ gdk_pixbuf_unref (pixbuf);
527+
528+ sprintf (count, "%u", node->unreadCount);
529+ indicate_indicator_set_property (indicator, "name", node->title);
530+ indicate_indicator_set_property (indicator, "count", count);
531+#if SET_DRAW_ATTENTION
532+ indicate_indicator_set_property_bool (indicator, "draw-attention", TRUE);
533+#endif
534+ g_ptr_array_add (indicator_priv->indicators, indicator);
535+}
536+
537+void
538+ui_indicator_update ()
539+{
540+ guint index;
541+
542+ /* Do not update indicators if the user is interacting with the main window */
543+ if (!indicator_priv || gtk_window_is_active (GTK_WINDOW (liferea_shell_get_window ())))
544+ return;
545+
546+ /* Remove all previous indicators from the menu */
547+ remove_all_indicators ();
548+ /* ...then walk the tree and add an indicator for each unread feed */
549+ feedlist_foreach (add_node_indicator);
550+
551+ /* revert order of items */
552+ for (index = indicator_priv->indicators->len; index > 0; index--)
553+ indicate_indicator_show (g_ptr_array_index (indicator_priv->indicators, index - 1));
554+}
555+
556+gboolean
557+ui_indicator_is_visible ()
558+{
559+ return indicator_priv && indicator_priv->visible;
560+}
561+
562+#else
563+
564+/*
565+ If Liferea is compiled without libindicate support, all indicator
566+ support functions do nothing. The application behaves as if there
567+ is no indicator applet present.
568+*/
569+
570+void ui_indicator_init () {}
571+void ui_indicator_destroy () {}
572+void ui_indicator_update () {}
573+gboolean ui_indicator_is_visible () { return FALSE; }
574+
575+#endif /* HAVE_LIBINDICATE */
576
577=== modified file 'configure.ac'
578--- configure.ac 2013-03-25 02:10:13 +0000
579+++ configure.ac 2013-03-25 03:54:20 +0000
580@@ -25,7 +25,7 @@
581
582 AC_ARG_ENABLE(sm, AS_HELP_STRING([--disable-sm],[compile without X session management support]),,enable_sm=yes)
583 AC_ARG_ENABLE(libnotify, AS_HELP_STRING([--disable-libnotify],[compile without libnotify support]),,enable_libnotify=yes)
584-AC_ARG_ENABLE(libindicate, AS_HELP_STRING([--disable-libindicate],[compile without libindicate support]),,enable_libindicate=yes)
585+AC_ARG_ENABLE(messaging-menu, AS_HELP_STRING([--disable-messaging-menu],[compile without messaging-menu support]),,enable_messaging_menu=yes)
586 AC_ARG_ENABLE(libunity, AS_HELP_STRING([--disable-libunity],[compile without libunity support]),,enable_libunity=yes)
587
588 AC_CHECK_FUNCS([strsep])
589@@ -64,22 +64,22 @@
590 AM_CONDITIONAL(WITH_LIBNOTIFY, test "x$enable_libnotify" = "xyes")
591
592 dnl *********
593-dnl libindicate
594+dnl messaging-menu
595 dnl *********
596
597-if test "x$enable_libindicate" = "xyes"; then
598- PKG_CHECK_MODULES([LIBINDICATE], indicate-0.7 indicate-gtk-0.7,enable_libindicate=yes,enable_libindicate=no)
599- AC_SUBST(LIBINDICATE_CFLAGS)
600- AC_SUBST(LIBINDICATE_LIBS)
601+if test "x$enable_messaging_menu" = "xyes"; then
602+ PKG_CHECK_MODULES([MESSAGING_MENU], messaging-menu,enable_messaging_menu=yes,enable_messaging_menu=no)
603+ AC_SUBST(MESSAGING_MENU_CFLAGS)
604+ AC_SUBST(MESSAGING_MENU_LIBS)
605 else
606- enable_libindicate=no
607-fi
608-
609-if test "x$enable_libindicate" = "xyes"; then
610- AC_DEFINE(HAVE_LIBINDICATE, 1, [Define if libindicate support is enabled])
611-fi
612-
613-AM_CONDITIONAL(WITH_LIBINDICATE, test "x$enable_libindicate" = "xyes")
614+ enable_messaging_menu=no
615+fi
616+
617+if test "x$enable_messaging_menu" = "xyes"; then
618+ AC_DEFINE(HAVE_MESSAGING_MENU, 1, [Define if messaging-menu support is enabled])
619+fi
620+
621+AM_CONDITIONAL(WITH_MESSAGING_MENU, test "x$enable_messaging_menu" = "xyes")
622
623 dnl *********
624 dnl libunity
625@@ -172,7 +172,7 @@
626 echo
627 echo "Use X Session Management........ : $enable_sm"
628 echo "Use libnotify................... : $enable_libnotify"
629-echo "Use libindicate................. : $enable_libindicate"
630+echo "Use messaging-menu.............. : $enable_messaging_menu"
631 echo "Use libunity.................... : $enable_libunity"
632 echo
633 eval eval echo Liferea will be installed in $bindir.
634
635=== modified file 'debian/changelog'
636--- debian/changelog 2013-03-25 02:10:13 +0000
637+++ debian/changelog 2013-03-25 03:54:20 +0000
638@@ -1,3 +1,9 @@
639+liferea (1.8.10-0ubuntu2) UNRELEASED; urgency=low
640+
641+ * Port to messaging-menu. (LP: #1040259)
642+
643+ -- Dmitrijs Ledkovs <dmitrij.ledkov@ubuntu.com> Mon, 25 Mar 2013 02:41:34 +0000
644+
645 liferea (1.8.10-0ubuntu1) raring; urgency=low
646
647 * New upstream release.
648
649=== modified file 'debian/control'
650--- debian/control 2013-03-25 02:10:13 +0000
651+++ debian/control 2013-03-25 03:54:20 +0000
652@@ -21,8 +21,7 @@
653 intltool,
654 libicu-dev,
655 libx11-dev,
656- libindicate-dev (>= 0.6.90),
657- libindicate-gtk-dev (>= 0.6.90),
658+ libmessaging-menu-dev,
659 dh-autoreconf,
660 libunity-dev (>= 5.0.0),
661 libice-dev,
662
663=== added file 'debian/patches/port-to-messaging-menu.patch'
664--- debian/patches/port-to-messaging-menu.patch 1970-01-01 00:00:00 +0000
665+++ debian/patches/port-to-messaging-menu.patch 2013-03-25 03:54:20 +0000
666@@ -0,0 +1,289 @@
667+Description: port to messaging menu
668+Author: Dmitrijs Ledkovs <dmitrij.ledkov@ubuntu.com>
669+Bug-Ubuntu: https://bugs.launchpad.net/bugs/1040259
670+
671+--- a/configure.ac
672++++ b/configure.ac
673+@@ -25,7 +25,7 @@
674+
675+ AC_ARG_ENABLE(sm, AS_HELP_STRING([--disable-sm],[compile without X session management support]),,enable_sm=yes)
676+ AC_ARG_ENABLE(libnotify, AS_HELP_STRING([--disable-libnotify],[compile without libnotify support]),,enable_libnotify=yes)
677+-AC_ARG_ENABLE(libindicate, AS_HELP_STRING([--disable-libindicate],[compile without libindicate support]),,enable_libindicate=yes)
678++AC_ARG_ENABLE(messaging-menu, AS_HELP_STRING([--disable-messaging-menu],[compile without messaging-menu support]),,enable_messaging_menu=yes)
679+ AC_ARG_ENABLE(libunity, AS_HELP_STRING([--disable-libunity],[compile without libunity support]),,enable_libunity=yes)
680+
681+ AC_CHECK_FUNCS([strsep])
682+@@ -64,22 +64,22 @@
683+ AM_CONDITIONAL(WITH_LIBNOTIFY, test "x$enable_libnotify" = "xyes")
684+
685+ dnl *********
686+-dnl libindicate
687++dnl messaging-menu
688+ dnl *********
689+
690+-if test "x$enable_libindicate" = "xyes"; then
691+- PKG_CHECK_MODULES([LIBINDICATE], indicate-0.7 indicate-gtk-0.7,enable_libindicate=yes,enable_libindicate=no)
692+- AC_SUBST(LIBINDICATE_CFLAGS)
693+- AC_SUBST(LIBINDICATE_LIBS)
694++if test "x$enable_messaging_menu" = "xyes"; then
695++ PKG_CHECK_MODULES([MESSAGING_MENU], messaging-menu,enable_messaging_menu=yes,enable_messaging_menu=no)
696++ AC_SUBST(MESSAGING_MENU_CFLAGS)
697++ AC_SUBST(MESSAGING_MENU_LIBS)
698+ else
699+- enable_libindicate=no
700++ enable_messaging_menu=no
701+ fi
702+
703+-if test "x$enable_libindicate" = "xyes"; then
704+- AC_DEFINE(HAVE_LIBINDICATE, 1, [Define if libindicate support is enabled])
705++if test "x$enable_messaging_menu" = "xyes"; then
706++ AC_DEFINE(HAVE_MESSAGING_MENU, 1, [Define if messaging-menu support is enabled])
707+ fi
708+
709+-AM_CONDITIONAL(WITH_LIBINDICATE, test "x$enable_libindicate" = "xyes")
710++AM_CONDITIONAL(WITH_MESSAGING_MENU, test "x$enable_messaging_menu" = "xyes")
711+
712+ dnl *********
713+ dnl libunity
714+@@ -172,7 +172,7 @@
715+ echo
716+ echo "Use X Session Management........ : $enable_sm"
717+ echo "Use libnotify................... : $enable_libnotify"
718+-echo "Use libindicate................. : $enable_libindicate"
719++echo "Use messaging-menu.............. : $enable_messaging_menu"
720+ echo "Use libunity.................... : $enable_libunity"
721+ echo
722+ eval eval echo Liferea will be installed in $bindir.
723+--- a/src/Makefile.am
724++++ b/src/Makefile.am
725+@@ -77,9 +77,9 @@
726+
727+ endif
728+
729+-if WITH_LIBINDICATE
730++if WITH_MESSAGING_MENU
731+
732+-liferea_LDADD += $(LIBINDICATE_LIBS)
733++liferea_LDADD += $(MESSAGING_MENU_LIBS)
734+
735+ endif
736+
737+--- a/src/ui/Makefile.am
738++++ b/src/ui/Makefile.am
739+@@ -8,7 +8,7 @@
740+
741+ noinst_LIBRARIES = libliui.a
742+
743+-libliui_a_CFLAGS = $(PACKAGE_CFLAGS) $(LIBINDICATE_CFLAGS) $(LIBUNITY_CFLAGS)
744++libliui_a_CFLAGS = $(PACKAGE_CFLAGS) $(MESSAGING_MENU_CFLAGS) $(LIBUNITY_CFLAGS)
745+ libliui_a_SOURCES = \
746+ auth_dialog.c auth_dialog.h \
747+ browser_tabs.c browser_tabs.h \
748+--- a/src/ui/ui_indicator.c
749++++ b/src/ui/ui_indicator.c
750+@@ -24,13 +24,10 @@
751+
752+ #include "ui_indicator.h"
753+
754+-#ifdef HAVE_LIBINDICATE
755++#ifdef HAVE_MESSAGING_MENU
756+
757+ #include <gtk/gtk.h>
758+-#include <libindicate/server.h>
759+-#include <libindicate/indicator.h>
760+-#include <libindicate-gtk/indicator.h>
761+-#include <libindicate/interests.h>
762++#include <messaging-menu.h>
763+ #include "feedlist.h"
764+ #include "feed_list_view.h"
765+ #include "liferea_shell.h"
766+@@ -39,15 +36,9 @@
767+
768+ /* The maximum number of feeds to display in the indicator menu. */
769+ #define MAX_INDICATORS 6
770+-/* Whether Liferea should set the indicator menu to attention
771+- status whenever new feed items are downloaded. Since news feeds
772+- do not typically require the user's urgent attention, unlike
773+- mail and IM messages, this is set to false by default. */
774+-#define SET_DRAW_ATTENTION FALSE
775+
776+ static struct indicator_priv {
777+- IndicateServer *server;
778+- gboolean visible;
779++ MessagingMenuApp *server;
780+ GPtrArray *indicators;
781+ } *indicator_priv = NULL;
782+
783+@@ -55,7 +46,7 @@
784+ The desktop file to initialize the indicator menu with. Resolves to
785+ a string like "/usr/share/applications/liferea.desktop".
786+ */
787+-static const char *DESKTOP_FILE = PACKAGE_DATA_DIR G_DIR_SEPARATOR_S "applications" G_DIR_SEPARATOR_S "liferea.desktop";
788++static const char *DESKTOP_FILE = "liferea.desktop";
789+
790+ static void
791+ remove_all_indicators () {
792+@@ -66,44 +57,18 @@
793+ Called when the main "Liferea" entry in the indicator menu is clicked.
794+ */
795+ static void
796+-on_indicator_server_clicked (IndicateServer *server, gchar *type, gpointer user_data)
797++on_indicator_server_clicked (MessagingMenuApp *server, gchar *source_id, gpointer user_data)
798+ {
799+ liferea_shell_present ();
800+ remove_all_indicators ();
801+ }
802+
803+ /*
804+- Called when the indicator container applet is shown.
805+-*/
806+-static void
807+-on_indicator_interest_added (IndicateServer *server, guint interest, gpointer user_data)
808+-{
809+- if (interest != INDICATE_INTEREST_SERVER_SIGNAL)
810+- return;
811+-
812+- indicator_priv->visible = TRUE;
813+- ui_tray_update ();
814+-}
815+-
816+-/*
817+- Called when the indicator container applet is hidden.
818+-*/
819+-static void
820+-on_indicator_interest_removed (IndicateServer *server, guint interest, gpointer user_data)
821+-{
822+- if (interest != INDICATE_INTEREST_SERVER_SIGNAL)
823+- return;
824+-
825+- indicator_priv->visible = FALSE;
826+- ui_tray_update ();
827+-}
828+-
829+-/*
830+ Called when the indicator menu entry for a specific feed
831+ is clicked, meaning Liferea should switch to that feed.
832+ */
833+ static void
834+-on_indicator_clicked (IndicateIndicator *indicator, guint timestamp, gpointer user_data)
835++on_indicator_clicked (MessagingMenuApp *indicator, gchar *source_id, gpointer user_data)
836+ {
837+ feed_list_view_select ((nodePtr) user_data);
838+ liferea_shell_present ();
839+@@ -116,8 +81,7 @@
840+ if (indicator_priv->server == NULL || indicator == NULL)
841+ return;
842+
843+- indicate_server_remove_indicator (indicator_priv->server, INDICATE_INDICATOR(indicator));
844+- g_object_unref (G_OBJECT (indicator));
845++ messaging_menu_app_remove_source (indicator_priv->server, (char *)(indicator));
846+ }
847+
848+ void
849+@@ -127,18 +91,13 @@
850+ return;
851+
852+ indicator_priv = g_new0 (struct indicator_priv, 1);
853+- indicator_priv->visible = FALSE;
854+ indicator_priv->indicators = g_ptr_array_new_with_free_func (destroy_indicator);
855+
856+- indicator_priv->server = indicate_server_ref_default();
857+- indicate_server_set_type (indicator_priv->server, "message.im");
858+- indicate_server_set_desktop_file (indicator_priv->server, DESKTOP_FILE);
859+-
860+- g_signal_connect (G_OBJECT (indicator_priv->server), "server-display", G_CALLBACK (on_indicator_server_clicked), NULL);
861+- g_signal_connect (G_OBJECT (indicator_priv->server), "interest-added", G_CALLBACK (on_indicator_interest_added), NULL);
862+- g_signal_connect (G_OBJECT (indicator_priv->server), "interest-removed", G_CALLBACK (on_indicator_interest_removed), NULL);
863++ indicator_priv->server = messaging_menu_app_new (DESKTOP_FILE);
864++ messaging_menu_app_register (indicator_priv->server);
865++
866++ g_signal_connect (G_OBJECT (indicator_priv->server), "activate-source", G_CALLBACK (on_indicator_server_clicked), NULL);
867+
868+- indicate_server_show (indicator_priv->server);
869+ ui_indicator_update ();
870+ }
871+
872+@@ -159,9 +118,10 @@
873+ static void
874+ add_node_indicator (nodePtr node)
875+ {
876+- IndicateIndicator *indicator;
877+- GdkPixbuf *pixbuf;
878++ GFile *file;
879++ GIcon *icon;
880+ gchar count[10];
881++ gchar *signal;
882+
883+ if (indicator_priv->indicators->len >= MAX_INDICATORS)
884+ return;
885+@@ -176,30 +136,28 @@
886+ if (node->unreadCount == 0)
887+ return;
888+
889+- indicator = indicate_indicator_new_with_server (indicator_priv->server);
890+- g_signal_connect (indicator, "user-display", G_CALLBACK (on_indicator_clicked), node);
891+-
892+- /* load favicon */
893+- pixbuf = gdk_pixbuf_new_from_file (node->iconFile, NULL);
894++ file = g_file_new_for_path (node->iconFile);
895++ icon = g_file_icon_new (file);
896+
897+- /* display favicon */
898+- indicate_gtk_indicator_set_property_icon (indicator, "icon", pixbuf);
899+- gdk_pixbuf_unref (pixbuf);
900+-
901+- sprintf (count, "%u", node->unreadCount);
902+- indicate_indicator_set_property (indicator, "name", node->title);
903+- indicate_indicator_set_property (indicator, "count", count);
904+-#if SET_DRAW_ATTENTION
905+- indicate_indicator_set_property_bool (indicator, "draw-attention", TRUE);
906+-#endif
907+- g_ptr_array_add (indicator_priv->indicators, indicator);
908++ messaging_menu_app_append_source_with_count(
909++ indicator_priv->server,
910++ node->id,
911++ icon,
912++ node->title,
913++ node->unreadCount);
914++
915++ signal = g_strdup_printf("activate-source::%s", node->id);
916++ g_signal_connect (indicator_priv->server, signal, G_CALLBACK (on_indicator_clicked), node);
917++ g_ptr_array_add (indicator_priv->indicators, node->id);
918++
919++ g_object_unref(icon);
920++ g_object_unref(file);
921++ g_free(signal);
922+ }
923+
924+ void
925+ ui_indicator_update ()
926+ {
927+- guint index;
928+-
929+ /* Do not update indicators if the user is interacting with the main window */
930+ if (!indicator_priv || gtk_window_is_active (GTK_WINDOW (liferea_shell_get_window ())))
931+ return;
932+@@ -208,16 +166,12 @@
933+ remove_all_indicators ();
934+ /* ...then walk the tree and add an indicator for each unread feed */
935+ feedlist_foreach (add_node_indicator);
936+-
937+- /* revert order of items */
938+- for (index = indicator_priv->indicators->len; index > 0; index--)
939+- indicate_indicator_show (g_ptr_array_index (indicator_priv->indicators, index - 1));
940+ }
941+
942+ gboolean
943+ ui_indicator_is_visible ()
944+ {
945+- return indicator_priv && indicator_priv->visible;
946++ return TRUE;
947+ }
948+
949+ #else
950+@@ -233,4 +187,4 @@
951+ void ui_indicator_update () {}
952+ gboolean ui_indicator_is_visible () { return FALSE; }
953+
954+-#endif /* HAVE_LIBINDICATE */
955++#endif /* HAVE_MESSAGING_MENU */
956
957=== modified file 'debian/patches/series'
958--- debian/patches/series 2013-03-25 02:10:13 +0000
959+++ debian/patches/series 2013-03-25 03:54:20 +0000
960@@ -5,3 +5,4 @@
961 add_X-Ubuntu-Gettext-Domain
962 libunity.patch
963 port-to-libindicate-0.7.patch
964+port-to-messaging-menu.patch
965
966=== modified file 'debian/rules'
967--- debian/rules 2013-03-25 02:10:13 +0000
968+++ debian/rules 2013-03-25 03:54:20 +0000
969@@ -48,7 +48,7 @@
970 ./configure $(SYSTEM) --prefix=/usr \
971 --mandir=\$${prefix}/share/man --sysconfdir=/etc \
972 --enable-sm --enable-gnutls --enable-lua --enable-libnotify \
973- --enable-libindicate \
974+ --enable-messaging-menu \
975 $(ENABLE_NM)
976 ln -s $(CURDIR)/man/liferea.1 $(CURDIR)/debian/liferea-add-feed.1
977
978
979=== modified file 'src/Makefile.am'
980--- src/Makefile.am 2013-03-25 02:10:13 +0000
981+++ src/Makefile.am 2013-03-25 03:54:20 +0000
982@@ -77,9 +77,9 @@
983
984 endif
985
986-if WITH_LIBINDICATE
987+if WITH_MESSAGING_MENU
988
989-liferea_LDADD += $(LIBINDICATE_LIBS)
990+liferea_LDADD += $(MESSAGING_MENU_LIBS)
991
992 endif
993
994
995=== modified file 'src/ui/Makefile.am'
996--- src/ui/Makefile.am 2013-03-25 02:10:13 +0000
997+++ src/ui/Makefile.am 2013-03-25 03:54:20 +0000
998@@ -8,7 +8,7 @@
999
1000 noinst_LIBRARIES = libliui.a
1001
1002-libliui_a_CFLAGS = $(PACKAGE_CFLAGS) $(LIBINDICATE_CFLAGS) $(LIBUNITY_CFLAGS)
1003+libliui_a_CFLAGS = $(PACKAGE_CFLAGS) $(MESSAGING_MENU_CFLAGS) $(LIBUNITY_CFLAGS)
1004 libliui_a_SOURCES = \
1005 auth_dialog.c auth_dialog.h \
1006 browser_tabs.c browser_tabs.h \
1007
1008=== modified file 'src/ui/ui_indicator.c'
1009--- src/ui/ui_indicator.c 2013-03-25 02:10:13 +0000
1010+++ src/ui/ui_indicator.c 2013-03-25 03:54:20 +0000
1011@@ -24,13 +24,10 @@
1012
1013 #include "ui_indicator.h"
1014
1015-#ifdef HAVE_LIBINDICATE
1016+#ifdef HAVE_MESSAGING_MENU
1017
1018 #include <gtk/gtk.h>
1019-#include <libindicate/server.h>
1020-#include <libindicate/indicator.h>
1021-#include <libindicate-gtk/indicator.h>
1022-#include <libindicate/interests.h>
1023+#include <messaging-menu.h>
1024 #include "feedlist.h"
1025 #include "feed_list_view.h"
1026 #include "liferea_shell.h"
1027@@ -39,15 +36,9 @@
1028
1029 /* The maximum number of feeds to display in the indicator menu. */
1030 #define MAX_INDICATORS 6
1031-/* Whether Liferea should set the indicator menu to attention
1032- status whenever new feed items are downloaded. Since news feeds
1033- do not typically require the user's urgent attention, unlike
1034- mail and IM messages, this is set to false by default. */
1035-#define SET_DRAW_ATTENTION FALSE
1036
1037 static struct indicator_priv {
1038- IndicateServer *server;
1039- gboolean visible;
1040+ MessagingMenuApp *server;
1041 GPtrArray *indicators;
1042 } *indicator_priv = NULL;
1043
1044@@ -55,7 +46,7 @@
1045 The desktop file to initialize the indicator menu with. Resolves to
1046 a string like "/usr/share/applications/liferea.desktop".
1047 */
1048-static const char *DESKTOP_FILE = PACKAGE_DATA_DIR G_DIR_SEPARATOR_S "applications" G_DIR_SEPARATOR_S "liferea.desktop";
1049+static const char *DESKTOP_FILE = "liferea.desktop";
1050
1051 static void
1052 remove_all_indicators () {
1053@@ -66,44 +57,18 @@
1054 Called when the main "Liferea" entry in the indicator menu is clicked.
1055 */
1056 static void
1057-on_indicator_server_clicked (IndicateServer *server, gchar *type, gpointer user_data)
1058+on_indicator_server_clicked (MessagingMenuApp *server, gchar *source_id, gpointer user_data)
1059 {
1060 liferea_shell_present ();
1061 remove_all_indicators ();
1062 }
1063
1064 /*
1065- Called when the indicator container applet is shown.
1066-*/
1067-static void
1068-on_indicator_interest_added (IndicateServer *server, guint interest, gpointer user_data)
1069-{
1070- if (interest != INDICATE_INTEREST_SERVER_SIGNAL)
1071- return;
1072-
1073- indicator_priv->visible = TRUE;
1074- ui_tray_update ();
1075-}
1076-
1077-/*
1078- Called when the indicator container applet is hidden.
1079-*/
1080-static void
1081-on_indicator_interest_removed (IndicateServer *server, guint interest, gpointer user_data)
1082-{
1083- if (interest != INDICATE_INTEREST_SERVER_SIGNAL)
1084- return;
1085-
1086- indicator_priv->visible = FALSE;
1087- ui_tray_update ();
1088-}
1089-
1090-/*
1091 Called when the indicator menu entry for a specific feed
1092 is clicked, meaning Liferea should switch to that feed.
1093 */
1094 static void
1095-on_indicator_clicked (IndicateIndicator *indicator, guint timestamp, gpointer user_data)
1096+on_indicator_clicked (MessagingMenuApp *indicator, gchar *source_id, gpointer user_data)
1097 {
1098 feed_list_view_select ((nodePtr) user_data);
1099 liferea_shell_present ();
1100@@ -116,8 +81,7 @@
1101 if (indicator_priv->server == NULL || indicator == NULL)
1102 return;
1103
1104- indicate_server_remove_indicator (indicator_priv->server, INDICATE_INDICATOR(indicator));
1105- g_object_unref (G_OBJECT (indicator));
1106+ messaging_menu_app_remove_source (indicator_priv->server, (char *)(indicator));
1107 }
1108
1109 void
1110@@ -127,18 +91,13 @@
1111 return;
1112
1113 indicator_priv = g_new0 (struct indicator_priv, 1);
1114- indicator_priv->visible = FALSE;
1115 indicator_priv->indicators = g_ptr_array_new_with_free_func (destroy_indicator);
1116
1117- indicator_priv->server = indicate_server_ref_default();
1118- indicate_server_set_type (indicator_priv->server, "message.im");
1119- indicate_server_set_desktop_file (indicator_priv->server, DESKTOP_FILE);
1120-
1121- g_signal_connect (G_OBJECT (indicator_priv->server), "server-display", G_CALLBACK (on_indicator_server_clicked), NULL);
1122- g_signal_connect (G_OBJECT (indicator_priv->server), "interest-added", G_CALLBACK (on_indicator_interest_added), NULL);
1123- g_signal_connect (G_OBJECT (indicator_priv->server), "interest-removed", G_CALLBACK (on_indicator_interest_removed), NULL);
1124-
1125- indicate_server_show (indicator_priv->server);
1126+ indicator_priv->server = messaging_menu_app_new (DESKTOP_FILE);
1127+ messaging_menu_app_register (indicator_priv->server);
1128+
1129+ g_signal_connect (G_OBJECT (indicator_priv->server), "activate-source", G_CALLBACK (on_indicator_server_clicked), NULL);
1130+
1131 ui_indicator_update ();
1132 }
1133
1134@@ -159,9 +118,10 @@
1135 static void
1136 add_node_indicator (nodePtr node)
1137 {
1138- IndicateIndicator *indicator;
1139- GdkPixbuf *pixbuf;
1140+ GFile *file;
1141+ GIcon *icon;
1142 gchar count[10];
1143+ gchar *signal;
1144
1145 if (indicator_priv->indicators->len >= MAX_INDICATORS)
1146 return;
1147@@ -176,30 +136,28 @@
1148 if (node->unreadCount == 0)
1149 return;
1150
1151- indicator = indicate_indicator_new_with_server (indicator_priv->server);
1152- g_signal_connect (indicator, "user-display", G_CALLBACK (on_indicator_clicked), node);
1153-
1154- /* load favicon */
1155- pixbuf = gdk_pixbuf_new_from_file (node->iconFile, NULL);
1156-
1157- /* display favicon */
1158- indicate_gtk_indicator_set_property_icon (indicator, "icon", pixbuf);
1159- gdk_pixbuf_unref (pixbuf);
1160-
1161- sprintf (count, "%u", node->unreadCount);
1162- indicate_indicator_set_property (indicator, "name", node->title);
1163- indicate_indicator_set_property (indicator, "count", count);
1164-#if SET_DRAW_ATTENTION
1165- indicate_indicator_set_property_bool (indicator, "draw-attention", TRUE);
1166-#endif
1167- g_ptr_array_add (indicator_priv->indicators, indicator);
1168+ file = g_file_new_for_path (node->iconFile);
1169+ icon = g_file_icon_new (file);
1170+
1171+ messaging_menu_app_append_source_with_count(
1172+ indicator_priv->server,
1173+ node->id,
1174+ icon,
1175+ node->title,
1176+ node->unreadCount);
1177+
1178+ signal = g_strdup_printf("activate-source::%s", node->id);
1179+ g_signal_connect (indicator_priv->server, signal, G_CALLBACK (on_indicator_clicked), node);
1180+ g_ptr_array_add (indicator_priv->indicators, node->id);
1181+
1182+ g_object_unref(icon);
1183+ g_object_unref(file);
1184+ g_free(signal);
1185 }
1186
1187 void
1188 ui_indicator_update ()
1189 {
1190- guint index;
1191-
1192 /* Do not update indicators if the user is interacting with the main window */
1193 if (!indicator_priv || gtk_window_is_active (GTK_WINDOW (liferea_shell_get_window ())))
1194 return;
1195@@ -208,16 +166,12 @@
1196 remove_all_indicators ();
1197 /* ...then walk the tree and add an indicator for each unread feed */
1198 feedlist_foreach (add_node_indicator);
1199-
1200- /* revert order of items */
1201- for (index = indicator_priv->indicators->len; index > 0; index--)
1202- indicate_indicator_show (g_ptr_array_index (indicator_priv->indicators, index - 1));
1203 }
1204
1205 gboolean
1206 ui_indicator_is_visible ()
1207 {
1208- return indicator_priv && indicator_priv->visible;
1209+ return TRUE;
1210 }
1211
1212 #else
1213@@ -233,4 +187,4 @@
1214 void ui_indicator_update () {}
1215 gboolean ui_indicator_is_visible () { return FALSE; }
1216
1217-#endif /* HAVE_LIBINDICATE */
1218+#endif /* HAVE_MESSAGING_MENU */

Subscribers

People subscribed via source and target branches

to all changes: