fontexplorer: Drop disable-size

Simplifies things.
This commit is contained in:
Matthias Clasen
2022-07-07 13:13:34 -04:00
parent 14e1df0370
commit 49ceffa41e
4 changed files with 4 additions and 36 deletions

View File

@@ -10,7 +10,6 @@ enum {
PROP_LINE_HEIGHT,
PROP_FOREGROUND,
PROP_BACKGROUND,
PROP_DISABLE_SIZE,
NUM_PROPERTIES
};
@@ -27,7 +26,6 @@ struct _FontControls
GtkColorButton *background;
GSimpleAction *reset_action;
gboolean disable_size;
};
struct _FontControlsClass
@@ -141,10 +139,6 @@ font_controls_set_property (GObject *object,
gtk_adjustment_set_value (self->size_adjustment, g_value_get_float (value));
break;
case PROP_DISABLE_SIZE:
self->disable_size = g_value_get_boolean (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
@@ -188,10 +182,6 @@ font_controls_get_property (GObject *object,
}
break;
case PROP_DISABLE_SIZE:
g_value_set_boolean (value, self->disable_size);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
@@ -234,11 +224,6 @@ font_controls_class_init (FontControlsClass *class)
GDK_TYPE_RGBA,
G_PARAM_READABLE);
properties[PROP_DISABLE_SIZE] =
g_param_spec_boolean ("disable-size", "", "",
FALSE,
G_PARAM_READWRITE);
g_object_class_install_properties (G_OBJECT_CLASS (class), NUM_PROPERTIES, properties);
gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (class),

View File

@@ -4,7 +4,6 @@
<property name="layout-manager"><object class="GtkGridLayout"/></property>
<child>
<object class="GtkLabel">
<property name="sensitive" bind-source="FontControls" bind-property="disable-size" bind-flags="invert-boolean"/>
<property name="label">Size</property>
<property name="xalign">0</property>
<property name="valign">baseline</property>
@@ -16,7 +15,6 @@
</child>
<child>
<object class="RangeEdit">
<property name="sensitive" bind-source="FontControls" bind-property="disable-size" bind-flags="invert-boolean"/>
<property name="hexpand">1</property>
<property name="width-request">160</property>
<property name="valign">baseline</property>

View File

@@ -54,7 +54,6 @@
</child>
<child>
<object class="FontControls" id="controls">
<property name="disable-size" bind-source="view" bind-property="ignore-size" bind-flags="sync-create"/>
</object>
</child>
<child>

View File

@@ -15,7 +15,6 @@ enum {
PROP_FEATURES,
PROP_PALETTE,
PROP_SAMPLE_TEXT,
PROP_IGNORE_SIZE,
NUM_PROPERTIES
};
@@ -131,7 +130,7 @@ update_view (FontView *self)
{
GString *str;
int sizes[] = { 7, 8, 9, 10, 12, 14, 16, 20, 24, 30, 40, 50, 60, 70, 90 };
int start, text_len;
int start, end, text_len;
str = g_string_new ("");
start = 0;
@@ -142,11 +141,12 @@ update_view (FontView *self)
g_string_append (str, self->sample_text);
g_string_append (str, ""); /* Unicode line separator */
end = start + text_len + strlen ("");
attr = pango2_attr_size_new (sizes[i] * PANGO2_SCALE);
pango2_attribute_set_range (attr, start, start + text_len);
pango2_attribute_set_range (attr, start, end);
pango2_attr_list_insert (attrs, attr);
start += text_len + strlen ("");
start = end;
}
gtk_label_set_text (self->content, str->str);
gtk_label_set_attributes (self->content, attrs);
@@ -214,7 +214,6 @@ plain_changed (GtkToggleButton *button,
}
update_view (self);
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_IGNORE_SIZE]);
}
static void
@@ -229,7 +228,6 @@ waterfall_changed (GtkToggleButton *button,
}
update_view (self);
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_IGNORE_SIZE]);
}
static void
@@ -242,8 +240,6 @@ glyphs_changed (GtkToggleButton *button,
gtk_stack_set_visible_child_name (self->stack, "glyphs");
self->do_waterfall = FALSE;
}
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_IGNORE_SIZE]);
}
static Pango2Font *
@@ -407,10 +403,6 @@ font_view_get_property (GObject *object,
g_value_set_string (value, self->sample_text);
break;
case PROP_IGNORE_SIZE:
g_value_set_boolean (value, self->do_waterfall);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
@@ -476,12 +468,6 @@ font_view_class_init (FontViewClass *class)
"",
G_PARAM_READWRITE);
properties[PROP_IGNORE_SIZE] =
g_param_spec_boolean ("ignore-size", "", "",
FALSE,
G_PARAM_READWRITE);
g_object_class_install_properties (G_OBJECT_CLASS (class), NUM_PROPERTIES, properties);
gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (class),