Commit 592fe9ff authored by Jim Nelson's avatar Jim Nelson

Integrate with libmessaging-menu: Closes #5607

Because Messaging Menu isn't available on Precise, a special
debian/control.quantal file is introduced here.  We should move to
using it solely when we phase out Precise support.
parent f9092fdd
......@@ -40,6 +40,7 @@ endif ()
find_package(PkgConfig)
pkg_check_modules(LIBINDICATE QUIET indicate-0.7>=0.6.1)
pkg_check_modules(LIBUNITY QUIET unity>=5.12.0)
pkg_check_modules(LIBMESSAGINGMENU QUIET messaging-menu>=12.10.2)
# intl
include(Gettext)
......
Source: geary
Section: gnome
Priority: optional
Maintainer: Jim Nelson <jim@yorba.org>
Build-Depends: debhelper (>= 8),
libgee-dev (>= 0.6.0),
libglib2.0-dev (>= 2.30.0),
libgtk-3-dev (>= 3.2.0),
libunique-3.0-dev (>= 3.0.0),
libnotify-dev (>=0.7.5),
libcanberra-dev (>= 0.28),
libwebkitgtk-3.0-dev (>= 1.8.0),
libgmime-2.6-dev (>= 2.6.0),
valac-0.18 (>= 0.17.4),
cmake (>= 2.8.0),
libsqlite3-dev (>= 3.7.4),
libgnome-keyring-dev (>= 3.2.2),
libindicate-dev (>= 0.6.1),
libunity-dev (>= 5.12.0),
libmessaging-menu-dev (>= 12.10.2)
Standards-Version: 3.8.3
Homepage: http://www.yorba.org
Package: geary
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends},
libgee2 (>= 0.6.0),
libglib2.0-0 (>= 2.30.0),
libgtk-3-0 (>= 3.2.0),
libunique-3.0-0 (>= 3.0.0),
libnotify4 (>= 0.7.5),
libcanberra0 (>= 0.28),
libwebkitgtk-3.0-0 (>= 1.8.0),
libxml2 (>= 2.6.32),
libsqlite3-0 (>= 3.7.4),
libgnome-keyring0 (>= 3.2.2),
libindicate5 (>= 0.6.1),
libunity9 (>= 5.12.0),
libmessaging-menu0 (>= 12.10.2)
Description: Email client
Geary is an email client built for the GNOME desktop environment. It
allows you to read and send email with a simple, modern interface.
.
Visit http://www.yorba.org to read about the current state of
Geary's development.
Package: geary-dbg
Architecture: any
Section: debug
Priority: extra
Depends: geary (= ${binary:Version}), ${misc:Depends}
Enhances: geary
Description: Email client (debugging symbols)
Geary is an email client built for the GNOME desktop environment. It
allows you to read and send email with a simple, modern interface.
.
Visit http://www.yorba.org to read about the current state of
Geary's development.
.
This package contains debugging symbols for geary.
......@@ -11,3 +11,10 @@ Terminal=false
Categories=GNOME;GTK;Network;Office;Email;
MimeType=x-scheme-handler/mailto;
StartupNotify=true
Actions=Compose
[Desktop Action Compose]
Name=Compose Message
Exec=geary mailto:
OnlyShowIn=Messaging Menu;Unity
......@@ -217,6 +217,7 @@ client/models/folder-list.vala
client/models/conversation-list-store.vala
client/notification/libindicate.vala
client/notification/libmessagingmenu.vala
client/notification/new-messages-indicator.vala
client/notification/new-messages-monitor.vala
client/notification/notification-bubble.vala
......@@ -273,7 +274,7 @@ include(ValaPrecompile)
# Packages
if (LIBINDICATE_FOUND)
message(STATUS "Unity messaging menu support: ON")
message(STATUS "Unity indicate support: ON")
set(EXTRA_CLIENT_PKG_CONFIG
${EXTRA_CLIENT_PKG_CONFIG}
indicate-0.7
......@@ -289,6 +290,26 @@ if (LIBINDICATE_FOUND)
${EXTRA_VALA_OPTIONS}
-D HAVE_LIBINDICATE
)
else ()
message(STATUS "Unity indicate support: OFF")
endif ()
if (LIBMESSAGINGMENU_FOUND)
message(STATUS "Unity messaging menu support: ON")
set(EXTRA_CLIENT_PKG_CONFIG
${EXTRA_CLIENT_PKG_CONFIG}
messaging-menu
)
set(EXTRA_CLIENT_PACKAGES
${EXTRA_CLIENT_PACKAGES}
MessagingMenu-1.0
)
set(EXTRA_VALA_OPTIONS
${EXTRA_VALA_OPTIONS}
-D HAVE_LIBMESSAGINGMENU
)
else ()
message(STATUS "Unity messaging menu support: OFF")
endif ()
......
/* Copyright 2011-2012 Yorba Foundation
*
* This software is licensed under the GNU Lesser General Public License
* (version 2.1 or later). See the COPYING file in this distribution.
*/
public class Libmessagingmenu : NewMessagesIndicator {
#if HAVE_LIBMESSAGINGMENU
private const string NEW_MESSAGES_ID = "new-messages-id";
private MessagingMenu.App app = new MessagingMenu.App("geary.desktop");
public Libmessagingmenu(NewMessagesMonitor monitor) {
base (monitor);
app.register();
app.activate_source.connect(on_activate_source);
monitor.notify["count"].connect(on_new_messages_changed);
debug("Registered messaging-menu indicator");
}
~Libmessagingmenu() {
monitor.notify["count"].disconnect(on_new_messages_changed);
}
private void on_activate_source(string source_id) {
if (source_id == NEW_MESSAGES_ID)
inbox_activated(now());
}
private void on_new_messages_changed() {
if (monitor.count > 0)
show_new_messages_count();
else
remove_new_messages_count();
}
private void show_new_messages_count() {
if (app.has_source(NEW_MESSAGES_ID))
app.set_source_count(NEW_MESSAGES_ID, monitor.count);
else
app.append_source_with_count(NEW_MESSAGES_ID, null, _("New Messages"), monitor.count);
app.draw_attention(NEW_MESSAGES_ID);
}
private void remove_new_messages_count() {
if (app.has_source(NEW_MESSAGES_ID)) {
app.remove_attention(NEW_MESSAGES_ID);
app.remove_source(NEW_MESSAGES_ID);
}
}
#else
public Libmessagingmenu(NewMessagesMonitor monitor) {
base (monitor);
}
#endif
}
......@@ -21,11 +21,32 @@ public abstract class NewMessagesIndicator : Object {
}
public static NewMessagesIndicator create(NewMessagesMonitor monitor) {
NewMessagesIndicator? indicator = null;
// these are ordered in order of preference, as it's possible for libindicate and
// libmessagingmenu to coexist (although only libmessagingmenu will work)
#if HAVE_LIBMESSAGINGMENU
if (indicator == null)
indicator = new Libmessagingmenu(monitor);
#endif
#if HAVE_LIBINDICATE
return new Libindicate(monitor);
#else
return new NullIndicator(monitor);
if (indicator == null)
indicator = new Libindicate(monitor);
#endif
if (indicator == null)
indicator = new NullIndicator(monitor);
assert(indicator != null);
return indicator;
}
// Returns time as a uint32 (suitable for signals if event doesn't supply it)
protected uint32 now() {
return (uint32) TimeVal().tv_sec;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment