1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
|
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* e-book-shell-view-private.c
*
* Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
* License as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#include "e-book-shell-view-private.h"
void
e_book_shell_view_private_init (EBookShellView *book_shell_view)
{
EBookShellViewPrivate *priv = book_shell_view->priv;
GHashTable *uid_to_view;
GHashTable *uid_to_editor;
GtkWidget *widget;
uid_to_view = g_hash_table_new_full (
g_str_hash, g_str_equal,
(GDestroyNotify) g_free,
(GDestroyNotify) g_object_unref);
uid_to_editor = g_hash_table_new_full (
g_str_hash, g_str_equal,
(GDestroyNotify) g_free,
(GDestroyNotify) g_free);
priv->contact_actions = gtk_action_group_new ("contacts");
e_book_shell_view_actions_init (book_shell_view);
widget = gtk_notebook_new ();
gtk_notebook_set_show_tabs (GTK_NOTEBOOK (widget), FALSE);
gtk_notebook_set_show_border (GTK_NOTEBOOK (widget), FALSE);
priv->notebook = g_object_ref_sink (widget);
gtk_widget_show (widget);
e_book_get_addressbooks (&priv->source_list, NULL);
}
void
e_book_shell_view_private_dispose (EBookShellView *book_shell_view)
{
EBookShellViewPrivate *priv = book_shell_view->priv;
DISPOSE (priv->notebook);
DISPOSE (priv->source_list);
g_hash_table_remove_all (priv->uid_to_view);
g_hash_table_remove_all (priv->uid_to_editor);
}
void
e_book_shell_view_private_finalize (EBookShellView *book_shell_view)
{
EBookShellViewPrivate *priv = book_shell_view->priv;
g_hash_table_destroy (priv->uid_to_view);
g_hash_table_destroy (priv->uid_to_editor);
}
EABView *
e_book_shell_view_get_current_view (EBookShellView *book_shell_view)
{
GtkNotebook *notebook;
GtkWidget *widget;
gint page_num;
g_return_val_if_fail (E_IS_BOOK_SHELL_VIEW (book_shell_view), NULL);
notebook = GTK_NOTEBOOK (book_shell_view->priv->notebook);
page_num = gtk_notebook_get_current_page (notebook);
widget = gtk_notebook_get_nth_page (notebook, page_num);
return EAB_VIEW (widget);
}
|