[gnumeric] Add Repeat Export menu item. [#594154]
- From: Andreas J. Guelzow <guelzow src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] Add Repeat Export menu item. [#594154]
- Date: Tue, 7 Aug 2012 21:17:06 +0000 (UTC)
commit f71ca51a9101a14ba7597394141994c11e0f2198
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date: Tue Aug 7 15:15:27 2012 -0600
Add Repeat Export menu item. [#594154]
2012-08-07 Andreas J. Guelzow <aguelzow pyrshep ca>
* component/Gnumeric-embed.xml.in: add Repeat Export menu item
* src/GNOME_Gnumeric-gtk.xml.in: add Repeat Export menu item
* src/gui-file.c (gui_file_export_repeat): new
* src/gui-file.h (gui_file_export_repeat): new
* src/wbc-gtk-actions.c (cb_data_export_repeat): new
(DataExportRepeat): new
ChangeLog | 9 +++++++
NEWS | 2 +-
component/Gnumeric-embed.xml.in | 2 +
src/GNOME_Gnumeric-gtk.xml.in | 2 +
src/gui-file.c | 50 +++++++++++++++++++++++++++++++++++++++
src/gui-file.h | 1 +
src/wbc-gtk-actions.c | 4 +++
7 files changed, 69 insertions(+), 1 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 50234fe..7be7f47 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
2012-08-07 Andreas J. Guelzow <aguelzow pyrshep ca>
+ * component/Gnumeric-embed.xml.in: add Repeat Export menu item
+ * src/GNOME_Gnumeric-gtk.xml.in: add Repeat Export menu item
+ * src/gui-file.c (gui_file_export_repeat): new
+ * src/gui-file.h (gui_file_export_repeat): new
+ * src/wbc-gtk-actions.c (cb_data_export_repeat): new
+ (DataExportRepeat): new
+
+2012-08-07 Andreas J. Guelzow <aguelzow pyrshep ca>
+
* src/gui-file.c: adjust all calls to workbook_update_history
(gui_file_save_as): get the correct file name,
* src/main-application.c: adjust all calls to workbook_update_history
diff --git a/NEWS b/NEWS
index 3aa6331..9633175 100644
--- a/NEWS
+++ b/NEWS
@@ -17,7 +17,7 @@ Andreas:
* Provide new saver for uncompressed Gnumeric xml. [#672622]
* Do not change workbook save info when exporting. [#672323]
* Fix format selection on export. [#681316]
- * Remember export file name.
+ * Add Repeat Export menu item. [#594154]
Jean:
* Fix component references issues. [#680190]
diff --git a/component/Gnumeric-embed.xml.in b/component/Gnumeric-embed.xml.in
index e98c7de..1397400 100644
--- a/component/Gnumeric-embed.xml.in
+++ b/component/Gnumeric-embed.xml.in
@@ -309,6 +309,8 @@
<menuitem action="DataExportText"/>
<menuitem action="DataExportCSV"/>
<menuitem action="DataExport"/>
+ <separator/>
+ <menuitem action="DataExportRepeat"/>
</menu>
</menu>
<menu name="Help" action="MenuHelp">
diff --git a/src/GNOME_Gnumeric-gtk.xml.in b/src/GNOME_Gnumeric-gtk.xml.in
index 17dd237..b694f14 100644
--- a/src/GNOME_Gnumeric-gtk.xml.in
+++ b/src/GNOME_Gnumeric-gtk.xml.in
@@ -316,6 +316,8 @@
<menuitem action="DataExportText"/>
<menuitem action="DataExportCSV"/>
<menuitem action="DataExport"/>
+ <separator/>
+ <menuitem action="DataExportRepeat"/>
</menu>
</menu>
<menu name="Help" action="MenuHelp">
diff --git a/src/gui-file.c b/src/gui-file.c
index 416b83e..11c7086 100644
--- a/src/gui-file.c
+++ b/src/gui-file.c
@@ -703,3 +703,53 @@ gui_file_save (WBCGtk *wbcg, WorkbookView *wb_view)
return ok;
}
}
+
+gboolean
+gui_file_export_repeat (WBCGtk *wbcg)
+{
+ WorkbookView *wb_view = wb_control_view (WORKBOOK_CONTROL (wbcg));
+ Workbook *wb = wb_view_get_workbook (wb_view);
+ GOFileSaver *fs = wb->file_exporter;
+
+ if (fs != NULL && wb->last_export_uri != NULL) {
+ char const *msg;
+ GtkWidget *dialog;
+
+ if (go_file_saver_get_save_scope (fs) != GO_FILE_SAVE_WORKBOOK)
+ msg = _("Do you want to export the <b>current sheet</b> of this "
+ "workbook to the location '<b>%s</b>' "
+ "using the '<b>%s</b>' exporter.");
+ else
+ msg = _("Do you want to export this workbook to the "
+ "location '<b>%s</b>' "
+ "using the '<b>%s</b>' exporter.");
+
+ /* go_gtk_query_yes_no does not handle markup ... */
+ dialog = gtk_message_dialog_new_with_markup (wbcg_toplevel (wbcg),
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_QUESTION,
+ GTK_BUTTONS_YES_NO,
+ msg, wb->last_export_uri,
+ go_file_saver_get_description (fs));
+ gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_YES);
+
+ if (GTK_RESPONSE_YES ==
+ go_gtk_dialog_run (GTK_DIALOG (dialog), wbcg_toplevel (wbcg))) {
+ /* We need to copy wb->last_export_uri since it will be reset during saving */
+ gchar *uri = g_strdup (wb->last_export_uri);
+ if(wb_view_save_as (wb_view, fs, uri, GO_CMD_CONTEXT (wbcg))) {
+ workbook_update_history (wb, FILE_SAVE_AS_EXPORT);
+ g_free (uri);
+ return TRUE;
+ }
+ g_free (uri);
+ }
+ return FALSE;
+ } else {
+ go_gtk_notice_dialog (wbcg_toplevel (wbcg), GTK_MESSAGE_ERROR,
+ _("Unable to repeat export since no previous "
+ "export information has been saved in this "
+ "session."));
+ return FALSE;
+ }
+}
diff --git a/src/gui-file.h b/src/gui-file.h
index d8c49bd..10fd7cd 100644
--- a/src/gui-file.h
+++ b/src/gui-file.h
@@ -20,6 +20,7 @@ gboolean gui_file_save_as (WBCGtk *wbcg, WorkbookView *wbv,
file_save_as_t type,
char const *default_format);
gboolean gui_file_save (WBCGtk *wbcg, WorkbookView *wbv);
+gboolean gui_file_export_repeat (WBCGtk *wbcg);
void gui_file_open (WBCGtk *wbcg, file_open_t type,
char const *default_format);
void gui_wb_view_show (WBCGtk *wbcg, WorkbookView *wbv);
diff --git a/src/wbc-gtk-actions.c b/src/wbc-gtk-actions.c
index 2a5e97d..1ceadde 100644
--- a/src/wbc-gtk-actions.c
+++ b/src/wbc-gtk-actions.c
@@ -1002,6 +1002,7 @@ static GNM_ACTION_DEF (cb_data_export_text) { gui_file_save_as
static GNM_ACTION_DEF (cb_data_export_csv) { gui_file_save_as
(wbcg, wb_control_view (WORKBOOK_CONTROL (wbcg)),
FILE_SAVE_AS_EXPORT, "Gnumeric_stf:stf_csv"); }
+static GNM_ACTION_DEF (cb_data_export_repeat) { gui_file_export_repeat (wbcg); }
static void
hide_show_detail_real (WBCGtk *wbcg, gboolean is_cols, gboolean show)
@@ -2618,6 +2619,9 @@ static GtkActionEntry const actions[] = {
{ "DataExportCSV", NULL, N_("Export as _CSV File"),
NULL, N_("Export the current sheet as a csv file"),
G_CALLBACK (cb_data_export_csv) },
+ { "DataExportRepeat", NULL, N_("Repeat Export"),
+ "<control>E", N_("Repeat the last data export"),
+ G_CALLBACK (cb_data_export_repeat) },
/* Data -> Fill */
{ "EditFillAutofill", NULL, N_("Auto_fill"),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]