2 * dialog-col-row.c: group/ungroup dialog
5 * Andreas J. Guelzow <aguelzow@taliesin.ca>
7 * (c) Copyright 2002-2006 Andreas J. Guelzow <aguelzow@taliesin.ca>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, see <https://www.gnu.org/licenses/>.
22 #include <gnumeric-config.h>
29 #include <workbook-control.h>
35 #define COL_ROW_DIALOG_KEY "col-row-dialog"
41 GtkWidget
*cancel_button
;
45 ColRowCallback_t callback
;
49 cb_dialog_col_row_destroy (ColRowState
*state
)
51 if (state
->gui
!= NULL
)
52 g_object_unref (state
->gui
);
57 cb_dialog_col_row_cancel_clicked (G_GNUC_UNUSED GtkWidget
*button
,
60 gtk_widget_destroy (state
->dialog
);
65 cb_dialog_col_row_ok_clicked (G_GNUC_UNUSED GtkWidget
*button
,
68 state
->callback (state
->wbcg
,
69 gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON
70 (go_gtk_builder_get_widget (state
->gui
,
73 gtk_widget_destroy (state
->dialog
);
77 * dialog_col_row: (skip)
80 dialog_col_row (WBCGtk
*wbcg
, char const *operation
,
81 ColRowCallback_t callback
,
87 g_return_if_fail (wbcg
!= NULL
);
89 if (gnm_dialog_raise_if_exists (wbcg
, COL_ROW_DIALOG_KEY
))
91 gui
= gnm_gtk_builder_load ("res:ui/colrow.ui", NULL
, GO_CMD_CONTEXT (wbcg
));
95 state
= g_new (ColRowState
, 1);
97 state
->callback
= callback
;
101 state
->dialog
= go_gtk_builder_get_widget (state
->gui
, "dialog");
103 state
->ok_button
= go_gtk_builder_get_widget (state
->gui
, "ok_button");
104 g_signal_connect (G_OBJECT (state
->ok_button
),
106 G_CALLBACK (cb_dialog_col_row_ok_clicked
), state
);
108 state
->cancel_button
= go_gtk_builder_get_widget (state
->gui
, "cancel_button");
109 g_signal_connect (G_OBJECT (state
->cancel_button
),
111 G_CALLBACK (cb_dialog_col_row_cancel_clicked
), state
);
113 gnm_init_help_button (
114 go_gtk_builder_get_widget (state
->gui
, "help_button"),
115 GNUMERIC_HELP_LINK_GROUP_UNGROUP
);
117 gtk_window_set_title (GTK_WINDOW (state
->dialog
), operation
);
119 wbc_gtk_attach_guru (state
->wbcg
, state
->dialog
);
120 g_object_set_data_full (G_OBJECT (state
->dialog
),
121 "state", state
, (GDestroyNotify
) cb_dialog_col_row_destroy
);
123 gnm_keyed_dialog (wbcg
, GTK_WINDOW (state
->dialog
),
125 gtk_widget_show (state
->dialog
);