[gedit/wip/adjustment-checks] utils: add gedit_utils_check_adjustment_changes()
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit/wip/adjustment-checks] utils: add gedit_utils_check_adjustment_changes()
- Date: Mon, 25 Jul 2022 00:31:16 +0000 (UTC)
commit 2b9eeea4ae19fedbed558d4e342c7ff3cdcbbb06
Author: Sébastien Wilmet <swilmet informatique-libre be>
Date: Mon Jul 25 02:27:10 2022 +0200
utils: add gedit_utils_check_adjustment_changes()
gedit/gedit-utils.c | 45 +++++++++++++++++++++++++++++++++++++++++++++
gedit/gedit-utils.h | 2 ++
2 files changed, 47 insertions(+)
---
diff --git a/gedit/gedit-utils.c b/gedit/gedit-utils.c
index 1ea5a1aa0..3a554b14d 100644
--- a/gedit/gedit-utils.c
+++ b/gedit/gedit-utils.c
@@ -606,4 +606,49 @@ gedit_utils_check_adjustment_invariants (GtkAdjustment *adjustment)
return TRUE;
}
+static void
+adjustment_notify_cb (GtkAdjustment *adjustment,
+ GParamSpec *pspec,
+ gpointer user_data)
+{
+ g_assert (gedit_utils_check_adjustment_invariants (adjustment));
+}
+
+static void
+adjustment_changed_cb (GtkAdjustment *adjustment,
+ gpointer user_data)
+{
+ g_assert (gedit_utils_check_adjustment_invariants (adjustment));
+}
+
+static void
+adjustment_value_changed_cb (GtkAdjustment *adjustment,
+ gpointer user_data)
+{
+ g_assert (gedit_utils_check_adjustment_invariants (adjustment));
+}
+
+void
+gedit_utils_check_adjustment_changes (GtkAdjustment *adjustment)
+{
+ g_return_if_fail (GTK_IS_ADJUSTMENT (adjustment));
+
+ g_assert (gedit_utils_check_adjustment_invariants (adjustment));
+
+ g_signal_connect (adjustment,
+ "notify",
+ G_CALLBACK (adjustment_notify_cb),
+ NULL);
+
+ g_signal_connect (adjustment,
+ "changed",
+ G_CALLBACK (adjustment_changed_cb),
+ NULL);
+
+ g_signal_connect (adjustment,
+ "value-changed",
+ G_CALLBACK (adjustment_value_changed_cb),
+ NULL);
+}
+
/* ex:set ts=8 noet: */
diff --git a/gedit/gedit-utils.h b/gedit/gedit-utils.h
index f400f0e34..81c86459a 100644
--- a/gedit/gedit-utils.h
+++ b/gedit/gedit-utils.h
@@ -51,6 +51,8 @@ const gchar *gedit_utils_newline_type_to_string (G
gboolean gedit_utils_check_adjustment_invariants (GtkAdjustment *adjustment);
+void gedit_utils_check_adjustment_changes (GtkAdjustment *adjustment);
+
G_END_DECLS
#endif /* GEDIT_UTILS_H */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]