join clips and status control to same 'operate' page
[rugen] / src / page_operate.c
diff --git a/src/page_operate.c b/src/page_operate.c
new file mode 100644 (file)
index 0000000..2cb9d63
--- /dev/null
@@ -0,0 +1,122 @@
+/*
+ * page_status.c -- Status Page Handling
+ * Copyright (C) 2002-2003 Charles Yates <charles.yates@pandora.be>
+ * Copyright (C) 2010 Dan Dennedy <dan@dennedy.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <gtk/gtk.h>
+
+#include "interface.h"
+#include "support.h"
+#include "dv1394app.h"
+#include "page.h"
+
+typedef struct
+{
+       struct page_t parent;
+       dv1394app app;
+       GtkWidget *widget;
+       page status;
+       page clips;
+}
+*page_operate, page_operate_t;
+
+static GtkWidget *this_page_get_widget( page super )
+{
+       page_operate this = ( page_operate )super;
+       if ( this->widget == NULL )
+               this->widget = create_page_operate( );
+       return this->widget;
+}
+
+static void this_page_get_toolbar_info( page super, GtkIconSize size, GtkWidget **icon, char **label )
+{
+       page_operate this = ( page_operate )super;
+
+       if ( this != NULL )
+       {
+               *icon = gtk_image_new_from_stock( "gtk-justify-fill",  size );
+               *label = _("_Operate");
+       }
+}
+
+static void this_page_on_connect( page super )
+{
+       page_operate this = ( page_operate )super;
+
+       if ( this != NULL )
+       {
+               this->clips->on_connect(this->clips);
+               this->status->on_connect(this->status);
+       }
+}
+
+static void this_page_on_disconnect( page super )
+{
+       page_operate this = ( page_operate )super;
+
+       if ( this != NULL )
+       {
+               this->clips->on_disconnect(this->clips);
+               this->status->on_disconnect(this->status);
+       }
+}
+
+static void this_page_close( page super )
+{
+       page_operate this = ( page_operate )super;
+
+       if ( this != NULL )
+       {
+               this->clips->close(this->clips);
+               this->status->close(this->status);
+               free( this );
+       }
+}
+
+static void this_page_show_status( page super, mvcp_status status )
+{
+       page_operate this = ( page_operate )super;
+
+       if ( this != NULL )
+               this->clips->show_status(this->clips, status);
+}
+
+
+page page_operate_init( dv1394app app )
+{
+       page_operate this = calloc( 1, sizeof( page_operate_t ) );
+
+       this->parent.get_widget = this_page_get_widget;
+       this->parent.get_toolbar_info = this_page_get_toolbar_info;
+       this->parent.on_connect = this_page_on_connect;
+       this->parent.on_disconnect = this_page_on_disconnect;
+       this->parent.close = this_page_close;
+       this->parent.show_status = this_page_show_status;
+
+       this->clips = page_clips_init( app, (page)this);
+       this->status = page_status_init( app, (page)this );
+
+       return ( page )this;
+}