return g_strdup (priv->ooo_version);
}
+/**
+ * solipa_ooo_get_cmd_apri_openoffice:
+ * @ooo:
+ */
+gchar
+*solipa_ooo_get_cmd_apri_openoffice (SolipaOOO *ooo)
+{
+ gchar *dash;
+ gchar *command;
+
+ SolipaOOOPrivate *priv = SOLIPA_OOO_GET_PRIVATE (ooo);
+
+ if (g_strcmp0 (priv->ooo_version, "") == 0
+ || zak_utils_compare_version (priv->ooo_version, "3.0.0", NULL, NULL) > 0)
+ {
+ dash = g_strdup ("-");
+ }
+ else
+ {
+ dash = g_strdup ("");
+ }
+
+#ifdef G_OS_WIN32
+
+ command = g_strdup_printf ("\"%s %s-accept=\"socket,host=localhost,port=%d;urp;\" %s-norestore %s%s\"",
+ priv->ooo_soffice,
+ dash,
+ priv->ooo_port,
+ dash,
+ dash,
+ priv->visible ? "-invisible" : "-headless");
+
+#else
+
+ command = g_strdup_printf ("\"%s\" %s-accept=\"socket,host=localhost,port=%d;urp;\" %s-norestore %s%s",
+ priv->ooo_soffice,
+ dash,
+ priv->ooo_port,
+ dash,
+ dash,
+ priv->visible ? "-invisible" : "-headless");
+
+#endif
+
+ g_free (dash);
+
+ return command;
+}
+
/**
* solipa_ooo_exec:
* @ooo:
{
GtkWidget *dialog;
+ gchar *command;
+
FILE *pipa;
gboolean in_esecuzione;
}
/* apro openoffice in ascolto */
- gchar *dash;
- gchar *command;
- guint part;
-
- if (g_strcmp0 (priv->ooo_version, "") == 0
- || zak_utils_compare_version (priv->ooo_version, "3.0.0", NULL, &part) > 0)
- {
- dash = g_strdup ("-");
- }
- else
- {
- dash = g_strdup ("");
- }
-
-#ifdef G_OS_WIN32
-
- command = g_strconcat ("\"",
- priv->ooo_soffice,
- g_strdup_printf (" %s-accept=\"socket,host=localhost,port=%d;urp;\" %s-norestore %s%s\"",
- dash,
- priv->ooo_port,
- dash,
- dash,
- priv->visible ? "-invisible" : "-headless"),
- NULL);
-
-#else
-
- command = g_strconcat ("\"",
- priv->ooo_soffice,
- g_strdup_printf ("\" %s-accept=\"socket,host=localhost,port=%d;urp;\" %s-norestore %s%s",
- dash,
- priv->ooo_port,
- dash,
- dash,
- priv->visible ? "-invisible" : "-headless"),
- NULL);
-
-#endif
+ command = solipa_ooo_get_cmd_apri_openoffice (ooo);
pipa = popen (command, "r");
g_free (command);
- g_free (dash);
-
g_string_append_printf (str,
"context = resolver.resolve(\"uno:socket,host=localhost,port=%d;urp;StarOffice.ComponentContext\")\n"
"desktop = context.ServiceManager.createInstanceWithContext(\"com.sun.star.frame.Desktop\", context)\n",
gboolean in_esecuzione;
gchar *ooo_path;
- gchar *dash;
- guint part;
gchar *command;
guint timeout;
solipa_ooo_chiudi_openoffice (ooo);
}
- if (g_strcmp0 (priv->ooo_version, "") == 0
- || zak_utils_compare_version (priv->ooo_version, "3.0.0", NULL, &part) > 0)
- {
- dash = g_strdup ("-");
- }
- else
- {
- dash = g_strdup ("");
- }
-
/* apro openoffice in ascolto */
#ifdef G_OS_WIN32
gchar *curdir = g_get_current_dir ();
chdir (g_build_filename (priv->ooo_path, "program", NULL));
- command = g_strconcat ("\"",
- priv->ooo_soffice,
- g_strdup_printf (" %s-accept=\"socket,host=localhost,port=%d;urp;\" %s-norestore %s%s\"",
- dash,
- priv->ooo_port,
- dash,
- dash,
- priv->visible ? "-invisible" : "-headless"),
- NULL);
+ command = solipa_ooo_get_cmd_apri_openoffice (ooo);
pipa = popen (command, "r");
#else
- command = g_strconcat ("\"",
- priv->ooo_soffice,
- g_strdup_printf ("\" %s-accept=\"socket,host=localhost,port=%d;urp;\" %s-norestore %s%s",
- dash,
- priv->ooo_port,
- dash,
- dash,
- priv->visible ? "-invisible" : "-headless"),
- NULL);
+ command = solipa_ooo_get_cmd_apri_openoffice (ooo);
if (!g_spawn_command_line_async (command, NULL))
{
g_warning ("Unable to run soffice");
#endif
g_free (command);
- g_free (dash);
if (priv->transient != NULL
&& GTK_IS_WINDOW (priv->transient))