Commit fa587e03 authored by Zander Brown's avatar Zander Brown 🔲 Committed by Jordi Mas
Browse files

deteplification: the mega commit

This commit is a reverse patch of a rebased version of gedit with
commits related to tepl/amtk removed

Sébastien Wilmet has stopped development of these libraries, relevant
commits:

https://gitlab.gnome.org/GNOME/amtk/-/commit/34a1171298808e5d9bd50540ee194b8be35bce9d
https://gitlab.gnome.org/GNOME/tepl/-/commit/457b5c37ebcb2ebb23cae10cd47f1342db45a98e

As a result usage is being dropped in favour simplifing gedit
dependencies, because there are not enough developers, and too many bugs.
Do you prefer a rock-solid text editor? Or a text editor with some shiny
and non-essential dependencies that complicate the build, at the expense
of more bugs?

Tracked at: Infrastructure/Infrastructure#564

Commits Dropped:
cfeb7cb6 build: add Tepl dependency, second try
872fb480 Utils: use str truncate functions from Tepl
9a121d52 Utils: deprecate str_end_truncate()
e0e60279 No longer use gedit_utils_str_end_truncate()
657ce9f7 Utils: deprecate str_middle_truncate()
6eefa74c No longer use gedit_utils_str_middle_truncate()
169c1594 main: call tepl_init() and tepl_finalize()
ec31f0c2 snap: Fixed build failures by added tepl part
76cf5562 Document: remove metadata implementation
75cdb6a7 Document: second pass to remove metadata implementation
d6b158ca App: remove the GeditMetadataManager
6eccd667 Remove GeditMetadataManager
03929157 build: remove enable-gvfs-metadata option
1dad3bce build: remove libxml dependency
8c082542 metadata: adapt key names for TeplFileMetadata
c2904aa8 Document: metadata: create an internal TeplFile
9c8ede1e App: setup Tepl metadata manager
91bc04ef App: remove leftover comment
b39dd020 Document: use TeplFileMetadata to re-implement set/get_metadata()
494677bf Utils: use tepl_utils_replace_home_dir_with_tilde()
aaaa28a8 docs: gtk-doc fixxref: fix the path for gtk and add path for tepl
8710e89d Remove GeditViewCentering
5e0909c1 ViewFrame: disable overlay scrolling for the GtkScrolledWindow
7c7296b0 Remove overview map: remove from preferences dialog
26899e0b Remove overview map
27f54a9a replace-open-button: remove OpenDocumentSelector
504ced5a replace-open-button: Window: remove open document popover
3a8c5bbc replace-open-button: remove open button UI
abab6529 replace-open-button: re-create a simple Open button
1ee984a4 replace-open-button: re-create simple Open Recent menu button (UI)
f1a58a70 replace-open-button: set Open Recent menu with Amtk
020e0b34 replace-open-button: re-handle the fullscreen mode
4dfd2104 Window: remove dead code (#defines)
0caf371b Window: make the code a little clearer wrt fullscreen mode
584aeb20 Window: rename fullscreen_controls -> fullscreen_revealer
75705bf1 Window: some code cleanup wrt fullscreen mode
cf0d6261 Window: simplify setting the state of the fullscreen revealer
8706e562 Window: fullscreen mode: remove idle function
6361b281 Window: fullscreen mode: remove no longer needed code
8d3e6faf Window: fullscreen mode: fix headerbar shown/hidden "stuttering"
a437e524 Window: fullscreen mode: add comment about the "stuttering" fix
d064c5f8 Window: remove useless #include
15833e5c build: list of deps: simplify
007caff5 build: list of deps: simplify version requirements
72dc3a47 build: avoid the use of a variable
4a49c856 flatpak: update Amtk to 5.0.2
9ab7b0f0 utils: remove GBOOLEAN_TO_POINTER() and GPOINTER_TO_BOOLEAN()
55c5f142 Utils: deprecate gedit_warning()
cbdd3a85 PreferencesDialog: use tepl_utils_show_warning_dialog()
7a442c76 Utils: deprecate decode_uri(), use the tepl one
bf3d5700 Use tepl_utils_decode_uri()
2e45bb03 io-error-info-bar: remove useless #include's
09241111 io-error-info-bar: use TeplInfoBar for the file_already_open_warning
8ccb4566 io-error-info-bar: file_already_open_warning moved to Tepl
8bfe0559 io-error-info-bar: use TeplInfoBar for no_backup_saving_error
ca582d2c io-error-info-bar: fix fixme in no_backup_saving_error
fa175808 io-error-info-bar: no_backup_saving_error: show also error->message
321eccdd io-error-info-bar: no_back_saving_error moved to Tepl
7bb88011 io-error-info-bar: tepl function renamed to have a shorter name
d1a14a06 io-error-info-bar: externally_modified: use TeplInfoBar
bf60cc1a io-error-info-bar: invalid_character: TeplInfoBar + other improvements
44cff979 io-error-info-bar: externally_modified: remove unneeded code
873ed25f io-error-info-bar: externally_modified: further simplify the code
a8a4724f io-error-info-bar: externally_modified: moved to Tepl
ec8d8c71 io-error-info-bar: invalid_character: moved to Tepl
2aae17c3 flatpak: switch Tepl to Meson
9caadded Window: fix RTL bug for Open buttons in the headerbar
82d8c507 View: subclass TeplView
e23569c5 View: deprecate lots of functions, use the TeplView ones
291eb9c8 commands-edit: use TeplView functions
00f8c5e6 Use tepl_view_scroll_to_cursor()
5fdeaee2 Document: deprecate goto_line() and goto_line_offset()
d87bf25b commands-file: use tepl_view_goto_line*()
fd5500d9 Tab: use tepl_view_goto_line_offset()
3c8a1dcb ViewFrame: use tepl_view_goto_line*()
079f9699 pkg-config file: add Tepl as public dep
cf6281d0 docs: document that gedit is in the process of using more Tepl features
9ac62a6f build: require Tepl 5
3f84484d App: port to new Tepl metadata API
9b9fa6c7 Document: port to new Tepl metadata API
491280c0 docs: roadmap: link to new Tepl roadmap
49db2a66 PreferencesDialog: use TeplStyleSchemeChooserWidget to fix several bugs
94c3b70c PreferencesDialog: improvements to color scheme management
53cfa171 PreferencesDialog: fix some bugs when (un)installing color schemes
da5b9af9 snap: the tepl build is meson only now
012a07cb snap: use the correct option to specify parameters
325aa857 Factory: class skeleton
7b857977 Factory: implement ::create_metadata_manager_file vfunc
d5a43cec Factory: create it in main() and set it as the TeplAbstractFactory
39254519 App: use tepl_application_handle_metadata()
8b2fa909 Keep default buttons orientation for TeplInfoBars
efe48bbe flatpak: remove uchardet, Tepl no longer depends on it
5e588d97 PreferencesDialog: improve code to install extra style scheme
eada68d9 PreferencesDialog: use GtkFileChooserNative, not GeditFileChooserDialog
55fc5973 FileChooserDialog: remove hide() (now dead code)
4f5a5681 FileChooserDialog: remove add_pattern_filter() (now dead code)
105ca1de File choosers: remove GeditFileChooserFlags
ff1e9c27 Update Romanian translation
b4a52f47 Merge branch 'master' of gitlab.gnome.org:GNOME/gedit
21d94f23 Remove all the deprecated API
4b5838b1 docs: update path to Amtk docs for the gtk-doc fixxref_args
a4cf3ac5 Use tepl_pango_font_description_to_css()
205bfc85 Window: port to TeplLanguageChooserWidget
ffedbc88 commands-view: port to TeplLanguageChooserDialog
1dc32529 Remove GeditHighlightModeSelector and GeditHighlightModeDialog
e487680b Use Tepl 6 (currently 5.99)
ee465ef0 Tab: port to TeplProgressInfoBar
bc992e11 Remove GeditProgressInfoBar, replaced by TeplProgressInfoBar
fa9d6aea docs: document the GeditProgressInfoBar removal
bb4ba554 docs: document that all deprecated APIs have been removed
32535180 GeditDocument: subclass TeplBuffer
8b01acac GeditDocument: remove the ::cursor-moved signal
b938c50f Use the TeplBuffer::tepl-cursor-moved signal
6b6a6e59 GeditDocument: bind GtkSourceFile and TeplFile :location properties
f73828fe GeditDocument: remove unused instance variable
01d8a157 flatpak: build amtk from git master, not from an archive
6e78a57c GeditDocument: use tepl_file_get_short_name()
49749c38 GeditDocument: remove untitled_number handling
844f6185 Tab: use TeplFile:short-name property notification
49c0c814 GeditDocument: remove the :shortname property
a4670d7c help: "Untitled Document" -> "Untitled File"
4d4d5d48 Use tepl_buffer_is_untouched()
b0f67d39 GeditDocument: remove is_untouched()
85b00705 GeditDocument: use the TeplFile location in is_untitled()
4df850fb View: use TeplSignalGroup
ef0d0ca9 View: minor code changes
284e6c05 View: make set_font() private
6b1e782d View: code refactorings for set_font()
ce790b51 View: use tepl_utils_override_font()
79b3e301 GeditSettings: remove no longer needed code
da4b3e61 GeditSettings: minor code change: removed unused function param
13033aff GeditSettings: rework fonts changes handling, add ::fonts-changed signal
878ceb98 GeditSettings: minor code change, improve get_system_font()
1e89921a GeditSettings: add get_selected_font()
9ef4cf7e View: simplify the code to update the font
3a3de93b debug: remove DEBUG_METADATA (dead code)
43925dac recent: use the TeplFile
2f7c4a69 recent: move some functions to gedit-recent-osx
87b1f50d recent-osx: add TODO comment

Brought to you by GitLens, which honesntly has been very useful
unpicking all this and sticking it back together again
parent 1d5b8b10
Pipeline #274227 passed with stage
in 7 minutes and 33 seconds
News in [unreleased]
----------------------------
* Deteplification:
- The tepl maintainer has "frozen" the project until further notice
- Moving things to tepl introduced some breakage, such as translation of the
default filename
- gedit didn't use much of the API anyway
- Used even less of amtk
- Revert all usage of amtk and tepl
- Unfortunatly a couple bug fixes may have been lost
- Plugin API is essentially reverted to 3.36
News in 40, 2021-03-19
----------------------------
* Remove all the deprecated API.
......
......@@ -59,17 +59,12 @@ modules:
url: https://download.gnome.org/sources/gspell/1.9/gspell-1.9.1.tar.xz
sha256: dcbb769dfdde8e3c0a8ed3102ce7e661abbf7ddf85df08b29915e92cd723abdd
- name: amtk
buildsystem: meson
- name: uchardet
buildsystem: cmake-ninja
sources:
- type: git
url: https://gitlab.gnome.org/GNOME/amtk.git
- name: tepl
buildsystem: meson
sources:
- type: git
url: https://gitlab.gnome.org/GNOME/tepl.git
- type: archive
url: https://www.freedesktop.org/software/uchardet/releases/uchardet-0.0.6.tar.xz
sha256: 8351328cdfbcb2432e63938721dd781eb8c11ebc56e3a89d0f84576b96002c61
- name: gedit
buildsystem: meson
......
......@@ -41,30 +41,6 @@ apps:
GTK_USE_PORTAL: 1
parts:
amtk:
source: https://gitlab.gnome.org/GNOME/amtk.git
source-type: git
plugin: autotools
configflags:
- --prefix=/usr
- --enable-introspection=no
organize:
snap/gedit/current/usr: usr
tepl:
after: [amtk, gtksourceview]
source: https://gitlab.gnome.org/GNOME/tepl.git
source-type: git
plugin: meson
meson-parameters:
- --prefix=/usr
organize:
snap/gedit/current/usr: usr
build-packages:
- libuchardet-dev
stage-packages:
- libuchardet0
gtksourceview:
source: https://gitlab.gnome.org/GNOME/gtksourceview.git
source-type: git
......@@ -94,7 +70,7 @@ parts:
cp $SNAPCRAFT_PART_INSTALL/usr/share/vala/vapi/gtksource* /usr/share/vala/vapi
gedit:
after: [gtksourceview, tepl]
after: [gtksourceview]
source: .
source-type: git
parse-info: [usr/share/metainfo/org.gnome.gedit.appdata.xml]
......@@ -102,6 +78,7 @@ parts:
meson-parameters:
- --prefix=/usr
- -Dvala_args="--vapidir=$SNAPCRAFT_STAGE/usr/share/vala/vapi"
build-environment:
- C_INCLUDE_PATH: $SNAPCRAFT_STAGE/usr/include/gtksourceview-4
override-build: |
......
......@@ -126,6 +126,11 @@
<summary>Right Margin Position</summary>
<description>Specifies the position of the right margin.</description>
</key>
<key name="display-overview-map" type="b">
<default>false</default>
<summary>Display Overview Map</summary>
<description>Whether gedit should display the overview map for the document.</description>
</key>
<key name="background-pattern" enum="org.gnome.gedit.BackgroundPatternType">
<default>'none'</default>
<summary>Document background pattern type</summary>
......
......@@ -31,11 +31,9 @@ editor. To learn that widget API, read the excellent
mostly valid). But GtkTextView is not enough for source code edition. gedit
actually uses the
[GtkSourceView](https://wiki.gnome.org/Projects/GtkSourceView) library, which
contains a subclass of GtkTextView with many features useful for a text editor
or an IDE. But GtkSourceView is not enough to have a full-blown text editor,
gedit is actually in the process of using more features from the
[Tepl](https://wiki.gnome.org/Projects/Tepl) library, and to further develop
Tepl alongside gedit.
contains a subclass of GtkTextView with syntax highlighting, a completion
framework, the search and replace, and many other features useful for a text
editor or an IDE.
For its plugin system, gedit uses the
[libpeas](https://wiki.gnome.org/Projects/Libpeas) library.
......
......@@ -21,6 +21,56 @@
<link linkend="api-index-deprecated">index of deprecated symbols</link>.
</para>
<refsect1>
<title>40 -> 41</title>
<itemizedlist>
<listitem>
<para>
The <code>GeditProgressInfoBar</code> class has been restored
</para>
</listitem>
<listitem>
<para>
<link linkend="GeditDocument">GeditDocument</link> is no longer a subclass
of <link linkend="TeplBuffer">TeplBuffer</link>.
</para>
</listitem>
<listitem>
<para>
The <code>GeditDocument::cursor-moved</code> signal has been restored.
</para>
</listitem>
<listitem>
<para>
The <code>GeditDocument:shortname</code> property has been restored.
</para>
</listitem>
<listitem>
<para>
The <code>gedit_document_is_untouched()</code> function has been
restored.
</para>
</listitem>
<listitem>
<para>
The <code>gedit_view_set_font()</code> function has been restored.
</para>
</listitem>
<listitem>
<para>
<code>DEBUG_METADATA</code> has been restored.
</para>
</listitem>
<listitem>
<para>
The <code>GBOOLEAN_TO_POINTER()</code> and
<code>GPOINTER_TO_BOOLEAN()</code> macros have been restored to
<code>gedit-utils.h</code>.
</para>
</listitem>
</itemizedlist>
</refsect1>
<refsect1>
<title>3.38 -> 40</title>
<itemizedlist>
......
......@@ -16,6 +16,7 @@
<xi:include href="xml/gedit-menu-extension.xml"/>
<xi:include href="xml/gedit-message-bus.xml"/>
<xi:include href="xml/gedit-message.xml"/>
<xi:include href="xml/gedit-progress-info-bar.xml"/>
<xi:include href="xml/gedit-statusbar.xml"/>
<xi:include href="xml/gedit-tab.xml"/>
<xi:include href="xml/gedit-view.xml"/>
......
......@@ -54,7 +54,10 @@ gedit_document_new
gedit_document_get_file
gedit_document_get_short_name_for_display
gedit_document_get_mime_type
gedit_document_is_untouched
gedit_document_is_untitled
gedit_document_goto_line
gedit_document_goto_line_offset
gedit_document_set_language
gedit_document_get_content_type
gedit_document_get_metadata
......@@ -148,6 +151,26 @@ GEDIT_MESSAGE_GET_CLASS
GeditMessagePrivate
</SECTION>
<SECTION>
<FILE>gedit-progress-info-bar</FILE>
<TITLE>GeditProgressInfoBar</TITLE>
GeditProgressInfoBar
gedit_progress_info_bar_new
gedit_progress_info_bar_set_icon_name
gedit_progress_info_bar_set_markup
gedit_progress_info_bar_set_text
gedit_progress_info_bar_set_fraction
gedit_progress_info_bar_pulse
<SUBSECTION Standard>
GEDIT_PROGRESS_INFO_BAR
GEDIT_IS_PROGRESS_INFO_BAR
GEDIT_TYPE_PROGRESS_INFO_BAR
gedit_progress_info_bar_get_type
GEDIT_PROGRESS_INFO_BAR_CLASS
GEDIT_IS_PROGRESS_INFO_BAR_CLASS
GEDIT_PROGRESS_INFO_BAR_GET_CLASS
</SECTION>
<SECTION>
<FILE>gedit-statusbar</FILE>
<TITLE>GeditStatusbar</TITLE>
......@@ -199,6 +222,13 @@ GeditViewPrivate
<TITLE>GeditView</TITLE>
GeditView
gedit_view_new
gedit_view_cut_clipboard
gedit_view_copy_clipboard
gedit_view_paste_clipboard
gedit_view_delete_selection
gedit_view_select_all
gedit_view_scroll_to_cursor
gedit_view_set_font
<SUBSECTION Standard>
GEDIT_VIEW
GEDIT_IS_VIEW
......@@ -291,6 +321,7 @@ DEBUG_DOCUMENT
DEBUG_COMMANDS
DEBUG_APP
DEBUG_UTILS
DEBUG_METADATA
gedit_debug_init
gedit_debug
gedit_debug_message
......@@ -321,9 +352,14 @@ gedit_menu_extension_get_type
<SECTION>
<FILE>gedit-utils</FILE>
GBOOLEAN_TO_POINTER
GPOINTER_TO_BOOLEAN
gedit_utils_menu_position_under_tree_view
gedit_utils_set_atk_name_description
gedit_warning
gedit_utils_replace_home_dir_with_tilde
gedit_utils_basename_for_display
gedit_utils_decode_uri
gedit_utils_drop_get_uris
gedit_utils_get_compression_type_from_content_type
gedit_utils_is_valid_location
......
......@@ -6,14 +6,12 @@ gio_docpath = dependency('gio-2.0').get_pkgconfig_variable('prefix') / 'share/gt
gdk_docpath = dependency('gdk-3.0').get_pkgconfig_variable('prefix') / 'share/gtk-doc/html/gdk3'
gtk_docpath = dependency('gtk+-3.0').get_pkgconfig_variable('prefix') / 'share/gtk-doc/html/gtk3'
gsv_docpath = dependency('gtksourceview-4').get_pkgconfig_variable('prefix') / 'share/gtk-doc/html/gtksourceview-4.0'
amtk_docpath = dependency('amtk-5').get_pkgconfig_variable('prefix') / 'share/gtk-doc/html/amtk-5'
tepl_docpath = dependency('tepl-6').get_pkgconfig_variable('prefix') / 'share/gtk-doc/html/tepl-6'
libpeas_docpath = dependency('libpeas-1.0').get_pkgconfig_variable('prefix') / 'share/gtk-doc/html/libpeas'
gedit_doc_dep = declare_dependency(
link_with: libgedit_shared_lib,
include_directories: root_include_dir,
dependencies: deps_basic_list,
dependencies: deps_basic_list + [libxml_dep],
)
gnome.gtkdoc(
......@@ -30,8 +28,6 @@ gnome.gtkdoc(
'--extra-dir=@0@'.format(gdk_docpath),
'--extra-dir=@0@'.format(gtk_docpath),
'--extra-dir=@0@'.format(gsv_docpath),
'--extra-dir=@0@'.format(amtk_docpath),
'--extra-dir=@0@'.format(tepl_docpath),
'--extra-dir=@0@'.format(libpeas_docpath),
],
content_files: [
......
gedit roadmap - done tasks
==========================
Tepl-ification of the gedit core
--------------------------------
- gedit 3.36:
- Start to use the Tepl library.
- Use some Tepl utility functions.
- Use TeplFileMetadata, remove GeditMetadataManager.
- gedit 3.38:
- Move some utility functions to the Tepl library.
- Refactor and move some I/O error infobars to Tepl.
- GeditView now inherits from TeplView.
- Port to the new Tepl metadata API.
- Use TeplStyleSchemeChooserWidget in the preferences dialog.
- Create GeditFactory class, subclass of TeplAbstractFactory.
- gedit 40:
- Use `tepl_pango_font_description_to_css()`.
- Use TeplLanguageChooser's, for choosing a language for the syntax
highlighting. Remove GeditHighlightModeSelector and
GeditHighlightModeDialog.
- Use TeplProgressInfoBar. Remove GeditProgressInfoBar.
- GeditDocument now inherits from TeplBuffer, start to use the
TeplBuffer and TeplFile APIs.
Links:
- https://wiki.gnome.org/Projects/Tepl
Tepl-ification of the gedit plugins
-----------------------------------
- gedit 40:
- Draw Spaces plugin: new implementation based on TeplSpaceDrawerPrefs.
Other done tasks in gedit plugins
---------------------------------
- gedit 40:
- Smart Spaces plugin: new implementation based on a GtkSourceView
feature.
New version of gedit on Windows
-------------------------------
[gedit is now available on the Microsoft Store](https://www.microsoft.com/store/apps/9PL1J21XF0PT).
It was done during the GNOME 3.38 development cycle. The integration with
Windows is not perfect, but it works. It is planned to improve gedit for
Windows over time.
Documentation for contributors
------------------------------
Write a guide to get started with gedit development.
Done during the GNOME 3.34 development cycle.
......@@ -4,27 +4,10 @@ gedit roadmap
This page contains the plans for major code changes we hope to get done in the
future.
See the [roadmap-done.md](roadmap-done.md) file for done tasks.
See also the [GtkSourceView](https://wiki.gnome.org/Projects/GtkSourceView/RoadMap).
See the [NEWS file](../NEWS) for a detailed history.
See also the
[Tepl roadmap](https://gitlab.gnome.org/GNOME/tepl/blob/master/docs/roadmap.md).
Continue to make the gedit source code more re-usable
-----------------------------------------------------
Status: **in progress** (this is an ongoing effort)
Next steps:
- Use more features from the Tepl library, and develop Tepl alongside gedit.
The goal is to reduce the amount of code in gedit, by having re-usable code
in Tepl instead.
Links:
- https://wiki.gnome.org/Apps/Gedit/ReusableCode
- https://wiki.gnome.org/Projects/Tepl
Improve gedit on Windows
------------------------
......
......@@ -6,6 +6,7 @@ EncodingsComboBox cheader_filename="gedit/gedit-encodings-combo-box.h"
MenuExtension cheader_filename="gedit/gedit-menu-extension.h"
Message cheader_filename="gedit/gedit-message.h"
MessageBus cheader_filename="gedit/gedit-message-bus.h"
ProgressInfoBar cheader_filename="gedit/gedit-progress-info-bar.h"
Statusbar cheader_filename="gedit/gedit-statusbar.h"
Tab cheader_filename="gedit/gedit-tab.h"
TabState cheader_filename="gedit/gedit-tab.h"
......
......@@ -31,7 +31,7 @@
#include "gedit-debug.h"
#include "gedit-commands.h"
#include "gedit-commands-private.h"
#include "gedit-recent-osx.h"
#include "gedit-recent.h"
#import <AppKit/AppKit.h>
NSWindow *gdk_quartz_window_get_nswindow(GdkWindow *window);
......@@ -286,7 +286,7 @@ gedit_app_osx_set_window_title_impl (GeditApp *app,
g_free (uri);
}
ismodified = !tepl_buffer_is_untouched (TEPL_BUFFER (document));
ismodified = !gedit_document_is_untouched (document);
[native setDocumentEdited:ismodified];
}
else
......
......@@ -22,6 +22,7 @@
#define GEDIT_APP_PRIVATE_H
#include "gedit-app.h"
#include "gedit-metadata-manager.h"
#include "gedit-menu-extension.h"
G_BEGIN_DECLS
......@@ -34,6 +35,8 @@ GtkPrintSettings *_gedit_app_get_default_print_settings (GeditApp *app);
void _gedit_app_set_default_print_settings (GeditApp *app,
GtkPrintSettings *settings);
GeditMetadataManager *_gedit_app_get_metadata_manager (GeditApp *app);
GMenuModel *_gedit_app_get_hamburger_menu (GeditApp *app);
GMenuModel *_gedit_app_get_notebook_menu (GeditApp *app);
......
......@@ -28,8 +28,9 @@
#include <stdlib.h>
#include <glib/gi18n.h>
#include <gio/gio.h>
#include <libpeas/peas-extension-set.h>
#include <tepl/tepl.h>
#include <gtksourceview/gtksource.h>
#include "gedit-commands-private.h"
#include "gedit-notebook.h"
......@@ -44,6 +45,10 @@
#include "gedit-preferences-dialog.h"
#include "gedit-tab.h"
#ifndef ENABLE_GVFS_METADATA
#include "gedit-metadata-manager.h"
#endif
#define GEDIT_PAGE_SETUP_FILE "gedit-page-setup"
#define GEDIT_PRINT_SETTINGS_FILE "gedit-print-settings"
......@@ -51,6 +56,10 @@ typedef struct
{
GeditPluginsEngine *engine;
#ifndef ENABLE_GVFS_METADATA
GeditMetadataManager *metadata_manager;
#endif
GtkCssProvider *theme_provider;
GtkPageSetup *page_setup;
......@@ -145,6 +154,10 @@ gedit_app_dispose (GObject *object)
priv = gedit_app_get_instance_private (GEDIT_APP (object));
#ifndef ENABLE_GVFS_METADATA
g_clear_object (&priv->metadata_manager);
#endif
g_clear_object (&priv->ui_settings);
g_clear_object (&priv->window_settings);
......@@ -643,6 +656,10 @@ gedit_app_startup (GApplication *application)
GeditAppPrivate *priv;
GtkCssProvider *css_provider;
GtkSourceStyleSchemeManager *manager;
#ifndef ENABLE_GVFS_METADATA
const gchar *cache_dir;
gchar *metadata_filename;
#endif
priv = gedit_app_get_instance_private (GEDIT_APP (application));
......@@ -654,6 +671,13 @@ gedit_app_startup (GApplication *application)
setup_theme_extensions (GEDIT_APP (application));
#ifndef ENABLE_GVFS_METADATA
cache_dir = gedit_dirs_get_user_cache_dir ();
metadata_filename = g_build_filename (cache_dir, "gedit-metadata.xml", NULL);
priv->metadata_manager = gedit_metadata_manager_new (metadata_filename);
g_free (metadata_filename);
#endif
/* Load/init settings */
_gedit_settings_get_singleton ();
priv->ui_settings = g_settings_new ("org.gnome.gedit.preferences.ui");
......@@ -1114,6 +1138,10 @@ gedit_app_shutdown (GApplication *app)
save_page_setup (GEDIT_APP (app));
save_print_settings (GEDIT_APP (app));
/* GTK+ can still hold references to some gedit objects, for example
* GeditDocument for the clipboard. So the metadata-manager should be
* shutdown after.
*/
G_APPLICATION_CLASS (gedit_app_parent_class)->shutdown (app);
}
......@@ -1253,15 +1281,10 @@ load_print_settings (GeditApp *app)
static void
gedit_app_init (GeditApp *app)
{
TeplApplication *tepl_app;
g_set_application_name ("gedit");
gtk_window_set_default_icon_name ("org.gnome.gedit");
g_application_add_main_option_entries (G_APPLICATION (app), options);
tepl_app = tepl_application_get_from_gtk_application (GTK_APPLICATION (app));
tepl_application_handle_metadata (tepl_app);
}
/**
......@@ -1571,6 +1594,25 @@ _gedit_app_set_default_print_settings (GeditApp *app,
priv->print_settings = g_object_ref (settings);
}
GeditMetadataManager *
_gedit_app_get_metadata_manager (GeditApp *app)
{
#ifndef ENABLE_GVFS_METADATA
GeditAppPrivate *priv;
g_return_val_if_fail (GEDIT_IS_APP (app), NULL);
priv = gedit_app_get_instance_private (app);
return priv->metadata_manager;
#else
g_assert_not_reached ();
return NULL;
#endif
}
GMenuModel *
_gedit_app_get_hamburger_menu (GeditApp *app)
{
......
......@@ -44,13 +44,13 @@ _gedit_cmd_edit_undo (GSimpleAction *action,
gedit_debug (DEBUG_COMMANDS);
active_view = gedit_window_get_active_view (window);
g_return_if_fail (active_view != NULL);
g_return_if_fail (active_view);
active_document = GTK_SOURCE_BUFFER (gtk_text_view_get_buffer (GTK_TEXT_VIEW (active_view)));
gtk_source_buffer_undo (active_document);
tepl_view_scroll_to_cursor (TEPL_VIEW (active_view));
gedit_view_scroll_to_cursor (active_view);
gtk_widget_grab_focus (GTK_WIDGET (active_view));
}
......@@ -67,13 +67,13 @@ _gedit_cmd_edit_redo (GSimpleAction *action,
gedit_debug (DEBUG_COMMANDS);
active_view = gedit_window_get_active_view (window);
g_return_if_fail (active_view != NULL);
g_return_if_fail (active_view);
active_document = GTK_SOURCE_BUFFER (gtk_text_view_get_buffer (GTK_TEXT_VIEW (active_view)));
gtk_source_buffer_redo (active_document);
tepl_view_scroll_to_cursor (TEPL_VIEW (active_view));
gedit_view_scroll_to_cursor (active_view);
gtk_widget_grab_focus (GTK_WIDGET (active_view));
}
......@@ -89,9 +89,9 @@ _gedit_cmd_edit_cut (GSimpleAction *action,
gedit_debug (DEBUG_COMMANDS);
active_view = gedit_window_get_active_view (window);
g_return_if_fail (active_view != NULL);
g_return_if_fail (active_view);
tepl_view_cut_clipboard (TEPL_VIEW (active_view));
gedit_view_cut_clipboard (active_view);
gtk_widget_grab_focus (GTK_WIDGET (active_view));
}
......@@ -107,9 +107,9 @@ _gedit_cmd_edit_copy (GSimpleAction *action,
gedit_debug (DEBUG_COMMANDS);
active_view = gedit_window_get_active_view (window);
g_return_if_fail (active_view != NULL);
g_return_if_fail (active_view);
tepl_view_copy_clipboard (TEPL_VIEW (active_view));
gedit_view_copy_clipboard (active_view);
gtk_widget_grab_focus (GTK_WIDGET (active_view));
}
......@@ -125,9 +125,9 @@ _gedit_cmd_edit_paste (GSimpleAction *action,
gedit_debug (DEBUG_COMMANDS);
active_view = gedit_window_get_active_view (window);
g_return_if_fail (active_view != NULL);
g_return_if_fail (active_view);
tepl_view_paste_clipboard (TEPL_VIEW (active_view));
gedit_view_paste_clipboard (active_view);
gtk_widget_grab_focus (GTK_WIDGET (active_view));
}
......@@ -143,9 +143,9 @@ _gedit_cmd_edit_delete (GSimpleAction *action,
gedit_debug (DEBUG_COMMANDS);