[libdazzle] shortcuts: move DzlShortcutPhase into separate header
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libdazzle] shortcuts: move DzlShortcutPhase into separate header
- Date: Wed, 19 Jul 2017 01:13:02 +0000 (UTC)
commit f77539017b3106c6c50294ace22dbb01d724936c
Author: Christian Hergert <chergert redhat com>
Date: Tue Jul 18 15:37:14 2017 -0700
shortcuts: move DzlShortcutPhase into separate header
This moves the enum type into a separate header so we can
include from various places without include cycles.
src/dazzle.h | 1 +
src/shortcuts/dzl-shortcut-controller.h | 19 +-----------
src/shortcuts/dzl-shortcut-phase.c | 39 ++++++++++++++++++++++++
src/shortcuts/dzl-shortcut-phase.h | 50 +++++++++++++++++++++++++++++++
src/shortcuts/meson.build | 2 +
5 files changed, 93 insertions(+), 18 deletions(-)
---
diff --git a/src/dazzle.h b/src/dazzle.h
index 3052f3e..fbeacb5 100644
--- a/src/dazzle.h
+++ b/src/dazzle.h
@@ -102,6 +102,7 @@ G_BEGIN_DECLS
#include "shortcuts/dzl-shortcut-label.h"
#include "shortcuts/dzl-shortcut-manager.h"
#include "shortcuts/dzl-shortcut-model.h"
+#include "shortcuts/dzl-shortcut-phase.h"
#include "shortcuts/dzl-shortcut-simple-label.h"
#include "shortcuts/dzl-shortcut-theme-editor.h"
#include "shortcuts/dzl-shortcut-theme.h"
diff --git a/src/shortcuts/dzl-shortcut-controller.h b/src/shortcuts/dzl-shortcut-controller.h
index 51c5f11..244284e 100644
--- a/src/shortcuts/dzl-shortcut-controller.h
+++ b/src/shortcuts/dzl-shortcut-controller.h
@@ -23,27 +23,10 @@
#include "shortcuts/dzl-shortcut-context.h"
#include "shortcuts/dzl-shortcut-manager.h"
+#include "shortcuts/dzl-shortcut-phase.h"
G_BEGIN_DECLS
-/**
- * DzlShortcutPhase:
- * @DZL_SHORTCUT_PHASE_CAPTURE: Indicates the capture phase of the shortcut
- * activation. This allows parent widgets to intercept the keybinding before
- * it is dispatched to the target #GdkWindow.
- * @DZL_SHORTCUT_DISPATCH: Indicates the typical dispatch phase of the shortcut
- * to the widget of the target #GdkWindow.
- * @DZL_SHORTCUT_BUBBLE: The final phase of event delivery. The event is
- * delivered to each widget as it progresses from the target window widget
- * up to the toplevel.
- */
-typedef enum
-{
- DZL_SHORTCUT_PHASE_CAPTURE,
- DZL_SHORTCUT_PHASE_DISPATCH,
- DZL_SHORTCUT_PHASE_BUBBLE,
-} DzlShortcutPhase;
-
#define DZL_TYPE_SHORTCUT_CONTROLLER (dzl_shortcut_controller_get_type())
G_DECLARE_FINAL_TYPE (DzlShortcutController, dzl_shortcut_controller, DZL, SHORTCUT_CONTROLLER, GObject)
diff --git a/src/shortcuts/dzl-shortcut-phase.c b/src/shortcuts/dzl-shortcut-phase.c
new file mode 100644
index 0000000..c560e67
--- /dev/null
+++ b/src/shortcuts/dzl-shortcut-phase.c
@@ -0,0 +1,39 @@
+/* dzl-shortcut-phase.c
+ *
+ * Copyright (C) 2017 Christian Hergert <chergert redhat com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "shortcuts/dzl-shortcut-phase.h"
+
+GType
+dzl_shortcut_phase_get_type (void)
+{
+ static GType type_id;
+
+ if (g_once_init_enter (&type_id))
+ {
+ static const GEnumValue values[] = {
+ { DZL_SHORTCUT_PHASE_DISPATCH, "DZL_SHORTCUT_PHASE_DISPATCH", "dispatch" },
+ { DZL_SHORTCUT_PHASE_CAPTURE, "DZL_SHORTCUT_PHASE_CAPTURE", "capture" },
+ { DZL_SHORTCUT_PHASE_BUBBLE, "DZL_SHORTCUT_PHASE_BUBBLE", "bubble" },
+ { 0 }
+ };
+ GType _type_id = g_enum_register_static ("DzlShortcutPhase", values);
+ g_once_init_leave (&type_id, _type_id);
+ }
+
+ return type_id;
+}
diff --git a/src/shortcuts/dzl-shortcut-phase.h b/src/shortcuts/dzl-shortcut-phase.h
new file mode 100644
index 0000000..25206e7
--- /dev/null
+++ b/src/shortcuts/dzl-shortcut-phase.h
@@ -0,0 +1,50 @@
+/* dzl-shortcut-phase.h
+ *
+ * Copyright (C) 2017 Christian Hergert <chergert redhat com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef DZL_SHORTCUT_PHASE_H
+#define DZL_SHORTCUT_PHASE_H
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define DZL_TYPE_SHORTCUT_PHASE (dzl_shortcut_phase_get_type())
+
+/**
+ * DzlShortcutPhase:
+ * @DZL_SHORTCUT_PHASE_CAPTURE: Indicates the capture phase of the shortcut
+ * activation. This allows parent widgets to intercept the keybinding before
+ * it is dispatched to the target #GdkWindow.
+ * @DZL_SHORTCUT_DISPATCH: Indicates the typical dispatch phase of the shortcut
+ * to the widget of the target #GdkWindow.
+ * @DZL_SHORTCUT_BUBBLE: The final phase of event delivery. The event is
+ * delivered to each widget as it progresses from the target window widget
+ * up to the toplevel.
+ */
+typedef enum
+{
+ DZL_SHORTCUT_PHASE_DISPATCH = 0,
+ DZL_SHORTCUT_PHASE_CAPTURE = 1,
+ DZL_SHORTCUT_PHASE_BUBBLE = 2,
+} DzlShortcutPhase;
+
+GType dzl_shortcut_phase_get_type (void);
+
+G_END_DECLS
+
+#endif /* DZL_SHORTCUT_PHASE_H */
diff --git a/src/shortcuts/meson.build b/src/shortcuts/meson.build
index 384bc26..0df7fbb 100644
--- a/src/shortcuts/meson.build
+++ b/src/shortcuts/meson.build
@@ -6,6 +6,7 @@ shortcuts_headers = [
'dzl-shortcut-label.h',
'dzl-shortcut-manager.h',
'dzl-shortcut-model.h',
+ 'dzl-shortcut-phase.h',
'dzl-shortcut-simple-label.h',
'dzl-shortcut-theme-editor.h',
'dzl-shortcut-theme.h',
@@ -23,6 +24,7 @@ shortcuts_sources = [
'dzl-shortcut-label.c',
'dzl-shortcut-manager.c',
'dzl-shortcut-model.c',
+ 'dzl-shortcut-phase.c',
'dzl-shortcut-simple-label.c',
'dzl-shortcut-theme-editor.c',
'dzl-shortcut-theme-load.c',
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]