diff --git a/gtk/inspector/visual.c b/gtk/inspector/visual.c
index dec6e744c4..3bde0aacb0 100644
--- a/gtk/inspector/visual.c
+++ b/gtk/inspector/visual.c
@@ -227,9 +227,7 @@ init_theme (GtkInspectorVisual *vis)
{
GHashTable *t;
GHashTableIter iter;
- gchar *theme, *current_theme, *path;
- gint i, pos;
- GSettings *settings;
+ gchar *theme, *path;
t = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
/* Builtin themes */
@@ -249,22 +247,14 @@ init_theme (GtkInspectorVisual *vis)
fill_gtk (path, t);
g_free (path);
- settings = g_settings_new ("org.gnome.desktop.interface");
- current_theme = g_settings_get_string (settings, "gtk-theme");
- g_object_unref (settings);
-
g_hash_table_iter_init (&iter, t);
- pos = i = 0;
while (g_hash_table_iter_next (&iter, (gpointer *)&theme, NULL))
- {
- gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (vis->priv->theme_combo), theme);
- if (g_strcmp0 (theme, current_theme) == 0)
- pos = i;
- i++;
- }
+ gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (vis->priv->theme_combo), theme, theme);
g_hash_table_destroy (t);
- gtk_combo_box_set_active (GTK_COMBO_BOX (vis->priv->theme_combo), pos);
+ g_object_bind_property (gtk_settings_get_default (), "gtk-theme-name",
+ vis->priv->theme_combo, "active-id",
+ G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
if (g_getenv ("GTK_THEME") != NULL)
{
@@ -274,17 +264,6 @@ init_theme (GtkInspectorVisual *vis)
}
}
-static void
-theme_changed (GtkComboBox *c,
- GtkInspectorVisual *vis)
-{
- gchar *theme;
-
- theme = gtk_combo_box_text_get_active_text (GTK_COMBO_BOX_TEXT (c));
- g_object_set (gtk_settings_get_default (), "gtk-theme-name", theme, NULL);
- g_free (theme);
-}
-
static void
init_dark (GtkInspectorVisual *vis)
{
@@ -329,46 +308,28 @@ init_icons (GtkInspectorVisual *vis)
{
GHashTable *t;
GHashTableIter iter;
- gchar *theme, *current_theme, *path;
- gint i, pos;
- GSettings *settings;
- gchar *iconsdir = get_data_path ("icons");
+ gchar *theme, *path;
t = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
- fill_icons (iconsdir, t);
-
- g_free (iconsdir);
+ path = get_data_path ("icons");
+ fill_icons (path, t);
+ g_free (path);
path = g_build_filename (g_get_user_data_dir (), "icons", NULL);
fill_icons (path, t);
g_free (path);
- settings = g_settings_new ("org.gnome.desktop.interface");
- current_theme = g_settings_get_string (settings, "icon-theme");
- g_object_unref (settings);
-
g_hash_table_iter_init (&iter, t);
- pos = i = 0;
while (g_hash_table_iter_next (&iter, (gpointer *)&theme, NULL))
{
- gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (vis->priv->icon_combo), theme);
- if (g_strcmp0 (theme, current_theme) == 0)
- pos = i;
- i++;
+ gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (vis->priv->icon_combo), theme, theme);
}
g_hash_table_destroy (t);
- gtk_combo_box_set_active (GTK_COMBO_BOX (vis->priv->icon_combo), pos);
-}
-
-static void
-icons_changed (GtkComboBox *c,
- GtkInspectorVisual *vis)
-{
- gchar *theme = gtk_combo_box_text_get_active_text (GTK_COMBO_BOX_TEXT (c));
- g_object_set (gtk_settings_get_default (), "gtk-icon-theme-name", theme, NULL);
- g_free (theme);
+ g_object_bind_property (gtk_settings_get_default (), "gtk-icon-theme-name",
+ vis->priv->icon_combo, "active-id",
+ G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
}
static void
@@ -401,44 +362,27 @@ init_cursors (GtkInspectorVisual *vis)
GHashTableIter iter;
gchar *theme, *current_theme, *path;
gint i, pos;
- GSettings *settings;
- gchar *cursordir;
t = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
- cursordir = get_data_path ("icons");
- fill_cursors (cursordir, t);
- g_free (cursordir);
+ path = get_data_path ("icons");
+ fill_cursors (path, t);
+ g_free (path);
path = g_build_filename (g_get_user_data_dir (), "icons", NULL);
fill_cursors (path, t);
g_free (path);
- settings = g_settings_new ("org.gnome.desktop.interface");
- current_theme = g_settings_get_string (settings, "cursor-theme");
- g_object_unref (settings);
-
g_hash_table_iter_init (&iter, t);
- pos = i = 0;
while (g_hash_table_iter_next (&iter, (gpointer *)&theme, NULL))
{
- gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (vis->priv->cursor_combo), theme);
- if (g_strcmp0 (theme, current_theme) == 0)
- pos = i;
- i++;
+ gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (vis->priv->cursor_combo), theme, theme);
}
g_hash_table_destroy (t);
- gtk_combo_box_set_active (GTK_COMBO_BOX (vis->priv->cursor_combo), pos);
-}
-
-static void
-cursors_changed (GtkComboBox *c,
- GtkInspectorVisual *vis)
-{
- gchar *theme = gtk_combo_box_text_get_active_text (GTK_COMBO_BOX_TEXT (c));
- g_object_set (gtk_settings_get_default (), "gtk-cursor-theme-name", theme, NULL);
- g_free (theme);
+ g_object_bind_property (gtk_settings_get_default (), "gtk-cursor-theme-name",
+ vis->priv->cursor_combo, "active-id",
+ G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
}
static void
@@ -568,7 +512,7 @@ keynav_failed (GtkWidget *widget, GtkDirectionType direction, GtkInspectorVisual
else if (direction == GTK_DIR_UP &&
widget == vis->priv->gl_box)
next = vis->priv->debug_box;
- else
+ else
next = NULL;
if (next)
@@ -758,9 +702,6 @@ gtk_inspector_visual_class_init (GtkInspectorVisualClass *klass)
gtk_widget_class_bind_template_callback (widget_class, rendering_mode_changed);
gtk_widget_class_bind_template_callback (widget_class, baselines_activate);
gtk_widget_class_bind_template_callback (widget_class, pixelcache_activate);
- gtk_widget_class_bind_template_callback (widget_class, theme_changed);
- gtk_widget_class_bind_template_callback (widget_class, icons_changed);
- gtk_widget_class_bind_template_callback (widget_class, cursors_changed);
gtk_widget_class_bind_template_callback (widget_class, software_gl_activate);
gtk_widget_class_bind_template_callback (widget_class, software_surface_activate);
gtk_widget_class_bind_template_callback (widget_class, texture_rectangle_activate);
diff --git a/gtk/inspector/visual.ui b/gtk/inspector/visual.ui
index abbfb2b1e6..adb7cf290f 100644
--- a/gtk/inspector/visual.ui
+++ b/gtk/inspector/visual.ui
@@ -57,7 +57,6 @@
True
end
baseline
-
True
@@ -124,7 +123,6 @@
True
end
baseline
-
True
@@ -193,7 +191,6 @@
True
end
baseline
-
True