camorama r354 - in trunk: . src



Author: herzi
Date: Wed May 28 14:19:54 2008
New Revision: 354
URL: http://svn.gnome.org/viewvc/camorama?rev=354&view=rev

Log:
2008-05-28  Sven Herzberg  <sven imendio com>

	Dropped pt2Function

	* src/callbacks.c: (timeout_capture_func): call into the capture
	interface
	* src/callbacks.h: dropped pt2Function
	* src/camorama-window.c: (tray_clicked_callback): call into the
	capture interface
	* src/main.c: (main): call into the capture interface


Modified:
   trunk/ChangeLog
   trunk/src/callbacks.c
   trunk/src/callbacks.h
   trunk/src/camorama-window.c
   trunk/src/main.c

Modified: trunk/src/callbacks.c
==============================================================================
--- trunk/src/callbacks.c	(original)
+++ trunk/src/callbacks.c	Wed May 28 14:19:54 2008
@@ -721,17 +721,15 @@
      * rect->x = 0; rect->y = 0;
      * rect->width = cam->x; rect->height = cam->y; */
 
-    /* need to return true, or the timeout will be destroyed - don't forget! :) */
     if (cam->hidden == TRUE) {
         /* call timeout_func to get a new picture.   stupid, but it works.
          * also need to add this to capture_func 
          * maybe add a "window_state_event" handler to do the same when window is iconified */
 
-        pt2Function (cam);
-        pt2Function (cam);
-        pt2Function (cam);
-        pt2Function (cam);
-
+        CAMORAMA_CAPTURE_STRATEGY_GET_IFACE(cam->capture)->capture (cam);
+        CAMORAMA_CAPTURE_STRATEGY_GET_IFACE(cam->capture)->capture (cam);
+        CAMORAMA_CAPTURE_STRATEGY_GET_IFACE(cam->capture)->capture (cam);
+        CAMORAMA_CAPTURE_STRATEGY_GET_IFACE(cam->capture)->capture (cam);
     }
     memcpy (cam->tmp, cam->pic_buf, cam->x * cam->y * cam->depth);
 
@@ -741,6 +739,8 @@
     if (cam->rcap == TRUE) {
         remote_save (cam);
     }
+
+    /* need to return true, or the timeout will be destroyed - don't forget! :) */
     return 1;
 }
 

Modified: trunk/src/callbacks.h
==============================================================================
--- trunk/src/callbacks.h	(original)
+++ trunk/src/callbacks.h	Wed May 28 14:19:54 2008
@@ -33,7 +33,6 @@
 void rts_func (GtkWidget *, cam *);
 void rjpg_func (GtkWidget *, cam *);
 void rpng_func (GtkWidget *, cam *);
-gint (*pt2Function) (cam *);
 void rppm_func (GtkWidget *, cam *);
 void on_preferences1_activate (GtkMenuItem * menuitem, gpointer user_data);
 void on_about_activate (GtkMenuItem * menuitem, cam *cam);

Modified: trunk/src/camorama-window.c
==============================================================================
--- trunk/src/camorama-window.c	(original)
+++ trunk/src/camorama-window.c	Wed May 28 14:19:54 2008
@@ -170,7 +170,7 @@
                                  (cam->xml, "main_window"));
             } else {
                 cam->idle_id =
-                    gtk_idle_add ((GSourceFunc) pt2Function, (gpointer) cam);
+                    gtk_idle_add ((GSourceFunc) CAMORAMA_CAPTURE_STRATEGY_GET_IFACE(cam->capture)->capture, cam);
                 gtk_widget_show (glade_xml_get_widget
                                  (cam->xml, "main_window"));
                 cam->hidden = FALSE;

Modified: trunk/src/main.c
==============================================================================
--- trunk/src/main.c	(original)
+++ trunk/src/main.c	Wed May 28 14:19:54 2008
@@ -12,6 +12,8 @@
 
 #include "camorama-display.h"
 #include "camorama-stock-items.h"
+#include "capture-strategy-read.h"
+#include "capture-strategy-mmap.h"
 
 static gboolean ver = FALSE, max = FALSE, min = FALSE, half =
     FALSE, use_read = FALSE;
@@ -245,15 +247,15 @@
 
     if (cam->read == FALSE) {
 	cam->capture = capture_strategy_mmap_new ();
-        pt2Function = timeout_func;
+	CAMORAMA_CAPTURE_STRATEGY_GET_IFACE(cam->capture)->capture = timeout_func;
         init_cam (cam);
     } else {
 	cam->capture = capture_strategy_read_new ();
+	CAMORAMA_CAPTURE_STRATEGY_GET_IFACE(cam->capture)->capture = read_timeout_func;
         printf ("using read()\n");
         cam->pic =
             realloc (cam->pic,
                      (cam->vid_cap.maxwidth * cam->vid_cap.maxheight * 3));
-        pt2Function = read_timeout_func;
     }
     cam->pixmap = gdk_pixmap_new (NULL, cam->x, cam->y, cam->desk_depth);
 
@@ -283,7 +285,7 @@
      * gtk_widget_show_all (GTK_WIDGET (tray_icon)); */
     load_interface (cam);
 
-    cam->idle_id = gtk_idle_add ((GSourceFunc) pt2Function, (gpointer) cam);
+    cam->idle_id = gtk_idle_add ((GSourceFunc) CAMORAMA_CAPTURE_STRATEGY_GET_IFACE (cam->capture)->capture, cam);
 
     gtk_timeout_add (2000, (GSourceFunc) fps, cam->status);
     gtk_main ();



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]