forked from AuroraMiddleware/gtk
inspector: Add a reset button for settings
This is exercising the new gtk_settings_reset_property api. https://bugzilla.gnome.org/show_bug.cgi?id=755008
This commit is contained in:
parent
2f0d4b6868
commit
47237ddd94
@ -1534,6 +1534,13 @@ add_settings_info (GtkInspectorPropEditor *editor)
|
|||||||
gtk_container_add (GTK_CONTAINER (editor), row);
|
gtk_container_add (GTK_CONTAINER (editor), row);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
reset_setting (GtkInspectorPropEditor *editor)
|
||||||
|
{
|
||||||
|
gtk_settings_reset_property (GTK_SETTINGS (editor->priv->object),
|
||||||
|
editor->priv->name);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
add_gtk_settings_info (GtkInspectorPropEditor *editor)
|
add_gtk_settings_info (GtkInspectorPropEditor *editor)
|
||||||
{
|
{
|
||||||
@ -1541,6 +1548,7 @@ add_gtk_settings_info (GtkInspectorPropEditor *editor)
|
|||||||
const gchar *name;
|
const gchar *name;
|
||||||
GtkWidget *row;
|
GtkWidget *row;
|
||||||
const gchar *source;
|
const gchar *source;
|
||||||
|
GtkWidget *button;
|
||||||
|
|
||||||
object = editor->priv->object;
|
object = editor->priv->object;
|
||||||
name = editor->priv->name;
|
name = editor->priv->name;
|
||||||
@ -1551,6 +1559,14 @@ add_gtk_settings_info (GtkInspectorPropEditor *editor)
|
|||||||
row = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10);
|
row = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10);
|
||||||
gtk_container_add (GTK_CONTAINER (row), gtk_label_new (_("Source:")));
|
gtk_container_add (GTK_CONTAINER (row), gtk_label_new (_("Source:")));
|
||||||
|
|
||||||
|
button = gtk_button_new_with_label (_("Reset"));
|
||||||
|
g_signal_connect_swapped (button, "clicked", G_CALLBACK (reset_setting), editor);
|
||||||
|
|
||||||
|
gtk_widget_set_halign (button, GTK_ALIGN_END);
|
||||||
|
gtk_widget_show (button);
|
||||||
|
gtk_widget_set_sensitive (button, FALSE);
|
||||||
|
gtk_box_pack_end (GTK_BOX (row), button, FALSE, FALSE, 0);
|
||||||
|
|
||||||
switch (_gtk_settings_get_setting_source (GTK_SETTINGS (object), name))
|
switch (_gtk_settings_get_setting_source (GTK_SETTINGS (object), name))
|
||||||
{
|
{
|
||||||
case GTK_SETTINGS_SOURCE_DEFAULT:
|
case GTK_SETTINGS_SOURCE_DEFAULT:
|
||||||
@ -1563,6 +1579,7 @@ add_gtk_settings_info (GtkInspectorPropEditor *editor)
|
|||||||
source = _("XSettings");
|
source = _("XSettings");
|
||||||
break;
|
break;
|
||||||
case GTK_SETTINGS_SOURCE_APPLICATION:
|
case GTK_SETTINGS_SOURCE_APPLICATION:
|
||||||
|
gtk_widget_set_sensitive (button, TRUE);
|
||||||
source = _("Application");
|
source = _("Application");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
Loading…
Reference in New Issue
Block a user