gnumeric r16967 - in trunk: . po-functions src
- From: mortenw svn gnome org
- To: svn-commits-list gnome org
- Subject: gnumeric r16967 - in trunk: . po-functions src
- Date: Thu, 20 Nov 2008 14:43:33 +0000 (UTC)
Author: mortenw
Date: Thu Nov 20 14:43:33 2008
New Revision: 16967
URL: http://svn.gnome.org/viewvc/gnumeric?rev=16967&view=rev
Log:
2008-11-20 Morten Welinder <terra gnome org>
* src/wbc-gtk.c (wbcg_menu_state_sheet_count,
sheet_menu_label_run): Count visible sheets only.
(cb_sheet_visibility_change): Attach with wbcg as data and call
wbcg_menu_state_sheet_count.
Modified:
trunk/ChangeLog
trunk/NEWS
trunk/po-functions/POTFILES.skip
trunk/src/wbc-gtk.c
Modified: trunk/NEWS
==============================================================================
--- trunk/NEWS (original)
+++ trunk/NEWS Thu Nov 20 14:43:33 2008
@@ -33,6 +33,7 @@
* Fix LOOKUP critical. [#559005]
* Fix GROWTH/TREND crash. [#559363]
* Make non-gnome the default. [#558840]
+ * Disallow deleting last visible sheet.
--------------------------------------------------------------------------
Gnumeric 1.9.3
Modified: trunk/po-functions/POTFILES.skip
==============================================================================
--- trunk/po-functions/POTFILES.skip (original)
+++ trunk/po-functions/POTFILES.skip Thu Nov 20 14:43:33 2008
@@ -1,8 +1,6 @@
# Generated by autogen.sh; do not edit.
src/parser.c
src/dialogs/pivottable.glade
-plugins/gb/plugin.c
-plugins/gb/plugin.xml.in
plugins/guile/plugin.c
plugins/guile/plugin.xml.in
plugins/guile/smob-value.c
Modified: trunk/src/wbc-gtk.c
==============================================================================
--- trunk/src/wbc-gtk.c (original)
+++ trunk/src/wbc-gtk.c Thu Nov 20 14:43:33 2008
@@ -106,6 +106,23 @@
/****************************************************************************/
+static int
+gnm_notebook_get_n_visible (GtkNotebook *nb)
+{
+ int count = 0;
+ GList *l, *children = gtk_container_get_children (GTK_CONTAINER (nb));
+
+ for (l = children; l; l = l->next) {
+ GtkWidget *child = l->data;
+ if (GTK_WIDGET_VISIBLE (child))
+ count++;
+ }
+
+ g_list_free (children);
+
+ return count;
+}
+
static void
wbc_gtk_set_action_sensitivity (WBCGtk const *wbcg,
char const *action, gboolean sensitive)
@@ -400,8 +417,6 @@
static void
sheet_menu_label_run (SheetControlGUI *scg, GdkEventButton *event)
{
- SheetControl *sc = (SheetControl *) scg;
-
struct {
char const *text;
void (*function) (SheetControlGUI *scg);
@@ -418,12 +433,13 @@
unsigned int i;
GtkWidget *item, *menu = gtk_menu_new ();
+ gboolean has_multiple = gnm_notebook_get_n_visible (scg->wbcg->notebook) > 1;
for (i = 0; i < G_N_ELEMENTS (sheet_label_context_actions); i++){
char const *text = sheet_label_context_actions[i].text;
gboolean req_multiple_sheets = sheet_label_context_actions [i].req_multiple_sheets;
gboolean inactive =
- (req_multiple_sheets && workbook_sheet_count (sc->sheet->workbook) < 2) ||
+ (req_multiple_sheets && !has_multiple) ||
wbc_gtk_get_guru (scg_wbcg (scg)) != NULL;
if (text != NULL) {
@@ -862,7 +878,7 @@
static void
wbcg_menu_state_sheet_count (WBCGtk *wbcg)
{
- int const sheet_count = g_list_length (wbcg->notebook->children);
+ int const sheet_count = gnm_notebook_get_n_visible (wbcg->notebook);
/* Should we enable commands requiring multiple sheets */
gboolean const multi_sheet = (sheet_count > 1);
@@ -896,12 +912,15 @@
static void
cb_sheet_visibility_change (Sheet *sheet,
G_GNUC_UNUSED GParamSpec *pspec,
- GtkWidget *w)
+ WBCGtk *wbcg)
{
+ GtkWidget *w = gtk_notebook_get_nth_page (wbcg->notebook, sheet->index_in_wb);
if (sheet_is_visible (sheet))
gtk_widget_show (w);
else
gtk_widget_hide (w);
+
+ wbcg_menu_state_sheet_count (wbcg);
}
static void
@@ -916,7 +935,7 @@
if (!focus_signals_only) {
g_signal_handlers_disconnect_by_func (sheet, cb_sheet_tab_change, scg->label);
- g_signal_handlers_disconnect_by_func (sheet, cb_sheet_visibility_change, scg->table);
+ g_signal_handlers_disconnect_by_func (sheet, cb_sheet_visibility_change, wbcg);
}
}
}
@@ -978,7 +997,7 @@
if (!visible)
gtk_widget_hide (GTK_WIDGET (scg->table));
g_object_connect (G_OBJECT (sheet),
- "signal::notify::visibility", cb_sheet_visibility_change, scg->table,
+ "signal::notify::visibility", cb_sheet_visibility_change, wbcg,
"signal::notify::name", cb_sheet_tab_change, scg->label,
"signal::notify::tab-foreground", cb_sheet_tab_change, scg->label,
"signal::notify::tab-background", cb_sheet_tab_change, scg->label,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]