[tepl] SignalGroup: make the class public
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tepl] SignalGroup: make the class public
- Date: Mon, 23 Nov 2020 15:50:12 +0000 (UTC)
commit cf7473b4d65cf61014f25c701c13e0db67d4a151
Author: Sébastien Wilmet <swilmet gnome org>
Date: Mon Nov 23 16:07:12 2020 +0100
SignalGroup: make the class public
tepl/meson.build | 4 +-
tepl/tepl-application-window.c | 32 +++++++--------
tepl/tepl-notebook.c | 16 ++++----
tepl/tepl-signal-group.c | 12 +++---
tepl/tepl-signal-group.h | 19 +++++----
tepl/tepl-statusbar.c | 16 ++++----
tepl/tepl-tab-label.c | 32 +++++++--------
tepl/tepl-window-actions-edit.c | 90 ++++++++++++++++++++---------------------
tepl/tepl.h | 1 +
9 files changed, 114 insertions(+), 108 deletions(-)
---
diff --git a/tepl/meson.build b/tepl/meson.build
index ed8490c..60e2193 100644
--- a/tepl/meson.build
+++ b/tepl/meson.build
@@ -26,6 +26,7 @@ tepl_public_headers = [
'tepl-panel.h',
'tepl-pango.h',
'tepl-progress-info-bar.h',
+ 'tepl-signal-group.h',
'tepl-space-drawer-prefs.h',
'tepl-statusbar.h',
'tepl-style-scheme-chooser-widget.h',
@@ -64,6 +65,7 @@ tepl_public_c_files = [
'tepl-panel.c',
'tepl-pango.c',
'tepl-progress-info-bar.c',
+ 'tepl-signal-group.c',
'tepl-space-drawer-prefs.c',
'tepl-statusbar.c',
'tepl-style-scheme-chooser-widget.c',
@@ -82,7 +84,6 @@ TEPL_PRIVATE_HEADERS = [
'tepl-io-error-info-bar.h',
'tepl-metadata-attic.h',
'tepl-metadata-parser.h',
- 'tepl-signal-group.h',
'tepl-window-actions-edit.h',
'tepl-window-actions-file.h',
'tepl-window-actions-search.h'
@@ -94,7 +95,6 @@ tepl_private_c_files = [
'tepl-io-error-info-bar.c',
'tepl-metadata-attic.c',
'tepl-metadata-parser.c',
- 'tepl-signal-group.c',
'tepl-window-actions-edit.c',
'tepl-window-actions-file.c',
'tepl-window-actions-search.c'
diff --git a/tepl/tepl-application-window.c b/tepl/tepl-application-window.c
index 27ac72f..ca6aed6 100644
--- a/tepl/tepl-application-window.c
+++ b/tepl/tepl-application-window.c
@@ -267,8 +267,8 @@ tepl_application_window_dispose (GObject *object)
g_clear_object (&tepl_window->priv->window_group);
g_clear_object (&tepl_window->priv->tab_group);
- _tepl_signal_group_clear (&tepl_window->priv->view_signal_group);
- _tepl_signal_group_clear (&tepl_window->priv->buffer_signal_group);
+ tepl_signal_group_clear (&tepl_window->priv->view_signal_group);
+ tepl_signal_group_clear (&tepl_window->priv->buffer_signal_group);
G_OBJECT_CLASS (tepl_application_window_parent_class)->dispose (object);
}
@@ -470,7 +470,7 @@ active_view_changed (TeplApplicationWindow *tepl_window)
{
TeplView *active_view;
- _tepl_signal_group_clear (&tepl_window->priv->view_signal_group);
+ tepl_signal_group_clear (&tepl_window->priv->view_signal_group);
active_view = tepl_tab_group_get_active_view (TEPL_TAB_GROUP (tepl_window));
if (active_view == NULL)
@@ -478,13 +478,13 @@ active_view_changed (TeplApplicationWindow *tepl_window)
return;
}
- tepl_window->priv->view_signal_group = _tepl_signal_group_new (G_OBJECT (active_view));
+ tepl_window->priv->view_signal_group = tepl_signal_group_new (G_OBJECT (active_view));
- _tepl_signal_group_add (tepl_window->priv->view_signal_group,
- g_signal_connect (active_view,
- "notify::editable",
- G_CALLBACK (active_view_editable_notify_cb),
- tepl_window));
+ tepl_signal_group_add (tepl_window->priv->view_signal_group,
+ g_signal_connect (active_view,
+ "notify::editable",
+ G_CALLBACK (active_view_editable_notify_cb),
+ tepl_window));
}
static void
@@ -500,7 +500,7 @@ active_buffer_changed (TeplApplicationWindow *tepl_window)
{
TeplBuffer *active_buffer;
- _tepl_signal_group_clear (&tepl_window->priv->buffer_signal_group);
+ tepl_signal_group_clear (&tepl_window->priv->buffer_signal_group);
active_buffer = tepl_tab_group_get_active_buffer (TEPL_TAB_GROUP (tepl_window));
if (active_buffer == NULL)
@@ -508,13 +508,13 @@ active_buffer_changed (TeplApplicationWindow *tepl_window)
goto end;
}
- tepl_window->priv->buffer_signal_group = _tepl_signal_group_new (G_OBJECT (active_buffer));
+ tepl_window->priv->buffer_signal_group = tepl_signal_group_new (G_OBJECT (active_buffer));
- _tepl_signal_group_add (tepl_window->priv->buffer_signal_group,
- g_signal_connect (active_buffer,
- "notify::tepl-full-title",
- G_CALLBACK (active_buffer_full_title_notify_cb),
- tepl_window));
+ tepl_signal_group_add (tepl_window->priv->buffer_signal_group,
+ g_signal_connect (active_buffer,
+ "notify::tepl-full-title",
+ G_CALLBACK (active_buffer_full_title_notify_cb),
+ tepl_window));
end:
update_title (tepl_window);
diff --git a/tepl/tepl-notebook.c b/tepl/tepl-notebook.c
index ea86adb..c343608 100644
--- a/tepl/tepl-notebook.c
+++ b/tepl/tepl-notebook.c
@@ -100,7 +100,7 @@ tepl_notebook_dispose (GObject *object)
{
TeplNotebook *notebook = TEPL_NOTEBOOK (object);
- _tepl_signal_group_clear (¬ebook->priv->view_signal_group);
+ tepl_signal_group_clear (¬ebook->priv->view_signal_group);
G_OBJECT_CLASS (tepl_notebook_parent_class)->dispose (object);
}
@@ -127,19 +127,19 @@ check_active_tab_changed (TeplNotebook *notebook)
notebook->priv->active_tab = active_tab;
- _tepl_signal_group_clear (¬ebook->priv->view_signal_group);
+ tepl_signal_group_clear (¬ebook->priv->view_signal_group);
active_view = tepl_tab_group_get_active_view (TEPL_TAB_GROUP (notebook));
if (active_view != NULL)
{
- notebook->priv->view_signal_group = _tepl_signal_group_new (G_OBJECT (active_view));
+ notebook->priv->view_signal_group = tepl_signal_group_new (G_OBJECT (active_view));
- _tepl_signal_group_add (notebook->priv->view_signal_group,
- g_signal_connect (active_view,
- "notify::buffer",
- G_CALLBACK (buffer_notify_cb),
- notebook));
+ tepl_signal_group_add (notebook->priv->view_signal_group,
+ g_signal_connect (active_view,
+ "notify::buffer",
+ G_CALLBACK (buffer_notify_cb),
+ notebook));
}
g_object_notify (G_OBJECT (notebook), "active-tab");
diff --git a/tepl/tepl-signal-group.c b/tepl/tepl-signal-group.c
index 6e7e463..24394ef 100644
--- a/tepl/tepl-signal-group.c
+++ b/tepl/tepl-signal-group.c
@@ -23,7 +23,7 @@ struct _TeplSignalGroup
};
TeplSignalGroup *
-_tepl_signal_group_new (GObject *object)
+tepl_signal_group_new (GObject *object)
{
TeplSignalGroup *group;
@@ -39,7 +39,7 @@ _tepl_signal_group_new (GObject *object)
}
static void
-_tepl_signal_group_free (TeplSignalGroup *group)
+signal_group_free (TeplSignalGroup *group)
{
if (group == NULL)
{
@@ -68,17 +68,17 @@ _tepl_signal_group_free (TeplSignalGroup *group)
}
void
-_tepl_signal_group_clear (TeplSignalGroup **group_pointer)
+tepl_signal_group_clear (TeplSignalGroup **group_pointer)
{
g_return_if_fail (group_pointer != NULL);
- _tepl_signal_group_free (*group_pointer);
+ signal_group_free (*group_pointer);
*group_pointer = NULL;
}
void
-_tepl_signal_group_add (TeplSignalGroup *group,
- gulong signal_handler_id)
+tepl_signal_group_add (TeplSignalGroup *group,
+ gulong signal_handler_id)
{
g_return_if_fail (group != NULL);
g_return_if_fail (signal_handler_id != 0);
diff --git a/tepl/tepl-signal-group.h b/tepl/tepl-signal-group.h
index d7d1838..a95a83b 100644
--- a/tepl/tepl-signal-group.h
+++ b/tepl/tepl-signal-group.h
@@ -1,24 +1,29 @@
-/* SPDX-FileCopyrightText: 2017 - Sébastien Wilmet <swilmet gnome org>
+/* SPDX-FileCopyrightText: 2017-2020 - Sébastien Wilmet <swilmet gnome org>
* SPDX-License-Identifier: LGPL-3.0-or-later
*/
#ifndef TEPL_SIGNAL_GROUP_H
#define TEPL_SIGNAL_GROUP_H
+#if !defined (TEPL_H_INSIDE) && !defined (TEPL_COMPILATION)
+#error "Only <tepl/tepl.h> can be included directly."
+#endif
+
#include <glib-object.h>
+#include <tepl/tepl-macros.h>
G_BEGIN_DECLS
typedef struct _TeplSignalGroup TeplSignalGroup;
-G_GNUC_INTERNAL
-TeplSignalGroup * _tepl_signal_group_new (GObject *object);
+_TEPL_EXTERN
+TeplSignalGroup * tepl_signal_group_new (GObject *object);
-G_GNUC_INTERNAL
-void _tepl_signal_group_clear (TeplSignalGroup **group_pointer);
+_TEPL_EXTERN
+void tepl_signal_group_clear (TeplSignalGroup **group_pointer);
-G_GNUC_INTERNAL
-void _tepl_signal_group_add (TeplSignalGroup *group,
+_TEPL_EXTERN
+void tepl_signal_group_add (TeplSignalGroup *group,
gulong signal_handler_id);
G_END_DECLS
diff --git a/tepl/tepl-statusbar.c b/tepl/tepl-statusbar.c
index ad19310..54a4c95 100644
--- a/tepl/tepl-statusbar.c
+++ b/tepl/tepl-statusbar.c
@@ -31,7 +31,7 @@ tepl_statusbar_dispose (GObject *object)
TeplStatusbar *statusbar = TEPL_STATUSBAR (object);
g_clear_object (&statusbar->priv->tab_group);
- _tepl_signal_group_clear (&statusbar->priv->buffer_signal_group);
+ tepl_signal_group_clear (&statusbar->priv->buffer_signal_group);
statusbar->priv->label = NULL;
@@ -163,7 +163,7 @@ active_buffer_changed (TeplStatusbar *statusbar)
{
TeplBuffer *active_buffer;
- _tepl_signal_group_clear (&statusbar->priv->buffer_signal_group);
+ tepl_signal_group_clear (&statusbar->priv->buffer_signal_group);
active_buffer = tepl_tab_group_get_active_buffer (statusbar->priv->tab_group);
if (active_buffer == NULL)
@@ -171,13 +171,13 @@ active_buffer_changed (TeplStatusbar *statusbar)
goto end;
}
- statusbar->priv->buffer_signal_group = _tepl_signal_group_new (G_OBJECT (active_buffer));
+ statusbar->priv->buffer_signal_group = tepl_signal_group_new (G_OBJECT (active_buffer));
- _tepl_signal_group_add (statusbar->priv->buffer_signal_group,
- g_signal_connect (active_buffer,
- "tepl-cursor-moved",
- G_CALLBACK (active_buffer_cursor_moved_cb),
- statusbar));
+ tepl_signal_group_add (statusbar->priv->buffer_signal_group,
+ g_signal_connect (active_buffer,
+ "tepl-cursor-moved",
+ G_CALLBACK (active_buffer_cursor_moved_cb),
+ statusbar));
end:
update_cursor_position (statusbar);
diff --git a/tepl/tepl-tab-label.c b/tepl/tepl-tab-label.c
index bf2fa96..2909144 100644
--- a/tepl/tepl-tab-label.c
+++ b/tepl/tepl-tab-label.c
@@ -96,8 +96,8 @@ buffer_changed (TeplTabLabel *tab_label)
TeplBuffer *buffer;
TeplFile *file;
- _tepl_signal_group_clear (&tab_label->priv->buffer_signal_group);
- _tepl_signal_group_clear (&tab_label->priv->file_signal_group);
+ tepl_signal_group_clear (&tab_label->priv->buffer_signal_group);
+ tepl_signal_group_clear (&tab_label->priv->file_signal_group);
if (tab_label->priv->tab == NULL)
{
@@ -107,26 +107,26 @@ buffer_changed (TeplTabLabel *tab_label)
/* Buffer */
buffer = tepl_tab_get_buffer (tab_label->priv->tab);
- tab_label->priv->buffer_signal_group = _tepl_signal_group_new (G_OBJECT (buffer));
+ tab_label->priv->buffer_signal_group = tepl_signal_group_new (G_OBJECT (buffer));
- _tepl_signal_group_add (tab_label->priv->buffer_signal_group,
- g_signal_connect (buffer,
- "notify::tepl-short-title",
- G_CALLBACK (buffer_short_title_notify_cb),
- tab_label));
+ tepl_signal_group_add (tab_label->priv->buffer_signal_group,
+ g_signal_connect (buffer,
+ "notify::tepl-short-title",
+ G_CALLBACK (buffer_short_title_notify_cb),
+ tab_label));
update_label (tab_label);
/* File */
file = tepl_buffer_get_file (buffer);
- tab_label->priv->file_signal_group = _tepl_signal_group_new (G_OBJECT (file));
+ tab_label->priv->file_signal_group = tepl_signal_group_new (G_OBJECT (file));
- _tepl_signal_group_add (tab_label->priv->file_signal_group,
- g_signal_connect (file,
- "notify::location",
- G_CALLBACK (file_location_notify_cb),
- tab_label));
+ tepl_signal_group_add (tab_label->priv->file_signal_group,
+ g_signal_connect (file,
+ "notify::location",
+ G_CALLBACK (file_location_notify_cb),
+ tab_label));
tepl_tab_label_update_tooltip (tab_label);
}
@@ -211,8 +211,8 @@ tepl_tab_label_dispose (GObject *object)
TeplTabLabel *tab_label = TEPL_TAB_LABEL (object);
g_clear_weak_pointer (&tab_label->priv->tab);
- _tepl_signal_group_clear (&tab_label->priv->buffer_signal_group);
- _tepl_signal_group_clear (&tab_label->priv->file_signal_group);
+ tepl_signal_group_clear (&tab_label->priv->buffer_signal_group);
+ tepl_signal_group_clear (&tab_label->priv->file_signal_group);
G_OBJECT_CLASS (tepl_tab_label_parent_class)->dispose (object);
}
diff --git a/tepl/tepl-window-actions-edit.c b/tepl/tepl-window-actions-edit.c
index b048628..1984a54 100644
--- a/tepl/tepl-window-actions-edit.c
+++ b/tepl/tepl-window-actions-edit.c
@@ -402,7 +402,7 @@ active_view_changed (TeplWindowActionsEdit *window_actions_edit)
{
TeplView *active_view;
- _tepl_signal_group_clear (&window_actions_edit->view_signal_group);
+ tepl_signal_group_clear (&window_actions_edit->view_signal_group);
active_view = tepl_tab_group_get_active_view (TEPL_TAB_GROUP (window_actions_edit->tepl_window));
if (active_view == NULL)
@@ -410,13 +410,13 @@ active_view_changed (TeplWindowActionsEdit *window_actions_edit)
goto end;
}
- window_actions_edit->view_signal_group = _tepl_signal_group_new (G_OBJECT (active_view));
+ window_actions_edit->view_signal_group = tepl_signal_group_new (G_OBJECT (active_view));
- _tepl_signal_group_add (window_actions_edit->view_signal_group,
- g_signal_connect (active_view,
- "notify::editable",
- G_CALLBACK (active_view_editable_notify_cb),
- window_actions_edit));
+ tepl_signal_group_add (window_actions_edit->view_signal_group,
+ g_signal_connect (active_view,
+ "notify::editable",
+ G_CALLBACK (active_view_editable_notify_cb),
+ window_actions_edit));
end:
update_undo_redo_actions_sensitivity (window_actions_edit->tepl_window);
@@ -461,7 +461,7 @@ active_buffer_changed (TeplWindowActionsEdit *window_actions_edit)
{
TeplBuffer *active_buffer;
- _tepl_signal_group_clear (&window_actions_edit->buffer_signal_group);
+ tepl_signal_group_clear (&window_actions_edit->buffer_signal_group);
active_buffer = tepl_tab_group_get_active_buffer (TEPL_TAB_GROUP (window_actions_edit->tepl_window));
if (active_buffer == NULL)
@@ -469,25 +469,25 @@ active_buffer_changed (TeplWindowActionsEdit *window_actions_edit)
goto end;
}
- window_actions_edit->buffer_signal_group = _tepl_signal_group_new (G_OBJECT (active_buffer));
+ window_actions_edit->buffer_signal_group = tepl_signal_group_new (G_OBJECT (active_buffer));
- _tepl_signal_group_add (window_actions_edit->buffer_signal_group,
- g_signal_connect (active_buffer,
- "notify::can-undo",
- G_CALLBACK (active_buffer_can_undo_notify_cb),
- window_actions_edit));
+ tepl_signal_group_add (window_actions_edit->buffer_signal_group,
+ g_signal_connect (active_buffer,
+ "notify::can-undo",
+ G_CALLBACK (active_buffer_can_undo_notify_cb),
+ window_actions_edit));
- _tepl_signal_group_add (window_actions_edit->buffer_signal_group,
- g_signal_connect (active_buffer,
- "notify::can-redo",
- G_CALLBACK (active_buffer_can_redo_notify_cb),
- window_actions_edit));
+ tepl_signal_group_add (window_actions_edit->buffer_signal_group,
+ g_signal_connect (active_buffer,
+ "notify::can-redo",
+ G_CALLBACK (active_buffer_can_redo_notify_cb),
+ window_actions_edit));
- _tepl_signal_group_add (window_actions_edit->buffer_signal_group,
- g_signal_connect (active_buffer,
- "notify::has-selection",
- G_CALLBACK (active_buffer_has_selection_notify_cb),
- window_actions_edit));
+ tepl_signal_group_add (window_actions_edit->buffer_signal_group,
+ g_signal_connect (active_buffer,
+ "notify::has-selection",
+ G_CALLBACK (active_buffer_has_selection_notify_cb),
+ window_actions_edit));
end:
update_undo_redo_actions_sensitivity (window_actions_edit->tepl_window);
@@ -542,27 +542,27 @@ _tepl_window_actions_edit_new (TeplApplicationWindow *tepl_window)
window_actions_edit = g_new0 (TeplWindowActionsEdit, 1);
window_actions_edit->tepl_window = tepl_window;
- window_actions_edit->tepl_window_signal_group = _tepl_signal_group_new (G_OBJECT (tepl_window));
+ window_actions_edit->tepl_window_signal_group = tepl_signal_group_new (G_OBJECT (tepl_window));
- _tepl_signal_group_add (window_actions_edit->tepl_window_signal_group,
- g_signal_connect (tepl_window,
- "notify::active-view",
- G_CALLBACK (active_view_notify_cb),
- window_actions_edit));
+ tepl_signal_group_add (window_actions_edit->tepl_window_signal_group,
+ g_signal_connect (tepl_window,
+ "notify::active-view",
+ G_CALLBACK (active_view_notify_cb),
+ window_actions_edit));
- _tepl_signal_group_add (window_actions_edit->tepl_window_signal_group,
- g_signal_connect (tepl_window,
- "notify::active-buffer",
- G_CALLBACK (active_buffer_notify_cb),
- window_actions_edit));
+ tepl_signal_group_add (window_actions_edit->tepl_window_signal_group,
+ g_signal_connect (tepl_window,
+ "notify::active-buffer",
+ G_CALLBACK (active_buffer_notify_cb),
+ window_actions_edit));
clipboard = gtk_widget_get_clipboard (GTK_WIDGET (gtk_window), GDK_SELECTION_CLIPBOARD);
- window_actions_edit->clipboard_signal_group = _tepl_signal_group_new (G_OBJECT (clipboard));
- _tepl_signal_group_add (window_actions_edit->clipboard_signal_group,
- g_signal_connect (clipboard,
- "owner-change",
- G_CALLBACK (clipboard_owner_change_cb),
- window_actions_edit));
+ window_actions_edit->clipboard_signal_group = tepl_signal_group_new (G_OBJECT (clipboard));
+ tepl_signal_group_add (window_actions_edit->clipboard_signal_group,
+ g_signal_connect (clipboard,
+ "owner-change",
+ G_CALLBACK (clipboard_owner_change_cb),
+ window_actions_edit));
active_view_changed (window_actions_edit);
active_buffer_changed (window_actions_edit);
@@ -578,10 +578,10 @@ window_actions_edit_free (TeplWindowActionsEdit *window_actions_edit)
return;
}
- _tepl_signal_group_clear (&window_actions_edit->tepl_window_signal_group);
- _tepl_signal_group_clear (&window_actions_edit->view_signal_group);
- _tepl_signal_group_clear (&window_actions_edit->buffer_signal_group);
- _tepl_signal_group_clear (&window_actions_edit->clipboard_signal_group);
+ tepl_signal_group_clear (&window_actions_edit->tepl_window_signal_group);
+ tepl_signal_group_clear (&window_actions_edit->view_signal_group);
+ tepl_signal_group_clear (&window_actions_edit->buffer_signal_group);
+ tepl_signal_group_clear (&window_actions_edit->clipboard_signal_group);
g_free (window_actions_edit);
}
diff --git a/tepl/tepl.h b/tepl/tepl.h
index 100b844..f557ed2 100644
--- a/tepl/tepl.h
+++ b/tepl/tepl.h
@@ -37,6 +37,7 @@
#include <tepl/tepl-panel.h>
#include <tepl/tepl-pango.h>
#include <tepl/tepl-progress-info-bar.h>
+#include <tepl/tepl-signal-group.h>
#include <tepl/tepl-space-drawer-prefs.h>
#include <tepl/tepl-statusbar.h>
#include <tepl/tepl-style-scheme-chooser-widget.h>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]