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
=== modified file '.pc/applied-patches'
--- .pc/applied-patches 2013-03-25 02:10:13 +0000
+++ .pc/applied-patches 2013-03-25 03:54:20 +0000
@@ -5,3 +5,4 @@
5add_X-Ubuntu-Gettext-Domain5add_X-Ubuntu-Gettext-Domain
6libunity.patch6libunity.patch
7port-to-libindicate-0.7.patch7port-to-libindicate-0.7.patch
8port-to-messaging-menu.patch
89
=== added directory '.pc/port-to-messaging-menu.patch'
=== added file '.pc/port-to-messaging-menu.patch/configure.ac'
--- .pc/port-to-messaging-menu.patch/configure.ac 1970-01-01 00:00:00 +0000
+++ .pc/port-to-messaging-menu.patch/configure.ac 2013-03-25 03:54:20 +0000
@@ -0,0 +1,181 @@
1dnl Process this file with autoconf to produce a configure script.
2
3AC_INIT([liferea],[1.8.10],[liferea-devel@lists.sourceforge.net])
4AC_CANONICAL_HOST
5AC_CONFIG_SRCDIR([src/feedlist.c])
6
7AC_CONFIG_HEADERS([config.h])
8AM_INIT_AUTOMAKE([1.11 foreign std-options -Wall -Werror])
9AM_SILENT_RULES([yes])
10
11dnl Needed for automake 1.12
12m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
13
14AC_PREREQ(2.59)
15
16LT_INIT
17IT_PROG_INTLTOOL([0.35.0])
18
19AC_PROG_CC
20AM_PROG_CC_C_O
21AC_HEADER_STDC
22AC_PROG_INSTALL
23AC_PROG_MAKE_SET
24AC_SYS_LARGEFILE
25
26AC_ARG_ENABLE(sm, AS_HELP_STRING([--disable-sm],[compile without X session management support]),,enable_sm=yes)
27AC_ARG_ENABLE(libnotify, AS_HELP_STRING([--disable-libnotify],[compile without libnotify support]),,enable_libnotify=yes)
28AC_ARG_ENABLE(libindicate, AS_HELP_STRING([--disable-libindicate],[compile without libindicate support]),,enable_libindicate=yes)
29AC_ARG_ENABLE(libunity, AS_HELP_STRING([--disable-libunity],[compile without libunity support]),,enable_libunity=yes)
30
31AC_CHECK_FUNCS([strsep])
32
33PKG_PROG_PKG_CONFIG()
34
35dnl #######################################################################
36dnl # Check for X session management libs
37dnl #######################################################################
38
39if test "x$enable_sm" = "xyes"; then
40 PKG_CHECK_MODULES([SM], [sm ice], [AC_DEFINE(USE_SM, 1, [Define if we're using X Session Management.])],[enable_sm=no])
41fi
42
43dnl *********
44dnl libnotify
45dnl *********
46
47if test "x$enable_libnotify" = "xyes"; then
48 PKG_CHECK_MODULES([LIBNOTIFY], libnotify >= 0.7,enable_libnotify=yes,enable_libnotify=no)
49 if test "x$enable_libnotify" = "xyes"; then
50 AC_DEFINE(HAVE_LIBNOTIFY, 4, [Define if libnotify.so.4 support is enabled])
51 fi
52 if test "x$enable_libnotify" = "xno"; then
53 PKG_CHECK_MODULES([LIBNOTIFY], libnotify >= 0.3.2,enable_libnotify=yes,enable_libnotify=no)
54 if test "x$enable_libnotify" = "xyes"; then
55 AC_DEFINE(HAVE_LIBNOTIFY, 1, [Define if libnotify.so.1 support is enabled])
56 fi
57 fi
58 AC_SUBST(LIBNOTIFY_CFLAGS)
59 AC_SUBST(LIBNOTIFY_LIBS)
60else
61 enable_libnotify=no
62fi
63
64AM_CONDITIONAL(WITH_LIBNOTIFY, test "x$enable_libnotify" = "xyes")
65
66dnl *********
67dnl libindicate
68dnl *********
69
70if test "x$enable_libindicate" = "xyes"; then
71 PKG_CHECK_MODULES([LIBINDICATE], indicate-0.7 indicate-gtk-0.7,enable_libindicate=yes,enable_libindicate=no)
72 AC_SUBST(LIBINDICATE_CFLAGS)
73 AC_SUBST(LIBINDICATE_LIBS)
74else
75 enable_libindicate=no
76fi
77
78if test "x$enable_libindicate" = "xyes"; then
79 AC_DEFINE(HAVE_LIBINDICATE, 1, [Define if libindicate support is enabled])
80fi
81
82AM_CONDITIONAL(WITH_LIBINDICATE, test "x$enable_libindicate" = "xyes")
83
84dnl *********
85dnl libunity
86dnl *********
87
88if test "x$enable_libunity" = "xyes"; then
89 PKG_CHECK_MODULES([LIBUNITY], unity >= 3.4.2,enable_libunity=yes,enable_libunity=no)
90 AC_SUBST(LIBUNITY_CFLAGS)
91 AC_SUBST(LIBUNITY_LIBS)
92else
93 enable_libunity=no
94fi
95
96if test "x$enable_libunity" = "xyes"; then
97 AC_DEFINE(HAVE_LIBUNITY, 1, [Define if libunity support is enabled])
98fi
99
100AM_CONDITIONAL(WITH_LIBUNITY, test "x$enable_libunity" = "xyes")
101
102dnl Checking for gconftool-2
103AC_PATH_PROG(GCONFTOOL, gconftool-2, no)
104
105if test "x$GCONFTOOL" = xno; then
106 AC_MSG_ERROR([gconftool-2 executable not found in your path - should be installed with GConf])
107fi
108
109AM_GCONF_SOURCE_2
110
111pkg_modules=" gtk+-2.0 >= 2.18.0
112 glib-2.0 >= 2.24.0
113 gio-2.0 >= 2.26.0
114 pango >= 1.4.0
115 gconf-2.0 >= 1.1.9
116 libxml-2.0 >= 2.6.27
117 libxslt >= 1.1.19
118 sqlite3 >= 3.7.0
119 gmodule-2.0 >= 2.0.0
120 gthread-2.0
121 libsoup-2.4 >= 2.28.2
122 unique-1.0
123 webkit-1.0 >= 1.2.2
124 json-glib-1.0"
125
126PKG_CHECK_MODULES(PACKAGE, [$pkg_modules])
127
128AC_SUBST(PACKAGE_CFLAGS)
129AC_SUBST(PACKAGE_LIBS)
130
131uname=`uname`
132AC_DEFINE_UNQUOTED(OS, $uname, [defines a OS version string, used for OS specific code])
133AC_DEFINE_UNQUOTED(OSNAME, "$uname", [defines a OS version string, used for the user agent string])
134AC_MSG_RESULT(user agent OS = $uname)
135
136AM_GLIB_GNU_GETTEXT
137
138GETTEXT_PACKAGE=liferea
139AC_SUBST(GETTEXT_PACKAGE)
140AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE], ["${GETTEXT_PACKAGE}"], [gettext domain])
141
142
143AC_CONFIG_FILES([
144Makefile
145src/Makefile
146src/webkit/Makefile
147src/parsers/Makefile
148src/fl_sources/Makefile
149src/notification/Makefile
150src/ui/Makefile
151doc/Makefile
152doc/html/Makefile
153xslt/Makefile
154man/Makefile
155man/pl/Makefile
156pixmaps/Makefile
157pixmaps/16x16/Makefile
158pixmaps/22x22/Makefile
159pixmaps/24x24/Makefile
160pixmaps/32x32/Makefile
161pixmaps/48x48/Makefile
162pixmaps/scalable/Makefile
163opml/Makefile
164glade/Makefile
165po/Makefile.in
166src/liferea-add-feed
167])
168AC_OUTPUT
169
170echo
171echo "$PACKAGE $VERSION"
172echo
173echo "Use X Session Management........ : $enable_sm"
174echo "Use libnotify................... : $enable_libnotify"
175echo "Use libindicate................. : $enable_libindicate"
176echo "Use libunity.................... : $enable_libunity"
177echo
178eval eval echo Liferea will be installed in $bindir.
179echo
180echo configure complete, now type \'make\'
181echo
0182
=== added directory '.pc/port-to-messaging-menu.patch/src'
=== added file '.pc/port-to-messaging-menu.patch/src/Makefile.am'
--- .pc/port-to-messaging-menu.patch/src/Makefile.am 1970-01-01 00:00:00 +0000
+++ .pc/port-to-messaging-menu.patch/src/Makefile.am 2013-03-25 03:54:20 +0000
@@ -0,0 +1,90 @@
1## Process this file with automake to produce Makefile.in
2
3SUBDIRS = parsers notification ui fl_sources webkit .
4
5AM_CPPFLAGS = \
6 -DPACKAGE_DATA_DIR=\""$(datadir)"\" \
7 -DPACKAGE_LIB_DIR=\""$(pkglibdir)"\" \
8 -DPACKAGE_LOCALE_DIR=\""$(prefix)/$(DATADIRNAME)/locale"\" \
9 -DBIN_DIR=\""$(bindir)"\" \
10 -I$(top_srcdir)/src \
11 $(PACKAGE_CFLAGS) \
12 $(SM_CFLAGS)
13
14bin_PROGRAMS = liferea
15bin_SCRIPTS = liferea-add-feed
16
17liferea_SOURCES = \
18 browser.c browser.h \
19 comments.c comments.h \
20 common.c common.h \
21 conf.c conf.h \
22 date.c date.h \
23 db.c db.h \
24 dbus.c dbus.h \
25 debug.c debug.h \
26 e-date.c e-date.h \
27 enclosure.c enclosure.h \
28 export.c export.h \
29 favicon.c favicon.h \
30 feed.c feed.h \
31 feed_parser.c feed_parser.h \
32 feedlist.c feedlist.h \
33 folder.c folder.h \
34 html.c html.h \
35 htmlview.c htmlview.h \
36 item.c item.h \
37 item_loader.c item_loader.h \
38 item_state.c item_state.h \
39 itemset.c itemset.h \
40 itemlist.c itemlist.h \
41 json.c json.h \
42 metadata.c metadata.h \
43 migrate.c migrate.h \
44 net.c net.h \
45 net_monitor.c net_monitor.h \
46 newsbin.c newsbin.h \
47 node.c node.h \
48 node_type.c node_type.h \
49 node_view.h \
50 render.c render.h \
51 rule.c rule.h \
52 social.c social.h \
53 subscription.c subscription.h \
54 subscription_type.h \
55 update.c update.h \
56 main.c \
57 vfolder.c vfolder.h \
58 vfolder_loader.c vfolder_loader.h \
59 xml.c xml.h
60
61liferea_LDADD = parsers/libliparsers.a \
62 fl_sources/libliflsources.a \
63 ui/libliui.a \
64 webkit/libwebkit.a \
65 $(SYNC_LIB) \
66 $(PACKAGE_LIBS) $(SM_LIBS) \
67 $(INTLLIBS) $(AVAHI_LIBS) \
68 $(WEBKIT_LIBS) $(LIBNOTIFY_LIBS)
69
70EXTRA_DIST = $(srcdir)/liferea-add-feed.in
71DISTCLEANFILES = $(srcdir)/liferea-add-feed
72AM_INSTALLCHECK_STD_OPTIONS_EXEMPT = liferea-add-feed
73
74if WITH_LIBNOTIFY
75
76liferea_LDADD += notification/libnotify.a $(LIBNOTIFY_LIBS)
77
78endif
79
80if WITH_LIBINDICATE
81
82liferea_LDADD += $(LIBINDICATE_LIBS)
83
84endif
85
86if WITH_LIBUNITY
87
88liferea_LDADD += $(LIBUNITY_LIBS)
89
90endif
091
=== added directory '.pc/port-to-messaging-menu.patch/src/ui'
=== added file '.pc/port-to-messaging-menu.patch/src/ui/Makefile.am'
--- .pc/port-to-messaging-menu.patch/src/ui/Makefile.am 1970-01-01 00:00:00 +0000
+++ .pc/port-to-messaging-menu.patch/src/ui/Makefile.am 2013-03-25 03:54:20 +0000
@@ -0,0 +1,37 @@
1## Process this file with automake to produce Makefile.in
2
3AM_CPPFLAGS = \
4 -DPACKAGE_DATA_DIR=\""$(datadir)"\" \
5 -DPACKAGE_LIB_DIR=\""$(pkglibdir)"\" \
6 -DPACKAGE_LOCALE_DIR=\""$(prefix)/$(DATADIRNAME)/locale"\" \
7 -I$(top_srcdir)/src
8
9noinst_LIBRARIES = libliui.a
10
11libliui_a_CFLAGS = $(PACKAGE_CFLAGS) $(LIBINDICATE_CFLAGS) $(LIBUNITY_CFLAGS)
12libliui_a_SOURCES = \
13 auth_dialog.c auth_dialog.h \
14 browser_tabs.c browser_tabs.h \
15 enclosure_list_view.c enclosure_list_view.h \
16 feed_list_view.c feed_list_view.h \
17 icons.c icons.h \
18 item_list_view.c item_list_view.h \
19 itemview.c itemview.h \
20 liferea_dialog.c liferea_dialog.h \
21 liferea_htmlview.c liferea_htmlview.h \
22 liferea_shell.c liferea_shell.h \
23 popup_menu.c popup_menu.h \
24 rule_editor.c rule_editor.h \
25 search_dialog.c search_dialog.h \
26 search_folder_dialog.c search_folder_dialog.h \
27 subscription_dialog.c subscription_dialog.h \
28 ui_common.c ui_common.h \
29 ui_dnd.c ui_dnd.h \
30 ui_folder.c ui_folder.h \
31 ui_indicator.c ui_indicator.h \
32 ui_node.c ui_node.h \
33 ui_prefs.c ui_prefs.h \
34 ui_session.c ui_session.h \
35 ui_tray.c ui_tray.h \
36 ui_unity.c ui_unity.h \
37 ui_update.c ui_update.h
038
=== added file '.pc/port-to-messaging-menu.patch/src/ui/ui_indicator.c'
--- .pc/port-to-messaging-menu.patch/src/ui/ui_indicator.c 1970-01-01 00:00:00 +0000
+++ .pc/port-to-messaging-menu.patch/src/ui/ui_indicator.c 2013-03-25 03:54:20 +0000
@@ -0,0 +1,236 @@
1/*
2 * @file ui_indicator.c libindicate support
3 *
4 * Copyright (C) 2010-2011 Maia Kozheva <sikon@ubuntu.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Library General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor Boston, MA 02110-1301, USA
19 */
20
21#ifdef HAVE_CONFIG_H
22# include <config.h>
23#endif
24
25#include "ui_indicator.h"
26
27#ifdef HAVE_LIBINDICATE
28
29#include <gtk/gtk.h>
30#include <libindicate/server.h>
31#include <libindicate/indicator.h>
32#include <libindicate-gtk/indicator.h>
33#include <libindicate/interests.h>
34#include "feedlist.h"
35#include "feed_list_view.h"
36#include "liferea_shell.h"
37#include "ui_tray.h"
38#include "vfolder.h"
39
40/* The maximum number of feeds to display in the indicator menu. */
41#define MAX_INDICATORS 6
42/* Whether Liferea should set the indicator menu to attention
43 status whenever new feed items are downloaded. Since news feeds
44 do not typically require the user's urgent attention, unlike
45 mail and IM messages, this is set to false by default. */
46#define SET_DRAW_ATTENTION FALSE
47
48static struct indicator_priv {
49 IndicateServer *server;
50 gboolean visible;
51 GPtrArray *indicators;
52} *indicator_priv = NULL;
53
54/*
55 The desktop file to initialize the indicator menu with. Resolves to
56 a string like "/usr/share/applications/liferea.desktop".
57*/
58static const char *DESKTOP_FILE = PACKAGE_DATA_DIR G_DIR_SEPARATOR_S "applications" G_DIR_SEPARATOR_S "liferea.desktop";
59
60static void
61remove_all_indicators () {
62 g_ptr_array_set_size (indicator_priv->indicators, 0);
63}
64
65/*
66 Called when the main "Liferea" entry in the indicator menu is clicked.
67*/
68static void
69on_indicator_server_clicked (IndicateServer *server, gchar *type, gpointer user_data)
70{
71 liferea_shell_present ();
72 remove_all_indicators ();
73}
74
75/*
76 Called when the indicator container applet is shown.
77*/
78static void
79on_indicator_interest_added (IndicateServer *server, guint interest, gpointer user_data)
80{
81 if (interest != INDICATE_INTEREST_SERVER_SIGNAL)
82 return;
83
84 indicator_priv->visible = TRUE;
85 ui_tray_update ();
86}
87
88/*
89 Called when the indicator container applet is hidden.
90*/
91static void
92on_indicator_interest_removed (IndicateServer *server, guint interest, gpointer user_data)
93{
94 if (interest != INDICATE_INTEREST_SERVER_SIGNAL)
95 return;
96
97 indicator_priv->visible = FALSE;
98 ui_tray_update ();
99}
100
101/*
102 Called when the indicator menu entry for a specific feed
103 is clicked, meaning Liferea should switch to that feed.
104*/
105static void
106on_indicator_clicked (IndicateIndicator *indicator, guint timestamp, gpointer user_data)
107{
108 feed_list_view_select ((nodePtr) user_data);
109 liferea_shell_present ();
110 remove_all_indicators ();
111}
112
113static void
114destroy_indicator (gpointer indicator)
115{
116 if (indicator_priv->server == NULL || indicator == NULL)
117 return;
118
119 indicate_server_remove_indicator (indicator_priv->server, INDICATE_INDICATOR(indicator));
120 g_object_unref (G_OBJECT (indicator));
121}
122
123void
124ui_indicator_init ()
125{
126 if (indicator_priv != NULL)
127 return;
128
129 indicator_priv = g_new0 (struct indicator_priv, 1);
130 indicator_priv->visible = FALSE;
131 indicator_priv->indicators = g_ptr_array_new_with_free_func (destroy_indicator);
132
133 indicator_priv->server = indicate_server_ref_default();
134 indicate_server_set_type (indicator_priv->server, "message.im");
135 indicate_server_set_desktop_file (indicator_priv->server, DESKTOP_FILE);
136
137 g_signal_connect (G_OBJECT (indicator_priv->server), "server-display", G_CALLBACK (on_indicator_server_clicked), NULL);
138 g_signal_connect (G_OBJECT (indicator_priv->server), "interest-added", G_CALLBACK (on_indicator_interest_added), NULL);
139 g_signal_connect (G_OBJECT (indicator_priv->server), "interest-removed", G_CALLBACK (on_indicator_interest_removed), NULL);
140
141 indicate_server_show (indicator_priv->server);
142 ui_indicator_update ();
143}
144
145void
146ui_indicator_destroy ()
147{
148 if (indicator_priv == NULL)
149 return;
150
151 remove_all_indicators ();
152 g_object_unref (indicator_priv->server);
153 indicator_priv->server = NULL;
154 g_ptr_array_free (indicator_priv->indicators, TRUE);
155 g_free (indicator_priv);
156 indicator_priv = NULL;
157}
158
159static void
160add_node_indicator (nodePtr node)
161{
162 IndicateIndicator *indicator;
163 GdkPixbuf *pixbuf;
164 gchar count[10];
165
166 if (indicator_priv->indicators->len >= MAX_INDICATORS)
167 return;
168
169 if (IS_VFOLDER(node) || g_slist_length (node->children) > 0) {
170 /* Not a feed - walk children and do nothing more */
171 node_foreach_child (node, add_node_indicator);
172 return;
173 }
174
175 /* Skip feeds with no unread items */
176 if (node->unreadCount == 0)
177 return;
178
179 indicator = indicate_indicator_new_with_server (indicator_priv->server);
180 g_signal_connect (indicator, "user-display", G_CALLBACK (on_indicator_clicked), node);
181
182 /* load favicon */
183 pixbuf = gdk_pixbuf_new_from_file (node->iconFile, NULL);
184
185 /* display favicon */
186 indicate_gtk_indicator_set_property_icon (indicator, "icon", pixbuf);
187 gdk_pixbuf_unref (pixbuf);
188
189 sprintf (count, "%u", node->unreadCount);
190 indicate_indicator_set_property (indicator, "name", node->title);
191 indicate_indicator_set_property (indicator, "count", count);
192#if SET_DRAW_ATTENTION
193 indicate_indicator_set_property_bool (indicator, "draw-attention", TRUE);
194#endif
195 g_ptr_array_add (indicator_priv->indicators, indicator);
196}
197
198void
199ui_indicator_update ()
200{
201 guint index;
202
203 /* Do not update indicators if the user is interacting with the main window */
204 if (!indicator_priv || gtk_window_is_active (GTK_WINDOW (liferea_shell_get_window ())))
205 return;
206
207 /* Remove all previous indicators from the menu */
208 remove_all_indicators ();
209 /* ...then walk the tree and add an indicator for each unread feed */
210 feedlist_foreach (add_node_indicator);
211
212 /* revert order of items */
213 for (index = indicator_priv->indicators->len; index > 0; index--)
214 indicate_indicator_show (g_ptr_array_index (indicator_priv->indicators, index - 1));
215}
216
217gboolean
218ui_indicator_is_visible ()
219{
220 return indicator_priv && indicator_priv->visible;
221}
222
223#else
224
225/*
226 If Liferea is compiled without libindicate support, all indicator
227 support functions do nothing. The application behaves as if there
228 is no indicator applet present.
229*/
230
231void ui_indicator_init () {}
232void ui_indicator_destroy () {}
233void ui_indicator_update () {}
234gboolean ui_indicator_is_visible () { return FALSE; }
235
236#endif /* HAVE_LIBINDICATE */
0237
=== modified file 'configure.ac'
--- configure.ac 2013-03-25 02:10:13 +0000
+++ configure.ac 2013-03-25 03:54:20 +0000
@@ -25,7 +25,7 @@
2525
26AC_ARG_ENABLE(sm, AS_HELP_STRING([--disable-sm],[compile without X session management support]),,enable_sm=yes)26AC_ARG_ENABLE(sm, AS_HELP_STRING([--disable-sm],[compile without X session management support]),,enable_sm=yes)
27AC_ARG_ENABLE(libnotify, AS_HELP_STRING([--disable-libnotify],[compile without libnotify support]),,enable_libnotify=yes)27AC_ARG_ENABLE(libnotify, AS_HELP_STRING([--disable-libnotify],[compile without libnotify support]),,enable_libnotify=yes)
28AC_ARG_ENABLE(libindicate, AS_HELP_STRING([--disable-libindicate],[compile without libindicate support]),,enable_libindicate=yes)28AC_ARG_ENABLE(messaging-menu, AS_HELP_STRING([--disable-messaging-menu],[compile without messaging-menu support]),,enable_messaging_menu=yes)
29AC_ARG_ENABLE(libunity, AS_HELP_STRING([--disable-libunity],[compile without libunity support]),,enable_libunity=yes)29AC_ARG_ENABLE(libunity, AS_HELP_STRING([--disable-libunity],[compile without libunity support]),,enable_libunity=yes)
3030
31AC_CHECK_FUNCS([strsep])31AC_CHECK_FUNCS([strsep])
@@ -64,22 +64,22 @@
64AM_CONDITIONAL(WITH_LIBNOTIFY, test "x$enable_libnotify" = "xyes")64AM_CONDITIONAL(WITH_LIBNOTIFY, test "x$enable_libnotify" = "xyes")
6565
66dnl *********66dnl *********
67dnl libindicate67dnl messaging-menu
68dnl *********68dnl *********
6969
70if test "x$enable_libindicate" = "xyes"; then70if test "x$enable_messaging_menu" = "xyes"; then
71 PKG_CHECK_MODULES([LIBINDICATE], indicate-0.7 indicate-gtk-0.7,enable_libindicate=yes,enable_libindicate=no)71 PKG_CHECK_MODULES([MESSAGING_MENU], messaging-menu,enable_messaging_menu=yes,enable_messaging_menu=no)
72 AC_SUBST(LIBINDICATE_CFLAGS)72 AC_SUBST(MESSAGING_MENU_CFLAGS)
73 AC_SUBST(LIBINDICATE_LIBS)73 AC_SUBST(MESSAGING_MENU_LIBS)
74else74else
75 enable_libindicate=no75 enable_messaging_menu=no
76fi76fi
7777
78if test "x$enable_libindicate" = "xyes"; then78if test "x$enable_messaging_menu" = "xyes"; then
79 AC_DEFINE(HAVE_LIBINDICATE, 1, [Define if libindicate support is enabled])79 AC_DEFINE(HAVE_MESSAGING_MENU, 1, [Define if messaging-menu support is enabled])
80fi80fi
8181
82AM_CONDITIONAL(WITH_LIBINDICATE, test "x$enable_libindicate" = "xyes")82AM_CONDITIONAL(WITH_MESSAGING_MENU, test "x$enable_messaging_menu" = "xyes")
8383
84dnl *********84dnl *********
85dnl libunity85dnl libunity
@@ -172,7 +172,7 @@
172echo172echo
173echo "Use X Session Management........ : $enable_sm"173echo "Use X Session Management........ : $enable_sm"
174echo "Use libnotify................... : $enable_libnotify"174echo "Use libnotify................... : $enable_libnotify"
175echo "Use libindicate................. : $enable_libindicate"175echo "Use messaging-menu.............. : $enable_messaging_menu"
176echo "Use libunity.................... : $enable_libunity"176echo "Use libunity.................... : $enable_libunity"
177echo177echo
178eval eval echo Liferea will be installed in $bindir.178eval eval echo Liferea will be installed in $bindir.
179179
=== modified file 'debian/changelog'
--- debian/changelog 2013-03-25 02:10:13 +0000
+++ debian/changelog 2013-03-25 03:54:20 +0000
@@ -1,3 +1,9 @@
1liferea (1.8.10-0ubuntu2) UNRELEASED; urgency=low
2
3 * Port to messaging-menu. (LP: #1040259)
4
5 -- Dmitrijs Ledkovs <dmitrij.ledkov@ubuntu.com> Mon, 25 Mar 2013 02:41:34 +0000
6
1liferea (1.8.10-0ubuntu1) raring; urgency=low7liferea (1.8.10-0ubuntu1) raring; urgency=low
28
3 * New upstream release.9 * New upstream release.
410
=== modified file 'debian/control'
--- debian/control 2013-03-25 02:10:13 +0000
+++ debian/control 2013-03-25 03:54:20 +0000
@@ -21,8 +21,7 @@
21 intltool,21 intltool,
22 libicu-dev,22 libicu-dev,
23 libx11-dev,23 libx11-dev,
24 libindicate-dev (>= 0.6.90),24 libmessaging-menu-dev,
25 libindicate-gtk-dev (>= 0.6.90),
26 dh-autoreconf,25 dh-autoreconf,
27 libunity-dev (>= 5.0.0),26 libunity-dev (>= 5.0.0),
28 libice-dev,27 libice-dev,
2928
=== added file 'debian/patches/port-to-messaging-menu.patch'
--- debian/patches/port-to-messaging-menu.patch 1970-01-01 00:00:00 +0000
+++ debian/patches/port-to-messaging-menu.patch 2013-03-25 03:54:20 +0000
@@ -0,0 +1,289 @@
1Description: port to messaging menu
2Author: Dmitrijs Ledkovs <dmitrij.ledkov@ubuntu.com>
3Bug-Ubuntu: https://bugs.launchpad.net/bugs/1040259
4
5--- a/configure.ac
6+++ b/configure.ac
7@@ -25,7 +25,7 @@
8
9 AC_ARG_ENABLE(sm, AS_HELP_STRING([--disable-sm],[compile without X session management support]),,enable_sm=yes)
10 AC_ARG_ENABLE(libnotify, AS_HELP_STRING([--disable-libnotify],[compile without libnotify support]),,enable_libnotify=yes)
11-AC_ARG_ENABLE(libindicate, AS_HELP_STRING([--disable-libindicate],[compile without libindicate support]),,enable_libindicate=yes)
12+AC_ARG_ENABLE(messaging-menu, AS_HELP_STRING([--disable-messaging-menu],[compile without messaging-menu support]),,enable_messaging_menu=yes)
13 AC_ARG_ENABLE(libunity, AS_HELP_STRING([--disable-libunity],[compile without libunity support]),,enable_libunity=yes)
14
15 AC_CHECK_FUNCS([strsep])
16@@ -64,22 +64,22 @@
17 AM_CONDITIONAL(WITH_LIBNOTIFY, test "x$enable_libnotify" = "xyes")
18
19 dnl *********
20-dnl libindicate
21+dnl messaging-menu
22 dnl *********
23
24-if test "x$enable_libindicate" = "xyes"; then
25- PKG_CHECK_MODULES([LIBINDICATE], indicate-0.7 indicate-gtk-0.7,enable_libindicate=yes,enable_libindicate=no)
26- AC_SUBST(LIBINDICATE_CFLAGS)
27- AC_SUBST(LIBINDICATE_LIBS)
28+if test "x$enable_messaging_menu" = "xyes"; then
29+ PKG_CHECK_MODULES([MESSAGING_MENU], messaging-menu,enable_messaging_menu=yes,enable_messaging_menu=no)
30+ AC_SUBST(MESSAGING_MENU_CFLAGS)
31+ AC_SUBST(MESSAGING_MENU_LIBS)
32 else
33- enable_libindicate=no
34+ enable_messaging_menu=no
35 fi
36
37-if test "x$enable_libindicate" = "xyes"; then
38- AC_DEFINE(HAVE_LIBINDICATE, 1, [Define if libindicate support is enabled])
39+if test "x$enable_messaging_menu" = "xyes"; then
40+ AC_DEFINE(HAVE_MESSAGING_MENU, 1, [Define if messaging-menu support is enabled])
41 fi
42
43-AM_CONDITIONAL(WITH_LIBINDICATE, test "x$enable_libindicate" = "xyes")
44+AM_CONDITIONAL(WITH_MESSAGING_MENU, test "x$enable_messaging_menu" = "xyes")
45
46 dnl *********
47 dnl libunity
48@@ -172,7 +172,7 @@
49 echo
50 echo "Use X Session Management........ : $enable_sm"
51 echo "Use libnotify................... : $enable_libnotify"
52-echo "Use libindicate................. : $enable_libindicate"
53+echo "Use messaging-menu.............. : $enable_messaging_menu"
54 echo "Use libunity.................... : $enable_libunity"
55 echo
56 eval eval echo Liferea will be installed in $bindir.
57--- a/src/Makefile.am
58+++ b/src/Makefile.am
59@@ -77,9 +77,9 @@
60
61 endif
62
63-if WITH_LIBINDICATE
64+if WITH_MESSAGING_MENU
65
66-liferea_LDADD += $(LIBINDICATE_LIBS)
67+liferea_LDADD += $(MESSAGING_MENU_LIBS)
68
69 endif
70
71--- a/src/ui/Makefile.am
72+++ b/src/ui/Makefile.am
73@@ -8,7 +8,7 @@
74
75 noinst_LIBRARIES = libliui.a
76
77-libliui_a_CFLAGS = $(PACKAGE_CFLAGS) $(LIBINDICATE_CFLAGS) $(LIBUNITY_CFLAGS)
78+libliui_a_CFLAGS = $(PACKAGE_CFLAGS) $(MESSAGING_MENU_CFLAGS) $(LIBUNITY_CFLAGS)
79 libliui_a_SOURCES = \
80 auth_dialog.c auth_dialog.h \
81 browser_tabs.c browser_tabs.h \
82--- a/src/ui/ui_indicator.c
83+++ b/src/ui/ui_indicator.c
84@@ -24,13 +24,10 @@
85
86 #include "ui_indicator.h"
87
88-#ifdef HAVE_LIBINDICATE
89+#ifdef HAVE_MESSAGING_MENU
90
91 #include <gtk/gtk.h>
92-#include <libindicate/server.h>
93-#include <libindicate/indicator.h>
94-#include <libindicate-gtk/indicator.h>
95-#include <libindicate/interests.h>
96+#include <messaging-menu.h>
97 #include "feedlist.h"
98 #include "feed_list_view.h"
99 #include "liferea_shell.h"
100@@ -39,15 +36,9 @@
101
102 /* The maximum number of feeds to display in the indicator menu. */
103 #define MAX_INDICATORS 6
104-/* Whether Liferea should set the indicator menu to attention
105- status whenever new feed items are downloaded. Since news feeds
106- do not typically require the user's urgent attention, unlike
107- mail and IM messages, this is set to false by default. */
108-#define SET_DRAW_ATTENTION FALSE
109
110 static struct indicator_priv {
111- IndicateServer *server;
112- gboolean visible;
113+ MessagingMenuApp *server;
114 GPtrArray *indicators;
115 } *indicator_priv = NULL;
116
117@@ -55,7 +46,7 @@
118 The desktop file to initialize the indicator menu with. Resolves to
119 a string like "/usr/share/applications/liferea.desktop".
120 */
121-static const char *DESKTOP_FILE = PACKAGE_DATA_DIR G_DIR_SEPARATOR_S "applications" G_DIR_SEPARATOR_S "liferea.desktop";
122+static const char *DESKTOP_FILE = "liferea.desktop";
123
124 static void
125 remove_all_indicators () {
126@@ -66,44 +57,18 @@
127 Called when the main "Liferea" entry in the indicator menu is clicked.
128 */
129 static void
130-on_indicator_server_clicked (IndicateServer *server, gchar *type, gpointer user_data)
131+on_indicator_server_clicked (MessagingMenuApp *server, gchar *source_id, gpointer user_data)
132 {
133 liferea_shell_present ();
134 remove_all_indicators ();
135 }
136
137 /*
138- Called when the indicator container applet is shown.
139-*/
140-static void
141-on_indicator_interest_added (IndicateServer *server, guint interest, gpointer user_data)
142-{
143- if (interest != INDICATE_INTEREST_SERVER_SIGNAL)
144- return;
145-
146- indicator_priv->visible = TRUE;
147- ui_tray_update ();
148-}
149-
150-/*
151- Called when the indicator container applet is hidden.
152-*/
153-static void
154-on_indicator_interest_removed (IndicateServer *server, guint interest, gpointer user_data)
155-{
156- if (interest != INDICATE_INTEREST_SERVER_SIGNAL)
157- return;
158-
159- indicator_priv->visible = FALSE;
160- ui_tray_update ();
161-}
162-
163-/*
164 Called when the indicator menu entry for a specific feed
165 is clicked, meaning Liferea should switch to that feed.
166 */
167 static void
168-on_indicator_clicked (IndicateIndicator *indicator, guint timestamp, gpointer user_data)
169+on_indicator_clicked (MessagingMenuApp *indicator, gchar *source_id, gpointer user_data)
170 {
171 feed_list_view_select ((nodePtr) user_data);
172 liferea_shell_present ();
173@@ -116,8 +81,7 @@
174 if (indicator_priv->server == NULL || indicator == NULL)
175 return;
176
177- indicate_server_remove_indicator (indicator_priv->server, INDICATE_INDICATOR(indicator));
178- g_object_unref (G_OBJECT (indicator));
179+ messaging_menu_app_remove_source (indicator_priv->server, (char *)(indicator));
180 }
181
182 void
183@@ -127,18 +91,13 @@
184 return;
185
186 indicator_priv = g_new0 (struct indicator_priv, 1);
187- indicator_priv->visible = FALSE;
188 indicator_priv->indicators = g_ptr_array_new_with_free_func (destroy_indicator);
189
190- indicator_priv->server = indicate_server_ref_default();
191- indicate_server_set_type (indicator_priv->server, "message.im");
192- indicate_server_set_desktop_file (indicator_priv->server, DESKTOP_FILE);
193-
194- g_signal_connect (G_OBJECT (indicator_priv->server), "server-display", G_CALLBACK (on_indicator_server_clicked), NULL);
195- g_signal_connect (G_OBJECT (indicator_priv->server), "interest-added", G_CALLBACK (on_indicator_interest_added), NULL);
196- g_signal_connect (G_OBJECT (indicator_priv->server), "interest-removed", G_CALLBACK (on_indicator_interest_removed), NULL);
197+ indicator_priv->server = messaging_menu_app_new (DESKTOP_FILE);
198+ messaging_menu_app_register (indicator_priv->server);
199+
200+ g_signal_connect (G_OBJECT (indicator_priv->server), "activate-source", G_CALLBACK (on_indicator_server_clicked), NULL);
201
202- indicate_server_show (indicator_priv->server);
203 ui_indicator_update ();
204 }
205
206@@ -159,9 +118,10 @@
207 static void
208 add_node_indicator (nodePtr node)
209 {
210- IndicateIndicator *indicator;
211- GdkPixbuf *pixbuf;
212+ GFile *file;
213+ GIcon *icon;
214 gchar count[10];
215+ gchar *signal;
216
217 if (indicator_priv->indicators->len >= MAX_INDICATORS)
218 return;
219@@ -176,30 +136,28 @@
220 if (node->unreadCount == 0)
221 return;
222
223- indicator = indicate_indicator_new_with_server (indicator_priv->server);
224- g_signal_connect (indicator, "user-display", G_CALLBACK (on_indicator_clicked), node);
225-
226- /* load favicon */
227- pixbuf = gdk_pixbuf_new_from_file (node->iconFile, NULL);
228+ file = g_file_new_for_path (node->iconFile);
229+ icon = g_file_icon_new (file);
230
231- /* display favicon */
232- indicate_gtk_indicator_set_property_icon (indicator, "icon", pixbuf);
233- gdk_pixbuf_unref (pixbuf);
234-
235- sprintf (count, "%u", node->unreadCount);
236- indicate_indicator_set_property (indicator, "name", node->title);
237- indicate_indicator_set_property (indicator, "count", count);
238-#if SET_DRAW_ATTENTION
239- indicate_indicator_set_property_bool (indicator, "draw-attention", TRUE);
240-#endif
241- g_ptr_array_add (indicator_priv->indicators, indicator);
242+ messaging_menu_app_append_source_with_count(
243+ indicator_priv->server,
244+ node->id,
245+ icon,
246+ node->title,
247+ node->unreadCount);
248+
249+ signal = g_strdup_printf("activate-source::%s", node->id);
250+ g_signal_connect (indicator_priv->server, signal, G_CALLBACK (on_indicator_clicked), node);
251+ g_ptr_array_add (indicator_priv->indicators, node->id);
252+
253+ g_object_unref(icon);
254+ g_object_unref(file);
255+ g_free(signal);
256 }
257
258 void
259 ui_indicator_update ()
260 {
261- guint index;
262-
263 /* Do not update indicators if the user is interacting with the main window */
264 if (!indicator_priv || gtk_window_is_active (GTK_WINDOW (liferea_shell_get_window ())))
265 return;
266@@ -208,16 +166,12 @@
267 remove_all_indicators ();
268 /* ...then walk the tree and add an indicator for each unread feed */
269 feedlist_foreach (add_node_indicator);
270-
271- /* revert order of items */
272- for (index = indicator_priv->indicators->len; index > 0; index--)
273- indicate_indicator_show (g_ptr_array_index (indicator_priv->indicators, index - 1));
274 }
275
276 gboolean
277 ui_indicator_is_visible ()
278 {
279- return indicator_priv && indicator_priv->visible;
280+ return TRUE;
281 }
282
283 #else
284@@ -233,4 +187,4 @@
285 void ui_indicator_update () {}
286 gboolean ui_indicator_is_visible () { return FALSE; }
287
288-#endif /* HAVE_LIBINDICATE */
289+#endif /* HAVE_MESSAGING_MENU */
0290
=== modified file 'debian/patches/series'
--- debian/patches/series 2013-03-25 02:10:13 +0000
+++ debian/patches/series 2013-03-25 03:54:20 +0000
@@ -5,3 +5,4 @@
5add_X-Ubuntu-Gettext-Domain5add_X-Ubuntu-Gettext-Domain
6libunity.patch6libunity.patch
7port-to-libindicate-0.7.patch7port-to-libindicate-0.7.patch
8port-to-messaging-menu.patch
89
=== modified file 'debian/rules'
--- debian/rules 2013-03-25 02:10:13 +0000
+++ debian/rules 2013-03-25 03:54:20 +0000
@@ -48,7 +48,7 @@
48 ./configure $(SYSTEM) --prefix=/usr \48 ./configure $(SYSTEM) --prefix=/usr \
49 --mandir=\$${prefix}/share/man --sysconfdir=/etc \49 --mandir=\$${prefix}/share/man --sysconfdir=/etc \
50 --enable-sm --enable-gnutls --enable-lua --enable-libnotify \50 --enable-sm --enable-gnutls --enable-lua --enable-libnotify \
51 --enable-libindicate \51 --enable-messaging-menu \
52 $(ENABLE_NM)52 $(ENABLE_NM)
53 ln -s $(CURDIR)/man/liferea.1 $(CURDIR)/debian/liferea-add-feed.153 ln -s $(CURDIR)/man/liferea.1 $(CURDIR)/debian/liferea-add-feed.1
5454
5555
=== modified file 'src/Makefile.am'
--- src/Makefile.am 2013-03-25 02:10:13 +0000
+++ src/Makefile.am 2013-03-25 03:54:20 +0000
@@ -77,9 +77,9 @@
7777
78endif78endif
7979
80if WITH_LIBINDICATE80if WITH_MESSAGING_MENU
8181
82liferea_LDADD += $(LIBINDICATE_LIBS)82liferea_LDADD += $(MESSAGING_MENU_LIBS)
8383
84endif84endif
8585
8686
=== modified file 'src/ui/Makefile.am'
--- src/ui/Makefile.am 2013-03-25 02:10:13 +0000
+++ src/ui/Makefile.am 2013-03-25 03:54:20 +0000
@@ -8,7 +8,7 @@
88
9noinst_LIBRARIES = libliui.a9noinst_LIBRARIES = libliui.a
1010
11libliui_a_CFLAGS = $(PACKAGE_CFLAGS) $(LIBINDICATE_CFLAGS) $(LIBUNITY_CFLAGS)11libliui_a_CFLAGS = $(PACKAGE_CFLAGS) $(MESSAGING_MENU_CFLAGS) $(LIBUNITY_CFLAGS)
12libliui_a_SOURCES = \12libliui_a_SOURCES = \
13 auth_dialog.c auth_dialog.h \13 auth_dialog.c auth_dialog.h \
14 browser_tabs.c browser_tabs.h \14 browser_tabs.c browser_tabs.h \
1515
=== modified file 'src/ui/ui_indicator.c'
--- src/ui/ui_indicator.c 2013-03-25 02:10:13 +0000
+++ src/ui/ui_indicator.c 2013-03-25 03:54:20 +0000
@@ -24,13 +24,10 @@
2424
25#include "ui_indicator.h"25#include "ui_indicator.h"
2626
27#ifdef HAVE_LIBINDICATE27#ifdef HAVE_MESSAGING_MENU
2828
29#include <gtk/gtk.h>29#include <gtk/gtk.h>
30#include <libindicate/server.h>30#include <messaging-menu.h>
31#include <libindicate/indicator.h>
32#include <libindicate-gtk/indicator.h>
33#include <libindicate/interests.h>
34#include "feedlist.h"31#include "feedlist.h"
35#include "feed_list_view.h"32#include "feed_list_view.h"
36#include "liferea_shell.h"33#include "liferea_shell.h"
@@ -39,15 +36,9 @@
3936
40/* The maximum number of feeds to display in the indicator menu. */37/* The maximum number of feeds to display in the indicator menu. */
41#define MAX_INDICATORS 638#define MAX_INDICATORS 6
42/* Whether Liferea should set the indicator menu to attention
43 status whenever new feed items are downloaded. Since news feeds
44 do not typically require the user's urgent attention, unlike
45 mail and IM messages, this is set to false by default. */
46#define SET_DRAW_ATTENTION FALSE
4739
48static struct indicator_priv {40static struct indicator_priv {
49 IndicateServer *server;41 MessagingMenuApp *server;
50 gboolean visible;
51 GPtrArray *indicators;42 GPtrArray *indicators;
52} *indicator_priv = NULL;43} *indicator_priv = NULL;
5344
@@ -55,7 +46,7 @@
55 The desktop file to initialize the indicator menu with. Resolves to46 The desktop file to initialize the indicator menu with. Resolves to
56 a string like "/usr/share/applications/liferea.desktop".47 a string like "/usr/share/applications/liferea.desktop".
57*/ 48*/
58static const char *DESKTOP_FILE = PACKAGE_DATA_DIR G_DIR_SEPARATOR_S "applications" G_DIR_SEPARATOR_S "liferea.desktop";49static const char *DESKTOP_FILE = "liferea.desktop";
5950
60static void51static void
61remove_all_indicators () {52remove_all_indicators () {
@@ -66,44 +57,18 @@
66 Called when the main "Liferea" entry in the indicator menu is clicked.57 Called when the main "Liferea" entry in the indicator menu is clicked.
67*/ 58*/
68static void59static void
69on_indicator_server_clicked (IndicateServer *server, gchar *type, gpointer user_data)60on_indicator_server_clicked (MessagingMenuApp *server, gchar *source_id, gpointer user_data)
70{61{
71 liferea_shell_present ();62 liferea_shell_present ();
72 remove_all_indicators ();63 remove_all_indicators ();
73}64}
7465
75/*66/*
76 Called when the indicator container applet is shown.
77*/
78static void
79on_indicator_interest_added (IndicateServer *server, guint interest, gpointer user_data)
80{
81 if (interest != INDICATE_INTEREST_SERVER_SIGNAL)
82 return;
83
84 indicator_priv->visible = TRUE;
85 ui_tray_update ();
86}
87
88/*
89 Called when the indicator container applet is hidden.
90*/
91static void
92on_indicator_interest_removed (IndicateServer *server, guint interest, gpointer user_data)
93{
94 if (interest != INDICATE_INTEREST_SERVER_SIGNAL)
95 return;
96
97 indicator_priv->visible = FALSE;
98 ui_tray_update ();
99}
100
101/*
102 Called when the indicator menu entry for a specific feed67 Called when the indicator menu entry for a specific feed
103 is clicked, meaning Liferea should switch to that feed.68 is clicked, meaning Liferea should switch to that feed.
104*/ 69*/
105static void70static void
106on_indicator_clicked (IndicateIndicator *indicator, guint timestamp, gpointer user_data)71on_indicator_clicked (MessagingMenuApp *indicator, gchar *source_id, gpointer user_data)
107{72{
108 feed_list_view_select ((nodePtr) user_data);73 feed_list_view_select ((nodePtr) user_data);
109 liferea_shell_present ();74 liferea_shell_present ();
@@ -116,8 +81,7 @@
116 if (indicator_priv->server == NULL || indicator == NULL) 81 if (indicator_priv->server == NULL || indicator == NULL)
117 return;82 return;
118 83
119 indicate_server_remove_indicator (indicator_priv->server, INDICATE_INDICATOR(indicator));84 messaging_menu_app_remove_source (indicator_priv->server, (char *)(indicator));
120 g_object_unref (G_OBJECT (indicator));
121}85}
12286
123void87void
@@ -127,18 +91,13 @@
127 return;91 return;
128 92
129 indicator_priv = g_new0 (struct indicator_priv, 1);93 indicator_priv = g_new0 (struct indicator_priv, 1);
130 indicator_priv->visible = FALSE;
131 indicator_priv->indicators = g_ptr_array_new_with_free_func (destroy_indicator);94 indicator_priv->indicators = g_ptr_array_new_with_free_func (destroy_indicator);
132 95
133 indicator_priv->server = indicate_server_ref_default();96 indicator_priv->server = messaging_menu_app_new (DESKTOP_FILE);
134 indicate_server_set_type (indicator_priv->server, "message.im");97 messaging_menu_app_register (indicator_priv->server);
135 indicate_server_set_desktop_file (indicator_priv->server, DESKTOP_FILE);98
136 99 g_signal_connect (G_OBJECT (indicator_priv->server), "activate-source", G_CALLBACK (on_indicator_server_clicked), NULL);
137 g_signal_connect (G_OBJECT (indicator_priv->server), "server-display", G_CALLBACK (on_indicator_server_clicked), NULL);100
138 g_signal_connect (G_OBJECT (indicator_priv->server), "interest-added", G_CALLBACK (on_indicator_interest_added), NULL);
139 g_signal_connect (G_OBJECT (indicator_priv->server), "interest-removed", G_CALLBACK (on_indicator_interest_removed), NULL);
140
141 indicate_server_show (indicator_priv->server);
142 ui_indicator_update ();101 ui_indicator_update ();
143}102}
144103
@@ -159,9 +118,10 @@
159static void118static void
160add_node_indicator (nodePtr node)119add_node_indicator (nodePtr node)
161{120{
162 IndicateIndicator *indicator;121 GFile *file;
163 GdkPixbuf *pixbuf;122 GIcon *icon;
164 gchar count[10];123 gchar count[10];
124 gchar *signal;
165 125
166 if (indicator_priv->indicators->len >= MAX_INDICATORS)126 if (indicator_priv->indicators->len >= MAX_INDICATORS)
167 return;127 return;
@@ -176,30 +136,28 @@
176 if (node->unreadCount == 0)136 if (node->unreadCount == 0)
177 return;137 return;
178 138
179 indicator = indicate_indicator_new_with_server (indicator_priv->server);139 file = g_file_new_for_path (node->iconFile);
180 g_signal_connect (indicator, "user-display", G_CALLBACK (on_indicator_clicked), node);140 icon = g_file_icon_new (file);
181141
182 /* load favicon */142 messaging_menu_app_append_source_with_count(
183 pixbuf = gdk_pixbuf_new_from_file (node->iconFile, NULL);143 indicator_priv->server,
184144 node->id,
185 /* display favicon */145 icon,
186 indicate_gtk_indicator_set_property_icon (indicator, "icon", pixbuf);146 node->title,
187 gdk_pixbuf_unref (pixbuf);147 node->unreadCount);
188148
189 sprintf (count, "%u", node->unreadCount);149 signal = g_strdup_printf("activate-source::%s", node->id);
190 indicate_indicator_set_property (indicator, "name", node->title);150 g_signal_connect (indicator_priv->server, signal, G_CALLBACK (on_indicator_clicked), node);
191 indicate_indicator_set_property (indicator, "count", count);151 g_ptr_array_add (indicator_priv->indicators, node->id);
192#if SET_DRAW_ATTENTION152
193 indicate_indicator_set_property_bool (indicator, "draw-attention", TRUE);153 g_object_unref(icon);
194#endif154 g_object_unref(file);
195 g_ptr_array_add (indicator_priv->indicators, indicator);155 g_free(signal);
196}156}
197157
198void158void
199ui_indicator_update ()159ui_indicator_update ()
200{160{
201 guint index;
202
203 /* Do not update indicators if the user is interacting with the main window */161 /* Do not update indicators if the user is interacting with the main window */
204 if (!indicator_priv || gtk_window_is_active (GTK_WINDOW (liferea_shell_get_window ())))162 if (!indicator_priv || gtk_window_is_active (GTK_WINDOW (liferea_shell_get_window ())))
205 return;163 return;
@@ -208,16 +166,12 @@
208 remove_all_indicators ();166 remove_all_indicators ();
209 /* ...then walk the tree and add an indicator for each unread feed */167 /* ...then walk the tree and add an indicator for each unread feed */
210 feedlist_foreach (add_node_indicator);168 feedlist_foreach (add_node_indicator);
211
212 /* revert order of items */
213 for (index = indicator_priv->indicators->len; index > 0; index--)
214 indicate_indicator_show (g_ptr_array_index (indicator_priv->indicators, index - 1));
215}169}
216170
217gboolean171gboolean
218ui_indicator_is_visible ()172ui_indicator_is_visible ()
219{173{
220 return indicator_priv && indicator_priv->visible;174 return TRUE;
221}175}
222176
223#else177#else
@@ -233,4 +187,4 @@
233void ui_indicator_update () {}187void ui_indicator_update () {}
234gboolean ui_indicator_is_visible () { return FALSE; }188gboolean ui_indicator_is_visible () { return FALSE; }
235189
236#endif /* HAVE_LIBINDICATE */190#endif /* HAVE_MESSAGING_MENU */

Subscribers

People subscribed via source and target branches

to all changes: