diff options
author | Thomas White <taw@bitwiz.me.uk> | 2018-04-22 12:18:28 +0200 |
---|---|---|
committer | Thomas White <taw@bitwiz.me.uk> | 2018-04-22 23:22:39 +0200 |
commit | ef49ac2a7919d9284e2db4c34b5fccf3d636f72e (patch) | |
tree | 77761a6c0035c083eadaa9b7da96a0df0bddc253 /src | |
parent | 3f0ef3ba6d8389a6aaeef7183c2a41b57ba36a8d (diff) |
Add preliminary stylesheet editor
Diffstat (limited to 'src')
-rw-r--r-- | src/colloquium.c | 1 | ||||
-rw-r--r-- | src/narrative_window.c | 14 | ||||
-rw-r--r-- | src/stylesheet_editor.c | 79 | ||||
-rw-r--r-- | src/stylesheet_editor.h | 73 |
4 files changed, 167 insertions, 0 deletions
diff --git a/src/colloquium.c b/src/colloquium.c index 3b1caa3..66e3dcb 100644 --- a/src/colloquium.c +++ b/src/colloquium.c @@ -338,6 +338,7 @@ static void colloquium_startup(GApplication *papp) G_N_ELEMENTS(app_entries), app); app->builder = gtk_builder_new_from_resource("/uk/me/bitwiz/Colloquium/menus.ui"); + gtk_builder_add_from_resource(app->builder, "/uk/me/bitwiz/Colloquium/windows.ui", NULL); gtk_application_set_menubar(GTK_APPLICATION(app), G_MENU_MODEL(gtk_builder_get_object(app->builder, "menubar"))); diff --git a/src/narrative_window.c b/src/narrative_window.c index 33609eb..1d254b1 100644 --- a/src/narrative_window.c +++ b/src/narrative_window.c @@ -40,6 +40,7 @@ #include "pr_clock.h" #include "print.h" #include "utils.h" +#include "stylesheet_editor.h" struct _narrative_window @@ -313,6 +314,18 @@ static gint load_ss_response_sig(GtkWidget *d, gint response, } +static void edit_ss_sig(GSimpleAction *action, GVariant *parameter, + gpointer vp) +{ + NarrativeWindow *nw = vp; + StylesheetEditor *se; + + se = stylesheet_editor_new(nw->p); + gtk_window_set_transient_for(GTK_WINDOW(se), GTK_WINDOW(nw->window)); + gtk_widget_show_all(GTK_WIDGET(se)); +} + + static void load_ss_sig(GSimpleAction *action, GVariant *parameter, gpointer vp) { @@ -741,6 +754,7 @@ GActionEntry nw_entries[] = { { "deleteslide", delete_slide_sig, NULL, NULL, NULL }, { "slide", add_slide_sig, NULL, NULL, NULL }, { "loadstylesheet", load_ss_sig, NULL, NULL, NULL }, + { "stylesheet", edit_ss_sig, NULL, NULL, NULL }, { "startslideshow", start_slideshow_sig, NULL, NULL, NULL }, { "startslideshowhere", start_slideshow_here_sig, NULL, NULL, NULL }, { "startslideshownoslides", start_slideshow_noslides_sig, NULL, NULL, NULL }, diff --git a/src/stylesheet_editor.c b/src/stylesheet_editor.c new file mode 100644 index 0000000..85e053c --- /dev/null +++ b/src/stylesheet_editor.c @@ -0,0 +1,79 @@ +/* + * stylesheet_editor.c + * + * Copyright © 2013-2018 Thomas White <taw@bitwiz.org.uk> + * + * This file is part of Colloquium. + * + * Colloquium 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/>. + * + */ + + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <stdlib.h> +#include <string.h> +#include <assert.h> +#include <gtk/gtk.h> + +#include "stylesheet_editor.h" +#include "presentation.h" + +G_DEFINE_TYPE_WITH_CODE(StylesheetEditor, stylesheet_editor, + GTK_TYPE_DIALOG, NULL) + +struct stylesheet_editor_private +{ + GtkDialog *default_style_ss; +}; + + +static void stylesheet_editor_init(StylesheetEditor *se) +{ + se->priv = G_TYPE_INSTANCE_GET_PRIVATE(se, COLLOQUIUM_TYPE_STYLESHEET_EDITOR, + struct stylesheet_editor_private); + gtk_widget_init_template(GTK_WIDGET(se)); +} + + +void stylesheet_editor_class_init(StylesheetEditorClass *klass) +{ + GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(klass); + GObjectClass *gobject_class = G_OBJECT_CLASS(klass); + + gtk_widget_class_set_template_from_resource(widget_class, + "/uk/me/bitwiz/Colloquium/stylesheeteditor.ui"); + + gtk_widget_class_bind_template_child(widget_class, + struct stylesheet_editor_private, + default_style_ss); + + g_type_class_add_private(gobject_class, + sizeof(struct stylesheet_editor_private)); +} + + +StylesheetEditor *stylesheet_editor_new(struct presentation *p) +{ + StylesheetEditor *se; + + se = g_object_new(COLLOQUIUM_TYPE_STYLESHEET_EDITOR, NULL); + if ( se == NULL ) return NULL; + + return se; +} + diff --git a/src/stylesheet_editor.h b/src/stylesheet_editor.h new file mode 100644 index 0000000..ab2d65c --- /dev/null +++ b/src/stylesheet_editor.h @@ -0,0 +1,73 @@ +/* + * stylesheet_editor.h + * + * Copyright © 2013-2018 Thomas White <taw@bitwiz.org.uk> + * + * This file is part of Colloquium. + * + * Colloquium 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 STYLESHEET_EDITOR_H +#define STYLESHEET_EDITOR_H + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <gtk/gtk.h> + +#include "presentation.h" + +#define COLLOQUIUM_TYPE_STYLESHEET_EDITOR (stylesheet_editor_get_type()) + +#define COLLOQUIUM_STYLESHEET_EDITOR(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), \ + COLLOQUIUM_TYPE_STYLESHEET_EDITOR, \ + StylesheetEditor)) + +#define COLLOQUIUM_IS_STYLESHEET_EDITOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), \ + COLLOQUIUM_TYPE_STYLESHEET_EDITOR)) + +#define COLLOQUIUM_STYLESHEET_EDITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((obj), \ + COLLOQUIUM_TYPE_STYLESHEET_EDITOR, \ + StylesheetEditorClass)) + +#define COLLOQUIUM_IS_STYLESHEET_EDITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((obj), \ + COLLOQUIUM_TYPE_STYLESHEET_EDITOR)) + +#define COLLOQUIUM_STYLESHEET_EDITOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), \ + COLLOQUIUM_TYPE_STYLESHEET_EDITOR, \ + StylesheetEditorClass)) + +struct stylesheet_editor_private; + +struct _stylesheeteditor +{ + GtkDialog parent_instance; + struct stylesheet_editor_private *priv; +}; + + +struct _stylesheeteditorclass +{ + GtkDialogClass parent_class; +}; + +typedef struct _stylesheeteditor StylesheetEditor; +typedef struct _stylesheeteditorclass StylesheetEditorClass; + +extern StylesheetEditor *stylesheet_editor_new(struct presentation *p); + +#endif /* STYLESHEET_EDITOR_H */ |