projects
/
pspp
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
psppire-data-sheet: Implement Edit|Paste.
[pspp]
/
src
/
ui
/
gui
/
psppire-dict.c
diff --git
a/src/ui/gui/psppire-dict.c
b/src/ui/gui/psppire-dict.c
index b3a24838580ea5d45fe10a06f39408c78eefc4ce..e6291b69c465535ee94434908070a9b78772d031 100644
(file)
--- a/
src/ui/gui/psppire-dict.c
+++ b/
src/ui/gui/psppire-dict.c
@@
-56,7
+56,7
@@
enum {
/* --- prototypes --- */
static void psppire_dict_class_init (PsppireDictClass *class);
static void psppire_dict_init (PsppireDict *dict);
/* --- prototypes --- */
static void psppire_dict_class_init (PsppireDictClass *class);
static void psppire_dict_init (PsppireDict *dict);
-static void psppire_dict_
finalize
(GObject *object);
+static void psppire_dict_
dispose
(GObject *object);
static void dictionary_tree_model_init (GtkTreeModelIface *iface);
static void dictionary_tree_model_init (GtkTreeModelIface *iface);
@@
-115,7
+115,7
@@
psppire_dict_class_init (PsppireDictClass *class)
parent_class = g_type_class_peek_parent (class);
parent_class = g_type_class_peek_parent (class);
- object_class->
finalize = psppire_dict_finaliz
e;
+ object_class->
dispose = psppire_dict_dispos
e;
signals [BACKEND_CHANGED] =
g_signal_new ("backend-changed",
signals [BACKEND_CHANGED] =
g_signal_new ("backend-changed",
@@
-129,7
+129,7
@@
psppire_dict_class_init (PsppireDictClass *class)
signals [VARIABLE_CHANGED] =
signals [VARIABLE_CHANGED] =
- g_signal_new ("variable
_
changed",
+ g_signal_new ("variable
-
changed",
G_TYPE_FROM_CLASS (class),
G_SIGNAL_RUN_FIRST,
0,
G_TYPE_FROM_CLASS (class),
G_SIGNAL_RUN_FIRST,
0,
@@
-142,7
+142,7
@@
psppire_dict_class_init (PsppireDictClass *class)
signals [VARIABLE_INSERTED] =
signals [VARIABLE_INSERTED] =
- g_signal_new ("variable
_
inserted",
+ g_signal_new ("variable
-
inserted",
G_TYPE_FROM_CLASS (class),
G_SIGNAL_RUN_FIRST,
0,
G_TYPE_FROM_CLASS (class),
G_SIGNAL_RUN_FIRST,
0,
@@
-227,13
+227,13
@@
psppire_dict_class_init (PsppireDictClass *class)
}
static void
}
static void
-psppire_dict_
finaliz
e (GObject *object)
+psppire_dict_
dispos
e (GObject *object)
{
PsppireDict *d = PSPPIRE_DICT (object);
{
PsppireDict *d = PSPPIRE_DICT (object);
- dict_
destroy (d->dict
);
+ dict_
set_callbacks (d->dict, NULL, NULL
);
- G_OBJECT_CLASS (parent_class)->
finaliz
e (object);
+ G_OBJECT_CLASS (parent_class)->
dispos
e (object);
}
/* Pass on callbacks from src/data/dictionary, as
}
/* Pass on callbacks from src/data/dictionary, as
@@
-352,8
+352,8
@@
psppire_dict_replace_dictionary (PsppireDict *dict, struct dictionary *d)
/* Stores a valid name for a new variable in DICT into the SIZE bytes in NAME.
Returns true if successful, false if SIZE is insufficient. */
/* Stores a valid name for a new variable in DICT into the SIZE bytes in NAME.
Returns true if successful, false if SIZE is insufficient. */
-
static
bool
-
auto_generate_var
_name (const PsppireDict *dict, char *name, size_t size)
+bool
+
psppire_dict_generate
_name (const PsppireDict *dict, char *name, size_t size)
{
gint d;
{
gint d;
@@
-379,23
+379,24
@@
auto_generate_var_name (const PsppireDict *dict, char *name, size_t size)
return name;
}
return name;
}
-/* Insert a new variable at posn IDX, with the name NAME.
+/* Insert a new variable at posn IDX, with the name NAME, and return the
+ new variable.
If NAME is null, then a name will be automatically assigned.
*/
If NAME is null, then a name will be automatically assigned.
*/
-void
+struct variable *
psppire_dict_insert_variable (PsppireDict *d, gint idx, const gchar *name)
{
psppire_dict_insert_variable (PsppireDict *d, gint idx, const gchar *name)
{
- struct variable *var
;
+ struct variable *var;
char tmpname[64];
char tmpname[64];
- g_return_
if_fail (idx >= 0
);
- g_return_
if_fail (d
);
- g_return_
if_fail (PSPPIRE_IS_DICT (d)
);
+ g_return_
val_if_fail (idx >= 0, NULL
);
+ g_return_
val_if_fail (d, NULL
);
+ g_return_
val_if_fail (PSPPIRE_IS_DICT (d), NULL
);
- if (
! name
)
+ if (
name == NULL
)
{
{
- if (!
auto_generate_var
_name (d, tmpname, sizeof tmpname))
- g_return_
if_reached (
);
+ if (!
psppire_dict_generate
_name (d, tmpname, sizeof tmpname))
+ g_return_
val_if_reached (NULL
);
name = tmpname;
}
name = tmpname;
}
@@
-409,6
+410,8
@@
psppire_dict_insert_variable (PsppireDict *d, gint idx, const gchar *name)
d->disable_insert_signal = FALSE;
g_signal_emit (d, signals[VARIABLE_INSERTED], 0, idx);
d->disable_insert_signal = FALSE;
g_signal_emit (d, signals[VARIABLE_INSERTED], 0, idx);
+
+ return var;
}
/* Delete N variables beginning at FIRST */
}
/* Delete N variables beginning at FIRST */