[gnome-software: 1/4] Drop custom carousel arrows
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software: 1/4] Drop custom carousel arrows
- Date: Thu, 14 Oct 2021 11:17:48 +0000 (UTC)
commit 27bcf9efce987426f00d86fec33920641cd1389b
Author: Adrien Plazas <kekun plazas laposte net>
Date: Wed Oct 6 13:01:05 2021 +0200
Drop custom carousel arrows
Use instead the standard arrow icons.
contrib/gnome-software.spec.in | 2 --
data/icons/hicolor/meson.build | 4 ---
.../scalable/carousel-arrow-next-symbolic.svg | 36 ----------------------
.../scalable/carousel-arrow-previous-symbolic.svg | 36 ----------------------
src/gs-featured-carousel.c | 35 ---------------------
src/gs-featured-carousel.ui | 6 ++--
src/gs-screenshot-carousel.c | 31 -------------------
src/gs-screenshot-carousel.ui | 6 ++--
8 files changed, 4 insertions(+), 152 deletions(-)
---
diff --git a/contrib/gnome-software.spec.in b/contrib/gnome-software.spec.in
index 06ef0cb2d..85f3908bd 100644
--- a/contrib/gnome-software.spec.in
+++ b/contrib/gnome-software.spec.in
@@ -141,8 +141,6 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/*.desktop
%{_mandir}/man1/gnome-software.1.gz
%{_datadir}/icons/hicolor/*/apps/org.gnome.Software.svg
%{_datadir}/icons/hicolor/symbolic/apps/org.gnome.Software-symbolic.svg
-%{_datadir}/icons/hicolor/scalable/actions/carousel-arrow-next-symbolic.svg
-%{_datadir}/icons/hicolor/scalable/actions/carousel-arrow-previous-symbolic.svg
%{_datadir}/icons/hicolor/scalable/status/software-installed-symbolic.svg
%{_datadir}/gnome-software/featured-*.svg
%{_datadir}/gnome-software/featured-*.jpg
diff --git a/data/icons/hicolor/meson.build b/data/icons/hicolor/meson.build
index 51838a15f..89a4ea91b 100644
--- a/data/icons/hicolor/meson.build
+++ b/data/icons/hicolor/meson.build
@@ -1,9 +1,5 @@
install_data('scalable/' + application_id + '.svg',
install_dir : 'share/icons/hicolor/scalable/apps')
-install_data('scalable/carousel-arrow-next-symbolic.svg',
- install_dir : 'share/icons/hicolor/scalable/actions')
-install_data('scalable/carousel-arrow-previous-symbolic.svg',
- install_dir : 'share/icons/hicolor/scalable/actions')
install_data('symbolic/org.gnome.Software-symbolic.svg',
install_dir : 'share/icons/hicolor/symbolic/apps')
install_data('scalable/software-installed-symbolic.svg',
diff --git a/src/gs-featured-carousel.c b/src/gs-featured-carousel.c
index 1be440d06..73b5938b8 100644
--- a/src/gs-featured-carousel.c
+++ b/src/gs-featured-carousel.c
@@ -46,9 +46,7 @@ struct _GsFeaturedCarousel
AdwCarousel *carousel;
GtkButton *next_button;
- GtkImage *next_button_image;
GtkButton *previous_button;
- GtkImage *previous_button_image;
};
G_DEFINE_TYPE (GsFeaturedCarousel, gs_featured_carousel, GTK_TYPE_BOX)
@@ -134,15 +132,6 @@ stop_rotation_timer (GsFeaturedCarousel *self)
}
}
-static void
-image_set_icon_for_direction (GtkImage *image,
- const gchar *ltr_icon_name,
- const gchar *rtl_icon_name)
-{
- const gchar *icon_name = (gtk_widget_get_direction (GTK_WIDGET (image)) == GTK_TEXT_DIR_RTL) ?
rtl_icon_name : ltr_icon_name;
- gtk_image_set_from_icon_name (image, icon_name);
-}
-
static void
next_button_clicked_cb (GtkButton *button,
gpointer user_data)
@@ -156,14 +145,6 @@ next_button_clicked_cb (GtkButton *button,
start_rotation_timer (self);
}
-static void
-next_button_direction_changed_cb (GtkWidget *widget,
- GtkTextDirection previous_direction,
- gpointer user_data)
-{
- image_set_icon_for_direction (GTK_IMAGE (widget), "carousel-arrow-next-symbolic",
"carousel-arrow-previous-symbolic");
-}
-
static void
previous_button_clicked_cb (GtkButton *button,
gpointer user_data)
@@ -177,14 +158,6 @@ previous_button_clicked_cb (GtkButton *button,
start_rotation_timer (self);
}
-static void
-previous_button_direction_changed_cb (GtkWidget *widget,
- GtkTextDirection previous_direction,
- gpointer user_data)
-{
- image_set_icon_for_direction (GTK_IMAGE (widget), "carousel-arrow-previous-symbolic",
"carousel-arrow-next-symbolic");
-}
-
static void
app_tile_clicked_cb (GsAppTile *app_tile,
gpointer user_data)
@@ -200,10 +173,6 @@ static void
gs_featured_carousel_init (GsFeaturedCarousel *self)
{
gtk_widget_init_template (GTK_WIDGET (self));
-
- /* Ensure the text directions are up to date */
- next_button_direction_changed_cb (GTK_WIDGET (self->next_button_image), GTK_TEXT_DIR_NONE, self);
- previous_button_direction_changed_cb (GTK_WIDGET (self->previous_button_image), GTK_TEXT_DIR_NONE,
self);
}
static void
@@ -329,13 +298,9 @@ gs_featured_carousel_class_init (GsFeaturedCarouselClass *klass)
gtk_widget_class_bind_template_child (widget_class, GsFeaturedCarousel, carousel);
gtk_widget_class_bind_template_child (widget_class, GsFeaturedCarousel, next_button);
- gtk_widget_class_bind_template_child (widget_class, GsFeaturedCarousel, next_button_image);
gtk_widget_class_bind_template_child (widget_class, GsFeaturedCarousel, previous_button);
- gtk_widget_class_bind_template_child (widget_class, GsFeaturedCarousel, previous_button_image);
gtk_widget_class_bind_template_callback (widget_class, next_button_clicked_cb);
- 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, key_pressed_cb);
}
diff --git a/src/gs-featured-carousel.ui b/src/gs-featured-carousel.ui
index 93f55a7bd..2e84133c7 100644
--- a/src/gs-featured-carousel.ui
+++ b/src/gs-featured-carousel.ui
@@ -43,9 +43,8 @@
</style>
<child>
<object class="GtkImage" id="previous_button_image">
- <property name="icon-name">carousel-arrow-previous-symbolic</property>
+ <property name="icon-name">go-previous-symbolic</property>
<property name="icon-size">large</property>
- <signal name="direction-changed" handler="previous_button_direction_changed_cb"/>
</object>
</child>
</object>
@@ -71,9 +70,8 @@
</style>
<child>
<object class="GtkImage" id="next_button_image">
- <property name="icon_name">carousel-arrow-next-symbolic</property>
+ <property name="icon_name">go-next-symbolic</property>
<property name="icon_size">large</property>
- <signal name="direction-changed" handler="next_button_direction_changed_cb"/>
</object>
</child>
</object>
diff --git a/src/gs-screenshot-carousel.c b/src/gs-screenshot-carousel.c
index 95b1de166..3a93053f0 100644
--- a/src/gs-screenshot-carousel.c
+++ b/src/gs-screenshot-carousel.c
@@ -46,10 +46,8 @@ struct _GsScreenshotCarousel
gboolean has_screenshots;
GtkWidget *button_next;
- GtkWidget *button_next_image;
GtkWidget *button_next_revealer;
GtkWidget *button_previous;
- GtkWidget *button_previous_image;
GtkWidget *button_previous_revealer;
GtkWidget *carousel;
GtkWidget *carousel_indicator;
@@ -241,28 +239,6 @@ gs_screenshot_carousel_button_next_clicked_cb (GsScreenshotCarousel *self)
ADW_NAVIGATION_DIRECTION_FORWARD);
}
-static void
-gs_screenshot_carousel_navigate_button_direction_changed_cb (GtkWidget *widget,
- GtkTextDirection previous_direction,
- gpointer user_data)
-{
- const gchar *ltr_icon_name, *rtl_icon_name, *icon_name;
-
- g_assert (g_strcmp0 (gtk_widget_get_name (widget), "previous") == 0 ||
- g_strcmp0 (gtk_widget_get_name (widget), "next") == 0);
-
- if (g_strcmp0 (gtk_widget_get_name (widget), "previous") == 0) {
- ltr_icon_name = "carousel-arrow-previous-symbolic";
- rtl_icon_name = "carousel-arrow-next-symbolic";
- } else {
- ltr_icon_name = "carousel-arrow-next-symbolic";
- rtl_icon_name = "carousel-arrow-previous-symbolic";
- }
-
- icon_name = (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL) ? rtl_icon_name : ltr_icon_name;
- gtk_image_set_from_icon_name (GTK_IMAGE (widget), icon_name);
-}
-
static void
gs_screenshot_carousel_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
{
@@ -331,10 +307,8 @@ gs_screenshot_carousel_class_init (GsScreenshotCarouselClass *klass)
gtk_widget_class_set_template_from_resource (widget_class,
"/org/gnome/Software/gs-screenshot-carousel.ui");
gtk_widget_class_bind_template_child (widget_class, GsScreenshotCarousel, button_next);
- gtk_widget_class_bind_template_child (widget_class, GsScreenshotCarousel, button_next_image);
gtk_widget_class_bind_template_child (widget_class, GsScreenshotCarousel, button_next_revealer);
gtk_widget_class_bind_template_child (widget_class, GsScreenshotCarousel, button_previous);
- gtk_widget_class_bind_template_child (widget_class, GsScreenshotCarousel, button_previous_image);
gtk_widget_class_bind_template_child (widget_class, GsScreenshotCarousel, button_previous_revealer);
gtk_widget_class_bind_template_child (widget_class, GsScreenshotCarousel, carousel);
gtk_widget_class_bind_template_child (widget_class, GsScreenshotCarousel, carousel_indicator);
@@ -344,7 +318,6 @@ gs_screenshot_carousel_class_init (GsScreenshotCarouselClass *klass)
gtk_widget_class_bind_template_callback (widget_class, gs_screenshot_carousel_notify_position_cb);
gtk_widget_class_bind_template_callback (widget_class,
gs_screenshot_carousel_button_previous_clicked_cb);
gtk_widget_class_bind_template_callback (widget_class, gs_screenshot_carousel_button_next_clicked_cb);
- gtk_widget_class_bind_template_callback (widget_class,
gs_screenshot_carousel_navigate_button_direction_changed_cb);
gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_BIN_LAYOUT);
gtk_widget_class_set_css_name (widget_class, "screenshot-carousel");
@@ -355,10 +328,6 @@ gs_screenshot_carousel_init (GsScreenshotCarousel *self)
{
gtk_widget_init_template (GTK_WIDGET (self));
- /* Ensure the arrow direction matches the text direction */
- gs_screenshot_carousel_navigate_button_direction_changed_cb (GTK_WIDGET (self->button_next_image),
GTK_TEXT_DIR_NONE, self);
- gs_screenshot_carousel_navigate_button_direction_changed_cb (GTK_WIDGET
(self->button_previous_image), GTK_TEXT_DIR_NONE, self);
-
#if ADW_CHECK_VERSION(1, 3, 0)
/* Disable scrolling through the carousel, as it’s typically used
* in application pages which are themselves scrollable. */
diff --git a/src/gs-screenshot-carousel.ui b/src/gs-screenshot-carousel.ui
index cb5bf4d96..4172ccf9f 100644
--- a/src/gs-screenshot-carousel.ui
+++ b/src/gs-screenshot-carousel.ui
@@ -50,11 +50,10 @@
<child>
<object class="GtkImage" id="button_previous_image">
<property name="halign">center</property>
- <property name="icon-name">carousel-arrow-previous-symbolic</property>
+ <property name="icon-name">go-previous-symbolic</property>
<property name="icon-size">normal</property>
<property name="valign">center</property>
<property name="name">previous</property>
- <signal name="direction-changed"
handler="gs_screenshot_carousel_navigate_button_direction_changed_cb"/>
</object>
</child>
</object>
@@ -86,11 +85,10 @@
<child>
<object class="GtkImage" id="button_next_image">
<property name="halign">center</property>
- <property name="icon-name">carousel-arrow-next-symbolic</property>
+ <property name="icon-name">go-next-symbolic</property>
<property name="icon-size">normal</property>
<property name="valign">center</property>
<property name="name">next</property>
- <signal name="direction-changed"
handler="gs_screenshot_carousel_navigate_button_direction_changed_cb"/>
</object>
</child>
</object>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]