Added the dbus method handler for OpenEditAccountsDialog
authorSergio Villar Senin <svillar@igalia.com>
Fri, 23 Oct 2009 14:47:28 +0000 (16:47 +0200)
committerSergio Villar Senin <svillar@igalia.com>
Mon, 2 Nov 2009 09:50:50 +0000 (10:50 +0100)
configure.ac
debian/control
libmodest-dbus-client/configure.ac
libmodest-dbus-client/debian/changelog
src/dbus_api/modest-dbus-callbacks.c

index 97ce739..018d022 100644 (file)
@@ -120,7 +120,7 @@ else
    AC_MSG_ERROR([install gtkhtml 3.8 or newer])
 fi
 
-PKG_CHECK_MODULES(LIBMODEST_DBUS_CLIENT,libmodest-dbus-client-1.0 >= 3.1.0)
+PKG_CHECK_MODULES(LIBMODEST_DBUS_CLIENT,libmodest-dbus-client-1.0 >= 3.2.0)
 dnl # GLib/Gobject/Gtk/Gconf => mandatory
 
 PKG_CHECK_MODULES(MODEST_GSTUFF,glib-2.0 >= 2.6 gobject-2.0 gtk+-2.0 >= 2.6 gconf-2.0 gnome-vfs-2.0 libgtkhtml-${gtk_html_version} libtinymail-1.0 libtinymail-camel-1.0 libtinymail-gnomevfs-1.0 libtinymailui-1.0 libtinymailui-gtk-1.0) 
index e67d69e..e19e5c1 100644 (file)
@@ -2,7 +2,7 @@ Source: modest
 Section: mail
 Priority: optional
 Maintainer: Moises Martinez <moises.martinez@nokia.com>
-Build-Depends: debhelper (>= 4.0.0), cdbs, libmodest-dbus-client-dev (>= 3.1.0), gnome-common, gtkhtml3.14-dev, 
+Build-Depends: debhelper (>= 4.0.0), cdbs, libmodest-dbus-client-dev (>= 3.2.0), gnome-common, gtkhtml3.14-dev, 
  libconic0-dev, libhildon1-dev, libdbus-1-dev,  libdbus-glib-1-dev, libebook-dev, osso-af-settings, libedataserver-dev,
  libhildonnotify-dev, libgconf2-dev, libglib2.0-dev, libosso-gnomevfs2-dev, libhildonmime-dev, libtinymail-1.0-0-dev,
  libtinymail-camel-1.0-0-dev, libtinymail-maemo-1.0-0-dev, libtinymailui-1.0-0-dev, libtinymail-gnomevfs-1.0-0-dev,
@@ -12,7 +12,7 @@ Standards-Version: 3.6.0
 
 Package: modest
 Architecture: any
-Depends: ${shlibs:Depends}, ${misc:Depends}, ${launcher:Depends}, libmodest-dbus-client (>= 3.1.0), 
+Depends: ${shlibs:Depends}, ${misc:Depends}, ${launcher:Depends}, libmodest-dbus-client (>= 3.2.0), 
  modest-providers-data, modest-l10n-mr | modest-l10n-mr0, osso-icons-theme, operator-wizard-settings,
  osso-countries-l10n-mr | osso-countries-l10n-mr0, microb-engine
 Description: an e-mail client for platforms with modest resources
index c2ff6fb..e820261 100644 (file)
 # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
-AC_INIT([libmodestclient],[3.1.0],[http://maemo.org])
+AC_INIT([libmodestclient],[3.2.0],[http://maemo.org])
 AC_CONFIG_HEADERS([config.h])
 
 m4_define([modest_api_major_version], [1])
 m4_define([modest_api_minor_version], [99])
-m4_define([modest_api_micro_version], [1])
+m4_define([modest_api_micro_version], [2])
 m4_define([modest_api_version], [modest_api_major_version.modest_api_minor_version.modest_api_micro_version])
 
 
index 4d9fe0c..a876179 100644 (file)
@@ -1,3 +1,10 @@
+libmodest-dbus-client (4:3.2.0-0) unstable; urgency=low
+
+  * Week 43, 2009 - third release
+  * Add API method OpenEditAccountsDialog
+
+ -- Moises Martinez <moises.martinez@nokia.com>  Wed, 23 Oct 2009 11:18:00 +0200
+
 libmodest-dbus-client (4:3.1.0-0) unstable; urgency=low
 
   * Week 42, 2009 - second release
index 84bab03..2d2f8a0 100644 (file)
@@ -1429,7 +1429,61 @@ on_top_application(GArray * arguments, gpointer data, osso_rpc_t * retval)
 {
        /* Use g_idle to context-switch into the application's thread: */
        g_idle_add(on_idle_top_application, NULL);
-       
+
+       return OSSO_OK;
+}
+
+static gboolean
+on_idle_open_edit_accounts_dialog (gpointer user_data)
+{
+       ModestWindow *top;
+       ModestWindowMgr *mgr;
+       gboolean closed;
+
+       /* This is a GDK lock because we are an idle callback and
+        * the code below is or does Gtk+ code */
+
+       gdk_threads_enter (); /* CHECKED */
+
+       mgr = modest_runtime_get_window_mgr ();
+       closed = modest_window_mgr_close_all_but_initial (mgr);
+       top = modest_window_mgr_get_current_top (mgr);
+
+       if (closed) {
+               /* Show edit accounts dialog */
+               modest_ui_actions_on_accounts (NULL, top);
+       } else {
+               gboolean has_accounts;
+
+               has_accounts = modest_account_mgr_has_accounts (modest_runtime_get_account_mgr (),
+                                                               TRUE);
+
+               /* Present the current top window */
+               gdk_threads_leave ();
+               on_idle_top_application (NULL);
+               gdk_threads_enter ();
+
+               /* Show edit accounts dialog if we're launching the
+                  program and there is no account (if there is at
+                  least one account then on_idle_top_application will
+                  show the accounts wizard */
+               if (!top && has_accounts) {
+                       top = modest_window_mgr_get_current_top (mgr);
+                       modest_ui_actions_on_accounts (NULL, top);
+               }
+       }
+
+       gdk_threads_leave (); /* CHECKED */
+
+       return FALSE; /* Do not call this callback again. */
+}
+
+static gint
+on_open_edit_accounts_dialog (GArray * arguments, gpointer data, osso_rpc_t * retval)
+{
+       /* Use g_idle to context-switch into the application's thread: */
+       g_idle_add (on_idle_open_edit_accounts_dialog, NULL);
+
        return OSSO_OK;
 }
 
@@ -1521,8 +1575,13 @@ modest_dbus_req_handler(const gchar * interface, const gchar * method,
                if (arguments->len != 0)
                        goto param_error;
                modest_runtime_set_allow_shutdown (TRUE);
-               return on_top_application (arguments, data, retval); 
-       } else { 
+               return on_top_application (arguments, data, retval);
+       } else if (g_ascii_strcasecmp (method, MODEST_DBUS_METHOD_OPEN_EDIT_ACCOUNTS_DIALOG) == 0) {
+               if (arguments->len != 0)
+                       goto param_error;
+               modest_runtime_set_allow_shutdown (TRUE);
+               return on_open_edit_accounts_dialog (arguments, data, retval);
+       } else {
                /* We need to return INVALID here so
                 * libosso will return DBUS_HANDLER_RESULT_NOT_YET_HANDLED,
                 * so that our modest_dbus_req_filter will then be tried instead.