X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fui%2Fgui%2Fpsppire-dialog-action.c;h=6bd1645460c876d9251b75648de54198fbf84c0e;hb=5d085e3326530983f7c2f3843dd2a1eebc0a6e73;hp=a97421f7ea0bbfeddb40f307ae7ea118df76381e;hpb=fc6620099bbc53762095569d5356b67a81a85402;p=pspp diff --git a/src/ui/gui/psppire-dialog-action.c b/src/ui/gui/psppire-dialog-action.c index a97421f7ea..6bd1645460 100644 --- a/src/ui/gui/psppire-dialog-action.c +++ b/src/ui/gui/psppire-dialog-action.c @@ -106,21 +106,29 @@ on_destroy_dataset (GObject *w) g_hash_table_unref (t); } +/* Each toplevel widget - that is the data window, which generally has a 1-1 association + with a dataset - has an associated GHashTable. + + This GHashTable is keyed by the address of a PsppireDialogAction, and its values + are user determined pointers (typically a GtkBuilder*). + + This is useful for storing the state of dialogs so they can persist between invocations. +*/ GHashTable * -psppire_dialog_action_get_pointer (PsppireDialogAction *act) +psppire_dialog_action_get_hash_table (PsppireDialogAction *act) { set_toplevel (act); - GHashTable *thing = g_object_get_data (G_OBJECT (act->toplevel), "thing-table"); - if (thing == NULL) + GHashTable *t = g_object_get_data (G_OBJECT (act->toplevel), "thing-table"); + if (t == NULL) { - thing = g_hash_table_new_full (g_direct_hash, g_direct_equal, 0, g_object_unref); - g_object_set_data (G_OBJECT (act->toplevel), "thing-table", thing); + t = g_hash_table_new_full (g_direct_hash, g_direct_equal, 0, g_object_unref); + g_object_set_data (G_OBJECT (act->toplevel), "thing-table", t); g_object_set_data (G_OBJECT (act->toplevel), "widget-list", NULL); g_signal_connect (act->toplevel, "destroy", G_CALLBACK (on_destroy_dataset), NULL); } - return thing; + return t; } static void @@ -135,8 +143,8 @@ psppire_dialog_action_activate (PsppireDialogAction *act) set_toplevel (act); act->dict = PSPPIRE_DATA_WINDOW(act->toplevel)->dict; - - g_object_set (act->source, "model", act->dict, NULL); + if (act->source) + g_object_set (act->source, "model", act->dict, NULL); GSList *wl = g_object_get_data (G_OBJECT (act->toplevel), "widget-list"); wl = g_slist_prepend (wl, act->dialog); @@ -147,7 +155,8 @@ psppire_dialog_action_activate (PsppireDialogAction *act) if (GTK_ACTION_CLASS (psppire_dialog_action_parent_class)->activate) GTK_ACTION_CLASS (psppire_dialog_action_parent_class)->activate ( GTK_ACTION (act)); - gtk_widget_grab_focus (act->source); + if (act->source) + gtk_widget_grab_focus (act->source); if (first_time) psppire_dialog_reload (PSPPIRE_DIALOG (act->dialog));