mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-23 20:30:15 +00:00
inspector: Merge Visual and Themes tabs
This commit is contained in:
parent
2d2f9861a6
commit
b36c8250a9
@ -42,8 +42,6 @@ libgtkinspector_la_SOURCES = \
|
||||
resources.c \
|
||||
signals-list.h \
|
||||
signals-list.c \
|
||||
themes.h \
|
||||
themes.c \
|
||||
visual.h \
|
||||
visual.c \
|
||||
widget-tree.h \
|
||||
@ -84,7 +82,6 @@ templates = \
|
||||
object-hierarchy.ui \
|
||||
prop-list.ui \
|
||||
signals-list.ui \
|
||||
themes.ui \
|
||||
visual.ui \
|
||||
widget-tree.ui \
|
||||
window.ui
|
||||
|
@ -34,7 +34,6 @@
|
||||
#include "python-shell.h"
|
||||
#include "resources.h"
|
||||
#include "signals-list.h"
|
||||
#include "themes.h"
|
||||
#include "visual.h"
|
||||
#include "widget-tree.h"
|
||||
#include "window.h"
|
||||
@ -58,7 +57,6 @@ gtk_inspector_init (void)
|
||||
g_type_ensure (GTK_TYPE_INSPECTOR_PROP_LIST);
|
||||
g_type_ensure (GTK_TYPE_INSPECTOR_PYTHON_SHELL);
|
||||
g_type_ensure (GTK_TYPE_INSPECTOR_SIGNALS_LIST);
|
||||
g_type_ensure (GTK_TYPE_INSPECTOR_THEMES);
|
||||
g_type_ensure (GTK_TYPE_INSPECTOR_VISUAL);
|
||||
g_type_ensure (GTK_TYPE_INSPECTOR_WIDGET_TREE);
|
||||
g_type_ensure (GTK_TYPE_INSPECTOR_WINDOW);
|
||||
|
@ -9,7 +9,6 @@
|
||||
<file>object-hierarchy.ui</file>
|
||||
<file>prop-list.ui</file>
|
||||
<file>signals-list.ui</file>
|
||||
<file>themes.ui</file>
|
||||
<file>visual.ui</file>
|
||||
<file>widget-tree.ui</file>
|
||||
<file>window.ui</file>
|
||||
|
@ -1,205 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2013 Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "themes.h"
|
||||
|
||||
struct _GtkInspectorThemesPrivate
|
||||
{
|
||||
GtkWidget *dark_switch;
|
||||
GtkWidget *theme_combo;
|
||||
GtkWidget *icon_combo;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (GtkInspectorThemes, gtk_inspector_themes, GTK_TYPE_LIST_BOX)
|
||||
|
||||
static void
|
||||
init_dark (GtkInspectorThemes *pt)
|
||||
{
|
||||
g_object_bind_property (pt->priv->dark_switch, "active",
|
||||
gtk_settings_get_default (), "gtk-application-prefer-dark-theme",
|
||||
G_BINDING_BIDIRECTIONAL);
|
||||
}
|
||||
|
||||
static void
|
||||
fill_gtk (const gchar *path,
|
||||
GHashTable *t)
|
||||
{
|
||||
const gchar *dir_entry;
|
||||
GDir *dir = g_dir_open (path, 0, NULL);
|
||||
|
||||
if (!dir)
|
||||
return;
|
||||
|
||||
while ((dir_entry = g_dir_read_name (dir)))
|
||||
{
|
||||
gchar *filename = g_build_filename (path, dir_entry, "gtk-3.0", "gtk.css", NULL);
|
||||
|
||||
if (g_file_test (filename, G_FILE_TEST_IS_REGULAR) &&
|
||||
!g_hash_table_contains (t, dir_entry))
|
||||
g_hash_table_add (t, g_strdup (dir_entry));
|
||||
|
||||
g_free (filename);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
init_theme (GtkInspectorThemes *pt)
|
||||
{
|
||||
GHashTable *t;
|
||||
GHashTableIter iter;
|
||||
gchar *theme, *current_theme, *path;
|
||||
gint i, pos;
|
||||
GSettings *settings;
|
||||
|
||||
t = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
|
||||
g_hash_table_add (t, g_strdup ("Raleigh"));
|
||||
|
||||
fill_gtk (GTK_DATADIR "/themes", t);
|
||||
path = g_build_filename (g_get_user_data_dir (), "themes", NULL);
|
||||
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 (pt->priv->theme_combo), theme);
|
||||
if (g_strcmp0 (theme, current_theme) == 0)
|
||||
pos = i;
|
||||
i++;
|
||||
}
|
||||
g_hash_table_destroy (t);
|
||||
|
||||
gtk_combo_box_set_active (GTK_COMBO_BOX (pt->priv->theme_combo), pos);
|
||||
}
|
||||
|
||||
static void
|
||||
fill_icons (const gchar *path,
|
||||
GHashTable *t)
|
||||
{
|
||||
const gchar *dir_entry;
|
||||
GDir *dir = g_dir_open (path, 0, NULL);
|
||||
|
||||
if (!dir)
|
||||
return;
|
||||
|
||||
while ((dir_entry = g_dir_read_name (dir)))
|
||||
{
|
||||
gchar *filename = g_build_filename (path, dir_entry, "index.theme", NULL);
|
||||
|
||||
if (g_file_test (filename, G_FILE_TEST_IS_REGULAR) &&
|
||||
g_strcmp0 (dir_entry, "hicolor") != 0 &&
|
||||
!g_hash_table_contains (t, dir_entry))
|
||||
g_hash_table_add (t, g_strdup (dir_entry));
|
||||
|
||||
g_free (filename);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
init_icons (GtkInspectorThemes *pt)
|
||||
{
|
||||
GHashTable *t;
|
||||
GHashTableIter iter;
|
||||
gchar *theme, *current_theme, *path;
|
||||
gint i, pos;
|
||||
GSettings *settings;
|
||||
|
||||
t = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
|
||||
|
||||
fill_icons (GTK_DATADIR "/icons", t);
|
||||
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 (pt->priv->icon_combo), theme);
|
||||
if (g_strcmp0 (theme, current_theme) == 0)
|
||||
pos = i;
|
||||
i++;
|
||||
}
|
||||
g_hash_table_destroy (t);
|
||||
|
||||
gtk_combo_box_set_active (GTK_COMBO_BOX (pt->priv->icon_combo), pos);
|
||||
}
|
||||
|
||||
static void
|
||||
theme_changed (GtkComboBox *c,
|
||||
GtkInspectorThemes *pt)
|
||||
{
|
||||
gchar *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
|
||||
icons_changed (GtkComboBox *c,
|
||||
GtkInspectorThemes *pt)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_inspector_themes_init (GtkInspectorThemes *pt)
|
||||
{
|
||||
pt->priv = gtk_inspector_themes_get_instance_private (pt);
|
||||
gtk_widget_init_template (GTK_WIDGET (pt));
|
||||
|
||||
init_dark (pt);
|
||||
init_theme (pt);
|
||||
init_icons (pt);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_inspector_themes_class_init (GtkInspectorThemesClass *klass)
|
||||
{
|
||||
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
|
||||
|
||||
gtk_widget_class_set_template_from_resource (widget_class, "/org/gtk/inspector/themes.ui");
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorThemes, dark_switch);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorThemes, theme_combo);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorThemes, icon_combo);
|
||||
|
||||
gtk_widget_class_bind_template_callback (widget_class, theme_changed);
|
||||
gtk_widget_class_bind_template_callback (widget_class, icons_changed);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
gtk_inspector_themes_new (void)
|
||||
{
|
||||
return GTK_WIDGET (g_object_new (GTK_TYPE_INSPECTOR_THEMES, NULL));
|
||||
}
|
||||
|
||||
// vim: set et sw=2 ts=2:
|
@ -1,58 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2013 Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef _GTK_INSPECTOR_THEMES_H_
|
||||
#define _GTK_INSPECTOR_THEMES_H_
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#define GTK_TYPE_INSPECTOR_THEMES (gtk_inspector_themes_get_type())
|
||||
#define GTK_INSPECTOR_THEMES(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GTK_TYPE_INSPECTOR_THEMES, GtkInspectorThemes))
|
||||
#define GTK_INSPECTOR_THEMES_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GTK_TYPE_INSPECTOR_THEMES, GtkInspectorThemesClass))
|
||||
#define GTK_INSPECTOR_IS_THEMES(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GTK_TYPE_INSPECTOR_THEMES))
|
||||
#define GTK_INSPECTOR_IS_THEMES_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GTK_TYPE_INSPECTOR_THEMES))
|
||||
#define GTK_INSPECTOR_THEMES_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GTK_TYPE_INSPECTOR_THEMES, GtkInspectorThemesClass))
|
||||
|
||||
|
||||
typedef struct _GtkInspectorThemesPrivate GtkInspectorThemesPrivate;
|
||||
|
||||
typedef struct _GtkInspectorThemes
|
||||
{
|
||||
GtkListBox parent;
|
||||
GtkInspectorThemesPrivate *priv;
|
||||
} GtkInspectorThemes;
|
||||
|
||||
typedef struct _GtkInspectorThemesClass
|
||||
{
|
||||
GtkListBoxClass parent;
|
||||
} GtkInspectorThemesClass;
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
GType gtk_inspector_themes_get_type (void);
|
||||
GtkWidget *gtk_inspector_themes_new (void);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif // _GTK_INSPECTOR_THEMES_H_
|
||||
|
||||
// vim: set et sw=2 ts=2:
|
@ -1,68 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface domain="gtk30">
|
||||
<template class="GtkInspectorThemes" parent="GtkListBox">
|
||||
<property name="selection-mode">none</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="orientation">horizontal</property>
|
||||
<property name="margin">10</property>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Use dark variant</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="xalign">0.0</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSwitch" id="dark_switch">
|
||||
<property name="visible">True</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="orientation">horizontal</property>
|
||||
<property name="margin">10</property>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">GTK+ Theme</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="xalign">0.0</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkComboBoxText" id="theme_combo">
|
||||
<property name="visible">True</property>
|
||||
<signal name="changed" handler="theme_changed"/>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="orientation">horizontal</property>
|
||||
<property name="margin">10</property>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Icon Theme</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="xalign">0.0</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkComboBoxText" id="icon_combo">
|
||||
<property name="visible">True</property>
|
||||
<signal name="changed" handler="icons_changed"/>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</template>
|
||||
</interface>
|
@ -19,22 +19,21 @@
|
||||
|
||||
struct _GtkInspectorVisualPrivate
|
||||
{
|
||||
GtkWidget *updates_switch;
|
||||
GtkWidget *direction_combo;
|
||||
GtkWidget *updates_switch;
|
||||
GtkWidget *baselines_switch;
|
||||
GtkWidget *pixelcache_switch;
|
||||
|
||||
GtkWidget *theme_combo;
|
||||
GtkWidget *dark_switch;
|
||||
GtkWidget *icon_combo;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (GtkInspectorVisual, gtk_inspector_visual, GTK_TYPE_LIST_BOX)
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (GtkInspectorVisual, gtk_inspector_visual, GTK_TYPE_BOX)
|
||||
|
||||
static void
|
||||
updates_activate (GtkSwitch *sw)
|
||||
{
|
||||
gdk_window_set_debug_updates (gtk_switch_get_active (sw));
|
||||
}
|
||||
|
||||
static void
|
||||
fix_direction_recurse (GtkWidget *widget, gpointer data)
|
||||
fix_direction_recurse (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GtkTextDirection dir = GPOINTER_TO_INT (data);
|
||||
|
||||
@ -84,6 +83,12 @@ init_direction (GtkInspectorVisual *vis)
|
||||
gtk_combo_box_set_active_id (GTK_COMBO_BOX (vis->priv->direction_combo), direction);
|
||||
}
|
||||
|
||||
void
|
||||
updates_activate (GtkSwitch *sw)
|
||||
{
|
||||
gdk_window_set_debug_updates (gtk_switch_get_active (sw));
|
||||
}
|
||||
|
||||
static void
|
||||
baselines_activate (GtkSwitch *sw)
|
||||
{
|
||||
@ -115,12 +120,157 @@ pixelcache_activate (GtkSwitch *sw)
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_inspector_visual_init (GtkInspectorVisual *pt)
|
||||
fill_gtk (const gchar *path,
|
||||
GHashTable *t)
|
||||
{
|
||||
pt->priv = gtk_inspector_visual_get_instance_private (pt);
|
||||
gtk_widget_init_template (GTK_WIDGET (pt));
|
||||
const gchar *dir_entry;
|
||||
GDir *dir = g_dir_open (path, 0, NULL);
|
||||
|
||||
init_direction (pt);
|
||||
if (!dir)
|
||||
return;
|
||||
|
||||
while ((dir_entry = g_dir_read_name (dir)))
|
||||
{
|
||||
gchar *filename = g_build_filename (path, dir_entry, "gtk-3.0", "gtk.css", NULL);
|
||||
|
||||
if (g_file_test (filename, G_FILE_TEST_IS_REGULAR) &&
|
||||
!g_hash_table_contains (t, dir_entry))
|
||||
g_hash_table_add (t, g_strdup (dir_entry));
|
||||
|
||||
g_free (filename);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
init_theme (GtkInspectorVisual *vis)
|
||||
{
|
||||
GHashTable *t;
|
||||
GHashTableIter iter;
|
||||
gchar *theme, *current_theme, *path;
|
||||
gint i, pos;
|
||||
GSettings *settings;
|
||||
|
||||
t = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
|
||||
g_hash_table_add (t, g_strdup ("Raleigh"));
|
||||
|
||||
fill_gtk (GTK_DATADIR "/themes", t);
|
||||
path = g_build_filename (g_get_user_data_dir (), "themes", NULL);
|
||||
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++;
|
||||
}
|
||||
g_hash_table_destroy (t);
|
||||
|
||||
gtk_combo_box_set_active (GTK_COMBO_BOX (vis->priv->theme_combo), pos);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
g_object_bind_property (vis->priv->dark_switch, "active",
|
||||
gtk_settings_get_default (), "gtk-application-prefer-dark-theme",
|
||||
G_BINDING_BIDIRECTIONAL);
|
||||
}
|
||||
|
||||
static void
|
||||
fill_icons (const gchar *path,
|
||||
GHashTable *t)
|
||||
{
|
||||
const gchar *dir_entry;
|
||||
GDir *dir;
|
||||
|
||||
dir = g_dir_open (path, 0, NULL);
|
||||
if (!dir)
|
||||
return;
|
||||
|
||||
while ((dir_entry = g_dir_read_name (dir)))
|
||||
{
|
||||
gchar *filename = g_build_filename (path, dir_entry, "index.theme", NULL);
|
||||
|
||||
if (g_file_test (filename, G_FILE_TEST_IS_REGULAR) &&
|
||||
g_strcmp0 (dir_entry, "hicolor") != 0 &&
|
||||
!g_hash_table_contains (t, dir_entry))
|
||||
g_hash_table_add (t, g_strdup (dir_entry));
|
||||
|
||||
g_free (filename);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
init_icons (GtkInspectorVisual *vis)
|
||||
{
|
||||
GHashTable *t;
|
||||
GHashTableIter iter;
|
||||
gchar *theme, *current_theme, *path;
|
||||
gint i, pos;
|
||||
GSettings *settings;
|
||||
|
||||
t = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
|
||||
|
||||
fill_icons (GTK_DATADIR "/icons", t);
|
||||
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++;
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_inspector_visual_init (GtkInspectorVisual *vis)
|
||||
{
|
||||
vis->priv = gtk_inspector_visual_get_instance_private (vis);
|
||||
gtk_widget_init_template (GTK_WIDGET (vis));
|
||||
init_direction (vis);
|
||||
init_theme (vis);
|
||||
init_dark (vis);
|
||||
init_icons (vis);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -133,10 +283,17 @@ gtk_inspector_visual_class_init (GtkInspectorVisualClass *klass)
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorVisual, direction_combo);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorVisual, baselines_switch);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorVisual, pixelcache_switch);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorVisual, dark_switch);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorVisual, theme_combo);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorVisual, icon_combo);
|
||||
|
||||
gtk_widget_class_bind_template_callback (widget_class, updates_activate);
|
||||
gtk_widget_class_bind_template_callback (widget_class, direction_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);
|
||||
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
|
@ -32,13 +32,13 @@ typedef struct _GtkInspectorVisualPrivate GtkInspectorVisualPrivate;
|
||||
|
||||
typedef struct _GtkInspectorVisual
|
||||
{
|
||||
GtkListBox parent;
|
||||
GtkBox parent;
|
||||
GtkInspectorVisualPrivate *priv;
|
||||
} GtkInspectorVisual;
|
||||
|
||||
typedef struct _GtkInspectorVisualClass
|
||||
{
|
||||
GtkListBoxClass parent;
|
||||
GtkBoxClass parent;
|
||||
} GtkInspectorVisualClass;
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
@ -1,94 +1,251 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface domain="gtk30">
|
||||
<template class="GtkInspectorVisual" parent="GtkListBox">
|
||||
<property name="selection-mode">none</property>
|
||||
<template class="GtkInspectorVisual" parent="GtkBox">
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="margin">60</property>
|
||||
<property name="spacing">10</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<object class="GtkFrame" id="visual_frame">
|
||||
<property name="visible">True</property>
|
||||
<property name="orientation">horizontal</property>
|
||||
<property name="margin">10</property>
|
||||
<property name="halign">center</property>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<object class="GtkListBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Text Direction</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="xalign">0.0</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkComboBoxText" id="direction_combo">
|
||||
<property name="visible">True</property>
|
||||
<signal name="changed" handler="direction_changed"/>
|
||||
<items>
|
||||
<item translatable="yes" id="ltr">Left-to-Right</item>
|
||||
<item translatable="yes" id="rtl">Right-to-Left</item>
|
||||
</items>
|
||||
<property name="selection-mode">none</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="orientation">horizontal</property>
|
||||
<property name="margin">10</property>
|
||||
<property name="spacing">40</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="direction_label">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Text Direction</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="valign">baseline</property>
|
||||
<property name="xalign">0.0</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkComboBoxText" id="direction_combo">
|
||||
<property name="visible">True</property>
|
||||
<property name="halign">end</property>
|
||||
<property name="valign">baseline</property>
|
||||
<signal name="changed" handler="direction_changed"/>
|
||||
<items>
|
||||
<item translatable="yes" id="ltr">Left-to-Right</item>
|
||||
<item translatable="yes" id="rtl">Right-to-Left</item>
|
||||
</items>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="orientation">horizontal</property>
|
||||
<property name="margin">10</property>
|
||||
<property name="spacing">40</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="updates_label">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Show Graphic Updates</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="valign">baseline</property>
|
||||
<property name="xalign">0.0</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSwitch" id="updates_switch">
|
||||
<property name="visible">True</property>
|
||||
<property name="halign">end</property>
|
||||
<property name="valign">baseline</property>
|
||||
<signal name="notify::active" handler="updates_activate"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="orientation">horizontal</property>
|
||||
<property name="margin">10</property>
|
||||
<property name="spacing">40</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="baselines_label">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Show Baselines</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="valign">baseline</property>
|
||||
<property name="xalign">0.0</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSwitch" id="baselines_switch">
|
||||
<property name="visible">True</property>
|
||||
<property name="halign">end</property>
|
||||
<property name="valign">baseline</property>
|
||||
<signal name="notify::active" handler="baselines_activate"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="orientation">horizontal</property>
|
||||
<property name="margin">10</property>
|
||||
<property name="spacing">40</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="pixelcache_label">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Show Pixel Cache</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="valign">baseline</property>
|
||||
<property name="xalign">0.0</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSwitch" id="pixelcache_switch">
|
||||
<property name="visible">True</property>
|
||||
<property name="halign">end</property>
|
||||
<property name="valign">baseline</property>
|
||||
<signal name="notify::active" handler="pixelcache_activate"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<object class="GtkFrame" id="theme_frame">
|
||||
<property name="visible">True</property>
|
||||
<property name="orientation">horizontal</property>
|
||||
<property name="margin">10</property>
|
||||
<property name="halign">center</property>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<object class="GtkListBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Show Graphic Updates</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="xalign">0.0</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSwitch" id="updates_switch">
|
||||
<property name="visible">True</property>
|
||||
<signal name="notify::active" handler="updates_activate"/>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="orientation">horizontal</property>
|
||||
<property name="margin">10</property>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Show Baselines</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="xalign">0.0</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSwitch" id="baselines_switch">
|
||||
<property name="visible">True</property>
|
||||
<signal name="notify::active" handler="baselines_activate"/>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="orientation">horizontal</property>
|
||||
<property name="margin">10</property>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Show Pixel Cache</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="xalign">0.0</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSwitch" id="pixelcache_switch">
|
||||
<property name="visible">True</property>
|
||||
<signal name="notify::active" handler="pixelcache_activate"/>
|
||||
<property name="selection-mode">none</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="orientation">horizontal</property>
|
||||
<property name="margin">10</property>
|
||||
<property name="spacing">40</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="theme_label">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">GTK+ Theme</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="valign">baseline</property>
|
||||
<property name="xalign">0.0</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkComboBoxText" id="theme_combo">
|
||||
<property name="visible">True</property>
|
||||
<property name="halign">end</property>
|
||||
<property name="valign">baseline</property>
|
||||
<signal name="changed" handler="theme_changed"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="orientation">horizontal</property>
|
||||
<property name="margin">10</property>
|
||||
<property name="spacing">40</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="dark_label">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Dark variant</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="valign">baseline</property>
|
||||
<property name="xalign">0.0</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSwitch" id="dark_switch">
|
||||
<property name="visible">True</property>
|
||||
<property name="halign">end</property>
|
||||
<property name="valign">baseline</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="orientation">horizontal</property>
|
||||
<property name="margin">10</property>
|
||||
<property name="spacing">40</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="icon_label">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Icon Theme</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="valign">baseline</property>
|
||||
<property name="xalign">0.0</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkComboBoxText" id="icon_combo">
|
||||
<property name="visible">True</property>
|
||||
<property name="halign">end</property>
|
||||
<property name="valign">baseline</property>
|
||||
<signal name="changed" handler="icons_changed"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</template>
|
||||
<object class="GtkSizeGroup">
|
||||
<property name="mode">horizontal</property>
|
||||
<widgets>
|
||||
<widget name="direction_label"/>
|
||||
<widget name="updates_label"/>
|
||||
<widget name="baselines_label"/>
|
||||
<widget name="pixelcache_label"/>
|
||||
<widget name="theme_label"/>
|
||||
<widget name="dark_label"/>
|
||||
<widget name="icon_label"/>
|
||||
</widgets>
|
||||
</object>
|
||||
<object class="GtkSizeGroup">
|
||||
<property name="mode">horizontal</property>
|
||||
<widgets>
|
||||
<widget name="visual_frame"/>
|
||||
<widget name="theme_frame"/>
|
||||
</widgets>
|
||||
</object>
|
||||
-->
|
||||
</interface>
|
||||
|
@ -36,7 +36,6 @@
|
||||
#include "python-shell.h"
|
||||
#include "button-path.h"
|
||||
#include "data-list.h"
|
||||
#include "themes.h"
|
||||
#include "signals-list.h"
|
||||
#include "actions.h"
|
||||
|
||||
|
@ -219,17 +219,6 @@
|
||||
<property name="label" translatable="yes">Visual</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkInspectorThemes">
|
||||
<property name="visible">True</property>
|
||||
</object>
|
||||
</child>
|
||||
<child type="tab">
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Themes</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkInspectorCssEditor">
|
||||
<property name="visible">True</property>
|
||||
|
@ -280,7 +280,6 @@ gtk/inspector/object-hierarchy.ui.h
|
||||
gtk/inspector/prop-list.ui.h
|
||||
gtk/inspector/signals-list.c
|
||||
gtk/inspector/signals-list.ui.h
|
||||
gtk/inspector/themes.ui.h
|
||||
gtk/inspector/visual.ui.h
|
||||
gtk/inspector/widget-tree.ui.h
|
||||
gtk/inspector/window.c
|
||||
|
Loading…
Reference in New Issue
Block a user