[gtk/wip/otte/icontheme: 11/11] icontheme: Remove contexts
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/otte/icontheme: 11/11] icontheme: Remove contexts
- Date: Sun, 2 Feb 2020 00:28:20 +0000 (UTC)
commit 2542933ef9dff9c5bdba1288a8afd71e98def812
Author: Benjamin Otte <otte redhat com>
Date: Sun Feb 2 01:19:50 2020 +0100
icontheme: Remove contexts
There is no way to query contexts or do anything useful with them.
So don't keep track of them and don't make them an argument in public
APIs with the docs saying "I don't know what to use here, maybe read
some spec somewhere".
demos/gtk-demo/fishbowl.c | 2 +-
gtk/gtkicontheme.c | 58 +++++++++--------------------------------------
gtk/gtkicontheme.h | 3 +--
tests/testicontheme.c | 9 +-------
testsuite/gtk/icontheme.c | 2 +-
5 files changed, 15 insertions(+), 59 deletions(-)
---
diff --git a/demos/gtk-demo/fishbowl.c b/demos/gtk-demo/fishbowl.c
index dd3619df73..111d6a199e 100644
--- a/demos/gtk-demo/fishbowl.c
+++ b/demos/gtk-demo/fishbowl.c
@@ -28,7 +28,7 @@ init_icon_names (GtkIconTheme *theme)
if (icon_names)
return;
- icon_list = gtk_icon_theme_list_icons (theme, NULL);
+ icon_list = gtk_icon_theme_list_icons (theme);
icons = g_ptr_array_new ();
for (l = icon_list; l; l = l->next)
diff --git a/gtk/gtkicontheme.c b/gtk/gtkicontheme.c
index 9d15bf2a0d..fb6b24da19 100644
--- a/gtk/gtkicontheme.c
+++ b/gtk/gtkicontheme.c
@@ -332,7 +332,6 @@ typedef struct
typedef struct
{
IconThemeDirType type;
- GQuark context;
gint size;
gint min_size;
@@ -375,8 +374,7 @@ static GtkIcon * theme_lookup_icon (IconTheme *theme
gint scale,
gboolean allow_svg);
static void theme_list_icons (IconTheme *theme,
- GHashTable *icons,
- GQuark context);
+ GHashTable *icons);
static gboolean theme_has_icon (IconTheme *theme,
const gchar *icon_name);
static void theme_subdir_load (GtkIconTheme *self,
@@ -2541,8 +2539,6 @@ add_key_to_list (gpointer key,
/**
* gtk_icon_theme_list_icons:
* @self: a #GtkIconTheme
- * @context: (allow-none): a string identifying a particular type of
- * icon, or %NULL to list all icons.
*
* Lists the icons in the current icon theme. Only a subset
* of the icons can be listed by providing a context string.
@@ -2559,40 +2555,27 @@ add_key_to_list (gpointer key,
* free the list itself with g_list_free().
*/
GList *
-gtk_icon_theme_list_icons (GtkIconTheme *self,
- const gchar *context)
+gtk_icon_theme_list_icons (GtkIconTheme *self)
{
GHashTable *icons;
GList *list, *l;
- GQuark context_quark;
gtk_icon_theme_lock (self);
ensure_valid_themes (self, FALSE);
- if (context)
- {
- context_quark = g_quark_try_string (context);
-
- if (!context_quark)
- goto out;
- }
- else
- context_quark = 0;
-
icons = g_hash_table_new (g_str_hash, g_str_equal);
l = self->themes;
while (l != NULL)
{
- theme_list_icons (l->data, icons, context_quark);
+ theme_list_icons (l->data, icons);
l = l->next;
}
- if (context_quark == 0)
- g_hash_table_foreach (self->unthemed_icons,
- add_key_to_hash,
- icons);
+ g_hash_table_foreach (self->unthemed_icons,
+ add_key_to_hash,
+ icons);
list = NULL;
@@ -2602,8 +2585,6 @@ gtk_icon_theme_list_icons (GtkIconTheme *self,
g_hash_table_destroy (icons);
- out:
-
gtk_icon_theme_unlock (self);
return list;
@@ -2959,8 +2940,7 @@ theme_lookup_icon (IconTheme *theme,
static void
theme_list_icons (IconTheme *theme,
- GHashTable *icons,
- GQuark context)
+ GHashTable *icons)
{
GList *l = theme->dirs;
IconThemeDir *dir;
@@ -2969,14 +2949,10 @@ theme_list_icons (IconTheme *theme,
{
dir = l->data;
- if (context == dir->context ||
- context == 0)
- {
- if (dir->cache)
- gtk_icon_cache_add_icons (dir->cache, dir->subdir, icons);
- else
- g_hash_table_foreach (dir->icons, add_key_to_hash, icons);
- }
+ if (dir->cache)
+ gtk_icon_cache_add_icons (dir->cache, dir->subdir, icons);
+ else
+ g_hash_table_foreach (dir->icons, add_key_to_hash, icons);
l = l->next;
}
}
@@ -3056,8 +3032,6 @@ theme_subdir_load (GtkIconTheme *self,
gchar *type_string;
IconThemeDir *dir;
IconThemeDirType type;
- gchar *context_string;
- GQuark context;
gint size;
gint min_size;
gint max_size;
@@ -3090,14 +3064,6 @@ theme_subdir_load (GtkIconTheme *self,
g_free (type_string);
}
- context = 0;
- context_string = g_key_file_get_string (theme_file, subdir, "Context", NULL);
- if (context_string)
- {
- context = g_quark_from_string (context_string);
- g_free (context_string);
- }
-
if (g_key_file_has_key (theme_file, subdir, "MaxSize", NULL))
max_size = g_key_file_get_integer (theme_file, subdir, "MaxSize", NULL);
else
@@ -3162,7 +3128,6 @@ theme_subdir_load (GtkIconTheme *self,
dir = g_new0 (IconThemeDir, 1);
dir->type = type;
dir->is_resource = FALSE;
- dir->context = context;
dir->size = size;
dir->min_size = min_size;
dir->max_size = max_size;
@@ -3212,7 +3177,6 @@ theme_subdir_load (GtkIconTheme *self,
dir->icons = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
dir->type = type;
dir->is_resource = TRUE;
- dir->context = context;
dir->size = size;
dir->min_size = min_size;
dir->max_size = max_size;
diff --git a/gtk/gtkicontheme.h b/gtk/gtkicontheme.h
index e40a48752a..6cfde1c960 100644
--- a/gtk/gtkicontheme.h
+++ b/gtk/gtkicontheme.h
@@ -149,8 +149,7 @@ GtkIcon * gtk_icon_theme_lookup_by_gicon (GtkIconTheme
GtkTextDirection direction,
GtkIconLookupFlags flags);
GDK_AVAILABLE_IN_ALL
-GList * gtk_icon_theme_list_icons (GtkIconTheme *self,
- const gchar *context);
+GList * gtk_icon_theme_list_icons (GtkIconTheme *self);
GDK_AVAILABLE_IN_ALL
diff --git a/tests/testicontheme.c b/tests/testicontheme.c
index 21acb2b9ed..f142e30220 100644
--- a/tests/testicontheme.c
+++ b/tests/testicontheme.c
@@ -37,7 +37,6 @@ main (int argc, char *argv[])
{
GtkIconTheme *icon_theme;
GtkIcon *icon;
- char *context;
char *themename;
GList *list;
int size = 48;
@@ -105,13 +104,7 @@ main (int argc, char *argv[])
}
else if (strcmp (argv[1], "list") == 0)
{
- if (argc >= 4)
- context = argv[3];
- else
- context = NULL;
-
- list = gtk_icon_theme_list_icons (icon_theme,
- context);
+ list = gtk_icon_theme_list_icons (icon_theme);
while (list)
{
diff --git a/testsuite/gtk/icontheme.c b/testsuite/gtk/icontheme.c
index 08ad9892ae..dac36f7f36 100644
--- a/testsuite/gtk/icontheme.c
+++ b/testsuite/gtk/icontheme.c
@@ -596,7 +596,7 @@ test_list (void)
GList *icons;
theme = get_test_icontheme (TRUE);
- icons = gtk_icon_theme_list_icons (theme, NULL);
+ icons = gtk_icon_theme_list_icons (theme);
g_assert (g_list_find_custom (icons, "size-test", (GCompareFunc)g_strcmp0));
g_assert (g_list_find_custom (icons, "simple", (GCompareFunc)g_strcmp0));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]