[gnumeric] Fix conditional formatting crash. [#700969]
- From: Andreas J. Guelzow <guelzow src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] Fix conditional formatting crash. [#700969]
- Date: Sat, 25 May 2013 08:49:01 +0000 (UTC)
commit 6645308a5f726ffa1033ac54e9b49a6a76eb034d
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date: Sat May 25 02:48:16 2013 -0600
Fix conditional formatting crash. [#700969]
2013-05-25 Andreas J. Guelzow <aguelzow pyrshep ca>
* dialog-cell-format-cond.c (CFormatState): add field
(cb_c_fmt_dialog_dialog_destroy): delete format dialog if it still
exists
(editor_destroy_cb): new
(c_fmt_dialog_select_style): new
(cb_c_fmt_dialog_edit_style_button): use c_fmt_dialog_select_style
(dialog_cell_format_cond): initialize new field
* dialog-cell-format.c (dialog_cell_format_select_style): return dialog
* dialogs.h: return GtkDialog from dialog_cell_format_select_style
NEWS | 1 +
src/dialogs/ChangeLog | 12 ++++++++++++
src/dialogs/dialog-cell-format-cond.c | 29 ++++++++++++++++++++++++++---
src/dialogs/dialog-cell-format.c | 4 +++-
src/dialogs/dialogs.h | 8 ++++----
5 files changed, 46 insertions(+), 8 deletions(-)
---
diff --git a/NEWS b/NEWS
index 60df6a9..24a6d86 100644
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,7 @@ Andreas:
* Fix 'Go to First'. [#699631]
* Fix data merges. [#699897]
* Fix editing of hyperlinks. [#700732]
+ * Fix conditional formatting crash. [#700969]
Darrell Tangman:
* Update documentation for Edit and Insert menus. [#700596]
diff --git a/src/dialogs/ChangeLog b/src/dialogs/ChangeLog
index 06d1139..5809bed 100644
--- a/src/dialogs/ChangeLog
+++ b/src/dialogs/ChangeLog
@@ -1,3 +1,15 @@
+2013-05-25 Andreas J. Guelzow <aguelzow pyrshep ca>
+
+ * dialog-cell-format-cond.c (CFormatState): add field
+ (cb_c_fmt_dialog_dialog_destroy): delete format dialog if it still
+ exists
+ (editor_destroy_cb): new
+ (c_fmt_dialog_select_style): new
+ (cb_c_fmt_dialog_edit_style_button): use c_fmt_dialog_select_style
+ (dialog_cell_format_cond): initialize new field
+ * dialog-cell-format.c (dialog_cell_format_select_style): return dialog
+ * dialogs.h: return GtkDialog from dialog_cell_format_select_style
+
2013-05-22 Andreas J. Guelzow <aguelzow pyrshep ca>
* dialog-hyperlink.c (dialog_hyperlink): preserve the type of
diff --git a/src/dialogs/dialog-cell-format-cond.c b/src/dialogs/dialog-cell-format-cond.c
index 20633a1..535bccf 100644
--- a/src/dialogs/dialog-cell-format-cond.c
+++ b/src/dialogs/dialog-cell-format-cond.c
@@ -92,6 +92,7 @@ typedef struct _CFormatState {
GtkListStore *typestore;
GnmStyle *style;
GtkWidget *style_label;
+ GtkDialog *dialog;
} editor;
} CFormatState;
@@ -121,6 +122,10 @@ cb_c_fmt_dialog_dialog_buttons (G_GNUC_UNUSED GtkWidget *btn, CFormatState *stat
static void
cb_c_fmt_dialog_dialog_destroy (CFormatState *state)
{
+ if (state->editor.dialog) {
+ gtk_widget_destroy (GTK_WIDGET (state->editor.dialog));
+ state->editor.dialog = NULL;
+ }
if (state->editor.style)
gnm_style_unref (state->editor.style);
if (state->style)
@@ -257,6 +262,25 @@ cb_c_fmt_dialog_chooser_check_page (CFormatState *state, gchar const *name,
}
static void
+editor_destroy_cb (G_GNUC_UNUSED GObject *obj, CFormatState *state)
+{
+ state->editor.dialog = NULL;
+}
+
+static void
+c_fmt_dialog_select_style (CFormatState *state, int pages)
+{
+ if (state->editor.dialog)
+ gtk_widget_destroy (GTK_WIDGET (state->editor.dialog));
+ state->editor.dialog = dialog_cell_format_select_style
+ (state->wbcg, pages,
+ GTK_WINDOW (state->dialog),
+ state->editor.style, state);
+ g_signal_connect (G_OBJECT (state->editor.dialog),
+ "destroy", G_CALLBACK (editor_destroy_cb), state);
+}
+
+static void
cb_c_fmt_dialog_edit_style_button (G_GNUC_UNUSED GtkWidget *btn, CFormatState *state)
{
int pages = 0;
@@ -277,9 +301,7 @@ cb_c_fmt_dialog_edit_style_button (G_GNUC_UNUSED GtkWidget *btn, CFormatState *s
if (state->editor.style != NULL)
gnm_style_ref (state->editor.style);
- dialog_cell_format_select_style (state->wbcg, pages,
- GTK_WINDOW (state->dialog),
- state->editor.style, state);
+ c_fmt_dialog_select_style (state, pages);
}
static GnmStyleCond *
@@ -1270,6 +1292,7 @@ dialog_cell_format_cond (WBCGtk *wbcg)
state->sheet = sv_sheet (state->sv);
state->style = NULL;
state->editor.style = NULL;
+ state->editor.dialog = NULL;
dialog = go_gtk_builder_get_widget (state->gui, "CellFormat");
g_return_if_fail (dialog != NULL);
diff --git a/src/dialogs/dialog-cell-format.c b/src/dialogs/dialog-cell-format.c
index 2925350..58835d6 100644
--- a/src/dialogs/dialog-cell-format.c
+++ b/src/dialogs/dialog-cell-format.c
@@ -2583,7 +2583,7 @@ dialog_cell_format (WBCGtk *wbcg, FormatDialogPosition_t pageno)
* - How to distinguish between auto & custom colors on extraction from styles.
*/
-void
+GtkDialog *
dialog_cell_format_select_style (WBCGtk *wbcg, gint pages,
GtkWindow *w,
GnmStyle *style, gpointer closure)
@@ -2622,4 +2622,6 @@ dialog_cell_format_select_style (WBCGtk *wbcg, gint pages,
go_gtk_nonmodal_dialog (w, GTK_WINDOW (state->dialog));
gtk_widget_show (GTK_WIDGET (state->dialog));
+
+ return state->dialog;
}
diff --git a/src/dialogs/dialogs.h b/src/dialogs/dialogs.h
index 30753ce..eaee736 100644
--- a/src/dialogs/dialogs.h
+++ b/src/dialogs/dialogs.h
@@ -23,10 +23,10 @@ void dialog_plugin_manager (WBCGtk *wbcg);
void dialog_goto_cell (WBCGtk *wbcg);
void dialog_cell_format (WBCGtk *wbcg,
FormatDialogPosition_t pageno);
-void dialog_cell_format_select_style (WBCGtk *wbcg,
- gint pages, GtkWindow *w,
- GnmStyle *style,
- gpointer closure);
+GtkDialog *dialog_cell_format_select_style (WBCGtk *wbcg,
+ gint pages, GtkWindow *w,
+ GnmStyle *style,
+ gpointer closure);
void dialog_cell_format_cond (WBCGtk *wbcg);
void dialog_cell_format_style_added (gpointer closure, GnmStyle *style);
void dialog_paste_special (WBCGtk *wbcg);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]