Added dbus config
[gregoa/zavai.git] / src / app_polygen.vala
index 05a85c6bfb9432b58189df30e6151fbed3f315cb..719ba886e880084df6300ccd5c15a72a5fd2f56b 100644 (file)
@@ -119,21 +119,25 @@ protected class PolygenRun : Gtk.VBox
         else
             args[2] = null;
         int pipe_out;
-        Process.spawn_async_with_pipes(config.homedir, args, null, 0, null, null, null, out pipe_out, null);
-        IOChannel ch = new IOChannel.unix_new(pipe_out);
         string result;
-        size_t res_len;
-        ch.read_to_end(out result, out res_len);
-        ch.shutdown(false);
+        try {
+            Process.spawn_async_with_pipes(config.homedir, args, null, 0, null, null, null, out pipe_out, null);
+            IOChannel ch = new IOChannel.unix_new(pipe_out);
+            size_t res_len;
+            ch.read_to_end(out result, out res_len);
+            ch.shutdown(false);
+
+            if (grm_type == "line/html" || grm_type == "block/html")
+            {
+                result = unhtml.replace(result, (long)res_len, 0, " ", 0);
+            } else if (grm_type == "line/text") {
+                result = seplines.replace(result, (long)res_len, 0, "\n\n", 0);
+            }
+            
 
-        if (grm_type == "line/html" || grm_type == "block/html")
-        {
-            result = unhtml.replace(result, (long)res_len, 0, " ", 0);
-        } else if (grm_type == "line/text") {
-            result = seplines.replace(result, (long)res_len, 0, "\n\n", 0);
+        } catch (Error e) {
+            result = "Error: " + e.message;
         }
-        
-
         text_buffer.text = result;
         Gtk.TextIter iter;
         text_buffer.get_iter_at_offset(out iter, 0);
@@ -230,10 +234,6 @@ Polygen polygen;
 
 public void init()
 {
-    var menu_misc = new zavai.Menu("Misc");
-    zavai.registry.register_menu("menu.misc", menu_misc);
-    zavai.registry.getmenu("menu.main").add_applet("menu.misc");
-
     try {
         var data = new IOChannel.file(zavai.config.homedir + "/polygen-info", "r");
         polygen = new Polygen("Polygen", data);
@@ -241,7 +241,7 @@ public void init()
 
         zavai.registry.register_applet("ui.polygen", polygen);
         zavai.registry.getmenu("menu.misc").add_applet("ui.polygen");
-    } catch (FileError e) {
+    } catch (Error e) {
         polygen = null;
         zavai.log.error("Skipping polygen plugin: " + e.message);
     }