[gnome-software: 27/110] Adapt to GtkImage API changes
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software: 27/110] Adapt to GtkImage API changes
- Date: Tue, 5 Oct 2021 20:32:36 +0000 (UTC)
commit c684c6b61f249d5b87c5be3bc9d94a4a2c59e0c7
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Sun Aug 22 20:48:56 2021 -0300
Adapt to GtkImage API changes
The icon size is not an argument to many GtkImage functions now.
src/gs-app-context-bar.c | 4 ++--
src/gs-app-details-page.c | 5 ++---
src/gs-app-row.c | 2 +-
src/gs-category-tile.c | 4 +---
src/gs-context-dialog-row.c | 8 ++------
src/gs-context-dialog-row.ui | 1 +
src/gs-details-page.c | 3 +--
src/gs-feature-tile.c | 2 +-
src/gs-featured-carousel.c | 2 +-
src/gs-hardware-support-context-dialog.c | 2 +-
src/gs-hardware-support-context-dialog.ui | 1 +
src/gs-license-tile.c | 2 +-
src/gs-repo-row.c | 2 +-
src/gs-safety-context-dialog.c | 2 +-
src/gs-safety-context-dialog.ui | 1 +
src/gs-screenshot-carousel.c | 2 +-
src/gs-summary-tile.c | 2 +-
src/gs-updates-page.c | 9 +++------
18 files changed, 23 insertions(+), 31 deletions(-)
---
diff --git a/src/gs-app-context-bar.c b/src/gs-app-context-bar.c
index d1ed21c3f..714ad85cc 100644
--- a/src/gs-app-context-bar.c
+++ b/src/gs-app-context-bar.c
@@ -454,7 +454,7 @@ update_safety_tile (GsAppContextBar *self)
g_assert_not_reached ();
}
- gtk_image_set_from_icon_name (GTK_IMAGE (self->tiles[SAFETY_TILE].lozenge_content), icon_name,
GTK_ICON_SIZE_BUTTON);
+ gtk_image_set_from_icon_name (GTK_IMAGE (self->tiles[SAFETY_TILE].lozenge_content), icon_name);
gtk_label_set_text (self->tiles[SAFETY_TILE].title, title);
gtk_label_set_text (self->tiles[SAFETY_TILE].description, description);
@@ -626,7 +626,7 @@ update_hardware_support_tile (GsAppContextBar *self)
/* Update the UI. The `adaptive-symbolic` icon needs a special size to
* be set, as it is wider than it is tall. Setting the size ensures it’s
* rendered at the right height. */
- gtk_image_set_from_icon_name (GTK_IMAGE (self->tiles[HARDWARE_SUPPORT_TILE].lozenge_content),
icon_name, GTK_ICON_SIZE_BUTTON);
+ gtk_image_set_from_icon_name (GTK_IMAGE (self->tiles[HARDWARE_SUPPORT_TILE].lozenge_content),
icon_name);
gtk_image_set_pixel_size (GTK_IMAGE (self->tiles[HARDWARE_SUPPORT_TILE].lozenge_content), g_str_equal
(icon_name, "adaptive-symbolic") ? 56 : -1);
gtk_label_set_text (self->tiles[HARDWARE_SUPPORT_TILE].title, title);
diff --git a/src/gs-app-details-page.c b/src/gs-app-details-page.c
index 0114fe4a9..b2caa1c16 100644
--- a/src/gs-app-details-page.c
+++ b/src/gs-app-details-page.c
@@ -99,7 +99,7 @@ populate_permissions_section (GsAppDetailsPage *page, GsAppPermissions permissio
gtk_style_context_add_class (gtk_widget_get_style_context (row),
"permission-row-warning");
}
- image = gtk_image_new_from_icon_name ("dialog-warning-symbolic", GTK_ICON_SIZE_MENU);
+ image = gtk_image_new_from_icon_name ("dialog-warning-symbolic");
if ((permission_display_data[i].permission & ~MEDIUM_PERMISSIONS) == 0)
gtk_widget_set_opacity (image, 0);
@@ -197,8 +197,7 @@ set_updates_description_ui (GsAppDetailsPage *page, GsApp *app)
}
gtk_image_set_pixel_size (GTK_IMAGE (page->image_icon), icon_size);
- gtk_image_set_from_gicon (GTK_IMAGE (page->image_icon), icon,
- GTK_ICON_SIZE_INVALID);
+ gtk_image_set_from_gicon (GTK_IMAGE (page->image_icon), icon);
if (gs_app_has_quirk (app, GS_APP_QUIRK_NEW_PERMISSIONS)) {
gtk_widget_show (page->permissions_section_box);
diff --git a/src/gs-app-row.c b/src/gs-app-row.c
index d7dddf245..342fdd4e6 100644
--- a/src/gs-app-row.c
+++ b/src/gs-app-row.c
@@ -420,7 +420,7 @@ gs_app_row_actually_refresh (GsAppRow *app_row)
gtk_image_get_pixel_size (GTK_IMAGE (priv->image)),
gtk_widget_get_scale_factor (priv->image),
"system-component-application");
- gtk_image_set_from_gicon (GTK_IMAGE (priv->image), icon, GTK_ICON_SIZE_DIALOG);
+ gtk_image_set_from_gicon (GTK_IMAGE (priv->image), icon);
context = gtk_widget_get_style_context (priv->image);
if (missing_search_result)
diff --git a/src/gs-category-tile.c b/src/gs-category-tile.c
index ee8d82dc9..34fced1a9 100644
--- a/src/gs-category-tile.c
+++ b/src/gs-category-tile.c
@@ -100,9 +100,7 @@ gs_category_tile_refresh (GsCategoryTile *tile)
gtk_label_set_label (GTK_LABEL (tile->label),
gs_category_get_name (tile->category));
- gtk_image_set_from_icon_name (GTK_IMAGE (tile->image),
- icon_name,
- GTK_ICON_SIZE_DND);
+ gtk_image_set_from_icon_name (GTK_IMAGE (tile->image), icon_name);
gtk_widget_set_visible (tile->image, icon_name != NULL);
/* Update the icon class. */
diff --git a/src/gs-context-dialog-row.c b/src/gs-context-dialog-row.c
index 341c71111..26e9c845e 100644
--- a/src/gs-context-dialog-row.c
+++ b/src/gs-context-dialog-row.c
@@ -120,7 +120,7 @@ gs_context_dialog_row_set_property (GObject *object,
switch ((GsContextDialogRowProperty) prop_id) {
case PROP_ICON_NAME:
- gtk_image_set_from_icon_name (self->lozenge_content_image, g_value_get_string (value),
GTK_ICON_SIZE_BUTTON);
+ gtk_image_set_from_icon_name (self->lozenge_content_image, g_value_get_string (value));
gtk_widget_set_visible (GTK_WIDGET (self->lozenge_content_image), TRUE);
gtk_widget_set_visible (GTK_WIDGET (self->lozenge_content_text), FALSE);
break;
@@ -325,13 +325,9 @@ gs_context_dialog_row_new_text (const gchar *content,
const gchar *
gs_context_dialog_row_get_icon_name (GsContextDialogRow *self)
{
- const gchar *icon_name = NULL;
-
g_return_val_if_fail (GS_IS_CONTEXT_DIALOG_ROW (self), NULL);
- gtk_image_get_icon_name (self->lozenge_content_image, &icon_name, NULL);
-
- return icon_name;
+ return gtk_image_get_icon_name (self->lozenge_content_image);
}
/**
diff --git a/src/gs-context-dialog-row.ui b/src/gs-context-dialog-row.ui
index 0b0f30171..edeabdf48 100644
--- a/src/gs-context-dialog-row.ui
+++ b/src/gs-context-dialog-row.ui
@@ -26,6 +26,7 @@
<property name="halign">center</property>
<!-- this is a placeholder: the icon is actually set in code -->
<property name="icon-name">safety-symbolic</property>
+ <property name="pixel-size">16</property>
<property name="visible">True</property>
<accessibility>
<relation target="title" type="labelled-by"/>
diff --git a/src/gs-details-page.c b/src/gs-details-page.c
index ea626080e..6faa5ac06 100644
--- a/src/gs-details-page.c
+++ b/src/gs-details-page.c
@@ -1028,8 +1028,7 @@ gs_details_page_refresh_all (GsDetailsPage *self)
}
}
- gtk_image_set_from_gicon (GTK_IMAGE (self->application_details_icon), icon,
- GTK_ICON_SIZE_INVALID);
+ gtk_image_set_from_gicon (GTK_IMAGE (self->application_details_icon), icon);
/* Set various external links. If none are visible, show a fallback
* message instead. */
diff --git a/src/gs-feature-tile.c b/src/gs-feature-tile.c
index 3237d3b3f..3c529f23c 100644
--- a/src/gs-feature-tile.c
+++ b/src/gs-feature-tile.c
@@ -214,7 +214,7 @@ gs_feature_tile_refresh (GsAppTile *self)
}
if (icon != NULL) {
- gtk_image_set_from_gicon (GTK_IMAGE (tile->image), icon, GTK_ICON_SIZE_INVALID);
+ gtk_image_set_from_gicon (GTK_IMAGE (tile->image), icon);
gtk_image_set_pixel_size (GTK_IMAGE (tile->image), icon_size);
gtk_widget_show (tile->image);
} else {
diff --git a/src/gs-featured-carousel.c b/src/gs-featured-carousel.c
index 3bc816a9f..0c15591b6 100644
--- a/src/gs-featured-carousel.c
+++ b/src/gs-featured-carousel.c
@@ -141,7 +141,7 @@ image_set_icon_for_direction (GtkImage *image,
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, GTK_ICON_SIZE_LARGE_TOOLBAR);
+ gtk_image_set_from_icon_name (image, icon_name);
}
static void
diff --git a/src/gs-hardware-support-context-dialog.c b/src/gs-hardware-support-context-dialog.c
index 2fcbace1d..849787a7b 100644
--- a/src/gs-hardware-support-context-dialog.c
+++ b/src/gs-hardware-support-context-dialog.c
@@ -721,7 +721,7 @@ update_relations_list (GsHardwareSupportContextDialog *self)
g_assert_not_reached ();
}
- gtk_image_set_from_icon_name (GTK_IMAGE (self->icon), icon_name, GTK_ICON_SIZE_LARGE_TOOLBAR);
+ gtk_image_set_from_icon_name (GTK_IMAGE (self->icon), icon_name);
gtk_label_set_text (self->title, title);
context = gtk_widget_get_style_context (self->lozenge);
diff --git a/src/gs-hardware-support-context-dialog.ui b/src/gs-hardware-support-context-dialog.ui
index c65321079..bd6c467ae 100644
--- a/src/gs-hardware-support-context-dialog.ui
+++ b/src/gs-hardware-support-context-dialog.ui
@@ -37,6 +37,7 @@
<property name="halign">center</property>
<!-- this is a placeholder: the icon is actually set in code -->
<property name="icon-name">safety-symbolic</property>
+ <property name="pixel-size">24</property>
<property name="visible">True</property>
<accessibility>
<relation target="title" type="labelled-by"/>
diff --git a/src/gs-license-tile.c b/src/gs-license-tile.c
index af348db87..0b9d64e47 100644
--- a/src/gs-license-tile.c
+++ b/src/gs-license-tile.c
@@ -123,7 +123,7 @@ gs_license_tile_refresh (GsLicenseTile *self)
}
for (gsize i = 0; i < G_N_ELEMENTS (self->lozenge_images); i++)
- gtk_image_set_from_icon_name (self->lozenge_images[i], lozenge_icon_names[i],
GTK_ICON_SIZE_BUTTON);
+ gtk_image_set_from_icon_name (self->lozenge_images[i], lozenge_icon_names[i]);
gtk_label_set_label (self->title_label, title);
gtk_label_set_label (self->description_label, description);
diff --git a/src/gs-repo-row.c b/src/gs-repo-row.c
index 8bd45d0c9..df1bccb7c 100644
--- a/src/gs-repo-row.c
+++ b/src/gs-repo-row.c
@@ -304,7 +304,7 @@ gs_repo_row_init (GsRepoRow *self)
gtk_widget_init_template (GTK_WIDGET (self));
priv->switch_handler_id = g_signal_connect (priv->disable_switch, "notify::active",
G_CALLBACK (disable_switch_clicked_cb), self);
- image = gtk_image_new_from_icon_name ("user-trash-symbolic", GTK_ICON_SIZE_BUTTON);
+ image = gtk_image_new_from_icon_name ("user-trash-symbolic");
gtk_button_set_image (GTK_BUTTON (priv->remove_button), image);
g_signal_connect (priv->remove_button, "clicked",
G_CALLBACK (gs_repo_row_remove_button_clicked_cb), self);
diff --git a/src/gs-safety-context-dialog.c b/src/gs-safety-context-dialog.c
index 8d6fce284..27f3c090d 100644
--- a/src/gs-safety-context-dialog.c
+++ b/src/gs-safety-context-dialog.c
@@ -361,7 +361,7 @@ update_permissions_list (GsSafetyContextDialog *self)
g_assert_not_reached ();
}
- gtk_image_set_from_icon_name (GTK_IMAGE (self->icon), icon_name, GTK_ICON_SIZE_LARGE_TOOLBAR);
+ gtk_image_set_from_icon_name (GTK_IMAGE (self->icon), icon_name);
gtk_label_set_text (self->title, title);
context = gtk_widget_get_style_context (self->lozenge);
diff --git a/src/gs-safety-context-dialog.ui b/src/gs-safety-context-dialog.ui
index 16fccf4fb..141927914 100644
--- a/src/gs-safety-context-dialog.ui
+++ b/src/gs-safety-context-dialog.ui
@@ -37,6 +37,7 @@
<property name="halign">center</property>
<!-- this is a placeholder: the icon is actually set in code -->
<property name="icon-name">safety-symbolic</property>
+ <property name="pixel-size">24</property>
<property name="visible">True</property>
<accessibility>
<relation target="title" type="labelled-by"/>
diff --git a/src/gs-screenshot-carousel.c b/src/gs-screenshot-carousel.c
index 6dca947e9..bd7aa6f74 100644
--- a/src/gs-screenshot-carousel.c
+++ b/src/gs-screenshot-carousel.c
@@ -259,7 +259,7 @@ gs_screenshot_carousel_navigate_button_direction_changed_cb (GtkWidget *w
}
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, GTK_ICON_SIZE_MENU);
+ gtk_image_set_from_icon_name (GTK_IMAGE (widget), icon_name);
}
static void
diff --git a/src/gs-summary-tile.c b/src/gs-summary-tile.c
index b47bf808f..d2ebdcf24 100644
--- a/src/gs-summary-tile.c
+++ b/src/gs-summary-tile.c
@@ -62,7 +62,7 @@ gs_summary_tile_refresh (GsAppTile *self)
gtk_image_get_pixel_size (GTK_IMAGE (tile->image)),
gtk_widget_get_scale_factor (tile->image),
"system-component-application");
- gtk_image_set_from_gicon (GTK_IMAGE (tile->image), icon, GTK_ICON_SIZE_DIALOG);
+ gtk_image_set_from_gicon (GTK_IMAGE (tile->image), icon);
accessible = gtk_widget_get_accessible (GTK_WIDGET (tile));
diff --git a/src/gs-updates-page.c b/src/gs-updates-page.c
index 8173a529a..a6089150f 100644
--- a/src/gs-updates-page.c
+++ b/src/gs-updates-page.c
@@ -305,8 +305,7 @@ gs_updates_page_update_ui_state (GsUpdatesPage *self)
switch (self->state) {
case GS_UPDATES_PAGE_STATE_ACTION_REFRESH:
case GS_UPDATES_PAGE_STATE_ACTION_GET_UPDATES:
- gtk_image_set_from_icon_name (GTK_IMAGE (gtk_button_get_image (GTK_BUTTON
(self->button_refresh))),
- "media-playback-stop-symbolic", GTK_ICON_SIZE_MENU);
+ gtk_button_set_icon_name (GTK_BUTTON (self->button_refresh), "media-playback-stop-symbolic");
gtk_widget_show (self->button_refresh);
break;
case GS_UPDATES_PAGE_STATE_STARTUP:
@@ -314,8 +313,7 @@ gs_updates_page_update_ui_state (GsUpdatesPage *self)
gtk_widget_hide (self->button_refresh);
break;
case GS_UPDATES_PAGE_STATE_IDLE:
- gtk_image_set_from_icon_name (GTK_IMAGE (gtk_button_get_image (GTK_BUTTON
(self->button_refresh))),
- "view-refresh-symbolic", GTK_ICON_SIZE_MENU);
+ gtk_button_set_icon_name (GTK_BUTTON (self->button_refresh), "view-refresh-symbolic");
if (self->result_flags != GS_UPDATES_PAGE_FLAG_NONE) {
gtk_widget_show (self->button_refresh);
} else {
@@ -326,8 +324,7 @@ gs_updates_page_update_ui_state (GsUpdatesPage *self)
}
break;
case GS_UPDATES_PAGE_STATE_FAILED:
- gtk_image_set_from_icon_name (GTK_IMAGE (gtk_button_get_image (GTK_BUTTON
(self->button_refresh))),
- "view-refresh-symbolic", GTK_ICON_SIZE_MENU);
+ gtk_button_set_icon_name (GTK_BUTTON (self->button_refresh), "view-refresh-symbolic");
gtk_widget_show (self->button_refresh);
break;
default:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]