2927c86dbe
This backports upstream patches to remove the dep on tepl. Fixes: #1951302 Related: #1951202
1012 lines
42 KiB
Diff
1012 lines
42 KiB
Diff
From 2046d92f85cf495ae4f66795b87f8435d3f591b0 Mon Sep 17 00:00:00 2001
|
|
From: Jordan Petridis <jordan@centricular.com>
|
|
Date: Sat, 10 Apr 2021 03:58:21 +0300
|
|
Subject: [PATCH 1/2] Revert "drawspaces: new implementation based on
|
|
TeplSpaceDrawerPrefs"
|
|
|
|
This reverts commit 2060f8a6a416653791d26352cf012b4c9e9ee9bb.
|
|
---
|
|
.../drawspaces.plugin.desktop.in.in | 4 +-
|
|
.../gedit-drawspaces-app-activatable.c | 293 ++++++++++++++++--
|
|
.../gedit-drawspaces-app-activatable.h | 32 +-
|
|
.../gedit-drawspaces-configurable.ui | 175 +++++++++++
|
|
.../gedit-drawspaces-view-activatable.c | 130 ++++++--
|
|
.../gedit-drawspaces-view-activatable.h | 17 +-
|
|
.../drawspaces/gedit-drawspaces.gresource.xml | 6 +
|
|
plugins/drawspaces/meson.build | 9 +
|
|
...gnome.gedit.plugins.drawspaces.gschema.xml | 26 +-
|
|
po/POTFILES.in | 1 +
|
|
10 files changed, 625 insertions(+), 68 deletions(-)
|
|
create mode 100644 plugins/drawspaces/gedit-drawspaces-configurable.ui
|
|
create mode 100644 plugins/drawspaces/gedit-drawspaces.gresource.xml
|
|
|
|
diff --git a/plugins/drawspaces/drawspaces.plugin.desktop.in.in b/plugins/drawspaces/drawspaces.plugin.desktop.in.in
|
|
index 0c5b584..8374851 100644
|
|
--- a/plugins/drawspaces/drawspaces.plugin.desktop.in.in
|
|
+++ b/plugins/drawspaces/drawspaces.plugin.desktop.in.in
|
|
@@ -3,7 +3,7 @@ Module=drawspaces
|
|
IAge=3
|
|
Name=Draw Spaces
|
|
Description=Draw spaces and tabs
|
|
-Authors=Paolo Borelli <pborelli@katamail.com>;Steve Frécinaux <code@istique.net>;Ignacio Casal Quinteiro <nacho.resa@gmail.com>;Sébastien Wilmet <swilmet@gnome.org>
|
|
-Copyright=Copyright © 2006 Paolo Borelli;Copyright © 2007 Steve Frécinaux;Copyright © 2008 Ignacio Casal Quinteiro;Copyright © 2020 Sébastien Wilmet
|
|
+Authors=Paolo Borelli <pborelli@katamail.com>;Steve Frécinaux <code@istique.net>;Ignacio Casal Quinteiro <nacho.resa@gmail.com>
|
|
+Copyright=Copyright © 2006 Paolo Borelli;Copyright © 2007 Steve Frécinaux;Copyright © 2008 Ignacio Casal Quinteiro
|
|
Website=http://www.gedit.org
|
|
Version=@VERSION@
|
|
diff --git a/plugins/drawspaces/gedit-drawspaces-app-activatable.c b/plugins/drawspaces/gedit-drawspaces-app-activatable.c
|
|
index 52f31ea..cb3d302 100644
|
|
--- a/plugins/drawspaces/gedit-drawspaces-app-activatable.c
|
|
+++ b/plugins/drawspaces/gedit-drawspaces-app-activatable.c
|
|
@@ -1,35 +1,62 @@
|
|
/*
|
|
* Copyright (C) 2008-2014 Ignacio Casal Quinteiro <icq@gnome.org>
|
|
- * Copyright (C) 2020 Sébastien Wilmet <swilmet@gnome.org>
|
|
*
|
|
- * gedit is free software; you can redistribute it and/or modify
|
|
+ * 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 2 of the License, or
|
|
- * (at your option) any later version.
|
|
+ * the Free Software Foundation; either version 2, or (at your option)
|
|
+ * any later version.
|
|
*
|
|
- * gedit is distributed in the hope that it will be useful,
|
|
+ * 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 gedit. If not, see <http://www.gnu.org/licenses/>.
|
|
+ * along with this program; if not, write to the Free Software
|
|
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
*/
|
|
|
|
+#include "config.h"
|
|
#include "gedit-drawspaces-app-activatable.h"
|
|
#include "gedit-drawspaces-view-activatable.h"
|
|
-#include <tepl/tepl.h>
|
|
-#include <libpeas-gtk/peas-gtk-configurable.h>
|
|
|
|
-/* TODO: rename the class to GeditDrawspacesPrefs or something like that, since
|
|
- * it no longer implements the GeditAppActivatable interface.
|
|
- */
|
|
+#include <gedit/gedit-app.h>
|
|
+#include <gedit/gedit-app-activatable.h>
|
|
+#include <gedit/gedit-debug.h>
|
|
+#include <gio/gio.h>
|
|
+#include <glib/gi18n-lib.h>
|
|
+#include <libpeas-gtk/peas-gtk-configurable.h>
|
|
|
|
typedef struct _GeditDrawspacesAppActivatablePrivate
|
|
{
|
|
- GSettings *settings;
|
|
+ GeditApp *app;
|
|
} GeditDrawspacesAppActivatablePrivate;
|
|
|
|
+typedef struct _DrawspacesConfigureWidget DrawspacesConfigureWidget;
|
|
+
|
|
+struct _DrawspacesConfigureWidget
|
|
+{
|
|
+ GSettings *settings;
|
|
+ guint flags;
|
|
+
|
|
+ GtkWidget *content;
|
|
+
|
|
+ GtkWidget *draw_tabs;
|
|
+ GtkWidget *draw_spaces;
|
|
+ GtkWidget *draw_newline;
|
|
+ GtkWidget *draw_nbsp;
|
|
+ GtkWidget *draw_leading;
|
|
+ GtkWidget *draw_text;
|
|
+ GtkWidget *draw_trailing;
|
|
+};
|
|
+
|
|
+enum
|
|
+{
|
|
+ PROP_0,
|
|
+ PROP_APP
|
|
+};
|
|
+
|
|
+static void gedit_app_activatable_iface_init (GeditAppActivatableInterface *iface);
|
|
static void peas_gtk_configurable_iface_init (PeasGtkConfigurableInterface *iface);
|
|
|
|
G_DEFINE_DYNAMIC_TYPE_EXTENDED (GeditDrawspacesAppActivatable,
|
|
@@ -37,6 +64,8 @@ G_DEFINE_DYNAMIC_TYPE_EXTENDED (GeditDrawspacesAppActivatable,
|
|
G_TYPE_OBJECT,
|
|
0,
|
|
G_ADD_PRIVATE_DYNAMIC (GeditDrawspacesAppActivatable)
|
|
+ G_IMPLEMENT_INTERFACE_DYNAMIC (GEDIT_TYPE_APP_ACTIVATABLE,
|
|
+ gedit_app_activatable_iface_init)
|
|
G_IMPLEMENT_INTERFACE_DYNAMIC (PEAS_GTK_TYPE_CONFIGURABLE,
|
|
peas_gtk_configurable_iface_init))
|
|
|
|
@@ -46,17 +75,63 @@ gedit_drawspaces_app_activatable_dispose (GObject *object)
|
|
GeditDrawspacesAppActivatable *activatable = GEDIT_DRAWSPACES_APP_ACTIVATABLE (object);
|
|
GeditDrawspacesAppActivatablePrivate *priv = gedit_drawspaces_app_activatable_get_instance_private (activatable);
|
|
|
|
- g_clear_object (&priv->settings);
|
|
+ g_clear_object (&priv->app);
|
|
|
|
G_OBJECT_CLASS (gedit_drawspaces_app_activatable_parent_class)->dispose (object);
|
|
}
|
|
|
|
+static void
|
|
+gedit_drawspaces_app_activatable_set_property (GObject *object,
|
|
+ guint prop_id,
|
|
+ const GValue *value,
|
|
+ GParamSpec *pspec)
|
|
+{
|
|
+ GeditDrawspacesAppActivatable *activatable = GEDIT_DRAWSPACES_APP_ACTIVATABLE (object);
|
|
+ GeditDrawspacesAppActivatablePrivate *priv = gedit_drawspaces_app_activatable_get_instance_private (activatable);
|
|
+
|
|
+ switch (prop_id)
|
|
+ {
|
|
+ case PROP_APP:
|
|
+ priv->app = GEDIT_APP (g_value_dup_object (value));
|
|
+ break;
|
|
+
|
|
+ default:
|
|
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
+ break;
|
|
+ }
|
|
+}
|
|
+
|
|
+static void
|
|
+gedit_drawspaces_app_activatable_get_property (GObject *object,
|
|
+ guint prop_id,
|
|
+ GValue *value,
|
|
+ GParamSpec *pspec)
|
|
+{
|
|
+ GeditDrawspacesAppActivatable *activatable = GEDIT_DRAWSPACES_APP_ACTIVATABLE (object);
|
|
+ GeditDrawspacesAppActivatablePrivate *priv = gedit_drawspaces_app_activatable_get_instance_private (activatable);
|
|
+
|
|
+ switch (prop_id)
|
|
+ {
|
|
+ case PROP_APP:
|
|
+ g_value_set_object (value, priv->app);
|
|
+ break;
|
|
+
|
|
+ default:
|
|
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
+ break;
|
|
+ }
|
|
+}
|
|
+
|
|
static void
|
|
gedit_drawspaces_app_activatable_class_init (GeditDrawspacesAppActivatableClass *klass)
|
|
{
|
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
|
|
|
object_class->dispose = gedit_drawspaces_app_activatable_dispose;
|
|
+ object_class->set_property = gedit_drawspaces_app_activatable_set_property;
|
|
+ object_class->get_property = gedit_drawspaces_app_activatable_get_property;
|
|
+
|
|
+ g_object_class_override_property (object_class, PROP_APP, "app");
|
|
}
|
|
|
|
static void
|
|
@@ -65,29 +140,190 @@ gedit_drawspaces_app_activatable_class_finalize (GeditDrawspacesAppActivatableCl
|
|
}
|
|
|
|
static void
|
|
-gedit_drawspaces_app_activatable_init (GeditDrawspacesAppActivatable *activatable)
|
|
+gedit_drawspaces_app_activatable_init (GeditDrawspacesAppActivatable *self)
|
|
{
|
|
- GeditDrawspacesAppActivatablePrivate *priv = gedit_drawspaces_app_activatable_get_instance_private (activatable);
|
|
+}
|
|
+
|
|
+static void
|
|
+gedit_drawspaces_app_activatable_activate (GeditAppActivatable *activatable)
|
|
+{
|
|
+}
|
|
+
|
|
+static void
|
|
+gedit_drawspaces_app_activatable_deactivate (GeditAppActivatable *activatable)
|
|
+{
|
|
+}
|
|
+
|
|
+static void
|
|
+gedit_app_activatable_iface_init (GeditAppActivatableInterface *iface)
|
|
+{
|
|
+ iface->activate = gedit_drawspaces_app_activatable_activate;
|
|
+ iface->deactivate = gedit_drawspaces_app_activatable_deactivate;
|
|
+}
|
|
+
|
|
+static void
|
|
+widget_destroyed (GtkWidget *obj, gpointer widget_pointer)
|
|
+{
|
|
+ DrawspacesConfigureWidget *widget = (DrawspacesConfigureWidget *)widget_pointer;
|
|
+
|
|
+ gedit_debug (DEBUG_PLUGINS);
|
|
|
|
- priv->settings = g_settings_new ("org.gnome.gedit.plugins.drawspaces");
|
|
+ g_object_unref (widget->settings);
|
|
+ g_slice_free (DrawspacesConfigureWidget, widget_pointer);
|
|
+
|
|
+ gedit_debug_message (DEBUG_PLUGINS, "END");
|
|
+}
|
|
+
|
|
+static void
|
|
+set_flag (DrawspacesConfigureWidget *widget, guint flag, gboolean active)
|
|
+{
|
|
+ widget->flags = active ? widget->flags | flag : widget->flags & ~flag;
|
|
+ g_settings_set_flags (widget->settings,
|
|
+ SETTINGS_KEY_DRAW_SPACES,
|
|
+ widget->flags);
|
|
+}
|
|
+
|
|
+static void
|
|
+on_draw_tabs_toggled (GtkToggleButton *button,
|
|
+ DrawspacesConfigureWidget *widget)
|
|
+{
|
|
+ set_flag (widget, GEDIT_DRAW_SPACES_TAB, gtk_toggle_button_get_active (button));
|
|
+}
|
|
+
|
|
+static void
|
|
+on_draw_spaces_toggled (GtkToggleButton *button,
|
|
+ DrawspacesConfigureWidget *widget)
|
|
+{
|
|
+ set_flag (widget, GEDIT_DRAW_SPACES_SPACE, gtk_toggle_button_get_active (button));
|
|
+}
|
|
+
|
|
+static void
|
|
+on_draw_newline_toggled (GtkToggleButton *button,
|
|
+ DrawspacesConfigureWidget *widget)
|
|
+{
|
|
+ set_flag (widget, GEDIT_DRAW_SPACES_NEWLINE, gtk_toggle_button_get_active (button));
|
|
+}
|
|
+
|
|
+static void
|
|
+on_draw_nbsp_toggled (GtkToggleButton *button,
|
|
+ DrawspacesConfigureWidget *widget)
|
|
+{
|
|
+ set_flag (widget, GEDIT_DRAW_SPACES_NBSP, gtk_toggle_button_get_active (button));
|
|
+}
|
|
+
|
|
+static void
|
|
+on_draw_leading_toggled (GtkToggleButton *button,
|
|
+ DrawspacesConfigureWidget *widget)
|
|
+{
|
|
+ set_flag (widget, GEDIT_DRAW_SPACES_LEADING, gtk_toggle_button_get_active (button));
|
|
+}
|
|
+
|
|
+static void
|
|
+on_draw_text_toggled (GtkToggleButton *button,
|
|
+ DrawspacesConfigureWidget *widget)
|
|
+{
|
|
+ set_flag (widget, GEDIT_DRAW_SPACES_TEXT, gtk_toggle_button_get_active (button));
|
|
+}
|
|
+
|
|
+static void
|
|
+on_draw_trailing_toggled (GtkToggleButton *button,
|
|
+ DrawspacesConfigureWidget *widget)
|
|
+{
|
|
+ set_flag (widget, GEDIT_DRAW_SPACES_TRAILING, gtk_toggle_button_get_active (button));
|
|
+}
|
|
+
|
|
+static DrawspacesConfigureWidget *
|
|
+get_configuration_widget (GeditDrawspacesAppActivatable *activatable)
|
|
+{
|
|
+ DrawspacesConfigureWidget *widget = NULL;
|
|
+ GtkBuilder *builder;
|
|
+
|
|
+ gchar *root_objects[] = {
|
|
+ "content",
|
|
+ NULL
|
|
+ };
|
|
+
|
|
+ widget = g_slice_new (DrawspacesConfigureWidget);
|
|
+ widget->settings = g_settings_new (DRAWSPACES_SETTINGS_BASE);
|
|
+ widget->flags = g_settings_get_flags (widget->settings,
|
|
+ SETTINGS_KEY_DRAW_SPACES);
|
|
+
|
|
+ builder = gtk_builder_new ();
|
|
+ gtk_builder_set_translation_domain (builder, GETTEXT_PACKAGE);
|
|
+ gtk_builder_add_objects_from_resource (builder, "/org/gnome/gedit/plugins/drawspaces/ui/gedit-drawspaces-configurable.ui",
|
|
+ root_objects, NULL);
|
|
+ widget->content = GTK_WIDGET (gtk_builder_get_object (builder, "content"));
|
|
+ g_object_ref (widget->content);
|
|
+ widget->draw_tabs = GTK_WIDGET (gtk_builder_get_object (builder, "check_button_draw_tabs"));
|
|
+ widget->draw_spaces = GTK_WIDGET (gtk_builder_get_object (builder, "check_button_draw_spaces"));
|
|
+ widget->draw_newline = GTK_WIDGET (gtk_builder_get_object (builder, "check_button_draw_new_lines"));
|
|
+ widget->draw_nbsp = GTK_WIDGET (gtk_builder_get_object (builder, "check_button_draw_nbsp"));
|
|
+ widget->draw_leading = GTK_WIDGET (gtk_builder_get_object (builder, "check_button_draw_leading"));
|
|
+ widget->draw_text = GTK_WIDGET (gtk_builder_get_object (builder, "check_button_draw_text"));
|
|
+ widget->draw_trailing = GTK_WIDGET (gtk_builder_get_object (builder, "check_button_draw_trailing"));
|
|
+ g_object_unref (builder);
|
|
+
|
|
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget->draw_tabs),
|
|
+ widget->flags & GEDIT_DRAW_SPACES_TAB);
|
|
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget->draw_spaces),
|
|
+ widget->flags & GEDIT_DRAW_SPACES_SPACE);
|
|
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget->draw_newline),
|
|
+ widget->flags & GEDIT_DRAW_SPACES_NEWLINE);
|
|
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget->draw_nbsp),
|
|
+ widget->flags & GEDIT_DRAW_SPACES_NBSP);
|
|
+
|
|
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget->draw_leading),
|
|
+ widget->flags & GEDIT_DRAW_SPACES_LEADING);
|
|
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget->draw_text),
|
|
+ widget->flags & GEDIT_DRAW_SPACES_TEXT);
|
|
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget->draw_trailing),
|
|
+ widget->flags & GEDIT_DRAW_SPACES_TRAILING);
|
|
+
|
|
+ g_signal_connect (widget->draw_tabs,
|
|
+ "toggled",
|
|
+ G_CALLBACK (on_draw_tabs_toggled),
|
|
+ widget);
|
|
+ g_signal_connect (widget->draw_spaces,
|
|
+ "toggled",
|
|
+ G_CALLBACK (on_draw_spaces_toggled),
|
|
+ widget);
|
|
+ g_signal_connect (widget->draw_newline,
|
|
+ "toggled",
|
|
+ G_CALLBACK (on_draw_newline_toggled),
|
|
+ widget);
|
|
+ g_signal_connect (widget->draw_nbsp,
|
|
+ "toggled",
|
|
+ G_CALLBACK (on_draw_nbsp_toggled),
|
|
+ widget);
|
|
+ g_signal_connect (widget->draw_leading,
|
|
+ "toggled",
|
|
+ G_CALLBACK (on_draw_leading_toggled),
|
|
+ widget);
|
|
+ g_signal_connect (widget->draw_text,
|
|
+ "toggled",
|
|
+ G_CALLBACK (on_draw_text_toggled),
|
|
+ widget);
|
|
+ g_signal_connect (widget->draw_trailing,
|
|
+ "toggled",
|
|
+ G_CALLBACK (on_draw_trailing_toggled),
|
|
+ widget);
|
|
+
|
|
+ g_signal_connect (widget->content,
|
|
+ "destroy",
|
|
+ G_CALLBACK (widget_destroyed),
|
|
+ widget);
|
|
+
|
|
+ return widget;
|
|
}
|
|
|
|
static GtkWidget *
|
|
gedit_drawspaces_app_activatable_create_configure_widget (PeasGtkConfigurable *configurable)
|
|
{
|
|
- GeditDrawspacesAppActivatable *activatable = GEDIT_DRAWSPACES_APP_ACTIVATABLE (configurable);
|
|
- GeditDrawspacesAppActivatablePrivate *priv = gedit_drawspaces_app_activatable_get_instance_private (activatable);
|
|
- TeplSpaceDrawerPrefs *prefs;
|
|
- GtkSourceSpaceDrawer *space_drawer;
|
|
+ DrawspacesConfigureWidget *widget;
|
|
|
|
- prefs = tepl_space_drawer_prefs_new ();
|
|
- space_drawer = tepl_space_drawer_prefs_get_space_drawer (prefs);
|
|
- gtk_source_space_drawer_bind_matrix_setting (space_drawer,
|
|
- priv->settings, "matrix",
|
|
- G_SETTINGS_BIND_DEFAULT |
|
|
- G_SETTINGS_BIND_NO_SENSITIVITY);
|
|
+ widget = get_configuration_widget (GEDIT_DRAWSPACES_APP_ACTIVATABLE (configurable));
|
|
|
|
- return GTK_WIDGET (prefs);
|
|
+ return widget->content;
|
|
}
|
|
|
|
static void
|
|
@@ -102,6 +338,9 @@ peas_register_types (PeasObjectModule *module)
|
|
gedit_drawspaces_app_activatable_register_type (G_TYPE_MODULE (module));
|
|
gedit_drawspaces_view_activatable_register (G_TYPE_MODULE (module));
|
|
|
|
+ peas_object_module_register_extension_type (module,
|
|
+ GEDIT_TYPE_APP_ACTIVATABLE,
|
|
+ GEDIT_TYPE_DRAWSPACES_APP_ACTIVATABLE);
|
|
peas_object_module_register_extension_type (module,
|
|
PEAS_GTK_TYPE_CONFIGURABLE,
|
|
GEDIT_TYPE_DRAWSPACES_APP_ACTIVATABLE);
|
|
diff --git a/plugins/drawspaces/gedit-drawspaces-app-activatable.h b/plugins/drawspaces/gedit-drawspaces-app-activatable.h
|
|
index f6a80bf..ac93ddc 100644
|
|
--- a/plugins/drawspaces/gedit-drawspaces-app-activatable.h
|
|
+++ b/plugins/drawspaces/gedit-drawspaces-app-activatable.h
|
|
@@ -1,23 +1,23 @@
|
|
/*
|
|
* Copyright (C) 2008-2014 Ignacio Casal Quinteiro <icq@gnome.org>
|
|
- * Copyright (C) 2020 Sébastien Wilmet <swilmet@gnome.org>
|
|
*
|
|
- * gedit is free software; you can redistribute it and/or modify
|
|
+ * 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 2 of the License, or
|
|
- * (at your option) any later version.
|
|
+ * the Free Software Foundation; either version 2, or (at your option)
|
|
+ * any later version.
|
|
*
|
|
- * gedit is distributed in the hope that it will be useful,
|
|
+ * 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 gedit. If not, see <http://www.gnu.org/licenses/>.
|
|
+ * along with this program; if not, write to the Free Software
|
|
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
*/
|
|
|
|
-#ifndef GEDIT_DRAWSPACES_APP_ACTIVATABLE_H
|
|
-#define GEDIT_DRAWSPACES_APP_ACTIVATABLE_H
|
|
+#ifndef __GEDIT_DRAWSPACES_APP_ACTIVATABLE_H__
|
|
+#define __GEDIT_DRAWSPACES_APP_ACTIVATABLE_H__
|
|
|
|
#include <glib-object.h>
|
|
#include <libpeas/peas-object-module.h>
|
|
@@ -26,6 +26,7 @@ G_BEGIN_DECLS
|
|
|
|
#define GEDIT_TYPE_DRAWSPACES_APP_ACTIVATABLE (gedit_drawspaces_app_activatable_get_type ())
|
|
#define GEDIT_DRAWSPACES_APP_ACTIVATABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEDIT_TYPE_DRAWSPACES_APP_ACTIVATABLE, GeditDrawspacesAppActivatable))
|
|
+#define GEDIT_DRAWSPACES_APP_ACTIVATABLE_CONST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEDIT_TYPE_DRAWSPACES_APP_ACTIVATABLE, GeditDrawspacesAppActivatable const))
|
|
#define GEDIT_DRAWSPACES_APP_ACTIVATABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEDIT_TYPE_DRAWSPACES_APP_ACTIVATABLE, GeditDrawspacesAppActivatableClass))
|
|
#define GEDIT_IS_DRAWSPACES_APP_ACTIVATABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEDIT_TYPE_DRAWSPACES_APP_ACTIVATABLE))
|
|
#define GEDIT_IS_DRAWSPACES_APP_ACTIVATABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEDIT_TYPE_DRAWSPACES_APP_ACTIVATABLE))
|
|
@@ -44,10 +45,21 @@ struct _GeditDrawspacesAppActivatableClass
|
|
GObjectClass parent_class;
|
|
};
|
|
|
|
-GType gedit_drawspaces_app_activatable_get_type (void);
|
|
+enum _GeditDrawSpacesFlags {
|
|
+ GEDIT_DRAW_SPACES_SPACE = 1 << 0,
|
|
+ GEDIT_DRAW_SPACES_TAB = 1 << 1,
|
|
+ GEDIT_DRAW_SPACES_NEWLINE = 1 << 2,
|
|
+ GEDIT_DRAW_SPACES_NBSP = 1 << 3,
|
|
+ GEDIT_DRAW_SPACES_LEADING = 1 << 4,
|
|
+ GEDIT_DRAW_SPACES_TEXT = 1 << 5,
|
|
+ GEDIT_DRAW_SPACES_TRAILING = 1 << 6,
|
|
+ GEDIT_DRAW_SPACES_ALL = 0x7f
|
|
+};
|
|
+
|
|
+GType gedit_drawspaces_app_activatable_get_type (void) G_GNUC_CONST;
|
|
|
|
G_MODULE_EXPORT void peas_register_types (PeasObjectModule *module);
|
|
|
|
G_END_DECLS
|
|
|
|
-#endif /* GEDIT_DRAWSPACES_APP_ACTIVATABLE_H */
|
|
+#endif /* __GEDIT_DRAWSPACES_APP_ACTIVATABLE_H__ */
|
|
diff --git a/plugins/drawspaces/gedit-drawspaces-configurable.ui b/plugins/drawspaces/gedit-drawspaces-configurable.ui
|
|
new file mode 100644
|
|
index 0000000..52d676d
|
|
--- /dev/null
|
|
+++ b/plugins/drawspaces/gedit-drawspaces-configurable.ui
|
|
@@ -0,0 +1,175 @@
|
|
+<?xml version="1.0" encoding="UTF-8"?>
|
|
+<interface>
|
|
+ <!-- interface-requires gtk+ 2.12 -->
|
|
+ <object class="GtkDialog" id="dialog_draw_spaces">
|
|
+ <property name="can_focus">False</property>
|
|
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
|
+ <property name="border_width">5</property>
|
|
+ <property name="window_position">center-on-parent</property>
|
|
+ <property name="type_hint">dialog</property>
|
|
+ <child internal-child="vbox">
|
|
+ <object class="GtkBox" id="dialog-vbox1">
|
|
+ <property name="visible">True</property>
|
|
+ <property name="can_focus">False</property>
|
|
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
|
+ <property name="orientation">vertical</property>
|
|
+ <property name="spacing">3</property>
|
|
+ <child internal-child="action_area">
|
|
+ <object class="GtkButtonBox" id="dialog-action_area1">
|
|
+ <property name="visible">True</property>
|
|
+ <property name="can_focus">False</property>
|
|
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
|
+ <property name="layout_style">end</property>
|
|
+ <child>
|
|
+ <object class="GtkButton" id="button1">
|
|
+ <property name="label">gtk-close</property>
|
|
+ <property name="visible">True</property>
|
|
+ <property name="can_focus">True</property>
|
|
+ <property name="receives_default">True</property>
|
|
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
|
+ <property name="use_action_appearance">False</property>
|
|
+ <property name="use_stock">True</property>
|
|
+ </object>
|
|
+ <packing>
|
|
+ <property name="expand">False</property>
|
|
+ <property name="fill">False</property>
|
|
+ <property name="position">0</property>
|
|
+ </packing>
|
|
+ </child>
|
|
+ </object>
|
|
+ <packing>
|
|
+ <property name="expand">False</property>
|
|
+ <property name="fill">True</property>
|
|
+ <property name="pack_type">end</property>
|
|
+ <property name="position">0</property>
|
|
+ </packing>
|
|
+ </child>
|
|
+ <child>
|
|
+ <object class="GtkBox" id="content">
|
|
+ <property name="visible">True</property>
|
|
+ <property name="can_focus">False</property>
|
|
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
|
+ <property name="border_width">6</property>
|
|
+ <property name="orientation">vertical</property>
|
|
+ <property name="spacing">3</property>
|
|
+ <child>
|
|
+ <object class="GtkCheckButton" id="check_button_draw_spaces">
|
|
+ <property name="label" translatable="yes">Draw spaces</property>
|
|
+ <property name="visible">True</property>
|
|
+ <property name="can_focus">True</property>
|
|
+ <property name="receives_default">False</property>
|
|
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
|
+ <property name="use_action_appearance">False</property>
|
|
+ <property name="draw_indicator">True</property>
|
|
+ </object>
|
|
+ <packing>
|
|
+ <property name="expand">False</property>
|
|
+ <property name="fill">True</property>
|
|
+ <property name="position">0</property>
|
|
+ </packing>
|
|
+ </child>
|
|
+ <child>
|
|
+ <object class="GtkCheckButton" id="check_button_draw_tabs">
|
|
+ <property name="label" translatable="yes">Draw tabs</property>
|
|
+ <property name="visible">True</property>
|
|
+ <property name="can_focus">True</property>
|
|
+ <property name="receives_default">False</property>
|
|
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
|
+ <property name="use_action_appearance">False</property>
|
|
+ <property name="draw_indicator">True</property>
|
|
+ </object>
|
|
+ <packing>
|
|
+ <property name="expand">False</property>
|
|
+ <property name="fill">True</property>
|
|
+ <property name="position">1</property>
|
|
+ </packing>
|
|
+ </child>
|
|
+ <child>
|
|
+ <object class="GtkCheckButton" id="check_button_draw_new_lines">
|
|
+ <property name="label" translatable="yes">Draw new lines</property>
|
|
+ <property name="visible">True</property>
|
|
+ <property name="can_focus">True</property>
|
|
+ <property name="receives_default">False</property>
|
|
+ <property name="use_action_appearance">False</property>
|
|
+ <property name="draw_indicator">True</property>
|
|
+ </object>
|
|
+ <packing>
|
|
+ <property name="expand">False</property>
|
|
+ <property name="fill">True</property>
|
|
+ <property name="position">2</property>
|
|
+ </packing>
|
|
+ </child>
|
|
+ <child>
|
|
+ <object class="GtkCheckButton" id="check_button_draw_nbsp">
|
|
+ <property name="label" translatable="yes">Draw non-breaking spaces</property>
|
|
+ <property name="visible">True</property>
|
|
+ <property name="can_focus">True</property>
|
|
+ <property name="receives_default">False</property>
|
|
+ <property name="use_action_appearance">False</property>
|
|
+ <property name="draw_indicator">True</property>
|
|
+ </object>
|
|
+ <packing>
|
|
+ <property name="expand">False</property>
|
|
+ <property name="fill">True</property>
|
|
+ <property name="position">3</property>
|
|
+ </packing>
|
|
+ </child>
|
|
+ <child>
|
|
+ <object class="GtkCheckButton" id="check_button_draw_leading">
|
|
+ <property name="label" translatable="yes">Draw leading spaces</property>
|
|
+ <property name="visible">True</property>
|
|
+ <property name="can_focus">True</property>
|
|
+ <property name="receives_default">False</property>
|
|
+ <property name="use_action_appearance">False</property>
|
|
+ <property name="draw_indicator">True</property>
|
|
+ </object>
|
|
+ <packing>
|
|
+ <property name="expand">False</property>
|
|
+ <property name="fill">True</property>
|
|
+ <property name="position">4</property>
|
|
+ </packing>
|
|
+ </child>
|
|
+ <child>
|
|
+ <object class="GtkCheckButton" id="check_button_draw_text">
|
|
+ <property name="label" translatable="yes">Draw spaces in text</property>
|
|
+ <property name="visible">True</property>
|
|
+ <property name="can_focus">True</property>
|
|
+ <property name="receives_default">False</property>
|
|
+ <property name="use_action_appearance">False</property>
|
|
+ <property name="draw_indicator">True</property>
|
|
+ </object>
|
|
+ <packing>
|
|
+ <property name="expand">False</property>
|
|
+ <property name="fill">True</property>
|
|
+ <property name="position">5</property>
|
|
+ </packing>
|
|
+ </child>
|
|
+ <child>
|
|
+ <object class="GtkCheckButton" id="check_button_draw_trailing">
|
|
+ <property name="label" translatable="yes">Draw trailing spaces</property>
|
|
+ <property name="visible">True</property>
|
|
+ <property name="can_focus">True</property>
|
|
+ <property name="receives_default">False</property>
|
|
+ <property name="use_action_appearance">False</property>
|
|
+ <property name="draw_indicator">True</property>
|
|
+ </object>
|
|
+ <packing>
|
|
+ <property name="expand">False</property>
|
|
+ <property name="fill">True</property>
|
|
+ <property name="position">6</property>
|
|
+ </packing>
|
|
+ </child>
|
|
+ </object>
|
|
+ <packing>
|
|
+ <property name="expand">False</property>
|
|
+ <property name="fill">True</property>
|
|
+ <property name="position">1</property>
|
|
+ </packing>
|
|
+ </child>
|
|
+ </object>
|
|
+ </child>
|
|
+ <action-widgets>
|
|
+ <action-widget response="-7">button1</action-widget>
|
|
+ </action-widgets>
|
|
+ </object>
|
|
+</interface>
|
|
diff --git a/plugins/drawspaces/gedit-drawspaces-view-activatable.c b/plugins/drawspaces/gedit-drawspaces-view-activatable.c
|
|
index c6a92b5..c50978d 100644
|
|
--- a/plugins/drawspaces/gedit-drawspaces-view-activatable.c
|
|
+++ b/plugins/drawspaces/gedit-drawspaces-view-activatable.c
|
|
@@ -1,6 +1,8 @@
|
|
/*
|
|
+ * gedit-drawspaces-view-activatable.h
|
|
+ * This file is part of gedit
|
|
+ *
|
|
* Copyright (C) 2008-2014 Ignacio Casal Quinteiro <icq@gnome.org>
|
|
- * Copyright (C) 2020 Sébastien Wilmet <swilmet@gnome.org>
|
|
*
|
|
* gedit is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
@@ -16,7 +18,9 @@
|
|
* along with gedit. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
+#include "gedit-drawspaces-app-activatable.h"
|
|
#include "gedit-drawspaces-view-activatable.h"
|
|
+
|
|
#include <gedit/gedit-view.h>
|
|
#include <gedit/gedit-view-activatable.h>
|
|
#include <libpeas/peas-object-module.h>
|
|
@@ -25,6 +29,9 @@ typedef struct _GeditDrawspacesViewActivatablePrivate
|
|
{
|
|
GeditView *view;
|
|
GSettings *settings;
|
|
+ guint flags;
|
|
+
|
|
+ guint enable : 1;
|
|
} GeditDrawspacesViewActivatablePrivate;
|
|
|
|
enum
|
|
@@ -50,7 +57,6 @@ gedit_drawspaces_view_activatable_dispose (GObject *object)
|
|
GeditDrawspacesViewActivatablePrivate *priv = gedit_drawspaces_view_activatable_get_instance_private (activatable);
|
|
|
|
g_clear_object (&priv->view);
|
|
- g_clear_object (&priv->settings);
|
|
|
|
G_OBJECT_CLASS (gedit_drawspaces_view_activatable_parent_class)->dispose (object);
|
|
}
|
|
@@ -115,47 +121,133 @@ gedit_drawspaces_view_activatable_class_finalize (GeditDrawspacesViewActivatable
|
|
}
|
|
|
|
static void
|
|
-gedit_drawspaces_view_activatable_init (GeditDrawspacesViewActivatable *activatable)
|
|
+gedit_drawspaces_view_activatable_init (GeditDrawspacesViewActivatable *self)
|
|
+{
|
|
+}
|
|
+
|
|
+static void
|
|
+get_config_options (GeditDrawspacesViewActivatable *activatable)
|
|
+{
|
|
+ GeditDrawspacesViewActivatablePrivate *priv = gedit_drawspaces_view_activatable_get_instance_private (activatable);
|
|
+
|
|
+ priv->enable = g_settings_get_boolean (priv->settings,
|
|
+ SETTINGS_KEY_SHOW_WHITE_SPACE);
|
|
+
|
|
+ priv->flags = g_settings_get_flags (priv->settings,
|
|
+ SETTINGS_KEY_DRAW_SPACES);
|
|
+}
|
|
+
|
|
+static inline void
|
|
+parse_flags (guint flags,
|
|
+ GtkSourceSpaceTypeFlags *type,
|
|
+ GtkSourceSpaceLocationFlags *location)
|
|
+{
|
|
+ *type = GTK_SOURCE_SPACE_TYPE_NONE;
|
|
+ *location = GTK_SOURCE_SPACE_LOCATION_NONE;
|
|
+
|
|
+ if (flags & GEDIT_DRAW_SPACES_SPACE)
|
|
+ *type |= GTK_SOURCE_SPACE_TYPE_SPACE;
|
|
+ if (flags & GEDIT_DRAW_SPACES_TAB)
|
|
+ *type |= GTK_SOURCE_SPACE_TYPE_TAB;
|
|
+ if (flags & GEDIT_DRAW_SPACES_NEWLINE)
|
|
+ *type |= GTK_SOURCE_SPACE_TYPE_NEWLINE;
|
|
+ if (flags & GEDIT_DRAW_SPACES_NBSP)
|
|
+ *type |= GTK_SOURCE_SPACE_TYPE_NBSP;
|
|
+
|
|
+ if (flags & GEDIT_DRAW_SPACES_LEADING)
|
|
+ *location |= GTK_SOURCE_SPACE_LOCATION_LEADING;
|
|
+ if (flags & GEDIT_DRAW_SPACES_TEXT)
|
|
+ *location |= GTK_SOURCE_SPACE_LOCATION_INSIDE_TEXT;
|
|
+ if (flags & GEDIT_DRAW_SPACES_TRAILING)
|
|
+ *location |= GTK_SOURCE_SPACE_LOCATION_TRAILING;
|
|
+}
|
|
+
|
|
+static void
|
|
+draw_spaces (GeditDrawspacesViewActivatable *activatable)
|
|
+{
|
|
+ GeditDrawspacesViewActivatablePrivate *priv = gedit_drawspaces_view_activatable_get_instance_private (activatable);
|
|
+ GtkSourceSpaceDrawer *drawer;
|
|
+ GtkSourceSpaceTypeFlags type;
|
|
+ GtkSourceSpaceLocationFlags location;
|
|
+
|
|
+ parse_flags (priv->flags, &type, &location);
|
|
+
|
|
+ drawer = gtk_source_view_get_space_drawer (GTK_SOURCE_VIEW (priv->view));
|
|
+
|
|
+ /* Clear all existing spaces in the matrix before setting */
|
|
+ gtk_source_space_drawer_set_types_for_locations (drawer, GTK_SOURCE_SPACE_LOCATION_ALL, 0);
|
|
+ gtk_source_space_drawer_set_types_for_locations (drawer, location, type);
|
|
+ gtk_source_space_drawer_set_enable_matrix (drawer, priv->enable);
|
|
+}
|
|
+
|
|
+static void
|
|
+on_draw_spaces_changed (GSettings *settings,
|
|
+ const gchar *key,
|
|
+ GeditDrawspacesViewActivatable *activatable)
|
|
{
|
|
GeditDrawspacesViewActivatablePrivate *priv = gedit_drawspaces_view_activatable_get_instance_private (activatable);
|
|
|
|
- priv->settings = g_settings_new ("org.gnome.gedit.plugins.drawspaces");
|
|
+ priv->flags = g_settings_get_flags (priv->settings,
|
|
+ SETTINGS_KEY_DRAW_SPACES);
|
|
+
|
|
+ draw_spaces (activatable);
|
|
}
|
|
|
|
static void
|
|
-gedit_drawspaces_view_activatable_activate (GeditViewActivatable *activatable)
|
|
+on_show_white_space_changed (GSettings *settings,
|
|
+ const gchar *key,
|
|
+ GeditDrawspacesViewActivatable *activatable)
|
|
+{
|
|
+ GeditDrawspacesViewActivatablePrivate *priv = gedit_drawspaces_view_activatable_get_instance_private (activatable);
|
|
+
|
|
+ priv->enable = g_settings_get_boolean (settings, key);
|
|
+
|
|
+ draw_spaces (activatable);
|
|
+}
|
|
+
|
|
+static void
|
|
+gedit_drawspaces_view_activatable_window_activate (GeditViewActivatable *activatable)
|
|
{
|
|
GeditDrawspacesViewActivatablePrivate *priv;
|
|
- GtkSourceSpaceDrawer *space_drawer;
|
|
|
|
priv = gedit_drawspaces_view_activatable_get_instance_private (GEDIT_DRAWSPACES_VIEW_ACTIVATABLE (activatable));
|
|
+ priv->settings = g_settings_new (DRAWSPACES_SETTINGS_BASE);
|
|
+
|
|
+ get_config_options (GEDIT_DRAWSPACES_VIEW_ACTIVATABLE (activatable));
|
|
|
|
- space_drawer = gtk_source_view_get_space_drawer (GTK_SOURCE_VIEW (priv->view));
|
|
- gtk_source_space_drawer_bind_matrix_setting (space_drawer,
|
|
- priv->settings, "matrix",
|
|
- G_SETTINGS_BIND_GET |
|
|
- G_SETTINGS_BIND_NO_SENSITIVITY);
|
|
- gtk_source_space_drawer_set_enable_matrix (space_drawer, TRUE);
|
|
+ if (priv->enable)
|
|
+ {
|
|
+ draw_spaces (GEDIT_DRAWSPACES_VIEW_ACTIVATABLE (activatable));
|
|
+ }
|
|
+
|
|
+ g_signal_connect (priv->settings,
|
|
+ "changed::show-white-space",
|
|
+ G_CALLBACK (on_show_white_space_changed),
|
|
+ activatable);
|
|
+ g_signal_connect (priv->settings,
|
|
+ "changed::draw-spaces",
|
|
+ G_CALLBACK (on_draw_spaces_changed),
|
|
+ activatable);
|
|
}
|
|
|
|
static void
|
|
-gedit_drawspaces_view_activatable_deactivate (GeditViewActivatable *activatable)
|
|
+gedit_drawspaces_view_activatable_window_deactivate (GeditViewActivatable *activatable)
|
|
{
|
|
GeditDrawspacesViewActivatablePrivate *priv;
|
|
- GtkSourceSpaceDrawer *space_drawer;
|
|
|
|
priv = gedit_drawspaces_view_activatable_get_instance_private (GEDIT_DRAWSPACES_VIEW_ACTIVATABLE (activatable));
|
|
|
|
- space_drawer = gtk_source_view_get_space_drawer (GTK_SOURCE_VIEW (priv->view));
|
|
- g_settings_unbind (space_drawer, "matrix");
|
|
- gtk_source_space_drawer_set_enable_matrix (space_drawer, FALSE);
|
|
+ priv->enable = FALSE;
|
|
+ draw_spaces (GEDIT_DRAWSPACES_VIEW_ACTIVATABLE (activatable));
|
|
+
|
|
+ g_clear_object (&priv->settings);
|
|
}
|
|
|
|
static void
|
|
gedit_view_activatable_iface_init (GeditViewActivatableInterface *iface)
|
|
{
|
|
- iface->activate = gedit_drawspaces_view_activatable_activate;
|
|
- iface->deactivate = gedit_drawspaces_view_activatable_deactivate;
|
|
+ iface->activate = gedit_drawspaces_view_activatable_window_activate;
|
|
+ iface->deactivate = gedit_drawspaces_view_activatable_window_deactivate;
|
|
}
|
|
|
|
void
|
|
diff --git a/plugins/drawspaces/gedit-drawspaces-view-activatable.h b/plugins/drawspaces/gedit-drawspaces-view-activatable.h
|
|
index e4114ce..4968369 100644
|
|
--- a/plugins/drawspaces/gedit-drawspaces-view-activatable.h
|
|
+++ b/plugins/drawspaces/gedit-drawspaces-view-activatable.h
|
|
@@ -1,6 +1,8 @@
|
|
/*
|
|
+ * gedit-drawspaces-view-activatable.h
|
|
+ * This file is part of gedit
|
|
+ *
|
|
* Copyright (C) 2008-2014 Ignacio Casal Quinteiro <icq@gnome.org>
|
|
- * Copyright (C) 2020 Sébastien Wilmet <swilmet@gnome.org>
|
|
*
|
|
* gedit is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
@@ -16,8 +18,8 @@
|
|
* along with gedit. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
-#ifndef GEDIT_DRAWSPACES_VIEW_ACTIVATABLE_H
|
|
-#define GEDIT_DRAWSPACES_VIEW_ACTIVATABLE_H
|
|
+#ifndef __GEDIT_DRAWSPACES_VIEW_ACTIVATABLE_H__
|
|
+#define __GEDIT_DRAWSPACES_VIEW_ACTIVATABLE_H__
|
|
|
|
#include <glib-object.h>
|
|
|
|
@@ -25,11 +27,16 @@ G_BEGIN_DECLS
|
|
|
|
#define GEDIT_TYPE_DRAWSPACES_VIEW_ACTIVATABLE (gedit_drawspaces_view_activatable_get_type ())
|
|
#define GEDIT_DRAWSPACES_VIEW_ACTIVATABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEDIT_TYPE_DRAWSPACES_VIEW_ACTIVATABLE, GeditDrawspacesViewActivatable))
|
|
+#define GEDIT_DRAWSPACES_VIEW_ACTIVATABLE_CONST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEDIT_TYPE_DRAWSPACES_VIEW_ACTIVATABLE, GeditDrawspacesViewActivatable const))
|
|
#define GEDIT_DRAWSPACES_VIEW_ACTIVATABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEDIT_TYPE_DRAWSPACES_VIEW_ACTIVATABLE, GeditDrawspacesViewActivatableClass))
|
|
#define GEDIT_IS_DRAWSPACES_VIEW_ACTIVATABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEDIT_TYPE_DRAWSPACES_VIEW_ACTIVATABLE))
|
|
#define GEDIT_IS_DRAWSPACES_VIEW_ACTIVATABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEDIT_TYPE_DRAWSPACES_VIEW_ACTIVATABLE))
|
|
#define GEDIT_DRAWSPACES_VIEW_ACTIVATABLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEDIT_TYPE_DRAWSPACES_VIEW_ACTIVATABLE, GeditDrawspacesViewActivatableClass))
|
|
|
|
+#define DRAWSPACES_SETTINGS_BASE "org.gnome.gedit.plugins.drawspaces"
|
|
+#define SETTINGS_KEY_SHOW_WHITE_SPACE "show-white-space"
|
|
+#define SETTINGS_KEY_DRAW_SPACES "draw-spaces"
|
|
+
|
|
typedef struct _GeditDrawspacesViewActivatable GeditDrawspacesViewActivatable;
|
|
typedef struct _GeditDrawspacesViewActivatableClass GeditDrawspacesViewActivatableClass;
|
|
|
|
@@ -43,12 +50,12 @@ struct _GeditDrawspacesViewActivatableClass
|
|
GObjectClass parent_class;
|
|
};
|
|
|
|
-GType gedit_drawspaces_view_activatable_get_type (void);
|
|
+GType gedit_drawspaces_view_activatable_get_type (void) G_GNUC_CONST;
|
|
|
|
void gedit_drawspaces_view_activatable_register (GTypeModule *module);
|
|
|
|
G_END_DECLS
|
|
|
|
-#endif /* GEDIT_DRAWSPACES_VIEW_ACTIVATABLE_H */
|
|
+#endif /* __GEDIT_DRAWSPACES_VIEW_ACTIVATABLE_H__ */
|
|
|
|
/* ex:set ts=8 noet: */
|
|
diff --git a/plugins/drawspaces/gedit-drawspaces.gresource.xml b/plugins/drawspaces/gedit-drawspaces.gresource.xml
|
|
new file mode 100644
|
|
index 0000000..1e09e4d
|
|
--- /dev/null
|
|
+++ b/plugins/drawspaces/gedit-drawspaces.gresource.xml
|
|
@@ -0,0 +1,6 @@
|
|
+<?xml version="1.0" encoding="UTF-8"?>
|
|
+<gresources>
|
|
+ <gresource prefix="/org/gnome/gedit/plugins/drawspaces/ui">
|
|
+ <file preprocess="xml-stripblanks">gedit-drawspaces-configurable.ui</file>
|
|
+ </gresource>
|
|
+</gresources>
|
|
diff --git a/plugins/drawspaces/meson.build b/plugins/drawspaces/meson.build
|
|
index d8d6acb..75610cb 100644
|
|
--- a/plugins/drawspaces/meson.build
|
|
+++ b/plugins/drawspaces/meson.build
|
|
@@ -7,6 +7,15 @@ libdrawspaces_deps = [
|
|
gedit_dep,
|
|
]
|
|
|
|
+libdrawspaces_res = gnome.compile_resources(
|
|
+ 'gedit-drawspaces-resources',
|
|
+ 'gedit-drawspaces.gresource.xml',
|
|
+)
|
|
+
|
|
+libdrawspaces_sources += [
|
|
+ libdrawspaces_res.get(0),
|
|
+]
|
|
+
|
|
libdrawspaces_sha = shared_module(
|
|
'drawspaces',
|
|
sources: libdrawspaces_sources,
|
|
diff --git a/plugins/drawspaces/org.gnome.gedit.plugins.drawspaces.gschema.xml b/plugins/drawspaces/org.gnome.gedit.plugins.drawspaces.gschema.xml
|
|
index 3f288d3..a05f96d 100644
|
|
--- a/plugins/drawspaces/org.gnome.gedit.plugins.drawspaces.gschema.xml
|
|
+++ b/plugins/drawspaces/org.gnome.gedit.plugins.drawspaces.gschema.xml
|
|
@@ -1,8 +1,24 @@
|
|
-<?xml version="1.0" encoding="UTF-8"?>
|
|
-<schemalist gettext-domain="gedit-plugins">
|
|
- <schema id="org.gnome.gedit.plugins.drawspaces" path="/org/gnome/gedit/plugins/drawspaces/">
|
|
- <key name="matrix" type="au">
|
|
- <default>[uint32 11, 11, 11]</default>
|
|
+<schemalist>
|
|
+ <flags id='org.gnome.gedit.plugins.drawspaces.GtkSourceDrawSpacesFlags'>
|
|
+ <value nick='space' value='1'/>
|
|
+ <value nick='tab' value='2'/>
|
|
+ <value nick='newline' value='4'/>
|
|
+ <value nick='nbsp' value='8'/>
|
|
+ <value nick='leading' value='16'/>
|
|
+ <value nick='text' value='32'/>
|
|
+ <value nick='trailing' value='64'/>
|
|
+ </flags>
|
|
+
|
|
+ <schema gettext-domain="gedit-plugins" id="org.gnome.gedit.plugins.drawspaces" path="/org/gnome/gedit/plugins/drawspaces/">
|
|
+ <key name="show-white-space" type="b">
|
|
+ <default>true</default>
|
|
+ <summary>Show White Space</summary>
|
|
+ <description>If TRUE drawing will be enabled.</description>
|
|
+ </key>
|
|
+ <key name="draw-spaces" flags="org.gnome.gedit.plugins.drawspaces.GtkSourceDrawSpacesFlags">
|
|
+ <default>['space', 'tab', 'leading', 'text', 'trailing']</default>
|
|
+ <summary>Draw Spaces</summary>
|
|
+ <description>The type of spaces to be drawn.</description>
|
|
</key>
|
|
</schema>
|
|
</schemalist>
|
|
diff --git a/po/POTFILES.in b/po/POTFILES.in
|
|
index ba022d7..5b19b7b 100644
|
|
--- a/po/POTFILES.in
|
|
+++ b/po/POTFILES.in
|
|
@@ -24,6 +24,7 @@ plugins/commander/commander.plugin.desktop.in.in
|
|
plugins/commander/gedit-commander.metainfo.xml.in
|
|
plugins/drawspaces/drawspaces.plugin.desktop.in.in
|
|
plugins/drawspaces/gedit-drawspaces-app-activatable.c
|
|
+plugins/drawspaces/gedit-drawspaces-configurable.ui
|
|
plugins/drawspaces/gedit-drawspaces.metainfo.xml.in
|
|
plugins/drawspaces/org.gnome.gedit.plugins.drawspaces.gschema.xml
|
|
plugins/findinfiles/dialog.ui
|
|
--
|
|
2.30.2
|
|
|
|
|
|
From 401f44f0634ef3d06515ae8624acde533a8b4c7f Mon Sep 17 00:00:00 2001
|
|
From: Jordan Petridis <jordan@centricular.com>
|
|
Date: Sat, 10 Apr 2021 03:58:29 +0300
|
|
Subject: [PATCH 2/2] Revert "Use the TeplBuffer::tepl-cursor-moved signal"
|
|
|
|
This reverts commit 9fe4fbf445b0004ee2b7cd0e76c2944a33c6ae70.
|
|
---
|
|
plugins/synctex/synctex/synctex.py | 2 +-
|
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
|
|
diff --git a/plugins/synctex/synctex/synctex.py b/plugins/synctex/synctex/synctex.py
|
|
index 9186c3c..1badf51 100644
|
|
--- a/plugins/synctex/synctex/synctex.py
|
|
+++ b/plugins/synctex/synctex/synctex.py
|
|
@@ -201,7 +201,7 @@ class SynctexViewHelper:
|
|
|
|
if self.active and self.window_proxy is None:
|
|
self._doc_active_handlers = [
|
|
- self._doc.connect('tepl-cursor-moved', self.on_cursor_moved),
|
|
+ self._doc.connect('cursor-moved', self.on_cursor_moved),
|
|
self._doc.connect('notify::style-scheme', self.on_notify_style_scheme)]
|
|
self._view_active_handlers = [
|
|
self._view.connect('key-press-event', self.on_key_press),
|
|
--
|
|
2.30.2
|
|
|