[libdazzle] examples: use DzlApplicationWindow
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libdazzle] examples: use DzlApplicationWindow
- Date: Sat, 8 Jul 2017 08:16:44 +0000 (UTC)
commit a85befab6ea010230d2f4b1d148c0ebb4c0397b5
Author: Christian Hergert <chergert redhat com>
Date: Sat Jul 8 01:10:08 2017 -0700
examples: use DzlApplicationWindow
This simplifies the process of adding a fullscreen action.
examples/app/example-window.c | 7 ++++---
examples/app/example-window.h | 4 ++--
examples/app/example-window.ui | 2 +-
3 files changed, 7 insertions(+), 6 deletions(-)
---
diff --git a/examples/app/example-window.c b/examples/app/example-window.c
index b4ec6bf..7c9a73e 100644
--- a/examples/app/example-window.c
+++ b/examples/app/example-window.c
@@ -1,13 +1,12 @@
#include "config.h"
-#include <dazzle.h>
#include <glib/gi18n.h>
#include "example-window.h"
struct _ExampleWindow
{
- GtkApplicationWindow parent_instance;
+ DzlApplicationWindow parent_instance;
DzlDockBin *dockbin;
GtkHeaderBar *header_bar;
GtkNotebook *notebook;
@@ -15,11 +14,12 @@ struct _ExampleWindow
GtkStack *stack;
};
-G_DEFINE_TYPE (ExampleWindow, example_window, GTK_TYPE_APPLICATION_WINDOW)
+G_DEFINE_TYPE (ExampleWindow, example_window, DZL_TYPE_APPLICATION_WINDOW)
static const DzlShortcutEntry shortcuts[] = {
{ "com.example.window.NewDoc", NULL, N_("Editing"), N_("Documents"), N_("New Document"), N_("Create a new
document") },
{ "com.example.window.CloseDoc", NULL, N_("Editing"), N_("Documents"), N_("Close Document"), N_("Close the
current document") },
+ { "com.example.window.Fullscreen", "F11", N_("Editing"), N_("General"), N_("Fullscreen"), N_("Toggle
window fullscreen") },
};
ExampleDocumentView *
@@ -177,6 +177,7 @@ example_window_init (ExampleWindow *self)
dzl_shortcut_controller_add_command_action (controller, "com.example.window.NewDoc", NULL,
"win.new-document");
dzl_shortcut_controller_add_command_action (controller, "com.example.window.CloseDoc", NULL,
"win.close-document");
+ dzl_shortcut_controller_add_command_action (controller, "com.example.window.Fullscreen", NULL,
"win.fullscreen");
g_signal_connect_swapped (self,
"key-press-event",
diff --git a/examples/app/example-window.h b/examples/app/example-window.h
index c25d27a..06507ed 100644
--- a/examples/app/example-window.h
+++ b/examples/app/example-window.h
@@ -1,6 +1,6 @@
#pragma once
-#include <gtk/gtk.h>
+#include <dazzle.h>
#include "example-document-view.h"
@@ -8,7 +8,7 @@ G_BEGIN_DECLS
#define EXAMPLE_TYPE_WINDOW (example_window_get_type())
-G_DECLARE_FINAL_TYPE (ExampleWindow, example_window, EXAMPLE, WINDOW, GtkApplicationWindow)
+G_DECLARE_FINAL_TYPE (ExampleWindow, example_window, EXAMPLE, WINDOW, DzlApplicationWindow)
GtkWidget *example_window_new (void);
ExampleDocumentView *example_window_get_current_document_view (ExampleWindow *self);
diff --git a/examples/app/example-window.ui b/examples/app/example-window.ui
index cf80227..92752a8 100644
--- a/examples/app/example-window.ui
+++ b/examples/app/example-window.ui
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
- <template class="ExampleWindow" parent="GtkApplicationWindow">
+ <template class="ExampleWindow" parent="DzlApplicationWindow">
<child type="titlebar">
<object class="GtkHeaderBar" id="header_bar">
<property name="show-close-button">true</property>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]