[libadwaita] indicator-bin: Remove the contained property
- From: Adrien Plazas <aplazas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libadwaita] indicator-bin: Remove the contained property
- Date: Thu, 8 Jul 2021 14:11:40 +0000 (UTC)
commit d8fd40e3627703548182f1f0bcc09d55316de0b7
Author: CodedOre <CodedOre>
Date: Mon Jun 28 17:35:19 2021 +0500
indicator-bin: Remove the contained property
We don't use it anymore, and it was a hack anyway.
src/adw-indicator-bin-private.h | 4 ---
src/adw-indicator-bin.c | 73 ++++-------------------------------------
2 files changed, 6 insertions(+), 71 deletions(-)
---
diff --git a/src/adw-indicator-bin-private.h b/src/adw-indicator-bin-private.h
index 03eeb921..efa1c428 100644
--- a/src/adw-indicator-bin-private.h
+++ b/src/adw-indicator-bin-private.h
@@ -34,8 +34,4 @@ const char *adw_indicator_bin_get_badge (AdwIndicatorBin *self);
void adw_indicator_bin_set_badge (AdwIndicatorBin *self,
const char *badge);
-gboolean adw_indicator_bin_get_contained (AdwIndicatorBin *self);
-void adw_indicator_bin_set_contained (AdwIndicatorBin *self,
- gboolean contained);
-
G_END_DECLS
diff --git a/src/adw-indicator-bin.c b/src/adw-indicator-bin.c
index 0b75f00e..59c391a7 100644
--- a/src/adw-indicator-bin.c
+++ b/src/adw-indicator-bin.c
@@ -28,7 +28,6 @@ struct _AdwIndicatorBin
GtkWidget *child;
gboolean needs_attention;
- gboolean contained;
GtkWidget *mask;
GtkWidget *indicator;
@@ -50,7 +49,6 @@ enum {
PROP_CHILD,
PROP_NEEDS_ATTENTION,
PROP_BADGE,
- PROP_CONTAINED,
LAST_PROP
};
@@ -133,24 +131,14 @@ adw_indicator_bin_size_allocate (GtkWidget *widget,
gtk_widget_get_preferred_size (self->indicator, NULL, &size);
- if (self->contained) {
- if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
- x = 0;
- else
- x = width - size.width;
-
- y = 0;
- } else {
- if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
- x = -size.height / 2.0f;
- else
- x = width - size.width + size.height / 2.0f;
-
- y = -size.height / 2.0f;
- }
-
if (size.width > width * 2)
x = (width - size.width) / 2.0f;
+ else if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
+ x = -size.height / 2.0f;
+ else
+ x = width - size.width + size.height / 2.0f;
+
+ y = -size.height / 2.0f;
gtk_widget_allocate (self->mask, size.width, size.height, baseline,
gsk_transform_translate (NULL, &GRAPHENE_POINT_INIT (x, y)));
@@ -225,10 +213,6 @@ adw_indicator_bin_get_property (GObject *object,
g_value_set_string (value, adw_indicator_bin_get_badge (self));
break;
- case PROP_CONTAINED:
- g_value_set_boolean (value, adw_indicator_bin_get_contained (self));
- break;
-
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
@@ -255,10 +239,6 @@ adw_indicator_bin_set_property (GObject *object,
adw_indicator_bin_set_badge (self, g_value_get_string (value));
break;
- case PROP_CONTAINED:
- adw_indicator_bin_set_contained (self, g_value_get_boolean (value));
- break;
-
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
@@ -333,21 +313,6 @@ adw_indicator_bin_class_init (AdwIndicatorBinClass *klass)
"",
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
- /**
- * AdwIndicatorBin:contained:
- *
- * Whether the indicator is centered on the top end corner of the widget or is
- * at the top end corner but contained in the widget bounds.
- *
- * Since: 1.0
- */
- props[PROP_CONTAINED] =
- g_param_spec_boolean ("contained",
- "Contained",
- "Whether the indicator is contained in the widget bounds",
- FALSE,
- G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
-
g_object_class_install_properties (object_class, LAST_PROP, props);
gtk_widget_class_set_css_name (widget_class, "indicatorbin");
@@ -511,29 +476,3 @@ adw_indicator_bin_set_badge (AdwIndicatorBin *self,
g_object_notify_by_pspec (G_OBJECT (self), props[PROP_BADGE]);
}
-
-gboolean
-adw_indicator_bin_get_contained (AdwIndicatorBin *self)
-{
- g_return_val_if_fail (ADW_IS_INDICATOR_BIN (self), FALSE);
-
- return self->contained;
-}
-
-void
-adw_indicator_bin_set_contained (AdwIndicatorBin *self,
- gboolean contained)
-{
- g_return_if_fail (ADW_IS_INDICATOR_BIN (self));
-
- contained = !!contained;
-
- if (self->contained == contained)
- return;
-
- self->contained = contained;
-
- gtk_widget_queue_allocate (GTK_WIDGET (self));
-
- g_object_notify_by_pspec (G_OBJECT (self), props[PROP_CONTAINED]);
-}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]