mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-14 14:20:21 +00:00
inspector: Cosmetics
Make the variant editor use a checkbutton instead of a togglebutton.
This commit is contained in:
parent
f1a01fb973
commit
8648ecf889
@ -21,7 +21,7 @@
|
||||
#include "variant-editor.h"
|
||||
|
||||
#include "gtksizegroup.h"
|
||||
#include "gtktogglebutton.h"
|
||||
#include "gtkcheckbutton.h"
|
||||
#include "gtkentry.h"
|
||||
#include "gtklabel.h"
|
||||
#include "gtkbox.h"
|
||||
@ -102,7 +102,7 @@ ensure_editor (GtkInspectorVariantEditor *self,
|
||||
if (self->editor)
|
||||
gtk_widget_unparent (self->editor);
|
||||
|
||||
self->editor = gtk_toggle_button_new_with_label ("FALSE");
|
||||
self->editor = gtk_check_button_new ();
|
||||
g_signal_connect (self->editor, "notify::active",
|
||||
G_CALLBACK (variant_editor_changed_cb), self);
|
||||
|
||||
@ -175,18 +175,14 @@ gtk_inspector_variant_editor_set_value (GtkWidget *editor,
|
||||
|
||||
ensure_editor (self, g_variant_get_type (value));
|
||||
|
||||
g_signal_handlers_block_by_func (self->editor, variant_editor_changed_cb, self->data);
|
||||
g_signal_handlers_block_by_func (self->editor, variant_editor_changed_cb, self);
|
||||
|
||||
if (g_variant_type_equal (self->type, G_VARIANT_TYPE_BOOLEAN))
|
||||
{
|
||||
GtkToggleButton *tb = GTK_TOGGLE_BUTTON (self->editor);
|
||||
GtkCheckButton *b = GTK_CHECK_BUTTON (self->editor);
|
||||
|
||||
if (gtk_toggle_button_get_active (tb) != g_variant_get_boolean (value))
|
||||
{
|
||||
gtk_toggle_button_set_active (tb, g_variant_get_boolean (value));
|
||||
gtk_button_set_label (GTK_BUTTON (tb),
|
||||
g_variant_get_boolean (value) ? "TRUE" : "FALSE");
|
||||
}
|
||||
if (gtk_check_button_get_active (b) != g_variant_get_boolean (value))
|
||||
gtk_check_button_set_active (b, g_variant_get_boolean (value));
|
||||
}
|
||||
else if (g_variant_type_equal (self->type, G_VARIANT_TYPE_STRING))
|
||||
{
|
||||
@ -207,7 +203,7 @@ gtk_inspector_variant_editor_set_value (GtkWidget *editor,
|
||||
g_free (text);
|
||||
}
|
||||
|
||||
g_signal_handlers_unblock_by_func (self->editor, variant_editor_changed_cb, self->data);
|
||||
g_signal_handlers_unblock_by_func (self->editor, variant_editor_changed_cb, self);
|
||||
}
|
||||
|
||||
GVariant *
|
||||
@ -221,8 +217,8 @@ gtk_inspector_variant_editor_get_value (GtkWidget *editor)
|
||||
|
||||
if (g_variant_type_equal (self->type, G_VARIANT_TYPE_BOOLEAN))
|
||||
{
|
||||
GtkToggleButton *tb = GTK_TOGGLE_BUTTON (self->editor);
|
||||
value = g_variant_new_boolean (gtk_toggle_button_get_active (tb));
|
||||
GtkCheckButton *b = GTK_CHECK_BUTTON (self->editor);
|
||||
value = g_variant_new_boolean (gtk_check_button_get_active (b));
|
||||
}
|
||||
else if (g_variant_type_equal (self->type, G_VARIANT_TYPE_STRING))
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user