[gnome-initial-setup/wip/port-to-gtk4: 3/23] Drop Cheese dependency




commit d118d1f14f9eecca1c2935a06d54e0f4e8e00b27
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Tue Jul 5 11:22:34 2022 -0300

    Drop Cheese dependency
    
    Cheese is not ported to GTK4, and it actively blocks our port.
    
    Remove this dependency for now.

 gnome-initial-setup/gnome-initial-setup.c          |   8 --
 gnome-initial-setup/meson.build                    |   2 -
 .../pages/account/um-photo-dialog.c                | 124 ---------------------
 meson.build                                        |  11 --
 meson_options.txt                                  |   6 -
 5 files changed, 151 deletions(-)
---
diff --git a/gnome-initial-setup/gnome-initial-setup.c b/gnome-initial-setup/gnome-initial-setup.c
index 7795004f..97e0c9ca 100644
--- a/gnome-initial-setup/gnome-initial-setup.c
+++ b/gnome-initial-setup/gnome-initial-setup.c
@@ -29,10 +29,6 @@
 #include <glib/gi18n.h>
 #include <handy.h>
 
-#ifdef HAVE_CHEESE
-#include <cheese-gtk.h>
-#endif
-
 //#include "pages/welcome/gis-welcome-page.h"
 //#include "pages/language/gis-language-page.h"
 //#include "pages/keyboard/gis-keyboard-page.h"
@@ -293,10 +289,6 @@ main (int argc, char *argv[])
   bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
   textdomain (GETTEXT_PACKAGE);
 
-#ifdef HAVE_CHEESE
-  cheese_gtk_init (NULL, NULL);
-#endif
-
   gtk_init (&argc, &argv);
   hdy_init ();
   hdy_style_manager_set_color_scheme (hdy_style_manager_get_default (),
diff --git a/gnome-initial-setup/meson.build b/gnome-initial-setup/meson.build
index f4212e5e..f829c629 100644
--- a/gnome-initial-setup/meson.build
+++ b/gnome-initial-setup/meson.build
@@ -64,8 +64,6 @@ dependencies = [
     #dependency ('pwquality'),
     #dependency ('rest-1.0'),
     dependency ('webkit2gtk-4.1'),
-    cheese_dep,
-    cheese_gtk_dep,
     #ibus_dep,
     #libmalcontent_dep,
     #libmalcontent_ui_dep,
diff --git a/gnome-initial-setup/pages/account/um-photo-dialog.c 
b/gnome-initial-setup/pages/account/um-photo-dialog.c
index 32f90c15..9f0a6183 100644
--- a/gnome-initial-setup/pages/account/um-photo-dialog.c
+++ b/gnome-initial-setup/pages/account/um-photo-dialog.c
@@ -28,12 +28,6 @@
 #include <glib/gi18n.h>
 #include <gtk/gtk.h>
 
-#ifdef HAVE_CHEESE
-#include <cheese-avatar-chooser.h>
-#include <cheese-camera-device.h>
-#include <cheese-camera-device-monitor.h>
-#endif /* HAVE_CHEESE */
-
 #include "um-photo-dialog.h"
 #include "um-utils.h"
 
@@ -48,12 +42,6 @@ struct _UmPhotoDialog {
         GtkWidget *flowbox;
         GtkWidget *recent_pictures;
 
-#ifdef HAVE_CHEESE
-        CheeseCameraDeviceMonitor *monitor;
-        GCancellable *cancellable;
-        guint num_cameras;
-#endif /* HAVE_CHEESE */
-
         GListStore *recent_faces;
         GListStore *faces;
         GFile *generated_avatar;
@@ -65,106 +53,12 @@ struct _UmPhotoDialog {
 
 G_DEFINE_TYPE (UmPhotoDialog, um_photo_dialog, GTK_TYPE_POPOVER)
 
-#ifdef HAVE_CHEESE
-static gboolean
-destroy_chooser (GtkWidget *chooser)
-{
-        gtk_widget_destroy (chooser);
-        return FALSE;
-}
-
-static void
-webcam_response_cb (GtkDialog     *dialog,
-                    int            response,
-                    UmPhotoDialog  *um)
-{
-        if (response == GTK_RESPONSE_ACCEPT) {
-                GdkPixbuf *pb, *pb2;
-
-                g_object_get (G_OBJECT (dialog), "pixbuf", &pb, NULL);
-                pb2 = gdk_pixbuf_scale_simple (pb, 96, 96, GDK_INTERP_BILINEAR);
-
-                um->callback (pb2, NULL, um->data);
-                um->custom_avatar_was_chosen = TRUE;
-
-                g_object_unref (pb2);
-                g_object_unref (pb);
-        }
-        if (response != GTK_RESPONSE_DELETE_EVENT &&
-            response != GTK_RESPONSE_NONE)
-                g_idle_add ((GSourceFunc) destroy_chooser, dialog);
-}
-
-static void
-webcam_icon_selected (UmPhotoDialog *um)
-{
-        GtkWidget *window;
-
-        window = cheese_avatar_chooser_new ();
-        gtk_window_set_transient_for (GTK_WINDOW (window),
-                                      GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (um))));
-        gtk_window_set_modal (GTK_WINDOW (window), TRUE);
-        g_signal_connect (G_OBJECT (window), "response",
-                          G_CALLBACK (webcam_response_cb), um);
-        gtk_widget_show (window);
-
-        gtk_popover_popdown (GTK_POPOVER (um));
-}
-
-static void
-update_photo_menu_status (UmPhotoDialog *um)
-{
-        gtk_widget_set_visible (um->take_picture_button, um->num_cameras != 0);
-}
-
-static void
-device_added (CheeseCameraDeviceMonitor *monitor,
-              CheeseCameraDevice        *device,
-              UmPhotoDialog             *um)
-{
-        um->num_cameras++;
-        update_photo_menu_status (um);
-}
-
-static void
-device_removed (CheeseCameraDeviceMonitor *monitor,
-                const char                *id,
-                UmPhotoDialog             *um)
-{
-        um->num_cameras--;
-        update_photo_menu_status (um);
-}
 
-static void
-setup_cheese_camera_device_monitor (UmPhotoDialog *um)
-{
-        g_signal_connect (G_OBJECT (um->monitor), "added", G_CALLBACK (device_added), um);
-        g_signal_connect (G_OBJECT (um->monitor), "removed", G_CALLBACK (device_removed), um);
-        cheese_camera_device_monitor_coldplug (um->monitor);
-}
-
-static void
-cheese_camera_device_monitor_new_cb (GObject *source,
-                                     GAsyncResult *result,
-                                     gpointer user_data)
-{
-        UmPhotoDialog *um = user_data;
-        GObject *ret;
-
-        ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source), result, NULL);
-        if (ret == NULL)
-                return;
-
-        um->monitor = CHEESE_CAMERA_DEVICE_MONITOR (ret);
-        setup_cheese_camera_device_monitor (um);
-}
-#else /* ! HAVE_CHEESE */
 static void
 webcam_icon_selected (UmPhotoDialog *um)
 {
   g_warning ("Webcam icon selected, but compiled without Cheese support");
 }
-#endif /* HAVE_CHEESE */
 
 static void
 face_widget_activated (GtkFlowBox      *flowbox,
@@ -347,16 +241,6 @@ setup_photo_popup (UmPhotoDialog *um)
                 facesdirs = get_system_facesdirs ();
                 add_faces_from_dirs (um->faces, facesdirs, FALSE);
         }
-
-#ifdef HAVE_CHEESE
-        um->cancellable = g_cancellable_new ();
-        g_async_initable_new_async (CHEESE_TYPE_CAMERA_DEVICE_MONITOR,
-                                    G_PRIORITY_DEFAULT,
-                                    um->cancellable,
-                                    cheese_camera_device_monitor_new_cb,
-                                    um,
-                                    NULL);
-#endif /* HAVE_CHEESE */
 }
 
 static void
@@ -441,14 +325,6 @@ um_photo_dialog_new (GtkWidget            *button,
 void
 um_photo_dialog_dispose (GObject *object)
 {
-#ifdef HAVE_CHEESE
-        UmPhotoDialog *um = UM_PHOTO_DIALOG (object);
-
-        g_cancellable_cancel (um->cancellable);
-        g_clear_object (&um->cancellable);
-        g_clear_object (&um->monitor);
-#endif
-
         G_OBJECT_CLASS (um_photo_dialog_parent_class)->dispose (object);
 }
 
diff --git a/meson.build b/meson.build
index c56ed390..1f315a81 100644
--- a/meson.build
+++ b/meson.build
@@ -45,16 +45,6 @@ if vendor_conf_file != ''
     conf.set_quoted('VENDOR_CONF_FILE', vendor_conf_file)
 endif
 
-# Needed for the 'account' page
-cheese_dep = dependency ('cheese',
-                         version: '>= 3.28',
-                         required: get_option('cheese'))
-cheese_gtk_dep = dependency ('cheese-gtk',
-                         version: '>= 3.3.5',
-                         required: get_option('cheese'))
-have_cheese = cheese_dep.found() and cheese_gtk_dep.found()
-conf.set('HAVE_CHEESE', have_cheese)
-
 # Needed for the 'keyboard' page
 ibus_dep = dependency ('ibus-1.0',
                        version: '>= 1.4.99',
@@ -84,7 +74,6 @@ subdir('build-aux')
 summary(
   {
     'systemd support': enable_systemd,
-    'Cheese': have_cheese,
     'IBus': have_ibus,
     'Parental Controls': have_parental_controls,
     'Vendor Configuration File':
diff --git a/meson_options.txt b/meson_options.txt
index be386b59..bb5883a9 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -3,12 +3,6 @@ option('vendor-conf-file',
        description: 'points to a keyfile containing vendor customization, use this only to override the 
usual search path'
 )
 
-option('cheese',
-       description: 'enable support for Cheese',
-       type: 'feature',
-       value: 'auto'
-)
-
 option('ibus',
        description: 'enable support for IBus',
        type: 'feature',


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