Initial import from Charles Yates' v0.2 tarball.
[rugen] / src / page.c
1 /*
2 * page.c -- Page handling
3 * Copyright (C) 2002-2003 Charles Yates <charles.yates@pandora.be>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software Foundation,
17 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 */
19
20 #include <page.h>
21 #include <gtk/gtk.h>
22
23 GtkWidget *page_get_widget( page this )
24 {
25 return this->get_widget( this );
26 }
27
28 void page_get_toolbar_info( page this, GtkIconSize size, GtkWidget **icon, char **label )
29 {
30 if ( this->get_toolbar_info )
31 {
32 this->get_toolbar_info( this, size, icon, label );
33 }
34 else
35 {
36 *icon = gtk_image_new_from_stock( "gtk-execute", size );
37 *label = "_Unknown";
38 }
39 }
40
41 /** Called on connection being established to a server.
42 */
43
44 void page_on_connect( page this )
45 {
46 if ( this->on_connect )
47 this->on_connect( this );
48 }
49
50 /** Called on a disconnection from a server.
51 */
52
53 void page_on_disconnect( page this )
54 {
55 if ( this->on_disconnect )
56 this->on_disconnect( this );
57 }
58
59 /** Called when the user changes the selected unit.
60 */
61
62 void page_on_unit_change( page this, int unit )
63 {
64 if ( this->on_unit_change )
65 this->on_unit_change( this, unit );
66 }
67
68 /** Called to propogate status information to any page that's interested.
69 */
70
71 void page_show_status( page this, valerie_status status )
72 {
73 if ( this->show_status )
74 this->show_status( this, status );
75 }
76
77 /** Called on close.
78 */
79
80 void page_close( page this )
81 {
82 if ( this->close )
83 this->close( this );
84 }
85