[gnumeric] ssconvert: don't list interactive savers/openers. They can't work.
- From: Morten Welinder <mortenw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] ssconvert: don't list interactive savers/openers. They can't work.
- Date: Sun, 10 Mar 2013 19:43:30 +0000 (UTC)
commit e62ae6aea015dadc638c4ecb1dbfa7a458bb3be7
Author: Morten Welinder <terra gnome org>
Date: Sun Mar 10 15:32:55 2013 -0400
ssconvert: don't list interactive savers/openers. They can't work.
ChangeLog | 4 ++++
configure.ac | 2 +-
src/ssconvert.c | 37 +++++++++++++++++++++++++------------
src/stf.c | 2 ++
4 files changed, 32 insertions(+), 13 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 5f12bc4..07dae9c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,11 @@
2013-03-10 Morten Welinder <terra gnome org>
+ * src/ssconvert.c (list_them): Skip interactive savers/openers.
+
* src/stf.c (stf_read_workbook): Set error when we fail due to
lack of GUI.
+ (stf_init): Mark the configurable saver/opener as interactive.
+
* src/ssconvert.c (convert): Fix error handling. Fixes #695529.
2013-03-09 Morten Welinder <terra gnome org>
diff --git a/configure.ac b/configure.ac
index d3a8cc0..9ba14c8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -152,7 +152,7 @@ PKG_PROG_PKG_CONFIG(0.18)
dnl *****************************
libspreadsheet_reqs="
- libgoffice-${GOFFICE_API_VER} >= 0.10.1
+ libgoffice-${GOFFICE_API_VER} >= 0.10.2
libgsf-1 >= 1.14.24
libxml-2.0 >= 2.4.12
"
diff --git a/src/ssconvert.c b/src/ssconvert.c
index fe2b1c1..dd51d53 100644
--- a/src/ssconvert.c
+++ b/src/ssconvert.c
@@ -223,30 +223,43 @@ handle_export_options (GOFileSaver *fs, GODoc *doc)
}
-typedef GList *(*get_them_f)(void);
typedef gchar const *(*get_desc_f)(void *);
static void
-list_them (get_them_f get_them,
+list_them (GList *them,
get_desc_f get_his_id,
get_desc_f get_his_description)
{
GList *ptr;
- int len = 0;
+ guint len = 0;
+ gboolean interactive;
- for (ptr = (*get_them) (); ptr ; ptr = ptr->next) {
- char const *id = (*get_his_id) (ptr->data);
- int tmp = strlen (id);
- if (len < tmp)
- len = tmp;
+ for (ptr = them; ptr ; ptr = ptr->next) {
+ GObject *obj = ptr->data;
+ char const *id;
+
+ g_object_get (obj, "interactive", &interactive, NULL);
+ if (interactive)
+ continue;
+
+ id = get_his_id (obj);
+ if (!id) id = "";
+ len = MAX (len, strlen (id));
}
g_printerr ("%-*s | %s\n", len,
/* Translate these? */
"ID",
"Description");
- for (ptr = (*get_them) (); ptr ; ptr = ptr->next) {
- char const *id = (*get_his_id) (ptr->data);
+ for (ptr = them; ptr ; ptr = ptr->next) {
+ GObject *obj = ptr->data;
+ char const *id = get_his_id (obj);
+
+ g_object_get (obj, "interactive", &interactive, NULL);
+ if (interactive)
+ continue;
+
+ if (!id) id = "";
g_printerr ("%-*s | %s\n", len,
id,
(*get_his_description) (ptr->data));
@@ -828,11 +841,11 @@ main (int argc, char const **argv)
go_component_set_default_command_context (cc);
if (ssconvert_list_exporters)
- list_them (&go_get_file_savers,
+ list_them (go_get_file_savers (),
(get_desc_f) &go_file_saver_get_id,
(get_desc_f) &go_file_saver_get_description);
else if (ssconvert_list_importers)
- list_them (&go_get_file_openers,
+ list_them (go_get_file_openers (),
(get_desc_f) &go_file_opener_get_id,
(get_desc_f) &go_file_opener_get_description);
else if (ssconvert_merge_target!=NULL && argc>=3) {
diff --git a/src/stf.c b/src/stf.c
index 9222cbb..716d97a 100644
--- a/src/stf.c
+++ b/src/stf.c
@@ -655,10 +655,12 @@ stf_init (void)
_("Text import (configurable)"),
NULL, mimes_txt,
NULL, stf_read_workbook);
+ g_object_set (G_OBJECT (opener), "interactive", TRUE, NULL);
go_file_opener_register (opener, 0);
g_object_unref (opener);
saver = gnm_stf_file_saver_create ("Gnumeric_stf:stf_assistant");
+ g_object_set (G_OBJECT (saver), "interactive", TRUE, NULL);
go_file_saver_register (saver);
g_object_unref (saver);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]