Commit 874a819b authored by Jody Goldberg's avatar Jody Goldberg Committed by Jody Goldberg

try and be smart about what a user wants when they activate and entry. If

2002-10-08  Jody Goldberg <jody@gnome.org>

	* dialog-define-names.c (cb_entry_activate) : try and be smart about
	  what a user wants when they activate and entry.  If there is
	  something there attempt to add it but don't close, else exit.

2002-10-09  Jody Goldberg <jody@gnome.org>

	* src/commands.c (cmd_define_name_redo) : fix ref counting.
parent 502797c7
2002-10-09 Jody Goldberg <jody@gnome.org>
* src/commands.c (cmd_define_name_redo) : fix ref counting.
2002-10-08 Jody Goldberg <jody@gnome.org>
* src/format.c (do_render_number) : Use the scale factor.
......
......@@ -30,6 +30,7 @@ Jody:
* Import named expressions, arrays and merged regions from OpenCalc
* More cleanup after the big parser rework
* Esoteric XL number formats #,,##0,,
* Simplify some dialog code
Morten:
* Port search center from gal's e-table to gtk's treeview.
......
2002-10-09 Jody Goldberg <jody@gnome.org>
* src/commands.c (cmd_define_name_redo) : fix ref counting.
2002-10-08 Jody Goldberg <jody@gnome.org>
* src/format.c (do_render_number) : Use the scale factor.
......
2002-10-09 Jody Goldberg <jody@gnome.org>
* src/commands.c (cmd_define_name_redo) : fix ref counting.
2002-10-08 Jody Goldberg <jody@gnome.org>
* src/format.c (do_render_number) : Use the scale factor.
......
......@@ -5296,6 +5296,7 @@ cmd_define_name_redo (GnumericCommand *cmd, WorkbookControl *wbc)
gnumeric_error_invalid (COMMAND_CONTEXT (wbc), _("Name"), err);
return TRUE;
}
expr_name_ref (me->nexpr);
me->expr = NULL;
} else {/* assigning a value to a placeholder */
GnmExpr const *tmp = me->nexpr->t.expr_tree;
......
2002-10-08 Jody Goldberg <jody@gnome.org>
* dialog-define-names.c (cb_entry_activate) : try and be smart about
what a user wants when they activate and entry. If there is
something there attempt to add it but don't close, else exit.
2002-10-07 Andreas J. Guelzow <aguelzow@taliesin.ca>
* dialog-cell-sort.c (cb_add_clicked): plug leak
......
......@@ -386,7 +386,7 @@ cb_cancel_clicked (GtkButton *button, AutoFormatState *state)
}
static void
cb_autoformat_destroy (GtkWidget *ignored, AutoFormatState *state)
cb_autoformat_destroy (AutoFormatState *state)
{
wbcg_edit_detach_guru (state->wbcg);
......@@ -685,9 +685,8 @@ dialog_autoformat (WorkbookControlGUI *wbcg)
gtk_dialog_set_default_response (state->dialog, GTK_RESPONSE_OK);
/* a candidate for merging into attach guru */
g_signal_connect (G_OBJECT (state->dialog),
"destroy",
G_CALLBACK (cb_autoformat_destroy), state);
g_object_set_data_full (G_OBJECT (state->dialog),
"state", state, (GDestroyNotify)cb_autoformat_destroy);
gnumeric_non_modal_dialog (state->wbcg, GTK_WINDOW (state->dialog));
wbcg_edit_attach_guru (state->wbcg, GTK_WIDGET (state->dialog));
gtk_widget_show_all (GTK_WIDGET (state->dialog));
......
......@@ -2466,7 +2466,7 @@ cb_fmt_dialog_dialog_buttons (GtkWidget *btn, FormatState *state)
/* Handler for destroy */
static gboolean
cb_fmt_dialog_dialog_destroy (GtkObject *unused, FormatState *state)
cb_fmt_dialog_dialog_destroy (FormatState *state)
{
wbcg_edit_detach_guru (state->wbcg);
style_format_unref (state->format.spec);
......@@ -2772,6 +2772,9 @@ fmt_dialog_impl (FormatState *state, FormatDialogPosition_t pageno)
/* Ok, edit events from now on are real */
state->enable_edit = TRUE;
g_signal_connect (G_OBJECT (dialog),
"set-focus",
G_CALLBACK (cb_fmt_dialog_set_focus), state);
/* We could now make it modeless, and arguably should do so. We must
* then track the selection: styles should be applied to the current
* selection.
......@@ -2783,14 +2786,11 @@ fmt_dialog_impl (FormatState *state, FormatDialogPosition_t pageno)
* cell is selected? May be, but then we can't first make a style,
* then move around and apply it to different cells.
*/
g_signal_connect (G_OBJECT (dialog),
"destroy",
G_CALLBACK (cb_fmt_dialog_dialog_destroy), state);
wbcg_edit_attach_guru (state->wbcg, GTK_WIDGET (state->dialog));
g_signal_connect (G_OBJECT (dialog),
"set-focus",
G_CALLBACK (cb_fmt_dialog_set_focus), state);
/* a candidate for merging into attach guru */
g_object_set_data_full (G_OBJECT (state->dialog),
"state", state, (GDestroyNotify)cb_fmt_dialog_dialog_destroy);
wbcg_edit_attach_guru (state->wbcg, GTK_WIDGET (state->dialog));
gnumeric_non_modal_dialog (state->wbcg, GTK_WINDOW (state->dialog));
gtk_widget_show (GTK_WIDGET (state->dialog));
}
......
......@@ -164,8 +164,8 @@ dialog_set_button_sensitivity (GtkWidget *dummy, ConsolidateState *state)
return;
}
static gboolean
cb_dialog_destroy (GtkObject *object, ConsolidateState *state)
static void
cb_dialog_destroy (ConsolidateState *state)
{
wbcg_edit_detach_guru (state->wbcg);
......@@ -176,8 +176,6 @@ cb_dialog_destroy (GtkObject *object, ConsolidateState *state)
g_free (state->construct_error);
}
g_free (state);
return FALSE;
}
static void
......@@ -385,9 +383,6 @@ setup_widgets (ConsolidateState *state, GladeXML *glade_gui)
gnumeric_editable_enters (GTK_WINDOW (state->gui.dialog),
GTK_WIDGET (state->gui.source));
g_signal_connect (G_OBJECT (state->gui.dialog),
"destroy",
G_CALLBACK (cb_dialog_destroy), state);
g_signal_connect (G_OBJECT (state->gui.destination),
"changed",
G_CALLBACK (dialog_set_button_sensitivity), state);
......@@ -479,9 +474,10 @@ dialog_consolidate (WorkbookControlGUI *wbcg)
gtk_widget_grab_focus (GTK_WIDGET (state->gui.function));
gtk_widget_grab_default (GTK_WIDGET (state->gui.btn_ok));
/* Show the dialog */
gnumeric_non_modal_dialog (state->wbcg, GTK_WINDOW (state->gui.dialog));
/* a candidate for merging into attach guru */
g_object_set_data_full (G_OBJECT (state->gui.dialog),
"state", state, (GDestroyNotify) cb_dialog_destroy);
wbcg_edit_attach_guru (state->wbcg, GTK_WIDGET (state->gui.dialog));
gnumeric_non_modal_dialog (state->wbcg, GTK_WINDOW (state->gui.dialog));
gtk_widget_show (GTK_WIDGET (state->gui.dialog));
}
......@@ -424,11 +424,11 @@ name_guru_init_button (NameGuruState *state, char const *name)
}
static gboolean
cb_name_guru_destroy (GtkObject *w, NameGuruState *state)
cb_name_guru_destroy (NameGuruState *state)
{
g_return_val_if_fail (w != NULL, FALSE);
g_return_val_if_fail (state != NULL, FALSE);
puts ("foo");
wbcg_edit_detach_guru (state->wbcg);
if (state->gui != NULL) {
......@@ -448,6 +448,17 @@ cb_name_guru_destroy (GtkObject *w, NameGuruState *state)
return FALSE;
}
static void
cb_entry_activate (GtkWidget *item, NameGuruState *state)
{
char const *name = gtk_entry_get_text (state->name);
if (name == NULL || *name == '\0' ||
gnm_expr_entry_is_blank (state->expr_entry))
gtk_widget_destroy (state->dialog);
name_guru_add (state);
}
static gboolean
name_guru_init (NameGuruState *state, WorkbookControlGUI *wbcg)
{
......@@ -515,6 +526,10 @@ name_guru_init (NameGuruState *state, WorkbookControlGUI *wbcg)
g_signal_connect (G_OBJECT (state->name),
"changed",
G_CALLBACK (cb_name_guru_update_sensitivity), state);
g_signal_connect (G_OBJECT (state->name),
"activate",
G_CALLBACK (cb_entry_activate), state);
/* We need to connect after because this is an expresion, and it will
* be changed by the mouse selecting a range, update after the entry
* is updated with the new text.
......@@ -522,22 +537,20 @@ name_guru_init (NameGuruState *state, WorkbookControlGUI *wbcg)
g_signal_connect_after (G_OBJECT (state->expr_entry),
"changed",
G_CALLBACK (cb_name_guru_update_sensitivity), state);
gnumeric_editable_enters (GTK_WINDOW (state->dialog),
GTK_WIDGET (state->name));
gnumeric_editable_enters (GTK_WINDOW (state->dialog),
GTK_WIDGET (state->expr_entry));
gnumeric_keyed_dialog (state->wbcg, GTK_WINDOW (state->dialog),
DEFINE_NAMES_KEY);
g_signal_connect (G_OBJECT (gnm_expr_entry_get_entry (state->expr_entry)),
"activate",
G_CALLBACK (cb_entry_activate), state);
gnm_expr_entry_set_scg (state->expr_entry, wbcg_cur_scg (wbcg));
name_guru_populate_list (state);
gnumeric_keyed_dialog (state->wbcg, GTK_WINDOW (state->dialog),
DEFINE_NAMES_KEY);
/* a candidate for merging into attach guru */
g_signal_connect (GTK_OBJECT (state->dialog),
"destroy",
G_CALLBACK (cb_name_guru_destroy), state);
g_object_set_data_full (G_OBJECT (state->dialog),
"state", state, (GDestroyNotify)cb_name_guru_destroy);
gnumeric_non_modal_dialog (state->wbcg, GTK_WINDOW (state->dialog));
wbcg_edit_attach_guru (state->wbcg, state->dialog);
gtk_widget_show_all (GTK_WIDGET (state->dialog));
......
......@@ -291,7 +291,7 @@ cb_merge_merge_clicked (GtkWidget *ignore, MergeState *state)
}
static void
cb_merge_destroy (GtkWidget *ignored, MergeState *state)
cb_merge_destroy (MergeState *state)
{
wbcg_edit_detach_guru (state->wbcg);
g_object_unref (G_OBJECT (state->gui));
......@@ -422,13 +422,13 @@ dialog_merge (WorkbookControlGUI *wbcg)
glade_xml_get_widget (state->gui, "help_button"),
"merge.html");
g_signal_connect (G_OBJECT (state->dialog),
"destroy",
G_CALLBACK (cb_merge_destroy), state);
gnumeric_non_modal_dialog (state->wbcg, GTK_WINDOW (state->dialog));
wbcg_edit_attach_guru (state->wbcg, GTK_WIDGET (state->dialog));
gnumeric_keyed_dialog (state->wbcg, GTK_WINDOW (state->dialog),
MERGE_KEY);
/* a candidate for merging into attach guru */
g_object_set_data_full (G_OBJECT (state->dialog),
"state", state, (GDestroyNotify) cb_merge_destroy);
gnumeric_non_modal_dialog (state->wbcg, GTK_WINDOW (state->dialog));
wbcg_edit_attach_guru (state->wbcg, GTK_WIDGET (state->dialog));
gtk_widget_show_all (GTK_WIDGET (state->dialog));
}
......@@ -689,7 +689,7 @@ cb_ok_clicked (GtkWidget *ignore, SheetManager *state)
}
static void
cb_sheet_order_destroy (GtkWidget *ignored, SheetManager *state)
cb_sheet_order_destroy (SheetManager *state)
{
Workbook *wb = wb_control_workbook (WORKBOOK_CONTROL (state->wbcg));
......@@ -960,11 +960,9 @@ dialog_sheet_order (WorkbookControlGUI *wbcg)
"sheet-order.html");
/* a candidate for merging into attach guru */
g_signal_connect (G_OBJECT (state->dialog),
"destroy",
G_CALLBACK (cb_sheet_order_destroy), state);
g_object_set_data_full (G_OBJECT (state->dialog),
"state", state, (GDestroyNotify) cb_sheet_order_destroy);
gnumeric_non_modal_dialog (state->wbcg, GTK_WINDOW (state->dialog));
wbcg_edit_attach_guru (state->wbcg, GTK_WIDGET (state->dialog));
gtk_widget_show_all (GTK_WIDGET (state->dialog));
}
......@@ -613,7 +613,7 @@ kill_popup_menu (GtkWidget *widget, GtkMenu *menu)
g_return_if_fail (menu != NULL);
g_return_if_fail (GTK_IS_MENU (menu));
gtk_object_unref (GTK_OBJECT (menu));
gtk_object_destroy (GTK_OBJECT (menu));
}
void
......
......@@ -910,7 +910,7 @@ item_bar_destroy (GtkObject *object)
ib_fonts_unref (ib);
if (ib->tip) {
gtk_object_unref (GTK_OBJECT (ib->tip));
gtk_object_destroy (GTK_OBJECT (ib->tip));
ib->tip = NULL;
}
......
......@@ -1180,8 +1180,10 @@ scg_finalize (GObject *object)
if (sc->view)
sv_detach_control (sc);
if (scg->table)
gtk_object_unref (GTK_OBJECT (scg->table));
if (scg->table) {
gtk_object_destroy (GTK_OBJECT (scg->table));
scg->table =NULL;
}
if (G_OBJECT_CLASS (scg_parent_class)->finalize)
(*G_OBJECT_CLASS (scg_parent_class)->finalize)(object);
......
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