[gtk/pango2] fontexplorer: Drop disable-size
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/pango2] fontexplorer: Drop disable-size
- Date: Sat, 9 Jul 2022 22:03:06 +0000 (UTC)
commit 49ceffa41eaa1df251d7e4c9c02be9f7bd8260fa
Author: Matthias Clasen <mclasen redhat com>
Date: Thu Jul 7 13:13:34 2022 -0400
fontexplorer: Drop disable-size
Simplifies things.
demos/font-explorer/fontcontrols.c | 15 ---------------
demos/font-explorer/fontcontrols.ui | 2 --
demos/font-explorer/fontexplorerwin.ui | 1 -
demos/font-explorer/fontview.c | 22 ++++------------------
4 files changed, 4 insertions(+), 36 deletions(-)
---
diff --git a/demos/font-explorer/fontcontrols.c b/demos/font-explorer/fontcontrols.c
index 77c02932aa..95a42efc14 100644
--- a/demos/font-explorer/fontcontrols.c
+++ b/demos/font-explorer/fontcontrols.c
@@ -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),
diff --git a/demos/font-explorer/fontcontrols.ui b/demos/font-explorer/fontcontrols.ui
index 3d5d5127da..1bd4ab2623 100644
--- a/demos/font-explorer/fontcontrols.ui
+++ b/demos/font-explorer/fontcontrols.ui
@@ -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>
diff --git a/demos/font-explorer/fontexplorerwin.ui b/demos/font-explorer/fontexplorerwin.ui
index 512f56541b..68c6ad0b26 100644
--- a/demos/font-explorer/fontexplorerwin.ui
+++ b/demos/font-explorer/fontexplorerwin.ui
@@ -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>
diff --git a/demos/font-explorer/fontview.c b/demos/font-explorer/fontview.c
index 32aee30ac5..f734cfdb2c 100644
--- a/demos/font-explorer/fontview.c
+++ b/demos/font-explorer/fontview.c
@@ -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),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]