[cheese/make-cheese-widget-get-camera-public] Promote "cheese_widget_get_camera" to a public method



commit 79410d484bf90155dd9b806226de917a7cf9915b
Author: Felipe Borges <felipeborges gnome org>
Date:   Wed Nov 21 14:52:29 2018 +0100

    Promote "cheese_widget_get_camera" to a public method
    
    It is very convenient for a libcheese client implementing their own
    camera widget to access cheese_widget_get_camera ().
    
    This way a simple camera app could be as simple as:
    
    static void
    on_photo_taken_cb (GtkWidget *cheese_widget,
                       GdkEvent  *event,
                       gpointer   user_data)
    {
        GObject *camera = cheese_widget_get_camera (CHEESE_WIDGET (cheese_widget));
    
        cheese_camera_take_photo (CHEESE_CAMERA (camera), "/tmp/photo");
    }
    
    int main (int argc, char *argv[])
    {
        GtkWidget *window, *cheese_widget;
    
        cheese_gtk_init (NULL, NULL);
        gtk_init (&argc, &argv);
    
        window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
        g_signal_connect (G_OBJECT (window), "destroy",
                          G_CALLBACK (gtk_main_quit), NULL);
    
        cheese_widget = cheese_widget_new ();
        g_signal_connect (G_OBJECT (cheese_widget), "button-press-event",
                          G_CALLBACK (on_photo_taken_cb), NULL);
    
        gtk_container_add (GTK_CONTAINER (window), cheese_widget);
        gtk_widget_show_all (window);
        gtk_main ();
    
        return 0;
    }

 libcheese/cheese-widget-private.h | 1 -
 libcheese/cheese-widget.h         | 1 +
 2 files changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/libcheese/cheese-widget-private.h b/libcheese/cheese-widget-private.h
index 96c6ca71..3e88bee9 100644
--- a/libcheese/cheese-widget-private.h
+++ b/libcheese/cheese-widget-private.h
@@ -32,7 +32,6 @@ enum
   LAST_PAGE    = 3,
 };
 
-GObject   *cheese_widget_get_camera (CheeseWidget *widget);
 GSettings *cheese_widget_get_settings (CheeseWidget *widget);
 GtkWidget *cheese_widget_get_video_area (CheeseWidget *widget);
 
diff --git a/libcheese/cheese-widget.h b/libcheese/cheese-widget.h
index e8923877..e9918fac 100644
--- a/libcheese/cheese-widget.h
+++ b/libcheese/cheese-widget.h
@@ -32,6 +32,7 @@ G_DECLARE_FINAL_TYPE (CheeseWidget, cheese_widget, CHEESE, WIDGET, GtkNotebook)
 
 GtkWidget *cheese_widget_new (void);
 void       cheese_widget_get_error (CheeseWidget *widget, GError **error);
+GObject   *cheese_widget_get_camera (CheeseWidget *widget);
 
 
 /**


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