1 /* gpawindowkeeper.c - The GNU Privacy Assistant
2 * Copyright (C) 2000, 2001 G-N-U GmbH.
3 *
4 * This file is part of GPA
5 *
6 * GPA is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * GPA is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
19 */
20
21 #include <config.h>
22
23 #include <glib.h>
24 #include <gtk/gtk.h>
25 #include "gpa.h"
26 #include "gpawindowkeeper.h"
27
28 static GList *tempWindows = NULL;
29
30 GpaWindowKeeper *
gpa_windowKeeper_new(void)31 gpa_windowKeeper_new (void)
32 {
33 /* var */
34 GpaWindowKeeper *keeper;
35 /* commands */
36 keeper = (GpaWindowKeeper *) g_malloc (sizeof (GpaWindowKeeper));
37 keeper->window = NULL;
38 keeper->listParam = NULL;
39 tempWindows = g_list_append (tempWindows, keeper);
40 return (keeper);
41 } /* GpaWindowKeeper */
42
43 void
gpa_windowKeeper_set_window(GpaWindowKeeper * keeper,GtkWidget * window)44 gpa_windowKeeper_set_window (GpaWindowKeeper * keeper, GtkWidget * window)
45 {
46 keeper->window = window;
47 } /* gpa_windowKeeper_set_window */
48
49 void
gpa_windowKeeper_add_param(GpaWindowKeeper * keeper,gpointer param)50 gpa_windowKeeper_add_param (GpaWindowKeeper * keeper, gpointer param)
51 {
52 keeper->listParam = g_list_append (keeper->listParam, param);
53 } /* gpa_windowKeeper_add_param */
54
55 void
gpa_windowKeeper_release_exec(gpointer data,gpointer userData)56 gpa_windowKeeper_release_exec (gpointer data, gpointer userData)
57 {
58 if (data)
59 g_free (data);
60 } /* gpa_windowKeeper_release_exec */
61
62 void
gpa_windowKeeper_release(GpaWindowKeeper * keeper)63 gpa_windowKeeper_release (GpaWindowKeeper * keeper)
64 {
65 gtk_widget_destroy (keeper->window);
66 g_list_foreach (keeper->listParam, gpa_windowKeeper_release_exec, NULL);
67 tempWindows = g_list_remove (tempWindows, keeper);
68 g_free (keeper);
69 } /* gpa_windowKeeper_release */
70