[gnome-software: 71/110] gs-featured-carousel: Remove 'clicked' signal




commit b2fb3e0dfe07b6892f2ec488cd982e72aae2e478
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Wed Aug 25 19:28:27 2021 -0300

    gs-featured-carousel: Remove 'clicked' signal
    
    It uses a hack that is not present in GTK4 any more, and is no longer
    needed as the tiles in the carousel are clickable and receive all the
    click events.

 src/gs-featured-carousel.c  | 40 +---------------------------------------
 src/gs-featured-carousel.ui |  1 -
 2 files changed, 1 insertion(+), 40 deletions(-)
---
diff --git a/src/gs-featured-carousel.c b/src/gs-featured-carousel.c
index 55700d232..1be440d06 100644
--- a/src/gs-featured-carousel.c
+++ b/src/gs-featured-carousel.c
@@ -61,10 +61,9 @@ static GParamSpec *obj_props[PROP_APPS + 1] = { NULL, };
 
 typedef enum {
        SIGNAL_APP_CLICKED,
-       SIGNAL_CLICKED,
 } GsFeaturedCarouselSignal;
 
-static guint obj_signals[SIGNAL_CLICKED + 1] = { 0, };
+static guint obj_signals[SIGNAL_APP_CLICKED + 1] = { 0, };
 
 static GtkWidget *
 get_nth_page_widget (GsFeaturedCarousel *self,
@@ -280,26 +279,6 @@ key_pressed_cb (GtkEventControllerKey *controller,
        return GDK_EVENT_PROPAGATE;
 }
 
-static void
-carousel_clicked_cb (GsFeaturedCarousel *carousel,
-                     gpointer            user_data)
-{
-       GsFeaturedCarousel *self = GS_FEATURED_CAROUSEL (user_data);
-       GsAppTile *current_tile;
-       GsApp *app;
-       gdouble current_page;
-
-       /* Get the currently visible tile. */
-       current_page = adw_carousel_get_position (self->carousel);
-       current_tile = GS_APP_TILE (get_nth_page_widget (self, current_page));
-
-       if (current_tile == NULL)
-               return;
-
-       app = gs_app_tile_get_app (current_tile);
-       g_signal_emit (self, obj_signals[SIGNAL_APP_CLICKED], 0, app);
-}
-
 static void
 gs_featured_carousel_class_init (GsFeaturedCarouselClass *klass)
 {
@@ -345,22 +324,6 @@ gs_featured_carousel_class_init (GsFeaturedCarouselClass *klass)
                              0, NULL, NULL, g_cclosure_marshal_VOID__OBJECT,
                              G_TYPE_NONE, 1, GS_TYPE_APP);
 
-       /**
-        * GsFeaturedCarousel::clicked:
-        *
-        * Emitted when the carousel is clicked, and typically emitted shortly
-        * before #GsFeaturedCarousel::app-clicked is emitted. Most callers will
-        * want to connect to #GsFeaturedCarousel::app-clicked instead.
-        *
-        * Since: 40
-        */
-       obj_signals[SIGNAL_CLICKED] =
-               g_signal_new ("clicked",
-                             G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
-                             0, NULL, NULL, g_cclosure_marshal_VOID__VOID,
-                             G_TYPE_NONE, 0);
-       widget_class->activate_signal = obj_signals[SIGNAL_CLICKED];
-
        gtk_widget_class_set_template_from_resource (widget_class, 
"/org/gnome/Software/gs-featured-carousel.ui");
        gtk_widget_class_set_accessible_role (widget_class, GTK_ACCESSIBLE_ROLE_GROUP);
 
@@ -373,7 +336,6 @@ gs_featured_carousel_class_init (GsFeaturedCarouselClass *klass)
        gtk_widget_class_bind_template_callback (widget_class, next_button_direction_changed_cb);
        gtk_widget_class_bind_template_callback (widget_class, previous_button_clicked_cb);
        gtk_widget_class_bind_template_callback (widget_class, previous_button_direction_changed_cb);
-       gtk_widget_class_bind_template_callback (widget_class, carousel_clicked_cb);
        gtk_widget_class_bind_template_callback (widget_class, key_pressed_cb);
 }
 
diff --git a/src/gs-featured-carousel.ui b/src/gs-featured-carousel.ui
index f1c0a5eda..7c301038f 100644
--- a/src/gs-featured-carousel.ui
+++ b/src/gs-featured-carousel.ui
@@ -13,7 +13,6 @@
         <signal name="key-pressed" handler="key_pressed_cb"/>
       </object>
     </child>
-    <signal name="clicked" handler="carousel_clicked_cb"/>
     <style>
       <class name="featured-carousel"/>
     </style>


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