[gnome-builder] libide: keep signal handler ids around for disconnection
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] libide: keep signal handler ids around for disconnection
- Date: Mon, 23 Mar 2015 23:40:37 +0000 (UTC)
commit 6d3d2684c82e8de4ac222745789810eaac18d0fa
Author: Christian Hergert <christian hergert me>
Date: Tue Feb 24 17:25:25 2015 -0800
libide: keep signal handler ids around for disconnection
libide/ide-source-view.c | 58 +++++++++++++++++++++++++++-------------------
1 files changed, 34 insertions(+), 24 deletions(-)
---
diff --git a/libide/ide-source-view.c b/libide/ide-source-view.c
index 5429f6c..a5684f8 100644
--- a/libide/ide-source-view.c
+++ b/libide/ide-source-view.c
@@ -39,6 +39,10 @@ typedef struct
PangoFontDescription *font_desc;
GtkSourceGutterRenderer *line_change_renderer;
+ gulong buffer_changed_handler;
+ gulong buffer_notify_file_handler;
+ gulong buffer_notify_language_handler;
+
guint show_grid_lines : 1;
guint show_line_changes : 1;
} IdeSourceViewPrivate;
@@ -116,42 +120,48 @@ static void
ide_source_view_connect_buffer (IdeSourceView *self,
IdeBuffer *buffer)
{
+ IdeSourceViewPrivate *priv = ide_source_view_get_instance_private (self);
+
g_assert (IDE_IS_SOURCE_VIEW (self));
g_assert (IDE_IS_BUFFER (buffer));
- g_signal_connect_object (buffer,
- "changed",
- G_CALLBACK (ide_source_view__buffer_changed_cb),
- self,
- G_CONNECT_SWAPPED);
-
- g_signal_connect_object (buffer,
- "notify::file",
- G_CALLBACK (ide_source_view__buffer_notify_file_cb),
- self,
- G_CONNECT_SWAPPED);
-
- g_signal_connect_object (buffer,
- "notify::language",
- G_CALLBACK (ide_source_view__buffer_notify_language_cb),
- self,
- G_CONNECT_SWAPPED);
+ priv->buffer_changed_handler =
+ g_signal_connect_object (buffer,
+ "changed",
+ G_CALLBACK (ide_source_view__buffer_changed_cb),
+ self,
+ G_CONNECT_SWAPPED);
+
+ priv->buffer_notify_file_handler =
+ g_signal_connect_object (buffer,
+ "notify::file",
+ G_CALLBACK (ide_source_view__buffer_notify_file_cb),
+ self,
+ G_CONNECT_SWAPPED);
+
+ priv->buffer_notify_language_handler =
+ g_signal_connect_object (buffer,
+ "notify::language",
+ G_CALLBACK (ide_source_view__buffer_notify_language_cb),
+ self,
+ G_CONNECT_SWAPPED);
+
+ ide_source_view__buffer_notify_language_cb (self, NULL, buffer);
+ ide_source_view__buffer_notify_file_cb (self, NULL, buffer);
}
static void
ide_source_view_disconnect_buffer (IdeSourceView *self,
IdeBuffer *buffer)
{
+ IdeSourceViewPrivate *priv = ide_source_view_get_instance_private (self);
+
g_assert (IDE_IS_SOURCE_VIEW (self));
g_assert (IDE_IS_BUFFER (buffer));
- g_signal_handlers_disconnect_by_func (buffer,
- G_CALLBACK (ide_source_view__buffer_notify_file_cb),
- self);
-
- g_signal_handlers_disconnect_by_func (buffer,
- G_CALLBACK (ide_source_view__buffer_notify_language_cb),
- self);
+ ide_clear_signal_handler (buffer, &priv->buffer_changed_handler);
+ ide_clear_signal_handler (buffer, &priv->buffer_notify_file_handler);
+ ide_clear_signal_handler (buffer, &priv->buffer_notify_language_handler);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]