void myreversefunc (GtkTreeModel *model, gint col, gint row, const gchar *in, GValue *out);
+static void
+delete_cases (PsppireDataEditor *de)
+{
+ JmdRange *range = JMD_SHEET(de->data_sheet)->selection;
+
+ psppire_data_store_delete_cases (de->data_store, range->start_y,
+ range->end_y - range->start_y + 1);
+
+ gtk_widget_queue_draw (GTK_WIDGET (de));
+}
+
static void
insert_new_case (PsppireDataEditor *de)
{
de->clear_cases_menu_item = gtk_menu_item_new_with_mnemonic (_("Cl_ear Cases"));
gtk_widget_set_sensitive (de->clear_cases_menu_item, FALSE);
gtk_menu_shell_append (GTK_MENU_SHELL (menu), de->clear_cases_menu_item);
+ g_signal_connect_swapped (de->clear_cases_menu_item, "activate",
+ G_CALLBACK (delete_cases), de);
gtk_widget_show_all (menu);
return menu;
enum
{
ITEMS_CHANGED,
- CASES_DELETED,
CASE_CHANGED,
n_SIGNALS
};
object_class->dispose = psppire_data_store_dispose;
signals [ITEMS_CHANGED] =
- g_signal_new ("changed",
+ g_signal_new ("items-changed",
G_TYPE_FROM_CLASS (class),
G_SIGNAL_RUN_FIRST,
0,
psppire_marshal_VOID__UINT_UINT_UINT,
G_TYPE_NONE,
3,
- G_TYPE_UINT,
- G_TYPE_UINT,
- G_TYPE_UINT);
+ G_TYPE_UINT, /* Index of the start of the change */
+ G_TYPE_UINT, /* The number of items deleted */
+ G_TYPE_UINT); /* The number of items inserted */
signals [CASE_CHANGED] =
g_signal_new ("case-changed",
G_TYPE_NONE,
1,
G_TYPE_INT);
-
- signals [CASES_DELETED] =
- g_signal_new ("cases-deleted",
- G_TYPE_FROM_CLASS (class),
- G_SIGNAL_RUN_FIRST,
- 0,
- NULL, NULL,
- psppire_marshal_VOID__INT_INT,
- G_TYPE_NONE,
- 2,
- G_TYPE_INT,
- G_TYPE_INT);
}
psppire_dict_clear (ds->dict);
- g_signal_emit (ds, signals [CASES_DELETED], 0, 0, -1);
+ g_signal_emit (ds, signals [ITEMS_CHANGED], 0, 0, -1, 0);
}
datasheet_delete_rows (ds->datasheet, first, n_cases);
- g_signal_emit (ds, signals [CASES_DELETED], 0, first, n_cases);
+ g_signal_emit (ds, signals[ITEMS_CHANGED], 0, first, n_cases, 0);
return TRUE;
}
g_signal_connect_swapped (de->data_store, "case-changed",
G_CALLBACK (set_unsaved), de);
- g_signal_connect_swapped (de->data_store, "cases-deleted",
- G_CALLBACK (set_unsaved), de);
-
dataset_set_callbacks (de->dataset, &cbs, de);
connect_help (de->builder);
G_CALLBACK (on_split_change),
de);
- g_signal_connect_swapped (de->dict, "changed",
+ g_signal_connect_swapped (de->dict, "items-changed",
G_CALLBACK (enable_save), de);
g_signal_connect_swapped (de->dict, "variable-inserted",
G_CALLBACK (enable_save), de);
/* PSPPIRE - a graphical user interface for PSPP.
- Copyright (C) 2004, 2006, 2007, 2009, 2010, 2011, 2012, 2016 Free Software Foundation
+ Copyright (C) 2004, 2006, 2007, 2009, 2010, 2011, 2012,
+ 2016, 2017 Free Software Foundation
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
enum {
- ITEMS_CHANGED,
-
VARIABLE_CHANGED,
VARIABLE_INSERTED,
VARIABLE_DELETED,
object_class->dispose = psppire_dict_dispose;
- signals [ITEMS_CHANGED] =
- g_signal_new ("changed",
- G_TYPE_FROM_CLASS (class),
- G_SIGNAL_RUN_FIRST,
- 0,
- NULL, NULL,
- psppire_marshal_VOID__UINT_UINT_UINT,
- G_TYPE_NONE,
- 3,
- G_TYPE_UINT,
- G_TYPE_UINT,
- G_TYPE_UINT);
-
-
signals [VARIABLE_CHANGED] =
g_signal_new ("variable-changed",
G_TYPE_FROM_CLASS (class),
if ( ! dict->disable_insert_signal)
{
g_signal_emit (dict, signals [VARIABLE_INSERTED], 0, idx);
- g_signal_emit (dict, signals [ITEMS_CHANGED], 0, idx, 1, 1);
+ g_signal_emit_by_name (dict, "items-changed", idx, 1, 1);
}
}
{
g_signal_emit (pd, signals [VARIABLE_DELETED], 0,
var, dict_idx, case_idx);
- g_signal_emit (pd, signals [ITEMS_CHANGED], 0, dict_idx, 1, 0);
+ g_signal_emit_by_name (pd, "items-changed", dict_idx, 1, 0);
}
static void
mutcb (struct dictionary *d, int idx, unsigned int what, const struct variable *oldvar, void *pd)
{
g_signal_emit (pd, signals [VARIABLE_CHANGED], 0, idx, what, oldvar);
- g_signal_emit (pd, signals [ITEMS_CHANGED], 0, idx, 1, 1);
+ g_signal_emit_by_name (pd, "items-changed", idx, 1, 1);
}
static void
dict_set_callbacks (dict->dict, &gui_callbacks, dict);
- g_signal_emit (dict, signals [ITEMS_CHANGED], 0, 0, old_n, new_n);
+ g_signal_emit_by_name (dict, "items-changed", 0, old_n, new_n);
}
d->disable_insert_signal = FALSE;
g_signal_emit (d, signals[VARIABLE_INSERTED], 0, idx);
- g_signal_emit (d, signals [ITEMS_CHANGED], 0, idx, 0, 1);
+ g_signal_emit_by_name (d, "items-changed", idx, 0, 1);
return var;
}