summaryrefslogtreecommitdiff
path: root/gtk/gtkicontheme.c
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2020-02-02 00:27:14 +0100
committerAlexander Larsson <alexl@redhat.com>2020-02-04 16:41:36 +0100
commitbbbe39fb44d2d9e40f0d92201f77e0680d2ff16a (patch)
tree14971b3436ceb5175562a502febabf6eab1c3d51 /gtk/gtkicontheme.c
parentb713b9f68dc443ca23e3fedaca7eb958741975d1 (diff)
downloadgtk+-bbbe39fb44d2d9e40f0d92201f77e0680d2ff16a.tar.gz
icontheme: Make text direction a lookup argument
Most users were just forgetting to set the proper flags. And flags aren't the right way to set this anyway, it was just acceptable as a workaround during GTK3 to not break API.
Diffstat (limited to 'gtk/gtkicontheme.c')
-rw-r--r--gtk/gtkicontheme.c31
1 files changed, 24 insertions, 7 deletions
diff --git a/gtk/gtkicontheme.c b/gtk/gtkicontheme.c
index 69ec9ace3f..438373c410 100644
--- a/gtk/gtkicontheme.c
+++ b/gtk/gtkicontheme.c
@@ -2037,6 +2037,7 @@ choose_icon (GtkIconTheme *self,
const gchar *icon_names[],
gint size,
gint scale,
+ GtkTextDirection direction,
GtkIconLookupFlags flags,
gboolean non_blocking,
gboolean *would_block)
@@ -2047,12 +2048,22 @@ choose_icon (GtkIconTheme *self,
const gchar *dir_suffix;
guint i;
- if (flags & GTK_ICON_LOOKUP_DIR_LTR)
+ switch (direction)
+ {
+ case GTK_TEXT_DIR_NONE:
+ dir_suffix = NULL;
+ break;
+ case GTK_TEXT_DIR_LTR:
dir_suffix = "-ltr";
- else if (flags & GTK_ICON_LOOKUP_DIR_RTL)
+ break;
+ case GTK_TEXT_DIR_RTL:
dir_suffix = "-rtl";
- else
+ break;
+ default:
+ g_assert_not_reached();
dir_suffix = NULL;
+ break;
+ }
for (i = 0; icon_names[i]; i++)
{
@@ -2151,6 +2162,7 @@ choose_icon (GtkIconTheme *self,
* @icon_name: the name of the icon to lookup
* @size: desired icon size. The resulting icon may not be exactly this size.
* @scale: the window scale this will be displayed on
+ * @direction: text direction the icon will be displayed in
* @flags: flags modifying the behavior of the icon lookup
*
* Looks up a named icon for a desired size and window scale, returning a
@@ -2183,6 +2195,7 @@ gtk_icon_theme_lookup_icon (GtkIconTheme *self,
const gchar *icon_name,
gint size,
gint scale,
+ GtkTextDirection direction,
GtkIconLookupFlags flags)
{
GtkIcon *icon;
@@ -2245,7 +2258,7 @@ gtk_icon_theme_lookup_icon (GtkIconTheme *self,
names = nonsymbolic_names;
}
- icon = choose_icon (self, (const gchar **) names, size, scale, flags, FALSE, NULL);
+ icon = choose_icon (self, (const gchar **) names, size, scale, direction, flags, FALSE, NULL);
g_strfreev (names);
}
@@ -2256,7 +2269,7 @@ gtk_icon_theme_lookup_icon (GtkIconTheme *self,
names[0] = icon_name;
names[1] = NULL;
- icon = choose_icon (self, names, size, scale, flags, FALSE, NULL);
+ icon = choose_icon (self, names, size, scale, direction, flags, FALSE, NULL);
}
gtk_icon_theme_unlock (self);
@@ -2271,6 +2284,7 @@ gtk_icon_theme_lookup_icon (GtkIconTheme *self,
* array of icon names to lookup
* @size: desired icon size. The resulting icon may not be exactly this size.
* @scale: the window scale this will be displayed on
+ * @direction: text direction the icon will be displayed in
* @flags: flags modifying the behavior of the icon lookup
*
* Looks up a named icon for a desired size and window scale, returning a
@@ -2308,6 +2322,7 @@ gtk_icon_theme_choose_icon (GtkIconTheme *self,
const gchar *icon_names[],
gint size,
gint scale,
+ GtkTextDirection direction,
GtkIconLookupFlags flags)
{
GtkIcon *icon;
@@ -2321,7 +2336,7 @@ gtk_icon_theme_choose_icon (GtkIconTheme *self,
gtk_icon_theme_lock (self);
- icon = choose_icon (self, icon_names, size, scale, flags, FALSE, NULL);
+ icon = choose_icon (self, icon_names, size, scale, direction, flags, FALSE, NULL);
gtk_icon_theme_unlock (self);
@@ -4073,6 +4088,7 @@ gtk_icon_new_for_pixbuf (GtkIconTheme *icon_theme,
* @icon: the #GIcon to look up
* @size: desired icon size
* @scale: the desired scale
+ * @direction: text direction the icon will be displayed in
* @flags: flags modifying the behavior of the icon lookup
*
* Looks up a icon for a desired size and window scale, returning a
@@ -4088,6 +4104,7 @@ gtk_icon_theme_lookup_by_gicon (GtkIconTheme *self,
GIcon *gicon,
gint size,
gint scale,
+ GtkTextDirection direction,
GtkIconLookupFlags flags)
{
GtkIcon *icon;
@@ -4160,7 +4177,7 @@ gtk_icon_theme_lookup_by_gicon (GtkIconTheme *self,
const gchar **names;
names = (const gchar **)g_themed_icon_get_names (G_THEMED_ICON (gicon));
- icon = gtk_icon_theme_choose_icon (self, names, size, scale, flags);
+ icon = gtk_icon_theme_choose_icon (self, names, size, scale, direction, flags);
return icon;
}