Commit 7566f7b1 authored by Jody Goldberg's avatar Jody Goldberg Committed by Jody Goldberg

Simplify and beautify.


2000-09-29  Jody Goldberg <jgoldberg@home.com>

	* src/workbook.c (workbook_close_if_user_permits) : Simplify and
	  beautify.
parent 3b188483
2000-09-29 Jody Goldberg <jgoldberg@home.com>
* src/workbook.c (workbook_close_if_user_permits) : Simplify and
beautify.
2000-09-28 Jody Goldberg <jgoldberg@home.com>
* src/dialogs/dialog-graph-guru.c (cb_graph_guru_clicked) : Do not
......
2000-09-29 Jody Goldberg <jgoldberg@home.com>
* src/workbook.c (workbook_close_if_user_permits) : Simplify and
beautify.
2000-09-28 Jody Goldberg <jgoldberg@home.com>
* src/dialogs/dialog-graph-guru.c (cb_graph_guru_clicked) : Do not
......
2000-09-29 Jody Goldberg <jgoldberg@home.com>
* src/workbook.c (workbook_close_if_user_permits) : Simplify and
beautify.
2000-09-28 Jody Goldberg <jgoldberg@home.com>
* src/dialogs/dialog-graph-guru.c (cb_graph_guru_clicked) : Do not
......
2000-09-29 Jody Goldberg <jgoldberg@home.com>
* src/workbook.c (workbook_close_if_user_permits) : Simplify and
beautify.
2000-09-28 Jody Goldberg <jgoldberg@home.com>
* src/dialogs/dialog-graph-guru.c (cb_graph_guru_clicked) : Do not
......
2000-09-29 Jody Goldberg <jgoldberg@home.com>
* src/workbook.c (workbook_close_if_user_permits) : Simplify and
beautify.
2000-09-28 Jody Goldberg <jgoldberg@home.com>
* src/dialogs/dialog-graph-guru.c (cb_graph_guru_clicked) : Do not
......
2000-09-29 Jody Goldberg <jgoldberg@home.com>
* src/workbook.c (workbook_close_if_user_permits) : Simplify and
beautify.
2000-09-28 Jody Goldberg <jgoldberg@home.com>
* src/dialogs/dialog-graph-guru.c (cb_graph_guru_clicked) : Do not
......
2000-09-29 Jody Goldberg <jgoldberg@home.com>
* src/workbook.c (workbook_close_if_user_permits) : Simplify and
beautify.
2000-09-28 Jody Goldberg <jgoldberg@home.com>
* src/dialogs/dialog-graph-guru.c (cb_graph_guru_clicked) : Do not
......
......@@ -75,7 +75,6 @@ graph_guru_state_destroy (GraphGuruState *state)
state->gui = NULL;
}
#if 0
/* Release the series objects */
if (state->series != NULL) {
int i = state->series->len;
......@@ -86,7 +85,6 @@ graph_guru_state_destroy (GraphGuruState *state)
g_ptr_array_free (state->series, TRUE);
state->series = NULL;
}
#endif
if (state->control != CORBA_OBJECT_NIL) {
CORBA_Environment ev;
......@@ -167,6 +165,13 @@ graph_guru_set_page (GraphGuruState *state, int page)
gtk_widget_set_sensitive (state->button_next, next_ok);
}
static gboolean
cb_graph_series_destroy (GtkObject *w, gpointer series)
{
printf ("series destroy %p\n", series);
return FALSE;
}
static void
cb_graph_guru_clicked (GtkWidget *button, GraphGuruState *state)
{
......@@ -196,6 +201,21 @@ cb_graph_guru_clicked (GtkWidget *button, GraphGuruState *state)
state->wb->current_sheet, client_site);
sheet_mode_create_object (so);
}
/* Add a reference to the series so that they continue to exist
* when the dialog goes away. Then tie them to the destruction of
* the client_site.
*/
if (state->series != NULL) {
int i = state->series->len;
while (i-- > 0) {
gpointer *elem = g_ptr_array_index (state->series, i);
gtk_object_ref (GTK_OBJECT (elem));
gtk_signal_connect (GTK_OBJECT (client_site), "destroy",
GTK_SIGNAL_FUNC (cb_graph_series_destroy),
elem);
}
}
}
gtk_object_destroy (GTK_OBJECT(state->dialog));
......@@ -417,7 +437,6 @@ dialog_graph_guru (Workbook *wb)
return;
}
/* Ok everything is hooked up. Let-er rip */
state->valid = TRUE;
}
......@@ -532,7 +532,9 @@ graph_series_set_subscriber (GraphSeries *series, CORBA_Object graph_manager)
default :
g_assert_not_reached();
}
if (ev._major != CORBA_NO_EXCEPTION)
g_warning ("Problems registering series %p", series);
CORBA_exception_free (&ev);
}
......@@ -508,54 +508,43 @@ workbook_close_if_user_permits (Workbook *wb)
while (workbook_is_dirty (wb) && !done) {
GtkWidget *d, *l, *cancel_button;
GtkWidget *d;
int button;
char *s;
char *msg;
iteration++;
d = gnome_dialog_new (
_("Warning"),
GNOME_STOCK_BUTTON_YES,
GNOME_STOCK_BUTTON_NO,
GNOME_STOCK_BUTTON_CANCEL,
NULL);
cancel_button = g_list_last (GNOME_DIALOG (d)->buttons)->data;
gtk_widget_grab_focus (cancel_button);
gnome_dialog_set_parent (GNOME_DIALOG (d), GTK_WINDOW (workbook_get_toplevel (wb)));
if (wb->filename)
s = g_strdup_printf (
msg = g_strdup_printf (
_("Workbook %s has unsaved changes, save them?"),
g_basename (wb->filename));
else
s = g_strdup (_("Workbook has unsaved changes, save them?"));
msg = g_strdup (_("Workbook has unsaved changes, save them?"));
l = gtk_label_new (s);
gtk_widget_show (l);
g_free (s);
gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (d)->vbox), l, TRUE, TRUE, 0);
d = gnome_message_box_new (msg,
GNOME_MESSAGE_BOX_WARNING,
GNOME_STOCK_BUTTON_YES,
GNOME_STOCK_BUTTON_NO,
GNOME_STOCK_BUTTON_CANCEL,
NULL);
gtk_window_set_position (GTK_WINDOW (d), GTK_WIN_POS_MOUSE);
button = gnome_dialog_run_and_close (GNOME_DIALOG (d));
g_free (msg);
switch (button) {
/* YES */
case 0:
case 0: /* YES */
done = workbook_save (workbook_command_context_gui (wb), wb);
break;
/* NO */
case 1:
case 1: /* NO */
can_close = TRUE;
done = TRUE;
workbook_set_dirty (wb, FALSE);
break;
/* CANCEL */
case -1:
case 2:
case 2: /* CANCEL */
can_close = FALSE;
done = TRUE;
break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment