reset line to avoid duplicating last item
[rugen] / src / page_operate.c
1 /*
2 * page_status.c -- Status Page Handling
3 * Copyright (C) 2002-2003 Charles Yates <charles.yates@pandora.be>
4 * Copyright (C) 2010 Dan Dennedy <dan@dennedy.org>
5 *
6 * This program 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 * This program 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 Foundation,
18 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 */
20
21 #ifdef HAVE_CONFIG_H
22 # include <config.h>
23 #endif
24
25 #include <stdio.h>
26 #include <stdlib.h>
27 #include <string.h>
28 #include <gtk/gtk.h>
29
30 #include "interface.h"
31 #include "support.h"
32 #include "dv1394app.h"
33 #include "page.h"
34
35 typedef struct
36 {
37 struct page_t parent;
38 dv1394app app;
39 GtkWidget *widget;
40 page status;
41 page clips;
42 }
43 *page_operate, page_operate_t;
44
45 static GtkWidget *this_page_get_widget( page super )
46 {
47 page_operate this = ( page_operate )super;
48 if ( this->widget == NULL )
49 this->widget = create_page_operate( );
50 return this->widget;
51 }
52
53 static void this_page_get_toolbar_info( page super, GtkIconSize size, GtkWidget **icon, char **label )
54 {
55 page_operate this = ( page_operate )super;
56
57 if ( this != NULL )
58 {
59 *icon = gtk_image_new_from_stock( "gtk-justify-fill", size );
60 *label = _("_Operate");
61 }
62 }
63
64 static void this_page_on_connect( page super )
65 {
66 page_operate this = ( page_operate )super;
67
68 if ( this != NULL )
69 {
70 this->clips->on_connect(this->clips);
71 this->status->on_connect(this->status);
72 }
73 }
74
75 static void this_page_on_disconnect( page super )
76 {
77 page_operate this = ( page_operate )super;
78
79 if ( this != NULL )
80 {
81 this->clips->on_disconnect(this->clips);
82 this->status->on_disconnect(this->status);
83 }
84 }
85
86 static void this_page_close( page super )
87 {
88 page_operate this = ( page_operate )super;
89
90 if ( this != NULL )
91 {
92 this->clips->close(this->clips);
93 this->status->close(this->status);
94 free( this );
95 }
96 }
97
98 static void this_page_show_status( page super, mvcp_status status )
99 {
100 page_operate this = ( page_operate )super;
101
102 if ( this != NULL )
103 this->clips->show_status(this->clips, status);
104 }
105
106
107 page page_operate_init( dv1394app app )
108 {
109 page_operate this = calloc( 1, sizeof( page_operate_t ) );
110
111 this->parent.get_widget = this_page_get_widget;
112 this->parent.get_toolbar_info = this_page_get_toolbar_info;
113 this->parent.on_connect = this_page_on_connect;
114 this->parent.on_disconnect = this_page_on_disconnect;
115 this->parent.close = this_page_close;
116 this->parent.show_status = this_page_show_status;
117
118 this->clips = page_clips_init( app, (page)this);
119 this->status = page_status_init( app, (page)this );
120
121 return ( page )this;
122 }