[pan2] dbus fixes



commit b711498d1325a6d1d566423a1223f653b4b2c8df
Author: Heinrich MÃller <henmull src gnome org>
Date:   Sat Jan 21 20:01:24 2012 +0100

    dbus fixes

 configure.in   |    4 +++-
 pan/gui/pan.cc |   52 +++++++++++++++++++++++++++++++++++-----------------
 2 files changed, 38 insertions(+), 18 deletions(-)
---
diff --git a/configure.in b/configure.in
index 165b3d2..5be40f0 100644
--- a/configure.in
+++ b/configure.in
@@ -58,6 +58,7 @@ GNUTLS_REQUIRED=2.12.10
 LIBNOTIFY_REQUIRED=0.4.1
 LIBGKR_REQUIRED=3.2.2
 ODB_REQUIRED=1.7.0
+SQLITE3_REQUIRED=3.7.0
 AC_SUBST(ODB_REQUIRED)
 AC_SUBST(GLIB_REQUIRED)
 AC_SUBST(GMIME_REQUIRED)
@@ -66,6 +67,7 @@ AC_SUBST(GTKSPELL_REQUIRED)
 AC_SUBST(GNUTLS_REQUIRED)
 AC_SUBST(LIBNOTIFY_REQUIRED)
 AC_SUBST(LIBGKR_REQUIRED)
+AC_SUBST(SQLITE3_REQUIRED)
 
 dnl LIBGSASL_REQUIRED=1.6.1
 dnl AC_SUBST(LIBGSASL_REQUIRED)
@@ -203,7 +205,7 @@ dnl check for odb and libodb-sqlite for database support
 AC_ARG_ENABLE([sqlite-support],
 AC_HELP_STRING([--enable-sqlite-support],[enable sqlite support with libodb]),[enable_sqlite_support=$enableval],[enable_sqlite_support=yes])
 if test "x$enable_sqlite_support" = "xyes" ; then
-  PKG_CHECK_MODULES([LIBODB],[libodb >= ODB_REQUIRED libodb-sqlite >= ODB_REQUIRED],[HAVE_ODB="yes"],[HAVE_ODB="no"])
+  PKG_CHECK_MODULES([LIBODB],[libodb >= ODB_REQUIRED libodb-sqlite >= ODB_REQUIRED sqlite3 >= SQLITE3_REQUIRED],[HAVE_ODB="yes"],[HAVE_ODB="no"])
   AC_SUBST([LIBODB_CFLAGS])
   AC_SUBST([LIBODB_LIBS])
   if test "x$HAVE_ODB" = "xyes"; then
diff --git a/pan/gui/pan.cc b/pan/gui/pan.cc
index 85f2632..4c97679 100644
--- a/pan/gui/pan.cc
+++ b/pan/gui/pan.cc
@@ -73,8 +73,10 @@ extern "C" {
   #include <gnome-keyring-1/gnome-keyring-memory.h>
 #endif
 
+
+/* NOTE : Dbus is disabled for now, it's buggy */
 //#define DEBUG_LOCALE 1
-//#define DEBUG_PARALLEL 1
+#define DEBUG_PARALLEL 1
 
 using namespace pan;
 
@@ -765,6 +767,8 @@ _("General Options\n"
       NULL
     );
 
+    std::cerr<<"bus acquired\n";
+
   }
 
   static void
@@ -776,11 +780,10 @@ _("General Options\n"
     Pan* pan(static_cast<Pan*>(user_data));
     g_return_if_fail (pan);
 
-    if (connection)
-    {
-      pan->name_valid = true;
-      pan->lost_name = false;
-    }
+    pan->name_valid = true;
+    pan->lost_name = false;
+
+    std::cerr<<"name acquired "<<pan->name_valid<<"\n";
   }
 
   static void
@@ -794,6 +797,8 @@ _("General Options\n"
     pan->name_valid = false;
     pan->lost_name = true;
     pan->dbus_id= -1;
+
+    std::cerr<<"name lost\n";
   }
 
 
@@ -810,12 +815,16 @@ _("General Options\n"
         pan,NULL);
 
     dbus_connection = g_bus_get_sync  (G_BUS_TYPE_SESSION , NULL, NULL);
+
+//    while (!pan->name_valid && !pan->lost_name) std::cerr<<pan->name_valid<<" "<<pan->lost_name<<"\n";
+
+    std::cerr<<"dbus id "<<pan->dbus_id<<" "<<dbus_connection<<"\n";
   }
 
   static void
   pan_dbus_deinit (Pan* pan)
   {
-    g_bus_unown_name(pan->dbus_id);
+    if (pan->dbus_id != -1) g_bus_unown_name(pan->dbus_id);
   }
 
   /***
@@ -938,30 +947,39 @@ main (int argc, char *argv[])
     GError* error(NULL);
     GVariant* var;
 
+    if (!dbus_connection) std::cerr<<"connection null\n";
+
     if (!dbus_connection) goto _fail;
-    if (pan.dbus_id == -1)
+
+    std::cerr<<"dbg "<<pan.dbus_id<<" "<<pan.lost_name<<" "<<pan.name_valid<<"\n";
+
+//    if (pan.dbus_id == -1 || pan.lost_name)
     {
 
-      var = g_variant_new ("(sssbb)",
-                      groups.c_str(), nzb_output_path.c_str(), nzb_str.c_str(),  gui, nzb);
+      std::cerr<<"dbus id -1\n";
       g_dbus_connection_call_sync (dbus_connection,
                              PAN_DBUS_SERVICE_NAME,
                              PAN_DBUS_SERVICE_PATH,
                              "news.pan.NZB",
                              "NZBEnqueue",
-                             var,
+                             g_variant_new ("(sssbb)",
+                                groups.c_str(), nzb_output_path.c_str(), nzb_str.c_str(),  gui, nzb),
                              NULL,
                              G_DBUS_CALL_FLAGS_NONE,
                              -1,
                              NULL,
                              &error);
+
+      if (!error)
+      {
+        std::cout<<"Added "<<nzb_files.size()<<" files to the queue. Exiting.\n";
+        exit(EXIT_SUCCESS);
+      } else
+      {
+        std::cerr<<error->message<<"\n";
+        g_error_free(error);
+      }
     }
-    if (!error)
-    {
-      std::cout<<"Added "<<nzb_files.size()<<" files to the queue. Exiting.\n";
-      exit(EXIT_SUCCESS);
-    } else
-      g_error_free(error);
   #endif
     _fail:
 #endif



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]