Compare commits
20 Commits
master.lmd
...
2.8.1
Author | SHA1 | Date | |
---|---|---|---|
|
ba9bcf2244 | ||
|
10e9a275c8 | ||
|
18d3ebf460 | ||
|
76b2fcba7b | ||
|
d41e63a340 | ||
|
c7455d5f23 | ||
|
6168aee699 | ||
|
f4be97d79d | ||
|
9e805380d4 | ||
|
15b607ddc0 | ||
|
4dcfaada50 | ||
|
3bf1b62a34 | ||
|
33d035aac7 | ||
|
a71e7eea3a | ||
|
7e6a888e1d | ||
|
36b625be6a | ||
|
5a3fc97c6a | ||
|
3ca66d6fb6 | ||
|
22ddcc04e0 | ||
|
63f9ac4baf |
@@ -46,19 +46,19 @@ shared: &shared
|
||||
fi
|
||||
|
||||
jobs:
|
||||
"mint19":
|
||||
"mint20":
|
||||
<<: *shared
|
||||
docker:
|
||||
- image: linuxmintd/mint19-amd64
|
||||
- image: linuxmintd/mint20-amd64
|
||||
|
||||
"lmde3":
|
||||
"lmde4":
|
||||
<<: *shared
|
||||
docker:
|
||||
- image: linuxmintd/lmde3-amd64
|
||||
- image: linuxmintd/lmde4-amd64
|
||||
|
||||
workflows:
|
||||
version: 2
|
||||
build:
|
||||
jobs:
|
||||
- "mint19"
|
||||
- "lmde3"
|
||||
- "mint20"
|
||||
- "lmde4"
|
||||
|
@@ -338,7 +338,7 @@
|
||||
<schema gettext-domain="@GETTEXT_PACKAGE@" id="org.x.editor.plugins" path="/org/x/editor/plugins/">
|
||||
|
||||
<key name="active-plugins" type="as">
|
||||
<default>[ 'docinfo', 'modelines', 'filebrowser', 'spell', 'time' ]</default>
|
||||
<default>[ 'docinfo', 'modelines', 'filebrowser', 'spell', 'time', 'bracketcompletion' ]</default>
|
||||
<summary>Active plugins</summary>
|
||||
<description>List of active plugins. It contains the "Location" of the active plugins. See the .xed-plugin file for obtaining the "Location" of a given plugin.</description>
|
||||
</key>
|
||||
|
@@ -10,3 +10,8 @@ Icon=accessories-text-editor
|
||||
Categories=GTK;Utility;TextEditor;
|
||||
Keywords=text;editor;tabs;highlighting;code;multiple;files;pluggable;notepad;
|
||||
X-MATE-DocPath=xed/xed.xml
|
||||
Actions=new-window;
|
||||
|
||||
[Desktop Action new-window]
|
||||
Name=New Window
|
||||
Exec=xed --new-window %U
|
||||
|
42
debian/changelog
vendored
42
debian/changelog
vendored
@@ -1,3 +1,45 @@
|
||||
xed (2.8.1) ulyssa; urgency=medium
|
||||
|
||||
[ Eli Schwartz ]
|
||||
* cleanup: remove code dropped in commit 67892da099357e24b3fd3c31fa758947b1dfc47a
|
||||
* remove never-used variable added in commit 9e805380d4aa6338ca1b85d06b5dbf60e9fb0cbe
|
||||
|
||||
[ Clement Lefebvre ]
|
||||
* bracketcompletion: Enable plugin by default
|
||||
* Remove links in plugin about dialogs
|
||||
|
||||
-- Clement Lefebvre <root@linuxmint.com> Tue, 08 Dec 2020 10:11:12 +0000
|
||||
|
||||
xed (2.8.0) ulyssa; urgency=medium
|
||||
|
||||
[ JosephMcc ]
|
||||
* Port to Gtksourceview4
|
||||
* Add a new window desktop action
|
||||
* plugins: Clean up deprecated preprcessor commands
|
||||
* Clean up remaining deprecated preprocessor commands
|
||||
* xed-highlight-mode-selector.c: Fix a couple of missing casts
|
||||
* textsize plugin: Zoom text regardless of selection
|
||||
* xed-highlight-mode-dialog/selector: Clean up code style
|
||||
* xed-completion-plugin.c: Clean up the code style
|
||||
|
||||
[ Hrutvik Suthar ]
|
||||
* auto bracket complete feature - added bracket-complete dir in plugins - gtksourceview min depedency change to 4.0.3
|
||||
|
||||
[ Michael Webster ]
|
||||
* Add XAppFavorites support to the file menu.
|
||||
* meson.build: bump xapp version.
|
||||
|
||||
[ Clement Lefebvre ]
|
||||
* l10n: Update POT
|
||||
|
||||
-- Clement Lefebvre <root@linuxmint.com> Mon, 30 Nov 2020 11:25:34 +0000
|
||||
|
||||
xed (2.6.2) ulyana; urgency=medium
|
||||
|
||||
* CI: Update targets
|
||||
|
||||
-- Clement Lefebvre <root@linuxmint.com> Wed, 24 Jun 2020 12:44:58 +0100
|
||||
|
||||
xed (2.6.1) ulyana; urgency=medium
|
||||
|
||||
[ NikoKrause ]
|
||||
|
6
debian/control
vendored
6
debian/control
vendored
@@ -10,9 +10,9 @@ Build-Depends: debhelper (>= 9),
|
||||
libglib2.0-dev,
|
||||
libgspell-1-dev,
|
||||
libgtk-3-dev,
|
||||
libgtksourceview-3.0-dev,
|
||||
libgtksourceview-4-dev,
|
||||
libpeas-dev,
|
||||
libxapp-dev,
|
||||
libxapp-dev (>= 1.9),
|
||||
libsm-dev,
|
||||
libx11-dev,
|
||||
libxml2-dev,
|
||||
@@ -32,7 +32,7 @@ Depends: iso-codes,
|
||||
${shlibs:Depends},
|
||||
python3,
|
||||
python3-gi,
|
||||
xapps-common,
|
||||
xapps-common (>= 1.9.0),
|
||||
zenity
|
||||
XB-Python-Version: ${python:Versions}
|
||||
Description: Text editor
|
||||
|
6
debian/copyright
vendored
6
debian/copyright
vendored
@@ -1,7 +1,7 @@
|
||||
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
|
||||
Upstream-Name: xed (old name: mate-text-editor)
|
||||
Upstream-Contact: Stefano Karapetsas <stefano@karapetsas.com>
|
||||
Source: http://git.mate-desktop.org/xed/
|
||||
Upstream-Name: xed
|
||||
Upstream-Contact: Linux Mint <root@linuxmint.com>
|
||||
Source: http://github.com/linuxmint/xed/
|
||||
|
||||
Files: plugins/docinfo/xed-docinfo-plugin.c
|
||||
plugins/docinfo/xed-docinfo-plugin.h
|
||||
|
@@ -1,4 +1,4 @@
|
||||
project('xed', 'c', version : '2.6.0')
|
||||
project('xed', 'c', version : '2.8.1')
|
||||
|
||||
gnome = import('gnome')
|
||||
i18n = import('i18n')
|
||||
@@ -29,12 +29,12 @@ glib = dependency('glib-2.0', version: '>= 2.40.0')
|
||||
gthread = dependency('gthread-2.0', version: '>= 2.13.0')
|
||||
gio = dependency('gio-2.0', version: '>= 2.40.0')
|
||||
gtk = dependency('gtk+-3.0', version: '>= 3.19.3')
|
||||
gtksourceview = dependency('gtksourceview-3.0', version: '>= 3.19.0')
|
||||
gtksourceview = dependency('gtksourceview-4', version: '>= 4.0.3')
|
||||
libpeas = dependency('libpeas-1.0', version: '>= 1.12.0')
|
||||
libpeas_gtk = dependency('libpeas-gtk-1.0', version: '>= 1.12.0')
|
||||
gir_dep = dependency('gobject-introspection-1.0', version: '>= 0.6.7', required: false)
|
||||
gir_dep = dependency('gobject-introspection-1.0', version: '>= 1.42.0', required: false)
|
||||
gmodule = dependency('gmodule-2.0')
|
||||
xapp = dependency('xapp', version: '>= 1.4.0')
|
||||
xapp = dependency('xapp', version: '>= 1.9.0')
|
||||
X11 = dependency('x11')
|
||||
pango = dependency('pango')
|
||||
|
||||
|
@@ -0,0 +1,105 @@
|
||||
[Plugin]
|
||||
Loader=python3
|
||||
Module=bracketcompletion
|
||||
IAge=3
|
||||
Name[ar]=إكمال الأقواس
|
||||
Name[be]=Дапаўненне дужак
|
||||
Name[bs]=Zatvaranje zagrada
|
||||
Name[ca]=Compleció dels claudàtors
|
||||
Name[ca@valencia]=Compleció dels claudàtors
|
||||
Name[cs]=Doplňování závorek
|
||||
Name[da]=Klammefuldførelse
|
||||
Name[de]=Klammern schließen
|
||||
Name[el]=Συμπλήρωση αγκύλων
|
||||
Name[en_GB]=Bracket Completion
|
||||
Name[eo]=Krampo-kompletigo
|
||||
Name[es]=Completar paréntesis
|
||||
Name[et]=Sulgude lõpetamine
|
||||
Name[eu]=Parentesien osaketa
|
||||
Name[fi]=Sulkuparin täsmäys
|
||||
Name[fr]=Complétion de parenthèses
|
||||
Name[fur]=Completament parentesis
|
||||
Name[gl]=Completar parénteses
|
||||
Name[he]=התאמת סוגריים
|
||||
Name[hr]=Dovršavanje zagrada
|
||||
Name[hu]=Zárójel-kiegészítés
|
||||
Name[id]=Penyelesaian Tanda Kurung
|
||||
Name[it]=Completamento parentesi
|
||||
Name[ja]=カッコの補完
|
||||
Name[kk]=Жақшаларды толықтыру
|
||||
Name[ko]=각괄호 일치
|
||||
Name[lt]=Skliaustų užbaigimas
|
||||
Name[lv]=Iekavu noslēgšana
|
||||
Name[nl]=Haakjes-voltooiing
|
||||
Name[oc]=Complecion de parentèsis
|
||||
Name[pl]=Uzupełnianie nawiasów
|
||||
Name[pt]=Conclusão de chavetas
|
||||
Name[pt_BR]=Fechamento de parênteses
|
||||
Name[ro]=Completare paranteze
|
||||
Name[ru]=Дополнение скобок
|
||||
Name[sk]=Dopĺňanie pravých zátvoriek
|
||||
Name[sl]=Dopolnjevanje oklepajev
|
||||
Name[sr]=Допуњавање заграда
|
||||
Name[sr@latin]=Dopunjavanje zagrada
|
||||
Name[sv]=Parenteskomplettering
|
||||
Name[te]=బ్రాకెట్ ముగింపు
|
||||
Name[th]=การเติมเต็มคู่วงเล็บ
|
||||
Name[tr]=Parantez Tamamlama
|
||||
Name[zh_CN]=括号补全
|
||||
Name[zh_TW]=括號補完
|
||||
Name=Bracket Completion
|
||||
Description[ar]=يغلق الأقواس آليا.
|
||||
Description[as]=বন্ধনী নিজেই যোগ কৰে ।
|
||||
Description[be]=Аўтаматычна дадае канцавыя дужкі.
|
||||
Description[be@latin]=Aŭtamatyčna dadaje kancavyja dužki.
|
||||
Description[bs]=Automatski dodaj zatvorene zagrade.
|
||||
Description[ca]=Afegeix claudàtors de tancada automàticament.
|
||||
Description[ca@valencia]=Afig claudàtors de tancada automàticament.
|
||||
Description[cs]=Automaticky přidává zavírací závorky.
|
||||
Description[da]=Tilføjer automatisk afsluttende klammer.
|
||||
Description[de]=Fügt automatisch schließende Klammern hinzu.
|
||||
Description[dz]=ཁ་བསྡམ་གུག་ཤད་ཚུ་ རང་བཞིན་གྱིས་ཁ་སྐོང་རྐྱབ་ཨིན།
|
||||
Description[el]=Συμπληρώνει αυτόματα τις αγκύλες.
|
||||
Description[en_CA]=Automatically adds closing brackets.
|
||||
Description[en_GB]=Automatically adds closing brackets.
|
||||
Description[eo]=Aŭtomate aldoni fermantajn krampojn.
|
||||
Description[es]=Añadir automáticamente cierres de paréntesis.
|
||||
Description[eu]=Automatikoki gehitzen ditu itxierako parentesiak.
|
||||
Description[fi]=Lisää suluille pääte automaattisesti.
|
||||
Description[fr]=Ajouter automatiquement les parenthèses fermantes.
|
||||
Description[fur]=Al zonte in automatic lis parentesis sieradis.
|
||||
Description[gl]=Engadir automaticamente peches de parénteses.
|
||||
Description[gu]=બંધ કરતા કૌંસો ઓપોઆપ ઉમેરાય છે.
|
||||
Description[he]=הוספת סוגר לסגירה.
|
||||
Description[hr]=Automatski zatvara zagrade.
|
||||
Description[hu]=Automatikusan hozzáadja a záró zárójeleket.
|
||||
Description[id]=Otomatis menambah kurung tutup.
|
||||
Description[it]=Aggiunge automaticamente le parentesi di chiusura
|
||||
Description[ja]=終わり括弧を自動的に追加します
|
||||
Description[kk]=Жабатын жақшаны автоматты түрде қосады.
|
||||
Description[ko]=자동으로 닫는 각괄호를 추가합니다.
|
||||
Description[lt]=Automatiškai prideda užveriančius skliaustus.
|
||||
Description[lv]=Automātiski pievieno aizverošās iekavas.
|
||||
Description[mr]=स्वयं बंद करण्याजोगी ब्रॅकेट समावेष करा.
|
||||
Description[nl]=Voegt automatisch ‘haakjes sluiten’ toe.
|
||||
Description[oc]=Apondre automaticament las parentèsis tampantas.
|
||||
Description[or]=ବନ୍ଦହୋଇଥିବା ବନ୍ଧନିଗୁଡ଼ିକୁ ସ୍ୱୟଂଚାଳିତ ଭାବରେ ଯୋଗକରନ୍ତୁ।
|
||||
Description[pl]=Automatycznie dodaje nawiasy zamykające.
|
||||
Description[pt]=Adiciona automaticamente fecho de chavetas.
|
||||
Description[pt_BR]=Fecha parênteses automaticamente.
|
||||
Description[ro]=Adaugă automat paranteze închise.
|
||||
Description[ru]=Автоматическое добавление закрывающей скобки.
|
||||
Description[sk]=Automatické pridávanie pravých zátvoriek.
|
||||
Description[sl]=Samodejno doda zaklepaje
|
||||
Description[sr]=Сам додаје затварајуће заграде.
|
||||
Description[sr@latin]=Sam dodaje zatvarajuće zagrade.
|
||||
Description[sv]=Lägger automatiskt till avslutande parenteser.
|
||||
Description[th]=เติมวงเล็บปิดโดยอัตโนมัติ
|
||||
Description[tr]=Parantez kapanışını kendiliğinden ekler.
|
||||
Description[vi]=Tự động thêm dấu ngoặc đóng.
|
||||
Description[zh_CN]=自动添加闭合括号。
|
||||
Description[zh_TW]=自動加入關閉用括號。
|
||||
Description=Automatically adds closing brackets.
|
||||
Authors=Hrutvik Suthar <steve@istique.net>
|
||||
Copyright=Copyright @ 2020 Hrutvik Suthar
|
||||
Version=1.0
|
318
plugins/bracket-complete/bracket-complete/bracketcompletion.py
Normal file
318
plugins/bracket-complete/bracket-complete/bracketcompletion.py
Normal file
@@ -0,0 +1,318 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# bracketcompletion.py - Bracket completion plugin for Xed
|
||||
#
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
# 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, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
# Boston, MA 02110-1301, USA.
|
||||
|
||||
import gi
|
||||
gi.require_version('Peas', '1.0')
|
||||
#gi.require_version('Xed', '3.0')
|
||||
from gi.repository import GObject, Gdk, Xed
|
||||
|
||||
common_brackets = {
|
||||
'(' : ')',
|
||||
'[' : ']',
|
||||
'{' : '}',
|
||||
'"' : '"',
|
||||
"'" : "'",
|
||||
}
|
||||
|
||||
close_brackets = {
|
||||
')' : '(',
|
||||
']' : '[',
|
||||
'}' : '{',
|
||||
}
|
||||
|
||||
language_brackets = {
|
||||
'changelog': { '<' : '>' },
|
||||
'html': { '<' : '>' },
|
||||
'ruby': { '|' : '|' },
|
||||
'sh': { '`' : '`' },
|
||||
'xml': { '<' : '>' },
|
||||
'php': { '<' : '>' },
|
||||
}
|
||||
|
||||
|
||||
class BracketCompletionPlugin(GObject.Object, Xed.ViewActivatable):
|
||||
__gtype_name__ = "BracketCompletion"
|
||||
|
||||
view = GObject.Property(type=Xed.View)
|
||||
|
||||
def __init__(self):
|
||||
GObject.Object.__init__(self)
|
||||
|
||||
def do_activate(self):
|
||||
self._doc = self.view.get_buffer()
|
||||
self._last_iter = None
|
||||
self._stack = []
|
||||
self._relocate_marks = True
|
||||
self.update_language()
|
||||
|
||||
# Add the markers to the buffer
|
||||
insert = self._doc.get_iter_at_mark(self._doc.get_insert())
|
||||
self._mark_begin = self._doc.create_mark(None, insert, True)
|
||||
self._mark_end = self._doc.create_mark(None, insert, False)
|
||||
|
||||
self._handlers = [
|
||||
None,
|
||||
None,
|
||||
self.view.connect('notify::editable', self.on_notify_editable),
|
||||
self._doc.connect('notify::language', self.on_notify_language),
|
||||
None,
|
||||
]
|
||||
self.update_active()
|
||||
|
||||
def do_deactivate(self):
|
||||
if self._handlers[0]:
|
||||
self.view.disconnect(self._handlers[0])
|
||||
self.view.disconnect(self._handlers[1])
|
||||
self._doc.disconnect(self._handlers[4])
|
||||
self.view.disconnect(self._handlers[2])
|
||||
self._doc.disconnect(self._handlers[3])
|
||||
self._doc.delete_mark(self._mark_begin)
|
||||
self._doc.delete_mark(self._mark_end)
|
||||
|
||||
def update_active(self):
|
||||
# Don't activate the feature if the buffer isn't editable or if
|
||||
# there are no brackets for the language
|
||||
active = self.view.get_editable() and \
|
||||
self._brackets is not None
|
||||
|
||||
if active and self._handlers[0] is None:
|
||||
self._handlers[0] = self.view.connect('event-after',
|
||||
self.on_event_after)
|
||||
self._handlers[1] = self.view.connect('key-press-event',
|
||||
self.on_key_press_event)
|
||||
self._handlers[4] = self._doc.connect('delete-range',
|
||||
self.on_delete_range)
|
||||
elif not active and self._handlers[0] is not None:
|
||||
self.view.disconnect(self._handlers[0])
|
||||
self._handlers[0] = None
|
||||
self.view.disconnect(self._handlers[1])
|
||||
self._handlers[1] = None
|
||||
self._doc.disconnect(self._handlers[4])
|
||||
self._handlers[4] = None
|
||||
|
||||
def update_language(self):
|
||||
lang = self._doc.get_language()
|
||||
if lang is None:
|
||||
self._brackets = None
|
||||
return
|
||||
|
||||
lang_id = lang.get_id()
|
||||
if lang_id in language_brackets:
|
||||
self._brackets = language_brackets[lang_id]
|
||||
# we populate the language-specific brackets with common ones lazily
|
||||
self._brackets.update(common_brackets)
|
||||
else:
|
||||
self._brackets = common_brackets
|
||||
|
||||
# get the corresponding keyvals
|
||||
self._bracket_keyvals = set()
|
||||
for b in self._brackets:
|
||||
kv = Gdk.unicode_to_keyval(ord(b[-1]))
|
||||
if (kv):
|
||||
self._bracket_keyvals.add(kv)
|
||||
for b in close_brackets:
|
||||
kv = Gdk.unicode_to_keyval(ord(b[-1]))
|
||||
if (kv):
|
||||
self._bracket_keyvals.add(kv)
|
||||
|
||||
def get_current_token(self):
|
||||
end = self._doc.get_iter_at_mark(self._doc.get_insert())
|
||||
start = end.copy()
|
||||
word = None
|
||||
|
||||
if end.ends_word() or (end.inside_word() and not end.starts_word()):
|
||||
start.backward_word_start()
|
||||
word = self._doc.get_text(start, end)
|
||||
|
||||
if not word and start.backward_char():
|
||||
word = start.get_char()
|
||||
if word.isspace():
|
||||
word = None
|
||||
|
||||
if word:
|
||||
return word, start, end
|
||||
else:
|
||||
return None, None, None
|
||||
|
||||
def get_next_token(self):
|
||||
start = self._doc.get_iter_at_mark(self._doc.get_insert())
|
||||
end = start.copy()
|
||||
word = None
|
||||
|
||||
if start.ends_word() or (start.inside_word() and not start.starts_word()):
|
||||
end.forward_word_end()
|
||||
word = self._doc.get_text(start, end)
|
||||
|
||||
if not word:
|
||||
word = start.get_char()
|
||||
if word.isspace():
|
||||
word = None
|
||||
|
||||
if word:
|
||||
return word, start, end
|
||||
else:
|
||||
return None, None, None
|
||||
|
||||
def compute_indentation(self, cur):
|
||||
"""
|
||||
Compute indentation at the given iterator line
|
||||
view : gtk.TextView
|
||||
cur : gtk.TextIter
|
||||
"""
|
||||
start = self._doc.get_iter_at_line(cur.get_line())
|
||||
end = start.copy()
|
||||
|
||||
c = end.get_char()
|
||||
while c.isspace() and c not in ('\n', '\r') and end.compare(cur) < 0:
|
||||
if not end.forward_char():
|
||||
break
|
||||
c = end.get_char()
|
||||
|
||||
if start.equal(end):
|
||||
return ''
|
||||
return start.get_slice(end)
|
||||
|
||||
def on_notify_language(self, view, pspec):
|
||||
self.update_language()
|
||||
self.update_active()
|
||||
|
||||
def on_notify_editable(self, view, pspec):
|
||||
self.update_active()
|
||||
|
||||
def on_key_press_event(self, view, event):
|
||||
if event.state & (Gdk.ModifierType.CONTROL_MASK | Gdk.ModifierType.MOD1_MASK):
|
||||
return False
|
||||
|
||||
if event.keyval in (Gdk.KEY_Left, Gdk.KEY_Right):
|
||||
self._stack = []
|
||||
|
||||
if event.keyval == Gdk.KEY_BackSpace:
|
||||
self._stack = []
|
||||
|
||||
if self._last_iter == None:
|
||||
return False
|
||||
|
||||
iter1 = self._doc.get_iter_at_mark(self._doc.get_insert())
|
||||
iter1.backward_char()
|
||||
self._doc.begin_user_action()
|
||||
self._doc.delete(iter1, self._last_iter)
|
||||
self._doc.end_user_action()
|
||||
self._last_iter = None
|
||||
return True
|
||||
|
||||
if event.keyval in (Gdk.KEY_Return, Gdk.KEY_KP_Enter) and \
|
||||
view.get_auto_indent() and self._last_iter != None:
|
||||
# This code has barely been adapted from gtksourceview.c
|
||||
# Note: it might break IM!
|
||||
|
||||
mark = self._doc.get_insert()
|
||||
iter1 = self._doc.get_iter_at_mark(mark)
|
||||
|
||||
indent = self.compute_indentation(iter1)
|
||||
indent = "\n" + indent
|
||||
|
||||
# Insert new line and auto-indent.
|
||||
self._doc.begin_user_action()
|
||||
self._doc.insert(iter1, indent)
|
||||
self._doc.insert(iter1, indent)
|
||||
self._doc.end_user_action()
|
||||
|
||||
# Leave the cursor where we want it to be
|
||||
iter1.backward_chars(len(indent))
|
||||
self._doc.place_cursor(iter1)
|
||||
self.view.scroll_mark_onscreen(mark)
|
||||
|
||||
self._last_iter = None
|
||||
return True
|
||||
|
||||
self._last_iter = None
|
||||
return False
|
||||
|
||||
def on_event_after(self, view, event):
|
||||
if event.type != Gdk.EventType.KEY_PRESS or \
|
||||
event.state & (Gdk.ModifierType.CONTROL_MASK | Gdk.ModifierType.MOD1_MASK) or \
|
||||
event.keyval not in self._bracket_keyvals:
|
||||
return
|
||||
|
||||
# Check if the insert mark is in the range of mark_begin to mark_end
|
||||
# if not we free the stack
|
||||
insert = self._doc.get_insert()
|
||||
iter_begin = self._doc.get_iter_at_mark(self._mark_begin)
|
||||
iter_end = self._doc.get_iter_at_mark(self._mark_end)
|
||||
insert_iter = self._doc.get_iter_at_mark(insert)
|
||||
if not iter_begin.equal(iter_end):
|
||||
if not insert_iter.in_range(iter_begin, iter_end):
|
||||
self._stack = []
|
||||
self._relocate_marks = True
|
||||
|
||||
# Check if the word is not in our brackets
|
||||
word, start, end = self.get_current_token()
|
||||
|
||||
if word not in self._brackets and word not in close_brackets:
|
||||
return
|
||||
|
||||
# If we didn't insert brackets yet we insert them in the insert mark iter
|
||||
if self._relocate_marks == True:
|
||||
insert_iter = self._doc.get_iter_at_mark(insert)
|
||||
self._doc.move_mark(self._mark_begin, insert_iter)
|
||||
self._doc.move_mark(self._mark_end, insert_iter)
|
||||
self._relocate_marks = False
|
||||
|
||||
# Depending on having close bracket or a open bracket we get the opposed
|
||||
# bracket
|
||||
bracket = None
|
||||
bracket2 = None
|
||||
|
||||
if word not in close_brackets:
|
||||
self._stack.append(word)
|
||||
bracket = self._brackets[word]
|
||||
else:
|
||||
bracket2 = close_brackets[word]
|
||||
|
||||
word2, _, _ = self.get_next_token()
|
||||
|
||||
# Check to skip the closing bracket
|
||||
# Example: word = ) and word2 = )
|
||||
if word == word2:
|
||||
if bracket2 != None and self._stack != [] and \
|
||||
self._stack[len(self._stack) - 1] == bracket2:
|
||||
self._stack.pop()
|
||||
self._doc.handler_block(self._handlers[4])
|
||||
self._doc.delete(start, end)
|
||||
self._doc.handler_unblock(self._handlers[4])
|
||||
end.forward_char()
|
||||
self._doc.place_cursor(end)
|
||||
return
|
||||
|
||||
# Insert the closing bracket
|
||||
if bracket != None:
|
||||
self._doc.begin_user_action()
|
||||
self._doc.insert(end, bracket)
|
||||
self._doc.end_user_action()
|
||||
|
||||
# Leave the cursor when we want it to be
|
||||
self._last_iter = end.copy()
|
||||
end.backward_chars(len(bracket))
|
||||
self._doc.place_cursor(end)
|
||||
|
||||
def on_delete_range(self, doc, start, end):
|
||||
self._stack = []
|
||||
|
||||
# ex:ts=4:et:
|
4
plugins/bracket-complete/meson.build
Normal file
4
plugins/bracket-complete/meson.build
Normal file
@@ -0,0 +1,4 @@
|
||||
install_subdir(
|
||||
'bracket-complete',
|
||||
install_dir: pluginslibdir
|
||||
)
|
@@ -69,7 +69,8 @@ G_DEFINE_DYNAMIC_TYPE_EXTENDED (XedDocInfoPlugin,
|
||||
PEAS_TYPE_EXTENSION_BASE,
|
||||
0,
|
||||
G_IMPLEMENT_INTERFACE_DYNAMIC (XED_TYPE_WINDOW_ACTIVATABLE,
|
||||
xed_window_activatable_iface_init))
|
||||
xed_window_activatable_iface_init)
|
||||
G_ADD_PRIVATE_DYNAMIC (XedDocInfoPlugin))
|
||||
|
||||
static void
|
||||
calculate_info (XedDocument *doc,
|
||||
@@ -385,7 +386,7 @@ static void
|
||||
xed_docinfo_plugin_init (XedDocInfoPlugin *plugin)
|
||||
{
|
||||
xed_debug_message (DEBUG_PLUGINS, "XedDocInfoPlugin initializing");
|
||||
plugin->priv = G_TYPE_INSTANCE_GET_PRIVATE (plugin, XED_TYPE_DOCINFO_PLUGIN, XedDocInfoPluginPrivate);
|
||||
plugin->priv = xed_docinfo_plugin_get_instance_private (plugin);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -531,8 +532,6 @@ xed_docinfo_plugin_class_init (XedDocInfoPluginClass *klass)
|
||||
object_class->get_property = xed_docinfo_plugin_get_property;
|
||||
|
||||
g_object_class_override_property (object_class, PROP_WINDOW, "window");
|
||||
|
||||
g_type_class_add_private (klass, sizeof (XedDocInfoPluginPrivate));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@@ -7,4 +7,3 @@ _Description=Easy file access from the side pane
|
||||
Icon=system-file-manager
|
||||
Authors=Jesse van den Kieboom <jesse@icecrew.nl>
|
||||
Copyright=Copyright © 2006 Jesse van den Kieboom
|
||||
Website=http://www.mate-desktop.org
|
||||
|
@@ -27,10 +27,6 @@
|
||||
#include "xed-file-bookmarks-store.h"
|
||||
#include "xed-file-browser-utils.h"
|
||||
|
||||
#define XED_FILE_BOOKMARKS_STORE_GET_PRIVATE(object)( \
|
||||
G_TYPE_INSTANCE_GET_PRIVATE((object), XED_TYPE_FILE_BOOKMARKS_STORE, \
|
||||
XedFileBookmarksStorePrivate))
|
||||
|
||||
struct _XedFileBookmarksStorePrivate
|
||||
{
|
||||
GVolumeMonitor * volume_monitor;
|
||||
@@ -55,7 +51,11 @@ static gboolean find_with_flags (GtkTreeModel * model,
|
||||
guint flags,
|
||||
guint notflags);
|
||||
|
||||
G_DEFINE_DYNAMIC_TYPE (XedFileBookmarksStore, xed_file_bookmarks_store, GTK_TYPE_TREE_STORE)
|
||||
G_DEFINE_DYNAMIC_TYPE_EXTENDED (XedFileBookmarksStore,
|
||||
xed_file_bookmarks_store,
|
||||
GTK_TYPE_TREE_STORE,
|
||||
0,
|
||||
G_ADD_PRIVATE_DYNAMIC (XedFileBookmarksStore))
|
||||
|
||||
static void
|
||||
xed_file_bookmarks_store_dispose (GObject * object)
|
||||
@@ -92,8 +92,6 @@ xed_file_bookmarks_store_class_init (XedFileBookmarksStoreClass *klass)
|
||||
|
||||
object_class->dispose = xed_file_bookmarks_store_dispose;
|
||||
object_class->finalize = xed_file_bookmarks_store_finalize;
|
||||
|
||||
g_type_class_add_private (object_class, sizeof (XedFileBookmarksStorePrivate));
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -105,7 +103,7 @@ xed_file_bookmarks_store_class_finalize (XedFileBookmarksStoreClass *klass)
|
||||
static void
|
||||
xed_file_bookmarks_store_init (XedFileBookmarksStore * obj)
|
||||
{
|
||||
obj->priv = XED_FILE_BOOKMARKS_STORE_GET_PRIVATE (obj);
|
||||
obj->priv = xed_file_bookmarks_store_get_instance_private (obj);
|
||||
}
|
||||
|
||||
/* Private */
|
||||
|
@@ -42,8 +42,6 @@
|
||||
#define FILE_BROWSER_SCHEMA "org.x.editor.plugins.filebrowser"
|
||||
#define FILE_BROWSER_ONLOAD_SCHEMA "org.x.editor.plugins.filebrowser.on-load"
|
||||
|
||||
#define XED_FILE_BROWSER_PLUGIN_GET_PRIVATE(object) (G_TYPE_INSTANCE_GET_PRIVATE ((object), XED_TYPE_FILE_BROWSER_PLUGIN, XedFileBrowserPluginPrivate))
|
||||
|
||||
struct _XedFileBrowserPluginPrivate
|
||||
{
|
||||
XedWindow *window;
|
||||
@@ -106,8 +104,8 @@ G_DEFINE_DYNAMIC_TYPE_EXTENDED (XedFileBrowserPlugin,
|
||||
PEAS_TYPE_EXTENSION_BASE,
|
||||
0,
|
||||
G_IMPLEMENT_INTERFACE_DYNAMIC (XED_TYPE_WINDOW_ACTIVATABLE,
|
||||
xed_window_activatable_iface_init) \
|
||||
\
|
||||
xed_window_activatable_iface_init)
|
||||
G_ADD_PRIVATE_DYNAMIC (XedFileBrowserPlugin)
|
||||
_xed_file_browser_store_register_type (type_module); \
|
||||
_xed_file_bookmarks_store_register_type (type_module); \
|
||||
_xed_file_browser_view_register_type (type_module); \
|
||||
@@ -118,7 +116,7 @@ G_DEFINE_DYNAMIC_TYPE_EXTENDED (XedFileBrowserPlugin,
|
||||
static void
|
||||
xed_file_browser_plugin_init (XedFileBrowserPlugin *plugin)
|
||||
{
|
||||
plugin->priv = XED_FILE_BROWSER_PLUGIN_GET_PRIVATE (plugin);
|
||||
plugin->priv = xed_file_browser_plugin_get_instance_private (plugin);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -620,8 +618,6 @@ xed_file_browser_plugin_class_init (XedFileBrowserPluginClass * klass)
|
||||
object_class->get_property = xed_file_browser_plugin_get_property;
|
||||
|
||||
g_object_class_override_property (object_class, PROP_WINDOW, "window");
|
||||
|
||||
g_type_class_add_private (object_class, sizeof (XedFileBrowserPluginPrivate));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@@ -31,10 +31,6 @@
|
||||
#include "xed-file-browser-error.h"
|
||||
#include "xed-file-browser-utils.h"
|
||||
|
||||
#define XED_FILE_BROWSER_STORE_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE((object), \
|
||||
XED_TYPE_FILE_BROWSER_STORE, \
|
||||
XedFileBrowserStorePrivate))
|
||||
|
||||
#define NODE_IS_DIR(node) (FILE_IS_DIR((node)->flags))
|
||||
#define NODE_IS_HIDDEN(node) (FILE_IS_HIDDEN((node)->flags))
|
||||
#define NODE_IS_TEXT(node) (FILE_IS_TEXT((node)->flags))
|
||||
@@ -193,14 +189,6 @@ static void next_files_async (GFileEnumerator *enumerator,
|
||||
|
||||
static void delete_files (AsyncData *data);
|
||||
|
||||
G_DEFINE_DYNAMIC_TYPE_EXTENDED (XedFileBrowserStore, xed_file_browser_store,
|
||||
G_TYPE_OBJECT,
|
||||
0,
|
||||
G_IMPLEMENT_INTERFACE_DYNAMIC (GTK_TYPE_TREE_MODEL,
|
||||
xed_file_browser_store_iface_init)
|
||||
G_IMPLEMENT_INTERFACE_DYNAMIC (GTK_TYPE_TREE_DRAG_SOURCE,
|
||||
xed_file_browser_store_drag_source_init))
|
||||
|
||||
/* Properties */
|
||||
enum {
|
||||
PROP_0,
|
||||
@@ -224,6 +212,15 @@ enum
|
||||
NUM_SIGNALS
|
||||
};
|
||||
|
||||
G_DEFINE_DYNAMIC_TYPE_EXTENDED (XedFileBrowserStore, xed_file_browser_store,
|
||||
G_TYPE_OBJECT,
|
||||
0,
|
||||
G_IMPLEMENT_INTERFACE_DYNAMIC (GTK_TYPE_TREE_MODEL,
|
||||
xed_file_browser_store_iface_init)
|
||||
G_IMPLEMENT_INTERFACE_DYNAMIC (GTK_TYPE_TREE_DRAG_SOURCE,
|
||||
xed_file_browser_store_drag_source_init)
|
||||
G_ADD_PRIVATE_DYNAMIC (XedFileBrowserStore))
|
||||
|
||||
static guint model_signals[NUM_SIGNALS] = { 0 };
|
||||
|
||||
static void
|
||||
@@ -418,8 +415,6 @@ xed_file_browser_store_class_init (XedFileBrowserStoreClass * klass)
|
||||
g_cclosure_marshal_VOID__OBJECT,
|
||||
G_TYPE_NONE, 1,
|
||||
G_TYPE_FILE);
|
||||
|
||||
g_type_class_add_private (object_class, sizeof (XedFileBrowserStorePrivate));
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -457,7 +452,7 @@ xed_file_browser_store_drag_source_init (GtkTreeDragSourceIface * iface)
|
||||
static void
|
||||
xed_file_browser_store_init (XedFileBrowserStore * obj)
|
||||
{
|
||||
obj->priv = XED_FILE_BROWSER_STORE_GET_PRIVATE (obj);
|
||||
obj->priv = xed_file_browser_store_get_instance_private (obj);
|
||||
|
||||
obj->priv->column_types[XED_FILE_BROWSER_STORE_COLUMN_LOCATION] = G_TYPE_FILE;
|
||||
obj->priv->column_types[XED_FILE_BROWSER_STORE_COLUMN_NAME] = G_TYPE_STRING;
|
||||
|
@@ -31,10 +31,6 @@
|
||||
#include "xed-file-browser-marshal.h"
|
||||
#include "xed-file-browser-enum-types.h"
|
||||
|
||||
#define XED_FILE_BROWSER_VIEW_GET_PRIVATE(object)( \
|
||||
G_TYPE_INSTANCE_GET_PRIVATE((object), \
|
||||
XED_TYPE_FILE_BROWSER_VIEW, XedFileBrowserViewPrivate))
|
||||
|
||||
struct _XedFileBrowserViewPrivate
|
||||
{
|
||||
GtkTreeViewColumn *column;
|
||||
@@ -81,7 +77,11 @@ static const GtkTargetEntry drag_source_targets[] = {
|
||||
{ "text/uri-list", 0, 0 }
|
||||
};
|
||||
|
||||
G_DEFINE_DYNAMIC_TYPE (XedFileBrowserView, xed_file_browser_view, GTK_TYPE_TREE_VIEW)
|
||||
G_DEFINE_DYNAMIC_TYPE_EXTENDED (XedFileBrowserView,
|
||||
xed_file_browser_view,
|
||||
GTK_TYPE_TREE_VIEW,
|
||||
0,
|
||||
G_ADD_PRIVATE_DYNAMIC (XedFileBrowserView))
|
||||
|
||||
static void on_cell_edited (GtkCellRendererText *cell,
|
||||
gchar *path,
|
||||
@@ -824,8 +824,6 @@ xed_file_browser_view_class_init (XedFileBrowserViewClass *klass)
|
||||
bookmark_activated), NULL, NULL,
|
||||
g_cclosure_marshal_VOID__BOXED,
|
||||
G_TYPE_NONE, 1, GTK_TYPE_TREE_ITER);
|
||||
|
||||
g_type_class_add_private (object_class, sizeof (XedFileBrowserViewPrivate));
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -864,7 +862,7 @@ cell_data_cb (GtkTreeViewColumn *tree_column,
|
||||
static void
|
||||
xed_file_browser_view_init (XedFileBrowserView *obj)
|
||||
{
|
||||
obj->priv = XED_FILE_BROWSER_VIEW_GET_PRIVATE (obj);
|
||||
obj->priv = xed_file_browser_view_get_instance_private (obj);
|
||||
|
||||
obj->priv->column = gtk_tree_view_column_new ();
|
||||
|
||||
|
@@ -38,10 +38,6 @@
|
||||
#include "xed-file-browser-marshal.h"
|
||||
#include "xed-file-browser-enum-types.h"
|
||||
|
||||
#define XED_FILE_BROWSER_WIDGET_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE((object), \
|
||||
XED_TYPE_FILE_BROWSER_WIDGET, \
|
||||
XedFileBrowserWidgetPrivate))
|
||||
|
||||
#define XML_UI_FILE "xed-file-browser-widget-ui.xml"
|
||||
#define LOCATION_DATA_KEY "xed-file-browser-widget-location"
|
||||
|
||||
@@ -225,7 +221,11 @@ static void on_action_filter_binary (GtkAction *action,
|
||||
static void on_action_bookmark_open (GtkAction *action,
|
||||
XedFileBrowserWidget *obj);
|
||||
|
||||
G_DEFINE_DYNAMIC_TYPE (XedFileBrowserWidget, xed_file_browser_widget, GTK_TYPE_BOX)
|
||||
G_DEFINE_DYNAMIC_TYPE_EXTENDED (XedFileBrowserWidget,
|
||||
xed_file_browser_widget,
|
||||
GTK_TYPE_BOX,
|
||||
0,
|
||||
G_ADD_PRIVATE_DYNAMIC (XedFileBrowserWidget))
|
||||
|
||||
static void
|
||||
free_name_icon (gpointer data)
|
||||
@@ -483,8 +483,6 @@ xed_file_browser_widget_class_init (XedFileBrowserWidgetClass *klass)
|
||||
G_TYPE_BOOLEAN,
|
||||
1,
|
||||
G_TYPE_POINTER);
|
||||
|
||||
g_type_class_add_private (object_class, sizeof (XedFileBrowserWidgetPrivate));
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1173,7 +1171,7 @@ create_filter (XedFileBrowserWidget *obj)
|
||||
static void
|
||||
xed_file_browser_widget_init (XedFileBrowserWidget *obj)
|
||||
{
|
||||
obj->priv = XED_FILE_BROWSER_WIDGET_GET_PRIVATE (obj);
|
||||
obj->priv = xed_file_browser_widget_get_instance_private (obj);
|
||||
|
||||
obj->priv->bookmarks_hash = g_hash_table_new_full (g_file_hash,
|
||||
(GEqualFunc)g_file_equal,
|
||||
|
@@ -7,6 +7,4 @@ _Description=Join several lines
|
||||
Icon=gnome-mime-text-x-python
|
||||
Authors=Steve Frécinaux <steve@istique.net>;André Homeyer;Linux Mint team
|
||||
Copyright=Copyright @ 2006-2007 Steve Frécinaux, André Homeyer
|
||||
Website=https://github.com/linuxmint
|
||||
Builtin=true
|
||||
|
||||
|
@@ -1,6 +1,7 @@
|
||||
pluginsdatadir = join_paths(datadir, 'xed', 'plugins')
|
||||
pluginslibdir = join_paths(libdir, 'xed', 'plugins')
|
||||
|
||||
subdir('bracket-complete')
|
||||
subdir('docinfo')
|
||||
subdir('filebrowser')
|
||||
subdir('joinlines')
|
||||
|
@@ -5,4 +5,3 @@ _Name=Modelines
|
||||
_Description=Emacs, Kate and Vim-style modelines support for xed.
|
||||
Authors=Steve Frécinaux <steve@istique.net>
|
||||
Copyright=Copyright © 2005 Steve Frécinaux
|
||||
Website=http://www.mate-desktop.org
|
||||
|
@@ -50,7 +50,8 @@ G_DEFINE_DYNAMIC_TYPE_EXTENDED (XedModelinePlugin,
|
||||
PEAS_TYPE_EXTENSION_BASE,
|
||||
0,
|
||||
G_IMPLEMENT_INTERFACE_DYNAMIC (XED_TYPE_VIEW_ACTIVATABLE,
|
||||
xed_view_activatable_iface_init))
|
||||
xed_view_activatable_iface_init)
|
||||
G_ADD_PRIVATE_DYNAMIC (XedModelinePlugin))
|
||||
|
||||
static void
|
||||
xed_modeline_plugin_constructed (GObject *object)
|
||||
@@ -71,9 +72,7 @@ xed_modeline_plugin_init (XedModelinePlugin *plugin)
|
||||
{
|
||||
xed_debug_message (DEBUG_PLUGINS, "XedModelinePlugin initializing");
|
||||
|
||||
plugin->priv = G_TYPE_INSTANCE_GET_PRIVATE (plugin,
|
||||
XED_TYPE_MODELINE_PLUGIN,
|
||||
XedModelinePluginPrivate);
|
||||
plugin->priv = xed_modeline_plugin_get_instance_private (plugin);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -193,8 +192,6 @@ xed_modeline_plugin_class_init (XedModelinePluginClass *klass)
|
||||
object_class->get_property = xed_modeline_plugin_get_property;
|
||||
|
||||
g_object_class_override_property (object_class, PROP_VIEW, "view");
|
||||
|
||||
g_type_class_add_private (klass, sizeof (XedModelinePluginPrivate));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@@ -7,5 +7,4 @@ Description=Adds context menu item to open an URI at the pointer position.
|
||||
Icon=gtk-open
|
||||
Authors=Martin Szulecki <opensuse@sukimashita.com>\nJean-Philippe Fleury <contact@jpfleury.net>
|
||||
Copyright=Copyright © 2007-2008 Martin Szulecki\nCopyright © 2011 Jean-Philippe Fleury
|
||||
Website=https://github.com/jpfleury/open-uri-context-menu
|
||||
Builtin=true
|
||||
|
@@ -6,5 +6,4 @@ _Description=Sorts a document or selected text.
|
||||
Icon=gtk-sort-ascending
|
||||
Authors=Carlo Borreo <borreo@softhome.net>;Lee Mallabone <mate@fonicmonkey.net>;Paolo Maggi <paolo.maggi@polito.it>;Jorge Alberto Torres H. <jorge@deadoak.com>
|
||||
Copyright=Copyright © 2001 Carlo Borreo\nCopyright © 2002-2003 Lee Mallabone, Paolo Maggi\nCopyright © 2004-2005 Paolo Maggi
|
||||
Website=http://www.mate-desktop.org
|
||||
Builtin=true
|
||||
|
@@ -33,19 +33,10 @@
|
||||
|
||||
#include "xed-sort-plugin.h"
|
||||
|
||||
#define XED_SORT_PLUGIN_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), XED_TYPE_SORT_PLUGIN, XedSortPluginPrivate))
|
||||
|
||||
#define MENU_PATH "/MenuBar/EditMenu/EditOps_6"
|
||||
|
||||
static void xed_window_activatable_iface_init (XedWindowActivatableInterface *iface);
|
||||
|
||||
G_DEFINE_DYNAMIC_TYPE_EXTENDED (XedSortPlugin,
|
||||
xed_sort_plugin,
|
||||
PEAS_TYPE_EXTENSION_BASE,
|
||||
0,
|
||||
G_IMPLEMENT_INTERFACE_DYNAMIC (XED_TYPE_WINDOW_ACTIVATABLE,
|
||||
xed_window_activatable_iface_init))
|
||||
|
||||
struct _XedSortPluginPrivate
|
||||
{
|
||||
XedWindow *window;
|
||||
@@ -62,6 +53,14 @@ enum
|
||||
PROP_WINDOW
|
||||
};
|
||||
|
||||
G_DEFINE_DYNAMIC_TYPE_EXTENDED (XedSortPlugin,
|
||||
xed_sort_plugin,
|
||||
PEAS_TYPE_EXTENSION_BASE,
|
||||
0,
|
||||
G_IMPLEMENT_INTERFACE_DYNAMIC (XED_TYPE_WINDOW_ACTIVATABLE,
|
||||
xed_window_activatable_iface_init)
|
||||
G_ADD_PRIVATE_DYNAMIC (XedSortPlugin))
|
||||
|
||||
static void sort_cb (GtkAction *action,
|
||||
XedSortPlugin *plugin);
|
||||
|
||||
@@ -310,7 +309,7 @@ xed_sort_plugin_init (XedSortPlugin *plugin)
|
||||
{
|
||||
xed_debug_message (DEBUG_PLUGINS, "XedSortPlugin initializing");
|
||||
|
||||
plugin->priv = G_TYPE_INSTANCE_GET_PRIVATE (plugin, XED_TYPE_SORT_PLUGIN, XedSortPluginPrivate);
|
||||
plugin->priv = xed_sort_plugin_get_instance_private (plugin);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -383,8 +382,6 @@ xed_sort_plugin_class_init (XedSortPluginClass *klass)
|
||||
object_class->get_property = xed_sort_plugin_get_property;
|
||||
|
||||
g_object_class_override_property (object_class, PROP_WINDOW, "window");
|
||||
|
||||
g_type_class_add_private (klass, sizeof (XedSortPluginPrivate));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@@ -6,4 +6,3 @@ _Description=Checks the spelling of the current document.
|
||||
Icon=gtk-spell-check
|
||||
Authors=Paolo Maggi <paolo@gnome.org>
|
||||
Copyright=Copyright © 2002-2005 Paolo Maggi
|
||||
Website=http://www.mate-desktop.org
|
||||
|
@@ -5,4 +5,3 @@ _Name=Tag list
|
||||
_Description=Provides a method to easily insert commonly used tags/strings into a document without having to type them.
|
||||
Authors=Paolo Maggi <paolo.maggi@polito.it>
|
||||
Copyright=Copyright © 2002-2005 Paolo Maggi
|
||||
Website=http://www.mate-desktop.org
|
||||
|
@@ -39,10 +39,6 @@
|
||||
#include "xed-taglist-plugin-panel.h"
|
||||
#include "xed-taglist-plugin-parser.h"
|
||||
|
||||
#define XED_TAGLIST_PLUGIN_PANEL_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), \
|
||||
XED_TYPE_TAGLIST_PLUGIN_PANEL, \
|
||||
XedTaglistPluginPanelPrivate))
|
||||
|
||||
enum
|
||||
{
|
||||
COLUMN_TAG_NAME,
|
||||
@@ -63,7 +59,11 @@ struct _XedTaglistPluginPanelPrivate
|
||||
gchar *data_dir;
|
||||
};
|
||||
|
||||
G_DEFINE_DYNAMIC_TYPE (XedTaglistPluginPanel, xed_taglist_plugin_panel, GTK_TYPE_BOX)
|
||||
G_DEFINE_DYNAMIC_TYPE_EXTENDED (XedTaglistPluginPanel,
|
||||
xed_taglist_plugin_panel,
|
||||
GTK_TYPE_BOX,
|
||||
0,
|
||||
G_ADD_PRIVATE_DYNAMIC (XedTaglistPluginPanel))
|
||||
|
||||
enum
|
||||
{
|
||||
@@ -114,8 +114,7 @@ xed_taglist_plugin_panel_get_property (GObject *object,
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_WINDOW:
|
||||
g_value_set_object (value,
|
||||
XED_TAGLIST_PLUGIN_PANEL_GET_PRIVATE (panel)->window);
|
||||
g_value_set_object (value, panel->priv->window);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
@@ -150,8 +149,6 @@ xed_taglist_plugin_panel_class_init (XedTaglistPluginPanelClass *klass)
|
||||
XED_TYPE_WINDOW,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT_ONLY));
|
||||
|
||||
g_type_class_add_private (object_class, sizeof(XedTaglistPluginPanelPrivate));
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -668,7 +665,7 @@ xed_taglist_plugin_panel_init (XedTaglistPluginPanel *panel)
|
||||
|
||||
xed_debug (DEBUG_PLUGINS);
|
||||
|
||||
panel->priv = XED_TAGLIST_PLUGIN_PANEL_GET_PRIVATE (panel);
|
||||
panel->priv = xed_taglist_plugin_panel_get_instance_private (panel);
|
||||
panel->priv->data_dir = NULL;
|
||||
|
||||
gtk_orientable_set_orientation (GTK_ORIENTABLE (panel),
|
||||
|
@@ -37,8 +37,6 @@
|
||||
#include "xed-taglist-plugin-panel.h"
|
||||
#include "xed-taglist-plugin-parser.h"
|
||||
|
||||
#define XED_TAGLIST_PLUGIN_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), XED_TYPE_TAGLIST_PLUGIN, XedTaglistPluginPrivate))
|
||||
|
||||
struct _XedTaglistPluginPrivate
|
||||
{
|
||||
XedWindow *window;
|
||||
@@ -48,26 +46,25 @@ struct _XedTaglistPluginPrivate
|
||||
|
||||
static void xed_window_activatable_iface_init (XedWindowActivatableInterface *iface);
|
||||
|
||||
G_DEFINE_DYNAMIC_TYPE_EXTENDED (XedTaglistPlugin,
|
||||
xed_taglist_plugin,
|
||||
PEAS_TYPE_EXTENSION_BASE,
|
||||
0,
|
||||
G_IMPLEMENT_INTERFACE_DYNAMIC (XED_TYPE_WINDOW_ACTIVATABLE,
|
||||
xed_window_activatable_iface_init) \
|
||||
\
|
||||
_xed_taglist_plugin_panel_register_type (type_module); \
|
||||
)
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
PROP_WINDOW
|
||||
};
|
||||
|
||||
G_DEFINE_DYNAMIC_TYPE_EXTENDED (XedTaglistPlugin,
|
||||
xed_taglist_plugin,
|
||||
PEAS_TYPE_EXTENSION_BASE,
|
||||
0,
|
||||
G_IMPLEMENT_INTERFACE_DYNAMIC (XED_TYPE_WINDOW_ACTIVATABLE,
|
||||
xed_window_activatable_iface_init)
|
||||
G_ADD_PRIVATE_DYNAMIC (XedTaglistPlugin)
|
||||
_xed_taglist_plugin_panel_register_type (type_module))
|
||||
|
||||
static void
|
||||
xed_taglist_plugin_init (XedTaglistPlugin *plugin)
|
||||
{
|
||||
plugin->priv = XED_TAGLIST_PLUGIN_GET_PRIVATE (plugin);
|
||||
plugin->priv = xed_taglist_plugin_get_instance_private (plugin);
|
||||
|
||||
xed_debug_message (DEBUG_PLUGINS, "XedTaglistPlugin initializing");
|
||||
}
|
||||
@@ -192,8 +189,6 @@ xed_taglist_plugin_class_init (XedTaglistPluginClass *klass)
|
||||
object_class->get_property = xed_taglist_plugin_get_property;
|
||||
|
||||
g_object_class_override_property (object_class, PROP_WINDOW, "window");
|
||||
|
||||
g_type_class_add_private (object_class, sizeof (XedTaglistPluginPrivate));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@@ -7,5 +7,4 @@ _Description=Allow controlling the zoom levels of the text
|
||||
Icon=gnome-mime-text-x-python
|
||||
Authors=Steve Frécinaux <steve@istique.net>;Linux Mint team
|
||||
Copyright=Copyright © 2017 by the authors
|
||||
Website=https://github.com/linuxmint
|
||||
Builtin=true
|
@@ -40,28 +40,15 @@ class DocumentHelper(Signals):
|
||||
|
||||
self._default_font = None
|
||||
self._last_font = None
|
||||
self._font_tags = {}
|
||||
|
||||
def stop(self):
|
||||
if self._default_font:
|
||||
self._view.override_font(self._default_font)
|
||||
|
||||
self.remove_font_tags()
|
||||
self.disconnect_signals(self._view)
|
||||
|
||||
self._view.textsize_document_helper = None
|
||||
|
||||
def remove_font_tags(self):
|
||||
buf = self._view.get_buffer()
|
||||
table = buf.get_tag_table()
|
||||
|
||||
# Remove all the font tags
|
||||
for size in self._font_tags:
|
||||
tag = self._font_tags[size]
|
||||
table.remove(tag)
|
||||
|
||||
self._font_tags = {}
|
||||
|
||||
def update_default_font(self):
|
||||
context = self._view.get_style_context()
|
||||
description = context.get_font(context.get_state()).copy()
|
||||
@@ -69,23 +56,6 @@ class DocumentHelper(Signals):
|
||||
if not self._last_font or description.hash() != self._last_font.hash():
|
||||
self._default_font = description
|
||||
|
||||
def get_font_tags(self, start, end):
|
||||
tags = set()
|
||||
|
||||
# Check all the know font tags
|
||||
for size in self._font_tags:
|
||||
tag = self._font_tags[size]
|
||||
|
||||
if start.has_tag(tag):
|
||||
tags.add(tag)
|
||||
else:
|
||||
cp = start.copy()
|
||||
|
||||
if cp.forward_to_tag_toggle(tag) and cp.compare(end) < 0:
|
||||
tags.add(tag)
|
||||
|
||||
return list(tags)
|
||||
|
||||
def set_font_size(self, amount):
|
||||
self.update_default_font()
|
||||
|
||||
@@ -93,61 +63,17 @@ class DocumentHelper(Signals):
|
||||
description = context.get_font(context.get_state()).copy()
|
||||
|
||||
buf = self._view.get_buffer()
|
||||
bounds = buf.get_selection_bounds()
|
||||
size = description.get_size() / Pango.SCALE
|
||||
|
||||
if not bounds:
|
||||
if size >= MAX_FONT_SIZE and amount == 1:
|
||||
return;
|
||||
if size <= MIN_FONT_SIZE and amount == -1:
|
||||
return;
|
||||
if size >= MAX_FONT_SIZE and amount == 1:
|
||||
return;
|
||||
if size <= MIN_FONT_SIZE and amount == -1:
|
||||
return;
|
||||
|
||||
description.set_size(max(1, (size + amount)) * Pango.SCALE)
|
||||
description.set_size(max(1, (size + amount)) * Pango.SCALE)
|
||||
|
||||
self._view.override_font(description)
|
||||
self._last_font = description
|
||||
else:
|
||||
start = bounds[0]
|
||||
end = bounds[1]
|
||||
|
||||
tags = self.get_font_tags(start, end)
|
||||
|
||||
if not tags:
|
||||
# Simply use the overall font size as the base
|
||||
newsize = size + amount
|
||||
elif len(tags) == 1:
|
||||
newsize = tags[0].props.font_desc.get_size() / Pango.SCALE + amount
|
||||
else:
|
||||
newsize = 0
|
||||
|
||||
for tag in tags:
|
||||
newsize += tag.props.font_desc.get_size() / Pango.SCALE
|
||||
|
||||
newsize = round(newsize / len(tags))
|
||||
|
||||
if newsize >= MAX_FONT_SIZE and amount == 1:
|
||||
return;
|
||||
if newsize <= MIN_FONT_SIZE and amount == -1:
|
||||
return;
|
||||
|
||||
newsize = int(max(1, newsize))
|
||||
|
||||
if not newsize in self._font_tags:
|
||||
newtag = buf.create_tag(None)
|
||||
|
||||
desc = description
|
||||
desc.set_size(newsize * Pango.SCALE)
|
||||
|
||||
newtag.props.font_desc = desc
|
||||
self._font_tags[newsize] = newtag
|
||||
else:
|
||||
newtag = self._font_tags[newsize]
|
||||
|
||||
# Remove all the previous mix of tags
|
||||
for tag in tags:
|
||||
buf.remove_tag(tag, start, end)
|
||||
|
||||
buf.apply_tag(newtag, start, end)
|
||||
self._view.override_font(description)
|
||||
self._last_font = description
|
||||
|
||||
def larger_text(self):
|
||||
self.set_font_size(1)
|
||||
@@ -159,18 +85,9 @@ class DocumentHelper(Signals):
|
||||
self.update_default_font()
|
||||
|
||||
buf = self._view.get_buffer()
|
||||
bounds = buf.get_selection_bounds()
|
||||
|
||||
if not bounds:
|
||||
self.remove_font_tags()
|
||||
|
||||
self._view.override_font(self._default_font)
|
||||
self._last_font = self._default_font
|
||||
else:
|
||||
tags = self.get_font_tags(bounds[0], bounds[1])
|
||||
|
||||
for tag in tags:
|
||||
buf.remove_tag(tag, bounds[0], bounds[1])
|
||||
self._view.override_font(self._default_font)
|
||||
self._last_font = self._default_font
|
||||
|
||||
def on_scroll_event(self, view, event):
|
||||
state = event.state & Gtk.accelerator_get_default_mod_mask()
|
||||
|
@@ -5,4 +5,3 @@ _Name=Insert Date/Time
|
||||
_Description=Inserts current date and time at the cursor position.
|
||||
Authors=Paolo Maggi <paolo.maggi@polito.it>;Lee Mallabone <mate@fonicmonkey.net>
|
||||
Copyright=Copyright © 2002-2005 Paolo Maggi
|
||||
Website=http://www.mate-desktop.org
|
||||
|
@@ -38,10 +38,6 @@
|
||||
|
||||
#include "xed-time-plugin.h"
|
||||
|
||||
#define XED_TIME_PLUGIN_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), \
|
||||
XED_TYPE_TIME_PLUGIN, \
|
||||
XedTimePluginPrivate))
|
||||
|
||||
#define MENU_PATH "/MenuBar/EditMenu/EditOps_4"
|
||||
|
||||
/* GSettings keys */
|
||||
@@ -166,7 +162,8 @@ G_DEFINE_DYNAMIC_TYPE_EXTENDED (XedTimePlugin,
|
||||
G_IMPLEMENT_INTERFACE_DYNAMIC (XED_TYPE_WINDOW_ACTIVATABLE,
|
||||
xed_window_activatable_iface_init)
|
||||
G_IMPLEMENT_INTERFACE_DYNAMIC (PEAS_GTK_TYPE_CONFIGURABLE,
|
||||
peas_gtk_configurable_iface_init))
|
||||
peas_gtk_configurable_iface_init)
|
||||
G_ADD_PRIVATE_DYNAMIC (XedTimePlugin))
|
||||
|
||||
static void time_cb (GtkAction *action,
|
||||
XedTimePlugin *plugin);
|
||||
@@ -188,7 +185,7 @@ xed_time_plugin_init (XedTimePlugin *plugin)
|
||||
{
|
||||
xed_debug_message (DEBUG_PLUGINS, "XedTimePlugin initializing");
|
||||
|
||||
plugin->priv = XED_TIME_PLUGIN_GET_PRIVATE (plugin);
|
||||
plugin->priv = xed_time_plugin_get_instance_private (plugin);
|
||||
|
||||
plugin->priv->settings = g_settings_new (TIME_SCHEMA);
|
||||
}
|
||||
@@ -1034,8 +1031,6 @@ xed_time_plugin_class_init (XedTimePluginClass *klass)
|
||||
object_class->get_property = xed_time_plugin_get_property;
|
||||
|
||||
g_object_class_override_property (object_class, PROP_WINDOW, "window");
|
||||
|
||||
g_type_class_add_private (object_class, sizeof (XedTimePluginPrivate));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@@ -6,4 +6,3 @@ _Description=Removes trailing spaces from lines before saving.
|
||||
Icon=gtk-cut
|
||||
Authors=Marty Mills <daggerbot@gmail.com>
|
||||
Copyright=Copyright © 2015 Marty Mills
|
||||
Website=http://www.mate-desktop.org
|
||||
|
@@ -24,19 +24,8 @@
|
||||
|
||||
#include "xed-trail-save-plugin.h"
|
||||
|
||||
#define XED_TRAIL_SAVE_PLUGIN_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), \
|
||||
XED_TYPE_TRAIL_SAVE_PLUGIN, \
|
||||
XedTrailSavePluginPrivate))
|
||||
|
||||
static void xed_window_activatable_iface_init (XedWindowActivatableInterface *iface);
|
||||
|
||||
G_DEFINE_DYNAMIC_TYPE_EXTENDED (XedTrailSavePlugin,
|
||||
xed_trail_save_plugin,
|
||||
PEAS_TYPE_EXTENSION_BASE,
|
||||
0,
|
||||
G_IMPLEMENT_INTERFACE_DYNAMIC (XED_TYPE_WINDOW_ACTIVATABLE,
|
||||
xed_window_activatable_iface_init))
|
||||
|
||||
struct _XedTrailSavePluginPrivate
|
||||
{
|
||||
XedWindow *window;
|
||||
@@ -48,6 +37,14 @@ enum
|
||||
PROP_WINDOW
|
||||
};
|
||||
|
||||
G_DEFINE_DYNAMIC_TYPE_EXTENDED (XedTrailSavePlugin,
|
||||
xed_trail_save_plugin,
|
||||
PEAS_TYPE_EXTENSION_BASE,
|
||||
0,
|
||||
G_IMPLEMENT_INTERFACE_DYNAMIC (XED_TYPE_WINDOW_ACTIVATABLE,
|
||||
xed_window_activatable_iface_init)
|
||||
G_ADD_PRIVATE_DYNAMIC (XedTrailSavePlugin))
|
||||
|
||||
static void
|
||||
strip_trailing_spaces (GtkTextBuffer *text_buffer)
|
||||
{
|
||||
@@ -235,7 +232,7 @@ xed_trail_save_plugin_init (XedTrailSavePlugin *plugin)
|
||||
{
|
||||
xed_debug_message (DEBUG_PLUGINS, "XedTrailSavePlugin initializing");
|
||||
|
||||
plugin->priv = G_TYPE_INSTANCE_GET_PRIVATE (plugin, XED_TYPE_TRAIL_SAVE_PLUGIN, XedTrailSavePluginPrivate);
|
||||
plugin->priv = xed_trail_save_plugin_get_instance_private (plugin);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -298,8 +295,6 @@ xed_trail_save_plugin_class_init (XedTrailSavePluginClass *klass)
|
||||
object_class->get_property = xed_trail_save_plugin_get_property;
|
||||
|
||||
g_object_class_override_property (object_class, PROP_WINDOW, "window");
|
||||
|
||||
g_type_class_add_private (object_class, sizeof (XedTrailSavePluginPrivate));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@@ -29,5 +29,4 @@ Name[zh_CN]=单词补全
|
||||
Description=Predicts the rest of the word after a few characters have been typed.
|
||||
Authors=Jesse van den Kieboom <jesse@gnome.org>\nIgnacio Casal Quinteiro <icq@gnome.org>\nMickael Albertus <mickael.albertus@gmail.com>
|
||||
Copyright=Copyright © 2017 Mickael Albertus\n2009 Jesse van den Kieboom
|
||||
Website=https://github.com/linuxmint/xed
|
||||
Version=@VERSION@
|
||||
|
@@ -5,5 +5,4 @@ _Name=Word Completion
|
||||
_Description=Predicts the rest of the word after a few characters have been typed.
|
||||
Authors=Jesse van den Kieboom <jesse@gnome.org>\nIgnacio Casal Quinteiro <icq@gnome.org>\nMickael Albertus <mickael.albertus@gmail.com>
|
||||
Copyright=Copyright © 2017 Mickael Albertus\n2009 Jesse van den Kieboom
|
||||
Website=https://github.com/linuxmint/xed
|
||||
Version=@VERSION@
|
||||
|
@@ -45,23 +45,12 @@ static void xed_window_activatable_iface_init (XedWindowActivatableInterface *if
|
||||
static void xed_view_activatable_iface_init (XedViewActivatableInterface *iface);
|
||||
static void peas_gtk_configurable_iface_init (PeasGtkConfigurableInterface *iface);
|
||||
|
||||
G_DEFINE_DYNAMIC_TYPE_EXTENDED (XedWordCompletionPlugin,
|
||||
xed_wordcompletion_plugin,
|
||||
PEAS_TYPE_EXTENSION_BASE,
|
||||
0,
|
||||
G_IMPLEMENT_INTERFACE_DYNAMIC (XED_TYPE_WINDOW_ACTIVATABLE,
|
||||
xed_window_activatable_iface_init)
|
||||
G_IMPLEMENT_INTERFACE_DYNAMIC (XED_TYPE_VIEW_ACTIVATABLE,
|
||||
xed_view_activatable_iface_init)
|
||||
G_IMPLEMENT_INTERFACE_DYNAMIC (PEAS_GTK_TYPE_CONFIGURABLE,
|
||||
peas_gtk_configurable_iface_init))
|
||||
|
||||
struct _XedWordCompletionPluginPrivate
|
||||
{
|
||||
GtkWidget *window;
|
||||
XedView *view;
|
||||
GtkSourceCompletionProvider *provider;
|
||||
GSettings *settings;
|
||||
GSettings *settings;
|
||||
};
|
||||
|
||||
enum
|
||||
@@ -83,14 +72,24 @@ struct _WordCompletionConfigureWidget
|
||||
GSettings *settings;
|
||||
};
|
||||
|
||||
G_DEFINE_DYNAMIC_TYPE_EXTENDED (XedWordCompletionPlugin,
|
||||
xed_wordcompletion_plugin,
|
||||
PEAS_TYPE_EXTENSION_BASE,
|
||||
0,
|
||||
G_IMPLEMENT_INTERFACE_DYNAMIC (XED_TYPE_WINDOW_ACTIVATABLE,
|
||||
xed_window_activatable_iface_init)
|
||||
G_IMPLEMENT_INTERFACE_DYNAMIC (XED_TYPE_VIEW_ACTIVATABLE,
|
||||
xed_view_activatable_iface_init)
|
||||
G_IMPLEMENT_INTERFACE_DYNAMIC (PEAS_GTK_TYPE_CONFIGURABLE,
|
||||
peas_gtk_configurable_iface_init)
|
||||
G_ADD_PRIVATE_DYNAMIC (XedWordCompletionPlugin))
|
||||
|
||||
static void
|
||||
xed_wordcompletion_plugin_init (XedWordCompletionPlugin *plugin)
|
||||
{
|
||||
xed_debug_message (DEBUG_PLUGINS, "XedWordCompletionPlugin initializing");
|
||||
|
||||
plugin->priv = G_TYPE_INSTANCE_GET_PRIVATE (plugin,
|
||||
XED_TYPE_WORDCOMPLETION_PLUGIN,
|
||||
XedWordCompletionPluginPrivate);
|
||||
plugin->priv = xed_wordcompletion_plugin_get_instance_private (plugin);
|
||||
|
||||
plugin->priv->settings = g_settings_new (WORDCOMPLETION_SETTINGS_BASE);
|
||||
}
|
||||
@@ -136,9 +135,9 @@ xed_wordcompletion_plugin_dispose (GObject *object)
|
||||
|
||||
static void
|
||||
xed_wordcompletion_plugin_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
XedWordCompletionPlugin *plugin = XED_WORDCOMPLETION_PLUGIN (object);
|
||||
|
||||
@@ -217,16 +216,16 @@ create_provider (void)
|
||||
settings = g_settings_new (WORDCOMPLETION_SETTINGS_BASE);
|
||||
|
||||
g_settings_bind (settings, SETTINGS_KEY_MINIMUM_WORD_SIZE,
|
||||
provider, "minimum-word-size",
|
||||
G_SETTINGS_BIND_GET);
|
||||
provider, "minimum-word-size",
|
||||
G_SETTINGS_BIND_GET);
|
||||
|
||||
update_activation (provider, settings);
|
||||
|
||||
g_signal_connect_object (settings,
|
||||
"changed::" SETTINGS_KEY_INTERACTIVE_COMPLETION,
|
||||
G_CALLBACK (on_interactive_completion_changed_cb),
|
||||
provider,
|
||||
0);
|
||||
"changed::" SETTINGS_KEY_INTERACTIVE_COMPLETION,
|
||||
G_CALLBACK (on_interactive_completion_changed_cb),
|
||||
provider,
|
||||
0);
|
||||
|
||||
g_object_unref (settings);
|
||||
|
||||
@@ -294,8 +293,7 @@ xed_wordcompletion_view_activate (XedViewActivatable *activatable)
|
||||
priv->provider = g_object_ref (provider);
|
||||
|
||||
gtk_source_completion_add_provider (completion, provider, NULL);
|
||||
gtk_source_completion_words_register (GTK_SOURCE_COMPLETION_WORDS (provider),
|
||||
buf);
|
||||
gtk_source_completion_words_register (GTK_SOURCE_COMPLETION_WORDS (provider), buf);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -316,14 +314,13 @@ xed_wordcompletion_view_deactivate (XedViewActivatable *activatable)
|
||||
priv->provider,
|
||||
NULL);
|
||||
|
||||
gtk_source_completion_words_unregister (GTK_SOURCE_COMPLETION_WORDS (priv->provider),
|
||||
buf);
|
||||
gtk_source_completion_words_unregister (GTK_SOURCE_COMPLETION_WORDS (priv->provider), buf);
|
||||
}
|
||||
|
||||
static void
|
||||
dialog_response_cb (GtkWidget *widget,
|
||||
gint response,
|
||||
gpointer data)
|
||||
dialog_response_cb (GtkWidget *widget,
|
||||
gint response,
|
||||
gpointer data)
|
||||
{
|
||||
gtk_widget_destroy (widget);
|
||||
}
|
||||
@@ -359,37 +356,37 @@ get_configure_widget (XedWordCompletionPlugin *plugin)
|
||||
data_dir = peas_extension_base_get_data_dir (PEAS_EXTENSION_BASE (plugin));
|
||||
ui_file = g_build_filename (data_dir, "xed-wordcompletion-configure.ui", NULL);
|
||||
ret = xed_utils_get_ui_objects (ui_file,
|
||||
NULL,
|
||||
&error_widget,
|
||||
"configure_dialog", &widget->dialog,
|
||||
"spin_button_min_word_size", &widget->min_word_size,
|
||||
"check_button_interactive_completion", &widget->interactive_completion,
|
||||
NULL,
|
||||
&error_widget,
|
||||
"configure_dialog", &widget->dialog,
|
||||
"spin_button_min_word_size", &widget->min_word_size,
|
||||
"check_button_interactive_completion", &widget->interactive_completion,
|
||||
NULL);
|
||||
|
||||
g_free (data_dir);
|
||||
g_free (ui_file);
|
||||
|
||||
if (!ret)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
gtk_window_set_modal (GTK_WINDOW (widget->dialog), TRUE);
|
||||
gtk_window_set_modal (GTK_WINDOW (widget->dialog), TRUE);
|
||||
|
||||
g_settings_bind (widget->settings, SETTINGS_KEY_INTERACTIVE_COMPLETION,
|
||||
widget->interactive_completion, "active",
|
||||
G_SETTINGS_BIND_DEFAULT | G_SETTINGS_BIND_GET_NO_CHANGES);
|
||||
widget->interactive_completion, "active",
|
||||
G_SETTINGS_BIND_DEFAULT | G_SETTINGS_BIND_GET_NO_CHANGES);
|
||||
|
||||
g_settings_bind (widget->settings, SETTINGS_KEY_MINIMUM_WORD_SIZE,
|
||||
widget->min_word_size, "value",
|
||||
G_SETTINGS_BIND_DEFAULT | G_SETTINGS_BIND_GET_NO_CHANGES);
|
||||
widget->min_word_size, "value",
|
||||
G_SETTINGS_BIND_DEFAULT | G_SETTINGS_BIND_GET_NO_CHANGES);
|
||||
|
||||
g_signal_connect (widget->dialog, "destroy",
|
||||
g_signal_connect (widget->dialog, "destroy",
|
||||
G_CALLBACK (configure_widget_destroyed), widget);
|
||||
|
||||
gtk_widget_show (GTK_WIDGET (widget->dialog));
|
||||
g_signal_connect (widget->dialog, "response",
|
||||
G_CALLBACK (dialog_response_cb), widget);
|
||||
G_CALLBACK (dialog_response_cb), widget);
|
||||
|
||||
return widget;
|
||||
}
|
||||
@@ -417,8 +414,6 @@ xed_wordcompletion_plugin_class_init (XedWordCompletionPluginClass *klass)
|
||||
|
||||
g_object_class_override_property (object_class, PROP_WINDOW, "window");
|
||||
g_object_class_override_property (object_class, PROP_VIEW, "view");
|
||||
|
||||
g_type_class_add_private (klass, sizeof (XedWordCompletionPluginPrivate));
|
||||
}
|
||||
|
||||
static void
|
||||
|
534
po/xed.pot
534
po/xed.pot
File diff suppressed because it is too large
Load Diff
@@ -6,4 +6,3 @@ _Description=##(DESCRIPTION)
|
||||
Icon=xed-plugin
|
||||
Authors=##(AUTHOR_FULLNAME) <##(AUTHOR_EMAIL.lower)>
|
||||
Copyright=Copyright © ##(DATE_YEAR) ##(AUTHOR_FULLNAME)
|
||||
Website=http://www.mate-desktop.org
|
||||
|
@@ -173,7 +173,7 @@ gir = gnome.generate_gir(
|
||||
sources: public_headers + libxed_sources + xed_enums + xed_marshal,
|
||||
identifier_prefix: 'Xed',
|
||||
symbol_prefix: 'xed',
|
||||
includes: ['Gtk-3.0', 'GtkSource-3.0'],
|
||||
includes: ['Gtk-3.0', 'GtkSource-4'],
|
||||
install: true,
|
||||
install_dir_typelib: join_paths(libdir, 'xed', 'girepository-1.0'),
|
||||
install_dir_gir: join_paths(datadir, 'xed', 'gir-1.0')
|
||||
@@ -186,7 +186,7 @@ pkgconfig.generate(
|
||||
version: meson.project_version(),
|
||||
libraries: libxed,
|
||||
requires: [
|
||||
'gtksourceview-3.0',
|
||||
'gtksourceview-4',
|
||||
'libpeas-1.0',
|
||||
'libpeas-gtk-1.0'
|
||||
],
|
||||
|
@@ -16,9 +16,15 @@
|
||||
<placeholder name="FileOps_5"/>
|
||||
<menuitem name="FilePrintPreviewMenu" action="FilePrintPreview"/>
|
||||
<menuitem name="FilePrintMenu" action="FilePrint"/>
|
||||
<placeholder name="FileRecentsPlaceholder">
|
||||
<separator/>
|
||||
</placeholder>
|
||||
<separator/>
|
||||
<menu name="XAppFavoritesMenu" action="XAppFavoritesMenu">
|
||||
<placeholder name="XAppFavorites">
|
||||
</placeholder>
|
||||
</menu>
|
||||
<menu name="FileRecentsMenu" action="FileRecentsMenu">
|
||||
<placeholder name="FileRecentsPlaceholder">
|
||||
</placeholder>
|
||||
</menu>
|
||||
<separator/>
|
||||
<menuitem name="FileCloseMenu" action="FileClose"/>
|
||||
<menuitem name="FileQuitMenu" action="FileQuit"/>
|
||||
|
@@ -60,8 +60,6 @@
|
||||
#define XED_PAGE_SETUP_FILE "xed-page-setup"
|
||||
#define XED_PRINT_SETTINGS_FILE "xed-print-settings"
|
||||
|
||||
#define XED_APP_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), XED_TYPE_APP, XedAppPrivate))
|
||||
|
||||
/* Properties */
|
||||
enum
|
||||
{
|
||||
@@ -92,7 +90,7 @@ struct _XedAppPrivate
|
||||
GApplicationCommandLine *command_line;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (XedApp, xed_app, GTK_TYPE_APPLICATION)
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (XedApp, xed_app, GTK_TYPE_APPLICATION)
|
||||
|
||||
static const GOptionEntry options[] =
|
||||
{
|
||||
@@ -893,8 +891,6 @@ xed_app_class_init (XedAppClass *klass)
|
||||
app_class->handle_local_options = xed_app_handle_local_options;
|
||||
app_class->open = xed_app_open;
|
||||
app_class->shutdown = xed_app_shutdown;
|
||||
|
||||
g_type_class_add_private (object_class, sizeof (XedAppPrivate));
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -987,7 +983,7 @@ setup_actions (XedApp *app)
|
||||
static void
|
||||
xed_app_init (XedApp *app)
|
||||
{
|
||||
app->priv = XED_APP_GET_PRIVATE (app);
|
||||
app->priv = xed_app_get_instance_private (app);
|
||||
|
||||
g_set_application_name ("xed");
|
||||
gtk_window_set_default_icon_name ("accessories-text-editor");
|
||||
|
@@ -70,15 +70,11 @@ struct _XedCloseConfirmationDialogPrivate
|
||||
GtkTreeModel *list_store;
|
||||
};
|
||||
|
||||
#define XED_CLOSE_CONFIRMATION_DIALOG_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), \
|
||||
XED_TYPE_CLOSE_CONFIRMATION_DIALOG, \
|
||||
XedCloseConfirmationDialogPrivate))
|
||||
|
||||
#define GET_MODE(priv) (((priv->unsaved_documents != NULL) && \
|
||||
(priv->unsaved_documents->next == NULL)) ? \
|
||||
SINGLE_DOC_MODE : MULTIPLE_DOCS_MODE)
|
||||
|
||||
G_DEFINE_TYPE(XedCloseConfirmationDialog, xed_close_confirmation_dialog, GTK_TYPE_DIALOG)
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (XedCloseConfirmationDialog, xed_close_confirmation_dialog, GTK_TYPE_DIALOG)
|
||||
|
||||
static void set_unsaved_document (XedCloseConfirmationDialog *dlg,
|
||||
const GList *list);
|
||||
@@ -175,7 +171,7 @@ xed_close_confirmation_dialog_init (XedCloseConfirmationDialog *dlg)
|
||||
{
|
||||
AtkObject *atk_obj;
|
||||
|
||||
dlg->priv = XED_CLOSE_CONFIRMATION_DIALOG_GET_PRIVATE (dlg);
|
||||
dlg->priv = xed_close_confirmation_dialog_get_instance_private (dlg);
|
||||
|
||||
gtk_container_set_border_width (GTK_CONTAINER (dlg), 5);
|
||||
gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dlg))), 14);
|
||||
@@ -276,8 +272,6 @@ xed_close_confirmation_dialog_class_init (XedCloseConfirmationDialogClass *klass
|
||||
gobject_class->get_property = xed_close_confirmation_dialog_get_property;
|
||||
gobject_class->finalize = xed_close_confirmation_dialog_finalize;
|
||||
|
||||
g_type_class_add_private (klass, sizeof (XedCloseConfirmationDialogPrivate));
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_UNSAVED_DOCUMENTS,
|
||||
g_param_spec_pointer ("unsaved_documents",
|
||||
|
@@ -35,11 +35,6 @@
|
||||
#include "xed-utils.h"
|
||||
#include "xed-notebook.h"
|
||||
|
||||
|
||||
#define XED_DOCUMENTS_PANEL_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), \
|
||||
XED_TYPE_DOCUMENTS_PANEL, \
|
||||
XedDocumentsPanelPrivate))
|
||||
|
||||
struct _XedDocumentsPanelPrivate
|
||||
{
|
||||
XedWindow *window;
|
||||
@@ -51,7 +46,7 @@ struct _XedDocumentsPanelPrivate
|
||||
guint is_reodering : 1;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (XedDocumentsPanel, xed_documents_panel, GTK_TYPE_BOX)
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (XedDocumentsPanel, xed_documents_panel, GTK_TYPE_BOX)
|
||||
|
||||
enum
|
||||
{
|
||||
@@ -401,7 +396,7 @@ xed_documents_panel_get_property (GObject *object,
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_WINDOW:
|
||||
g_value_set_object (value, XED_DOCUMENTS_PANEL_GET_PRIVATE (panel)->window);
|
||||
g_value_set_object (value, panel->priv->window);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
@@ -452,8 +447,6 @@ xed_documents_panel_class_init (XedDocumentsPanelClass *klass)
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT_ONLY |
|
||||
G_PARAM_STATIC_STRINGS));
|
||||
|
||||
g_type_class_add_private (object_class, sizeof (XedDocumentsPanelPrivate));
|
||||
}
|
||||
|
||||
static GtkTreePath *
|
||||
@@ -471,51 +464,6 @@ get_current_path (XedDocumentsPanel *panel)
|
||||
return path;
|
||||
}
|
||||
|
||||
static void
|
||||
menu_position (GtkMenu *menu,
|
||||
gint *x,
|
||||
gint *y,
|
||||
gboolean *push_in,
|
||||
XedDocumentsPanel *panel)
|
||||
{
|
||||
GtkTreePath *path;
|
||||
GdkRectangle rect;
|
||||
gint wy;
|
||||
GtkAllocation allocation;
|
||||
GtkRequisition requisition;
|
||||
GtkWidget *w;
|
||||
|
||||
w = panel->priv->treeview;
|
||||
|
||||
gtk_widget_get_allocation(w, &allocation);
|
||||
|
||||
path = get_current_path (panel);
|
||||
|
||||
gtk_tree_view_get_cell_area (GTK_TREE_VIEW (w), path, NULL, &rect);
|
||||
|
||||
wy = rect.y;
|
||||
|
||||
gdk_window_get_origin (gtk_widget_get_window (w), x, y);
|
||||
|
||||
gtk_widget_get_preferred_size (GTK_WIDGET (menu), NULL, &requisition);
|
||||
|
||||
if (gtk_widget_get_direction (w) == GTK_TEXT_DIR_RTL)
|
||||
{
|
||||
*x += allocation.x + allocation.width - requisition.width - 10;
|
||||
}
|
||||
else
|
||||
{
|
||||
*x += allocation.x + 10;
|
||||
}
|
||||
|
||||
wy = MAX (*y + 5, *y + wy + 5);
|
||||
wy = MIN (wy, *y + allocation.height - requisition.height - 5);
|
||||
|
||||
*y = wy;
|
||||
|
||||
*push_in = TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
show_popup_menu (XedDocumentsPanel *panel,
|
||||
GdkEventButton *event)
|
||||
@@ -673,7 +621,7 @@ xed_documents_panel_init (XedDocumentsPanel *panel)
|
||||
GtkCellRenderer *cell;
|
||||
GtkTreeSelection *selection;
|
||||
|
||||
panel->priv = XED_DOCUMENTS_PANEL_GET_PRIVATE (panel);
|
||||
panel->priv = xed_documents_panel_get_instance_private (panel);
|
||||
|
||||
panel->priv->adding_tab = FALSE;
|
||||
panel->priv->is_reodering = FALSE;
|
||||
|
@@ -37,10 +37,6 @@
|
||||
#include "xed-settings.h"
|
||||
#include "xed-utils.h"
|
||||
|
||||
#define XED_ENCODINGS_COMBO_BOX_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), \
|
||||
XED_TYPE_ENCODINGS_COMBO_BOX, \
|
||||
XedEncodingsComboBoxPrivate))
|
||||
|
||||
struct _XedEncodingsComboBoxPrivate
|
||||
{
|
||||
GSettings *enc_settings;
|
||||
@@ -69,7 +65,7 @@ enum
|
||||
};
|
||||
|
||||
|
||||
G_DEFINE_TYPE(XedEncodingsComboBox, xed_encodings_combo_box, GTK_TYPE_COMBO_BOX)
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (XedEncodingsComboBox, xed_encodings_combo_box, GTK_TYPE_COMBO_BOX)
|
||||
|
||||
static void update_menu (XedEncodingsComboBox *combo_box);
|
||||
|
||||
@@ -147,8 +143,6 @@ xed_encodings_combo_box_class_init (XedEncodingsComboBoxClass *klass)
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT |
|
||||
G_PARAM_STATIC_STRINGS));
|
||||
|
||||
g_type_class_add_private (object_class, sizeof (XedEncodingsComboBoxPrivate));
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -358,7 +352,7 @@ xed_encodings_combo_box_init (XedEncodingsComboBox *menu)
|
||||
{
|
||||
GtkCellRenderer *text_renderer;
|
||||
|
||||
menu->priv = XED_ENCODINGS_COMBO_BOX_GET_PRIVATE (menu);
|
||||
menu->priv = xed_encodings_combo_box_get_instance_private (menu);
|
||||
|
||||
menu->priv->enc_settings = g_settings_new ("org.x.editor.preferences.encodings");
|
||||
menu->priv->store = gtk_list_store_new (N_COLUMNS, G_TYPE_STRING, G_TYPE_POINTER, G_TYPE_BOOLEAN);
|
||||
|
@@ -39,10 +39,6 @@
|
||||
#include "xed-dirs.h"
|
||||
#include "xed-settings.h"
|
||||
|
||||
#define XED_ENCODINGS_DIALOG_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), \
|
||||
XED_TYPE_ENCODINGS_DIALOG, \
|
||||
XedEncodingsDialogPrivate))
|
||||
|
||||
struct _XedEncodingsDialogPrivate
|
||||
{
|
||||
GSettings *enc_settings;
|
||||
@@ -58,7 +54,7 @@ struct _XedEncodingsDialogPrivate
|
||||
GSList *show_in_menu_list;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE(XedEncodingsDialog, xed_encodings_dialog, GTK_TYPE_DIALOG)
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (XedEncodingsDialog, xed_encodings_dialog, GTK_TYPE_DIALOG)
|
||||
|
||||
static void
|
||||
xed_encodings_dialog_finalize (GObject *object)
|
||||
@@ -87,8 +83,6 @@ xed_encodings_dialog_class_init (XedEncodingsDialogClass *klass)
|
||||
|
||||
object_class->finalize = xed_encodings_dialog_finalize;
|
||||
object_class->dispose = xed_encodings_dialog_dispose;
|
||||
|
||||
g_type_class_add_private (object_class, sizeof (XedEncodingsDialogPrivate));
|
||||
}
|
||||
|
||||
enum
|
||||
@@ -329,7 +323,7 @@ xed_encodings_dialog_init (XedEncodingsDialog *dlg)
|
||||
NULL
|
||||
};
|
||||
|
||||
dlg->priv = XED_ENCODINGS_DIALOG_GET_PRIVATE (dlg);
|
||||
dlg->priv = xed_encodings_dialog_get_instance_private (dlg);
|
||||
dlg->priv->enc_settings = g_settings_new ("org.x.editor.preferences.encodings");
|
||||
|
||||
gtk_dialog_add_buttons (GTK_DIALOG (dlg),
|
||||
|
@@ -41,8 +41,6 @@
|
||||
#include "xed-enum-types.h"
|
||||
#include "xed-settings.h"
|
||||
|
||||
#define XED_FILE_CHOOSER_DIALOG_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), XED_TYPE_FILE_CHOOSER_DIALOG, XedFileChooserDialogPrivate))
|
||||
|
||||
#define ALL_FILES _("All Files")
|
||||
#define ALL_TEXT_FILES _("All Text Files")
|
||||
|
||||
@@ -58,7 +56,7 @@ struct _XedFileChooserDialogPrivate
|
||||
GtkListStore *newline_store;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE(XedFileChooserDialog, xed_file_chooser_dialog, GTK_TYPE_FILE_CHOOSER_DIALOG)
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (XedFileChooserDialog, xed_file_chooser_dialog, GTK_TYPE_FILE_CHOOSER_DIALOG)
|
||||
|
||||
static void
|
||||
xed_file_chooser_dialog_dispose (GObject *object)
|
||||
@@ -76,8 +74,6 @@ xed_file_chooser_dialog_class_init (XedFileChooserDialogClass *klass)
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
object_class->dispose = xed_file_chooser_dialog_dispose;
|
||||
|
||||
g_type_class_add_private (object_class, sizeof(XedFileChooserDialogPrivate));
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -324,7 +320,7 @@ all_text_files_filter (const GtkFileFilterInfo *filter_info,
|
||||
static void
|
||||
xed_file_chooser_dialog_init (XedFileChooserDialog *dialog)
|
||||
{
|
||||
dialog->priv = XED_FILE_CHOOSER_DIALOG_GET_PRIVATE (dialog);
|
||||
dialog->priv = xed_file_chooser_dialog_get_instance_private (dialog);
|
||||
|
||||
dialog->priv->filter_settings = g_settings_new ("org.x.editor.state.file-filter");
|
||||
}
|
||||
|
@@ -24,40 +24,40 @@
|
||||
|
||||
struct _XedHighlightModeDialog
|
||||
{
|
||||
GtkDialog parent_instance;
|
||||
GtkDialog parent_instance;
|
||||
|
||||
XedHighlightModeSelector *selector;
|
||||
gulong on_language_selected_id;
|
||||
XedHighlightModeSelector *selector;
|
||||
gulong on_language_selected_id;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (XedHighlightModeDialog, xed_highlight_mode_dialog, GTK_TYPE_DIALOG)
|
||||
|
||||
static void
|
||||
xed_highlight_mode_dialog_response (GtkDialog *dialog,
|
||||
gint response_id)
|
||||
gint response_id)
|
||||
{
|
||||
XedHighlightModeDialog *dlg = XED_HIGHLIGHT_MODE_DIALOG (dialog);
|
||||
XedHighlightModeDialog *dlg = XED_HIGHLIGHT_MODE_DIALOG (dialog);
|
||||
|
||||
if (response_id == GTK_RESPONSE_OK)
|
||||
{
|
||||
g_signal_handler_block (dlg->selector, dlg->on_language_selected_id);
|
||||
xed_highlight_mode_selector_activate_selected_language (dlg->selector);
|
||||
g_signal_handler_unblock (dlg->selector, dlg->on_language_selected_id);
|
||||
}
|
||||
if (response_id == GTK_RESPONSE_OK)
|
||||
{
|
||||
g_signal_handler_block (dlg->selector, dlg->on_language_selected_id);
|
||||
xed_highlight_mode_selector_activate_selected_language (dlg->selector);
|
||||
g_signal_handler_unblock (dlg->selector, dlg->on_language_selected_id);
|
||||
}
|
||||
|
||||
gtk_widget_destroy (GTK_WIDGET (dialog));
|
||||
gtk_widget_destroy (GTK_WIDGET (dialog));
|
||||
}
|
||||
|
||||
static void
|
||||
on_language_selected (XedHighlightModeSelector *sel,
|
||||
GtkSourceLanguage *language,
|
||||
GtkSourceLanguage *language,
|
||||
XedHighlightModeDialog *dlg)
|
||||
{
|
||||
g_signal_handler_block (dlg->selector, dlg->on_language_selected_id);
|
||||
xed_highlight_mode_selector_activate_selected_language (dlg->selector);
|
||||
g_signal_handler_unblock (dlg->selector, dlg->on_language_selected_id);
|
||||
g_signal_handler_block (dlg->selector, dlg->on_language_selected_id);
|
||||
xed_highlight_mode_selector_activate_selected_language (dlg->selector);
|
||||
g_signal_handler_unblock (dlg->selector, dlg->on_language_selected_id);
|
||||
|
||||
gtk_widget_destroy (GTK_WIDGET (dlg));
|
||||
gtk_widget_destroy (GTK_WIDGET (dlg));
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -70,25 +70,25 @@ on_dialog_cancelled (XedHighlightModeSelector *sel,
|
||||
static void
|
||||
xed_highlight_mode_dialog_class_init (XedHighlightModeDialogClass *klass)
|
||||
{
|
||||
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
|
||||
GtkDialogClass *dialog_class = GTK_DIALOG_CLASS (klass);
|
||||
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
|
||||
GtkDialogClass *dialog_class = GTK_DIALOG_CLASS (klass);
|
||||
|
||||
dialog_class->response = xed_highlight_mode_dialog_response;
|
||||
dialog_class->response = xed_highlight_mode_dialog_response;
|
||||
|
||||
/* Bind class to template */
|
||||
gtk_widget_class_set_template_from_resource (widget_class,
|
||||
"/org/x/editor/ui/xed-highlight-mode-dialog.ui");
|
||||
gtk_widget_class_bind_template_child (widget_class, XedHighlightModeDialog, selector);
|
||||
/* Bind class to template */
|
||||
gtk_widget_class_set_template_from_resource (widget_class,
|
||||
"/org/x/editor/ui/xed-highlight-mode-dialog.ui");
|
||||
gtk_widget_class_bind_template_child (widget_class, XedHighlightModeDialog, selector);
|
||||
}
|
||||
|
||||
static void
|
||||
xed_highlight_mode_dialog_init (XedHighlightModeDialog *dlg)
|
||||
{
|
||||
gtk_widget_init_template (GTK_WIDGET (dlg));
|
||||
gtk_dialog_set_default_response (GTK_DIALOG (dlg), GTK_RESPONSE_OK);
|
||||
gtk_widget_init_template (GTK_WIDGET (dlg));
|
||||
gtk_dialog_set_default_response (GTK_DIALOG (dlg), GTK_RESPONSE_OK);
|
||||
|
||||
dlg->on_language_selected_id = g_signal_connect (dlg->selector, "language-selected",
|
||||
G_CALLBACK (on_language_selected), dlg);
|
||||
dlg->on_language_selected_id = g_signal_connect (dlg->selector, "language-selected",
|
||||
G_CALLBACK (on_language_selected), dlg);
|
||||
|
||||
g_signal_connect (dlg->selector, "cancelled",
|
||||
G_CALLBACK (on_dialog_cancelled), dlg);
|
||||
@@ -97,17 +97,15 @@ xed_highlight_mode_dialog_init (XedHighlightModeDialog *dlg)
|
||||
GtkWidget *
|
||||
xed_highlight_mode_dialog_new (GtkWindow *parent)
|
||||
{
|
||||
return GTK_WIDGET (g_object_new (XED_TYPE_HIGHLIGHT_MODE_DIALOG,
|
||||
"transient-for", parent,
|
||||
NULL));
|
||||
return GTK_WIDGET (g_object_new (XED_TYPE_HIGHLIGHT_MODE_DIALOG,
|
||||
"transient-for", parent,
|
||||
NULL));
|
||||
}
|
||||
|
||||
XedHighlightModeSelector *
|
||||
xed_highlight_mode_dialog_get_selector (XedHighlightModeDialog *dlg)
|
||||
{
|
||||
g_return_val_if_fail (XED_IS_HIGHLIGHT_MODE_DIALOG (dlg), NULL);
|
||||
g_return_val_if_fail (XED_IS_HIGHLIGHT_MODE_DIALOG (dlg), NULL);
|
||||
|
||||
return dlg->selector;
|
||||
return dlg->selector;
|
||||
}
|
||||
|
||||
/* ex:set ts=8 noet: */
|
||||
|
@@ -26,28 +26,28 @@
|
||||
|
||||
enum
|
||||
{
|
||||
COLUMN_NAME,
|
||||
COLUMN_LANG,
|
||||
N_COLUMNS
|
||||
COLUMN_NAME,
|
||||
COLUMN_LANG,
|
||||
N_COLUMNS
|
||||
};
|
||||
|
||||
struct _XedHighlightModeSelector
|
||||
{
|
||||
GtkGrid parent_instance;
|
||||
GtkGrid parent_instance;
|
||||
|
||||
GtkWidget *treeview;
|
||||
GtkWidget *entry;
|
||||
GtkListStore *liststore;
|
||||
GtkTreeModelFilter *treemodelfilter;
|
||||
GtkTreeSelection *treeview_selection;
|
||||
GtkWidget *treeview;
|
||||
GtkWidget *entry;
|
||||
GtkListStore *liststore;
|
||||
GtkTreeModelFilter *treemodelfilter;
|
||||
GtkTreeSelection *treeview_selection;
|
||||
};
|
||||
|
||||
/* Signals */
|
||||
enum
|
||||
{
|
||||
LANGUAGE_SELECTED,
|
||||
LANGUAGE_SELECTED,
|
||||
CANCELLED,
|
||||
LAST_SIGNAL
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
static guint signals[LAST_SIGNAL] = { 0 };
|
||||
@@ -56,24 +56,24 @@ G_DEFINE_TYPE (XedHighlightModeSelector, xed_highlight_mode_selector, GTK_TYPE_G
|
||||
|
||||
static void
|
||||
xed_highlight_mode_selector_language_selected (XedHighlightModeSelector *widget,
|
||||
GtkSourceLanguage *language)
|
||||
GtkSourceLanguage *language)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
xed_highlight_mode_selector_class_init (XedHighlightModeSelectorClass *klass)
|
||||
{
|
||||
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
|
||||
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
|
||||
|
||||
signals[LANGUAGE_SELECTED] =
|
||||
g_signal_new_class_handler ("language-selected",
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
|
||||
G_CALLBACK (xed_highlight_mode_selector_language_selected),
|
||||
NULL, NULL, NULL,
|
||||
G_TYPE_NONE,
|
||||
1,
|
||||
GTK_SOURCE_TYPE_LANGUAGE);
|
||||
signals[LANGUAGE_SELECTED] =
|
||||
g_signal_new_class_handler ("language-selected",
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
|
||||
G_CALLBACK (xed_highlight_mode_selector_language_selected),
|
||||
NULL, NULL, NULL,
|
||||
G_TYPE_NONE,
|
||||
1,
|
||||
GTK_SOURCE_TYPE_LANGUAGE);
|
||||
|
||||
signals[CANCELLED] =
|
||||
g_signal_new_class_handler ("cancelled",
|
||||
@@ -82,325 +82,323 @@ xed_highlight_mode_selector_class_init (XedHighlightModeSelectorClass *klass)
|
||||
NULL, NULL, NULL, NULL,
|
||||
G_TYPE_NONE, 0);
|
||||
|
||||
/* Bind class to template */
|
||||
gtk_widget_class_set_template_from_resource (widget_class,
|
||||
"/org/x/editor/ui/xed-highlight-mode-selector.ui");
|
||||
gtk_widget_class_bind_template_child (widget_class, XedHighlightModeSelector, treeview);
|
||||
gtk_widget_class_bind_template_child (widget_class, XedHighlightModeSelector, entry);
|
||||
gtk_widget_class_bind_template_child (widget_class, XedHighlightModeSelector, liststore);
|
||||
gtk_widget_class_bind_template_child (widget_class, XedHighlightModeSelector, treemodelfilter);
|
||||
gtk_widget_class_bind_template_child (widget_class, XedHighlightModeSelector, treeview_selection);
|
||||
/* Bind class to template */
|
||||
gtk_widget_class_set_template_from_resource (widget_class,
|
||||
"/org/x/editor/ui/xed-highlight-mode-selector.ui");
|
||||
gtk_widget_class_bind_template_child (widget_class, XedHighlightModeSelector, treeview);
|
||||
gtk_widget_class_bind_template_child (widget_class, XedHighlightModeSelector, entry);
|
||||
gtk_widget_class_bind_template_child (widget_class, XedHighlightModeSelector, liststore);
|
||||
gtk_widget_class_bind_template_child (widget_class, XedHighlightModeSelector, treemodelfilter);
|
||||
gtk_widget_class_bind_template_child (widget_class, XedHighlightModeSelector, treeview_selection);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
visible_func (GtkTreeModel *model,
|
||||
GtkTreeIter *iter,
|
||||
visible_func (GtkTreeModel *model,
|
||||
GtkTreeIter *iter,
|
||||
XedHighlightModeSelector *selector)
|
||||
{
|
||||
const gchar *entry_text;
|
||||
gchar *name;
|
||||
gchar *name_normalized;
|
||||
gchar *name_casefolded;
|
||||
gchar *text_normalized;
|
||||
gchar *text_casefolded;
|
||||
gboolean visible = FALSE;
|
||||
const gchar *entry_text;
|
||||
gchar *name;
|
||||
gchar *name_normalized;
|
||||
gchar *name_casefolded;
|
||||
gchar *text_normalized;
|
||||
gchar *text_casefolded;
|
||||
gboolean visible = FALSE;
|
||||
|
||||
entry_text = gtk_entry_get_text (GTK_ENTRY (selector->entry));
|
||||
entry_text = gtk_entry_get_text (GTK_ENTRY (selector->entry));
|
||||
|
||||
if (*entry_text == '\0')
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
if (*entry_text == '\0')
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gtk_tree_model_get (model, iter, COLUMN_NAME, &name, -1);
|
||||
gtk_tree_model_get (model, iter, COLUMN_NAME, &name, -1);
|
||||
|
||||
name_normalized = g_utf8_normalize (name, -1, G_NORMALIZE_ALL);
|
||||
g_free (name);
|
||||
name_normalized = g_utf8_normalize (name, -1, G_NORMALIZE_ALL);
|
||||
g_free (name);
|
||||
|
||||
name_casefolded = g_utf8_casefold (name_normalized, -1);
|
||||
g_free (name_normalized);
|
||||
name_casefolded = g_utf8_casefold (name_normalized, -1);
|
||||
g_free (name_normalized);
|
||||
|
||||
text_normalized = g_utf8_normalize (entry_text, -1, G_NORMALIZE_ALL);
|
||||
text_casefolded = g_utf8_casefold (text_normalized, -1);
|
||||
g_free (text_normalized);
|
||||
text_normalized = g_utf8_normalize (entry_text, -1, G_NORMALIZE_ALL);
|
||||
text_casefolded = g_utf8_casefold (text_normalized, -1);
|
||||
g_free (text_normalized);
|
||||
|
||||
if (strstr (name_casefolded, text_casefolded) != NULL)
|
||||
{
|
||||
visible = TRUE;
|
||||
}
|
||||
if (strstr (name_casefolded, text_casefolded) != NULL)
|
||||
{
|
||||
visible = TRUE;
|
||||
}
|
||||
|
||||
g_free (name_casefolded);
|
||||
g_free (text_casefolded);
|
||||
g_free (name_casefolded);
|
||||
g_free (text_casefolded);
|
||||
|
||||
return visible;
|
||||
return visible;
|
||||
}
|
||||
|
||||
static void
|
||||
on_entry_activate (GtkEntry *entry,
|
||||
on_entry_activate (GtkEntry *entry,
|
||||
XedHighlightModeSelector *selector)
|
||||
{
|
||||
xed_highlight_mode_selector_activate_selected_language (selector);
|
||||
xed_highlight_mode_selector_activate_selected_language (selector);
|
||||
}
|
||||
|
||||
static void
|
||||
on_entry_changed (GtkEntry *entry,
|
||||
on_entry_changed (GtkEntry *entry,
|
||||
XedHighlightModeSelector *selector)
|
||||
{
|
||||
GtkTreeIter iter;
|
||||
GtkTreeIter iter;
|
||||
|
||||
gtk_tree_model_filter_refilter (selector->treemodelfilter);
|
||||
gtk_tree_model_filter_refilter (selector->treemodelfilter);
|
||||
|
||||
if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (selector->treemodelfilter), &iter))
|
||||
{
|
||||
gtk_tree_selection_select_iter (selector->treeview_selection, &iter);
|
||||
}
|
||||
if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (selector->treemodelfilter), &iter))
|
||||
{
|
||||
gtk_tree_selection_select_iter (selector->treeview_selection, &iter);
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
move_selection (XedHighlightModeSelector *selector,
|
||||
gint howmany)
|
||||
{
|
||||
GtkTreeIter iter;
|
||||
GtkTreePath *path;
|
||||
gint *indices;
|
||||
gint ret = FALSE;
|
||||
GtkTreeIter iter;
|
||||
GtkTreePath *path;
|
||||
gint *indices;
|
||||
gint ret = FALSE;
|
||||
|
||||
if (!gtk_tree_selection_get_selected (selector->treeview_selection, NULL, &iter) &&
|
||||
!gtk_tree_model_get_iter_first (GTK_TREE_MODEL (selector->treemodelfilter), &iter))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
if (!gtk_tree_selection_get_selected (selector->treeview_selection, NULL, &iter) &&
|
||||
!gtk_tree_model_get_iter_first (GTK_TREE_MODEL (selector->treemodelfilter), &iter))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
path = gtk_tree_model_get_path (GTK_TREE_MODEL (selector->treemodelfilter), &iter);
|
||||
indices = gtk_tree_path_get_indices (path);
|
||||
path = gtk_tree_model_get_path (GTK_TREE_MODEL (selector->treemodelfilter), &iter);
|
||||
indices = gtk_tree_path_get_indices (path);
|
||||
|
||||
if (indices)
|
||||
{
|
||||
gint num;
|
||||
gint idx;
|
||||
GtkTreePath *new_path;
|
||||
if (indices)
|
||||
{
|
||||
gint num;
|
||||
gint idx;
|
||||
GtkTreePath *new_path;
|
||||
|
||||
idx = indices[0];
|
||||
num = gtk_tree_model_iter_n_children (GTK_TREE_MODEL (selector->treemodelfilter), NULL);
|
||||
idx = indices[0];
|
||||
num = gtk_tree_model_iter_n_children (GTK_TREE_MODEL (selector->treemodelfilter), NULL);
|
||||
|
||||
if ((idx + howmany) < 0)
|
||||
{
|
||||
idx = 0;
|
||||
}
|
||||
else if ((idx + howmany) >= num)
|
||||
{
|
||||
idx = num - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
idx = idx + howmany;
|
||||
}
|
||||
if ((idx + howmany) < 0)
|
||||
{
|
||||
idx = 0;
|
||||
}
|
||||
else if ((idx + howmany) >= num)
|
||||
{
|
||||
idx = num - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
idx = idx + howmany;
|
||||
}
|
||||
|
||||
new_path = gtk_tree_path_new_from_indices (idx, -1);
|
||||
gtk_tree_selection_select_path (selector->treeview_selection, new_path);
|
||||
gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (selector->treeview),
|
||||
new_path, NULL, TRUE, 0.5, 0);
|
||||
gtk_tree_path_free (new_path);
|
||||
new_path = gtk_tree_path_new_from_indices (idx, -1);
|
||||
gtk_tree_selection_select_path (selector->treeview_selection, new_path);
|
||||
gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (selector->treeview),
|
||||
new_path, NULL, TRUE, 0.5, 0);
|
||||
gtk_tree_path_free (new_path);
|
||||
|
||||
ret = TRUE;
|
||||
}
|
||||
ret = TRUE;
|
||||
}
|
||||
|
||||
gtk_tree_path_free (path);
|
||||
gtk_tree_path_free (path);
|
||||
|
||||
return ret;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
on_entry_key_press_event (GtkWidget *entry,
|
||||
GdkEventKey *event,
|
||||
on_entry_key_press_event (GtkWidget *entry,
|
||||
GdkEventKey *event,
|
||||
XedHighlightModeSelector *selector)
|
||||
{
|
||||
if (event->keyval == GDK_KEY_Down)
|
||||
{
|
||||
return move_selection (selector, 1);
|
||||
}
|
||||
else if (event->keyval == GDK_KEY_Up)
|
||||
{
|
||||
return move_selection (selector, -1);
|
||||
}
|
||||
else if (event->keyval == GDK_KEY_Page_Down)
|
||||
{
|
||||
return move_selection (selector, 5);
|
||||
}
|
||||
else if (event->keyval == GDK_KEY_Page_Up)
|
||||
{
|
||||
return move_selection (selector, -5);
|
||||
}
|
||||
if (event->keyval == GDK_KEY_Down)
|
||||
{
|
||||
return move_selection (selector, 1);
|
||||
}
|
||||
else if (event->keyval == GDK_KEY_Up)
|
||||
{
|
||||
return move_selection (selector, -1);
|
||||
}
|
||||
else if (event->keyval == GDK_KEY_Page_Down)
|
||||
{
|
||||
return move_selection (selector, 5);
|
||||
}
|
||||
else if (event->keyval == GDK_KEY_Page_Up)
|
||||
{
|
||||
return move_selection (selector, -5);
|
||||
}
|
||||
else if (event->keyval == GDK_KEY_Escape)
|
||||
{
|
||||
g_signal_emit (G_OBJECT (selector), signals[CANCELLED], 0);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
on_entry_realized (GtkWidget *entry,
|
||||
XedHighlightModeSelector *selector)
|
||||
{
|
||||
if (gtk_widget_is_focus (selector))
|
||||
if (gtk_widget_is_focus (GTK_WIDGET (selector)))
|
||||
{
|
||||
gtk_widget_grab_focus (entry);
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_widget_grab_focus (selector);
|
||||
gtk_widget_grab_focus (GTK_WIDGET (selector));
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
on_row_activated (GtkTreeView *tree_view,
|
||||
GtkTreePath *path,
|
||||
GtkTreeViewColumn *column,
|
||||
on_row_activated (GtkTreeView *tree_view,
|
||||
GtkTreePath *path,
|
||||
GtkTreeViewColumn *column,
|
||||
XedHighlightModeSelector *selector)
|
||||
{
|
||||
xed_highlight_mode_selector_activate_selected_language (selector);
|
||||
xed_highlight_mode_selector_activate_selected_language (selector);
|
||||
}
|
||||
|
||||
static void
|
||||
xed_highlight_mode_selector_init (XedHighlightModeSelector *selector)
|
||||
{
|
||||
GtkSourceLanguageManager *lm;
|
||||
const gchar * const *ids;
|
||||
gint i;
|
||||
GtkTreeIter iter;
|
||||
GtkSourceLanguageManager *lm;
|
||||
const gchar * const *ids;
|
||||
gint i;
|
||||
GtkTreeIter iter;
|
||||
|
||||
selector = xed_highlight_mode_selector_get_instance_private (selector);
|
||||
selector = xed_highlight_mode_selector_get_instance_private (selector);
|
||||
|
||||
gtk_widget_init_template (GTK_WIDGET (selector));
|
||||
gtk_widget_init_template (GTK_WIDGET (selector));
|
||||
|
||||
gtk_tree_model_filter_set_visible_func (selector->treemodelfilter,
|
||||
(GtkTreeModelFilterVisibleFunc)visible_func,
|
||||
selector,
|
||||
NULL);
|
||||
gtk_tree_model_filter_set_visible_func (selector->treemodelfilter,
|
||||
(GtkTreeModelFilterVisibleFunc)visible_func,
|
||||
selector,
|
||||
NULL);
|
||||
|
||||
g_signal_connect (selector->entry, "activate",
|
||||
G_CALLBACK (on_entry_activate), selector);
|
||||
g_signal_connect (selector->entry, "changed",
|
||||
G_CALLBACK (on_entry_changed), selector);
|
||||
g_signal_connect (selector->entry, "key-press-event",
|
||||
G_CALLBACK (on_entry_key_press_event), selector);
|
||||
g_signal_connect (selector->entry, "activate",
|
||||
G_CALLBACK (on_entry_activate), selector);
|
||||
g_signal_connect (selector->entry, "changed",
|
||||
G_CALLBACK (on_entry_changed), selector);
|
||||
g_signal_connect (selector->entry, "key-press-event",
|
||||
G_CALLBACK (on_entry_key_press_event), selector);
|
||||
g_signal_connect (selector->entry, "realize",
|
||||
G_CALLBACK (on_entry_realized), selector);
|
||||
g_signal_connect (selector->treeview, "row-activated",
|
||||
G_CALLBACK (on_row_activated), selector);
|
||||
g_signal_connect (selector->treeview, "row-activated",
|
||||
G_CALLBACK (on_row_activated), selector);
|
||||
|
||||
/* Populate tree model */
|
||||
gtk_list_store_append (selector->liststore, &iter);
|
||||
gtk_list_store_set (selector->liststore, &iter,
|
||||
COLUMN_NAME, _("Plain Text"),
|
||||
COLUMN_LANG, NULL,
|
||||
-1);
|
||||
/* Populate tree model */
|
||||
gtk_list_store_append (selector->liststore, &iter);
|
||||
gtk_list_store_set (selector->liststore, &iter,
|
||||
COLUMN_NAME, _("Plain Text"),
|
||||
COLUMN_LANG, NULL,
|
||||
-1);
|
||||
|
||||
lm = gtk_source_language_manager_get_default ();
|
||||
ids = gtk_source_language_manager_get_language_ids (lm);
|
||||
lm = gtk_source_language_manager_get_default ();
|
||||
ids = gtk_source_language_manager_get_language_ids (lm);
|
||||
|
||||
for (i = 0; ids[i] != NULL; i++)
|
||||
{
|
||||
GtkSourceLanguage *lang;
|
||||
for (i = 0; ids[i] != NULL; i++)
|
||||
{
|
||||
GtkSourceLanguage *lang;
|
||||
|
||||
lang = gtk_source_language_manager_get_language (lm, ids[i]);
|
||||
lang = gtk_source_language_manager_get_language (lm, ids[i]);
|
||||
|
||||
if (!gtk_source_language_get_hidden (lang))
|
||||
{
|
||||
gtk_list_store_append (selector->liststore, &iter);
|
||||
gtk_list_store_set (selector->liststore, &iter,
|
||||
COLUMN_NAME, gtk_source_language_get_name (lang),
|
||||
COLUMN_LANG, lang,
|
||||
-1);
|
||||
}
|
||||
}
|
||||
if (!gtk_source_language_get_hidden (lang))
|
||||
{
|
||||
gtk_list_store_append (selector->liststore, &iter);
|
||||
gtk_list_store_set (selector->liststore, &iter,
|
||||
COLUMN_NAME, gtk_source_language_get_name (lang),
|
||||
COLUMN_LANG, lang,
|
||||
-1);
|
||||
}
|
||||
}
|
||||
|
||||
/* select first item */
|
||||
if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (selector->treemodelfilter), &iter))
|
||||
{
|
||||
gtk_tree_selection_select_iter (selector->treeview_selection, &iter);
|
||||
}
|
||||
/* select first item */
|
||||
if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (selector->treemodelfilter), &iter))
|
||||
{
|
||||
gtk_tree_selection_select_iter (selector->treeview_selection, &iter);
|
||||
}
|
||||
}
|
||||
|
||||
XedHighlightModeSelector *
|
||||
xed_highlight_mode_selector_new ()
|
||||
{
|
||||
return g_object_new (XED_TYPE_HIGHLIGHT_MODE_SELECTOR, NULL);
|
||||
return g_object_new (XED_TYPE_HIGHLIGHT_MODE_SELECTOR, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
xed_highlight_mode_selector_select_language (XedHighlightModeSelector *selector,
|
||||
GtkSourceLanguage *language)
|
||||
{
|
||||
GtkTreeIter iter;
|
||||
GtkTreeIter iter;
|
||||
|
||||
g_return_if_fail (XED_IS_HIGHLIGHT_MODE_SELECTOR (selector));
|
||||
g_return_if_fail (XED_IS_HIGHLIGHT_MODE_SELECTOR (selector));
|
||||
|
||||
if (language == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (language == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (selector->treemodelfilter), &iter))
|
||||
{
|
||||
do
|
||||
{
|
||||
GtkSourceLanguage *lang;
|
||||
if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (selector->treemodelfilter), &iter))
|
||||
{
|
||||
do
|
||||
{
|
||||
GtkSourceLanguage *lang;
|
||||
|
||||
gtk_tree_model_get (GTK_TREE_MODEL (selector->treemodelfilter),
|
||||
&iter,
|
||||
COLUMN_LANG, &lang,
|
||||
-1);
|
||||
gtk_tree_model_get (GTK_TREE_MODEL (selector->treemodelfilter),
|
||||
&iter,
|
||||
COLUMN_LANG, &lang,
|
||||
-1);
|
||||
|
||||
if (lang != NULL)
|
||||
{
|
||||
gboolean equal = (lang == language);
|
||||
if (lang != NULL)
|
||||
{
|
||||
gboolean equal = (lang == language);
|
||||
|
||||
g_object_unref (lang);
|
||||
g_object_unref (lang);
|
||||
|
||||
if (equal)
|
||||
{
|
||||
GtkTreePath *path;
|
||||
if (equal)
|
||||
{
|
||||
GtkTreePath *path;
|
||||
|
||||
path = gtk_tree_model_get_path (GTK_TREE_MODEL (selector->treemodelfilter), &iter);
|
||||
path = gtk_tree_model_get_path (GTK_TREE_MODEL (selector->treemodelfilter), &iter);
|
||||
|
||||
gtk_tree_selection_select_iter (selector->treeview_selection, &iter);
|
||||
gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (selector->treeview),
|
||||
path, NULL, TRUE, 0.5, 0);
|
||||
gtk_tree_path_free (path);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
while (gtk_tree_model_iter_next (GTK_TREE_MODEL (selector->treemodelfilter), &iter));
|
||||
}
|
||||
gtk_tree_selection_select_iter (selector->treeview_selection, &iter);
|
||||
gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (selector->treeview),
|
||||
path, NULL, TRUE, 0.5, 0);
|
||||
gtk_tree_path_free (path);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
while (gtk_tree_model_iter_next (GTK_TREE_MODEL (selector->treemodelfilter), &iter));
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
xed_highlight_mode_selector_activate_selected_language (XedHighlightModeSelector *selector)
|
||||
{
|
||||
GtkSourceLanguage *lang;
|
||||
GtkTreeIter iter;
|
||||
GtkSourceLanguage *lang;
|
||||
GtkTreeIter iter;
|
||||
|
||||
g_return_if_fail (XED_IS_HIGHLIGHT_MODE_SELECTOR (selector));
|
||||
g_return_if_fail (XED_IS_HIGHLIGHT_MODE_SELECTOR (selector));
|
||||
|
||||
if (!gtk_tree_selection_get_selected (selector->treeview_selection, NULL, &iter))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (!gtk_tree_selection_get_selected (selector->treeview_selection, NULL, &iter))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
gtk_tree_model_get (GTK_TREE_MODEL (selector->treemodelfilter), &iter,
|
||||
COLUMN_LANG, &lang,
|
||||
-1);
|
||||
gtk_tree_model_get (GTK_TREE_MODEL (selector->treemodelfilter), &iter,
|
||||
COLUMN_LANG, &lang,
|
||||
-1);
|
||||
|
||||
g_signal_emit (G_OBJECT (selector), signals[LANGUAGE_SELECTED], 0, lang);
|
||||
g_signal_emit (G_OBJECT (selector), signals[LANGUAGE_SELECTED], 0, lang);
|
||||
|
||||
if (lang != NULL)
|
||||
{
|
||||
g_object_unref (lang);
|
||||
}
|
||||
if (lang != NULL)
|
||||
{
|
||||
g_object_unref (lang);
|
||||
}
|
||||
}
|
||||
|
||||
/* ex:set ts=8 noet: */
|
||||
|
@@ -47,10 +47,6 @@ enum
|
||||
|
||||
#define XED_HISTORY_ENTRY_HISTORY_LENGTH_DEFAULT 10
|
||||
|
||||
#define XED_HISTORY_ENTRY_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), \
|
||||
XED_TYPE_HISTORY_ENTRY, \
|
||||
XedHistoryEntryPrivate))
|
||||
|
||||
struct _XedHistoryEntryPrivate
|
||||
{
|
||||
gchar *history_id;
|
||||
@@ -59,7 +55,7 @@ struct _XedHistoryEntryPrivate
|
||||
GSettings *settings;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE(XedHistoryEntry, xed_history_entry, GTK_TYPE_COMBO_BOX_TEXT)
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (XedHistoryEntry, xed_history_entry, GTK_TYPE_COMBO_BOX_TEXT)
|
||||
|
||||
static void
|
||||
xed_history_entry_set_property (GObject *object,
|
||||
@@ -167,8 +163,6 @@ xed_history_entry_class_init (XedHistoryEntryClass *klass)
|
||||
G_PARAM_STATIC_STRINGS));
|
||||
|
||||
/* TODO: Add enable-completion property */
|
||||
|
||||
g_type_class_add_private (object_class, sizeof(XedHistoryEntryPrivate));
|
||||
}
|
||||
|
||||
static GtkListStore *
|
||||
@@ -384,7 +378,7 @@ xed_history_entry_init (XedHistoryEntry *entry)
|
||||
{
|
||||
XedHistoryEntryPrivate *priv;
|
||||
|
||||
priv = XED_HISTORY_ENTRY_GET_PRIVATE (entry);
|
||||
priv = xed_history_entry_get_instance_private (entry);
|
||||
entry->priv = priv;
|
||||
|
||||
priv->history_id = NULL;
|
||||
|
@@ -90,8 +90,6 @@
|
||||
* </example>
|
||||
*/
|
||||
|
||||
#define XED_MESSAGE_BUS_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE((object), XED_TYPE_MESSAGE_BUS, XedMessageBusPrivate))
|
||||
|
||||
typedef struct
|
||||
{
|
||||
gchar *object_path;
|
||||
@@ -143,7 +141,7 @@ static guint message_bus_signals[LAST_SIGNAL] = { 0 };
|
||||
static void xed_message_bus_dispatch_real (XedMessageBus *bus,
|
||||
XedMessage *message);
|
||||
|
||||
G_DEFINE_TYPE (XedMessageBus, xed_message_bus, G_TYPE_OBJECT)
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (XedMessageBus, xed_message_bus, G_TYPE_OBJECT)
|
||||
|
||||
static void
|
||||
listener_free (Listener *listener)
|
||||
@@ -264,8 +262,6 @@ xed_message_bus_class_init (XedMessageBusClass *klass)
|
||||
G_TYPE_NONE,
|
||||
1,
|
||||
XED_TYPE_MESSAGE_TYPE);
|
||||
|
||||
g_type_class_add_private (object_class, sizeof(XedMessageBusPrivate));
|
||||
}
|
||||
|
||||
static Message *
|
||||
@@ -506,7 +502,7 @@ process_by_match (XedMessageBus *bus,
|
||||
static void
|
||||
xed_message_bus_init (XedMessageBus *self)
|
||||
{
|
||||
self->priv = XED_MESSAGE_BUS_GET_PRIVATE (self);
|
||||
self->priv = xed_message_bus_get_instance_private (self);
|
||||
|
||||
self->priv->messages = g_hash_table_new_full (g_str_hash,
|
||||
g_str_equal,
|
||||
|
@@ -18,7 +18,6 @@
|
||||
* who is the sender and who is the receiver. There is no explicit distinction
|
||||
* between methods and signals.
|
||||
*/
|
||||
#define XED_MESSAGE_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE((object), XED_TYPE_MESSAGE, XedMessagePrivate))
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
@@ -36,7 +35,7 @@ struct _XedMessagePrivate
|
||||
GHashTable *values;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (XedMessage, xed_message, G_TYPE_OBJECT)
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (XedMessage, xed_message, G_TYPE_OBJECT)
|
||||
|
||||
static void
|
||||
xed_message_finalize (GObject *object)
|
||||
@@ -163,8 +162,6 @@ xed_message_class_init (XedMessageClass *klass)
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT_ONLY |
|
||||
G_PARAM_STATIC_STRINGS));
|
||||
|
||||
g_type_class_add_private (object_class, sizeof(XedMessagePrivate));
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -177,7 +174,7 @@ destroy_value (GValue *value)
|
||||
static void
|
||||
xed_message_init (XedMessage *self)
|
||||
{
|
||||
self->priv = XED_MESSAGE_GET_PRIVATE (self);
|
||||
self->priv = xed_message_get_instance_private (self);
|
||||
|
||||
self->priv->values = g_hash_table_new_full (g_str_hash,
|
||||
g_str_equal,
|
||||
|
@@ -49,8 +49,6 @@
|
||||
#define AFTER_ALL_TABS -1
|
||||
#define NOT_IN_APP_WINDOWS -2
|
||||
|
||||
#define XED_NOTEBOOK_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), XED_TYPE_NOTEBOOK, XedNotebookPrivate))
|
||||
|
||||
struct _XedNotebookPrivate
|
||||
{
|
||||
GSettings *ui_settings;
|
||||
@@ -65,7 +63,7 @@ struct _XedNotebookPrivate
|
||||
guint destroy_has_run : 1;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE(XedNotebook, xed_notebook, GTK_TYPE_NOTEBOOK)
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (XedNotebook, xed_notebook, GTK_TYPE_NOTEBOOK)
|
||||
|
||||
static void xed_notebook_finalize (GObject *object);
|
||||
|
||||
@@ -178,8 +176,6 @@ xed_notebook_class_init (XedNotebookClass *klass)
|
||||
G_TYPE_NONE,
|
||||
1,
|
||||
XED_TYPE_TAB);
|
||||
|
||||
g_type_class_add_private (object_class, sizeof(XedNotebookPrivate));
|
||||
}
|
||||
|
||||
static XedNotebook *
|
||||
@@ -709,7 +705,7 @@ xed_notebook_switch_page_cb (GtkNotebook *notebook,
|
||||
static void
|
||||
xed_notebook_init (XedNotebook *notebook)
|
||||
{
|
||||
notebook->priv = XED_NOTEBOOK_GET_PRIVATE (notebook);
|
||||
notebook->priv = xed_notebook_get_instance_private (notebook);
|
||||
|
||||
notebook->priv->close_buttons_sensitive = TRUE;
|
||||
notebook->priv->tab_drag_and_drop_enabled = TRUE;
|
||||
|
@@ -41,8 +41,6 @@
|
||||
|
||||
#define PANEL_ITEM_KEY "XedPanelItemKey"
|
||||
|
||||
#define XED_PANEL_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), XED_TYPE_PANEL, XedPanelPrivate))
|
||||
|
||||
struct _XedPanelPrivate
|
||||
{
|
||||
GtkOrientation orientation;
|
||||
@@ -83,7 +81,7 @@ static GObject *xed_panel_constructor (GType type,
|
||||
GObjectConstructParam *construct_properties);
|
||||
|
||||
|
||||
G_DEFINE_TYPE (XedPanel, xed_panel, GTK_TYPE_BIN)
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (XedPanel, xed_panel, GTK_TYPE_BIN)
|
||||
|
||||
static void
|
||||
xed_panel_finalize (GObject *obj)
|
||||
@@ -239,8 +237,6 @@ xed_panel_class_init (XedPanelClass *klass)
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
|
||||
|
||||
g_type_class_add_private (klass, sizeof (XedPanelPrivate));
|
||||
|
||||
object_class->constructor = xed_panel_constructor;
|
||||
object_class->finalize = xed_panel_finalize;
|
||||
object_class->get_property = xed_panel_get_property;
|
||||
@@ -319,7 +315,7 @@ xed_panel_class_init (XedPanelClass *klass)
|
||||
static void
|
||||
xed_panel_init (XedPanel *panel)
|
||||
{
|
||||
panel->priv = XED_PANEL_GET_PRIVATE (panel);
|
||||
panel->priv = xed_panel_get_instance_private (panel);
|
||||
|
||||
panel->priv->main_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
|
||||
gtk_widget_show (panel->priv->main_box);
|
||||
|
@@ -40,13 +40,13 @@
|
||||
#include "xed-settings.h"
|
||||
#include "xed-utils.h"
|
||||
|
||||
G_DEFINE_TYPE (XedPluginsEngine, xed_plugins_engine, PEAS_TYPE_ENGINE)
|
||||
|
||||
struct _XedPluginsEnginePrivate
|
||||
{
|
||||
GSettings *plugin_settings;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (XedPluginsEngine, xed_plugins_engine, PEAS_TYPE_ENGINE)
|
||||
|
||||
XedPluginsEngine *default_engine = NULL;
|
||||
|
||||
static void
|
||||
@@ -58,7 +58,7 @@ xed_plugins_engine_init (XedPluginsEngine *engine)
|
||||
|
||||
xed_debug (DEBUG_PLUGINS);
|
||||
|
||||
engine->priv = G_TYPE_INSTANCE_GET_PRIVATE (engine, XED_TYPE_PLUGINS_ENGINE, XedPluginsEnginePrivate);
|
||||
engine->priv = xed_plugins_engine_get_instance_private (engine);
|
||||
|
||||
engine->priv->plugin_settings = g_settings_new ("org.x.editor.plugins");
|
||||
|
||||
@@ -142,8 +142,6 @@ xed_plugins_engine_class_init (XedPluginsEngineClass *klass)
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
object_class->dispose = xed_plugins_engine_dispose;
|
||||
|
||||
g_type_class_add_private (klass, sizeof (XedPluginsEnginePrivate));
|
||||
}
|
||||
|
||||
XedPluginsEngine *
|
||||
|
@@ -41,11 +41,6 @@
|
||||
#include "xed-dirs.h"
|
||||
#include "xed-settings.h"
|
||||
|
||||
|
||||
#define XED_PRINT_JOB_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), \
|
||||
XED_TYPE_PRINT_JOB, \
|
||||
XedPrintJobPrivate))
|
||||
|
||||
struct _XedPrintJobPrivate
|
||||
{
|
||||
GSettings *print_settings;
|
||||
@@ -103,7 +98,7 @@ enum
|
||||
|
||||
static guint print_job_signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
G_DEFINE_TYPE (XedPrintJob, xed_print_job, G_TYPE_OBJECT)
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (XedPrintJob, xed_print_job, G_TYPE_OBJECT)
|
||||
|
||||
static void
|
||||
set_view (XedPrintJob *job,
|
||||
@@ -236,8 +231,6 @@ xed_print_job_class_init (XedPrintJobClass *klass)
|
||||
2,
|
||||
G_TYPE_UINT,
|
||||
G_TYPE_POINTER);
|
||||
|
||||
g_type_class_add_private (object_class, sizeof (XedPrintJobPrivate));
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -731,7 +724,7 @@ xed_print_job_print (XedPrintJob *job,
|
||||
static void
|
||||
xed_print_job_init (XedPrintJob *job)
|
||||
{
|
||||
job->priv = XED_PRINT_JOB_GET_PRIVATE (job);
|
||||
job->priv = xed_print_job_get_instance_private (job);
|
||||
|
||||
job->priv->print_settings = g_settings_new ("org.x.editor.preferences.print");
|
||||
|
||||
|
@@ -81,7 +81,7 @@ struct _XedPrintPreviewPrivate
|
||||
guint cur_page;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (XedPrintPreview, xed_print_preview, GTK_TYPE_BOX)
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (XedPrintPreview, xed_print_preview, GTK_TYPE_BOX)
|
||||
|
||||
static void goto_page (XedPrintPreview *preview,
|
||||
gint page);
|
||||
@@ -150,8 +150,6 @@ xed_print_preview_class_init (XedPrintPreviewClass *klass)
|
||||
object_class->finalize = xed_print_preview_finalize;
|
||||
|
||||
widget_class->grab_focus = xed_print_preview_grab_focus;
|
||||
|
||||
g_type_class_add_private (object_class, sizeof(XedPrintPreviewPrivate));
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1003,7 +1001,7 @@ xed_print_preview_init (XedPrintPreview *preview)
|
||||
{
|
||||
XedPrintPreviewPrivate *priv;
|
||||
|
||||
priv = G_TYPE_INSTANCE_GET_PRIVATE (preview, XED_TYPE_PRINT_PREVIEW, XedPrintPreviewPrivate);
|
||||
priv = xed_print_preview_get_instance_private (preview);
|
||||
|
||||
preview->priv = priv;
|
||||
|
||||
|
@@ -43,9 +43,6 @@ enum
|
||||
PROP_HAS_CANCEL_BUTTON
|
||||
};
|
||||
|
||||
|
||||
#define XED_PROGRESS_INFO_BAR_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), XED_TYPE_PROGRESS_INFO_BAR, XedProgressInfoBarPrivate))
|
||||
|
||||
struct _XedProgressInfoBarPrivate
|
||||
{
|
||||
GtkWidget *image;
|
||||
@@ -53,7 +50,7 @@ struct _XedProgressInfoBarPrivate
|
||||
GtkWidget *progress;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE(XedProgressInfoBar, xed_progress_info_bar, GTK_TYPE_INFO_BAR)
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (XedProgressInfoBar, xed_progress_info_bar, GTK_TYPE_INFO_BAR)
|
||||
|
||||
static void
|
||||
xed_progress_info_bar_set_has_cancel_button (XedProgressInfoBar *bar,
|
||||
@@ -119,8 +116,6 @@ xed_progress_info_bar_class_init (XedProgressInfoBarClass *klass)
|
||||
G_PARAM_WRITABLE |
|
||||
G_PARAM_CONSTRUCT_ONLY |
|
||||
G_PARAM_STATIC_STRINGS));
|
||||
|
||||
g_type_class_add_private (gobject_class, sizeof (XedProgressInfoBarPrivate));
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -130,7 +125,7 @@ xed_progress_info_bar_init (XedProgressInfoBar *bar)
|
||||
GtkWidget *hbox;
|
||||
GtkWidget *content;
|
||||
|
||||
bar->priv = XED_PROGRESS_INFO_BAR_GET_PRIVATE (bar);
|
||||
bar->priv = xed_progress_info_bar_get_instance_private (bar);
|
||||
|
||||
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
|
||||
gtk_widget_show (vbox);
|
||||
|
@@ -13,8 +13,6 @@
|
||||
#include "xed-commands.h"
|
||||
#include "xed-window-private.h"
|
||||
|
||||
#define XED_SEARCHBAR_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), XED_TYPE_SEARCHBAR, XedSearchbarPrivate))
|
||||
|
||||
enum
|
||||
{
|
||||
SHOW_REPLACE,
|
||||
@@ -49,7 +47,7 @@ struct _XedSearchbarPrivate
|
||||
guint update_occurrence_count_id;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE(XedSearchbar, xed_searchbar, GTK_TYPE_BOX)
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (XedSearchbar, xed_searchbar, GTK_TYPE_BOX)
|
||||
|
||||
static void
|
||||
xed_searchbar_dispose (GObject *object)
|
||||
@@ -73,8 +71,6 @@ xed_searchbar_class_init (XedSearchbarClass *klass)
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
object_class->dispose = xed_searchbar_dispose;
|
||||
|
||||
g_type_class_add_private (object_class, sizeof(XedSearchbarPrivate));
|
||||
}
|
||||
|
||||
#define XED_SEARCHBAR_KEY "xed-searchbar-key"
|
||||
@@ -136,7 +132,7 @@ forward_search_finished (GtkSourceSearchContext *search_context,
|
||||
GtkTextIter match_start;
|
||||
GtkTextIter match_end;
|
||||
|
||||
found = gtk_source_search_context_forward_finish2 (search_context, result, &match_start, &match_end, NULL, NULL);
|
||||
found = gtk_source_search_context_forward_finish (search_context, result, &match_start, &match_end, NULL, NULL);
|
||||
buffer = gtk_source_search_context_get_buffer (search_context);
|
||||
|
||||
if (found)
|
||||
@@ -210,7 +206,7 @@ backward_search_finished (GtkSourceSearchContext *search_context,
|
||||
GtkTextIter match_end;
|
||||
GtkSourceBuffer *buffer;
|
||||
|
||||
found = gtk_source_search_context_backward_finish2 (search_context, result, &match_start, &match_end, NULL, NULL);
|
||||
found = gtk_source_search_context_backward_finish (search_context, result, &match_start, &match_end, NULL, NULL);
|
||||
buffer = gtk_source_search_context_get_buffer (search_context);
|
||||
|
||||
if (found)
|
||||
@@ -479,12 +475,12 @@ do_replace (XedSearchbar *searchbar)
|
||||
gtk_text_buffer_get_selection_bounds (GTK_TEXT_BUFFER (doc), &start, &end);
|
||||
searchbar->priv->search_mode = XED_SEARCH_MODE_REPLACE;
|
||||
|
||||
gtk_source_search_context_replace2 (search_context,
|
||||
&start,
|
||||
&end,
|
||||
unescaped_replace_text,
|
||||
-1,
|
||||
NULL);
|
||||
gtk_source_search_context_replace (search_context,
|
||||
&start,
|
||||
&end,
|
||||
unescaped_replace_text,
|
||||
-1,
|
||||
NULL);
|
||||
|
||||
g_free (unescaped_replace_text);
|
||||
|
||||
@@ -669,7 +665,7 @@ xed_searchbar_init (XedSearchbar *searchbar)
|
||||
GtkBuilder *builder;
|
||||
gchar *root_objects[] = { "searchbar_content", NULL };
|
||||
|
||||
searchbar->priv = XED_SEARCHBAR_GET_PRIVATE (searchbar);
|
||||
searchbar->priv = xed_searchbar_get_instance_private (searchbar);
|
||||
|
||||
builder = gtk_builder_new ();
|
||||
gtk_builder_add_objects_from_resource (builder, "/org/x/editor/ui/xed-searchbar.ui", root_objects, NULL);
|
||||
|
@@ -38,8 +38,6 @@
|
||||
|
||||
#define XED_SETTINGS_SYSTEM_FONT "monospace-font-name"
|
||||
|
||||
#define XED_SETTINGS_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE((object), XED_TYPE_SETTINGS, XedSettingsPrivate))
|
||||
|
||||
struct _XedSettingsPrivate
|
||||
{
|
||||
GSettings *interface;
|
||||
@@ -49,7 +47,7 @@ struct _XedSettingsPrivate
|
||||
gchar *old_scheme;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (XedSettings, xed_settings, G_TYPE_OBJECT)
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (XedSettings, xed_settings, G_TYPE_OBJECT)
|
||||
|
||||
static void
|
||||
xed_settings_finalize (GObject *object)
|
||||
@@ -336,7 +334,7 @@ on_max_recents_changed (GSettings *settings,
|
||||
static void
|
||||
xed_settings_init (XedSettings *xs)
|
||||
{
|
||||
xs->priv = XED_SETTINGS_GET_PRIVATE (xs);
|
||||
xs->priv = xed_settings_get_instance_private (xs);
|
||||
|
||||
xs->priv->old_scheme = NULL;
|
||||
xs->priv->editor = g_settings_new ("org.x.editor.preferences.editor");
|
||||
@@ -378,8 +376,6 @@ xed_settings_class_init (XedSettingsClass *klass)
|
||||
|
||||
object_class->finalize = xed_settings_finalize;
|
||||
object_class->dispose = xed_settings_dispose;
|
||||
|
||||
g_type_class_add_private (object_class, sizeof (XedSettingsPrivate));
|
||||
}
|
||||
|
||||
GObject *
|
||||
|
@@ -35,10 +35,6 @@
|
||||
|
||||
#include "xed-statusbar.h"
|
||||
|
||||
#define XED_STATUSBAR_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object),\
|
||||
XED_TYPE_STATUSBAR,\
|
||||
XedStatusbarPrivate))
|
||||
|
||||
struct _XedStatusbarPrivate
|
||||
{
|
||||
GtkWidget *overwrite_mode_label;
|
||||
@@ -58,7 +54,7 @@ struct _XedStatusbarPrivate
|
||||
guint flash_message_id;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE(XedStatusbar, xed_statusbar, GTK_TYPE_STATUSBAR)
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (XedStatusbar, xed_statusbar, GTK_TYPE_STATUSBAR)
|
||||
|
||||
|
||||
static gchar *
|
||||
@@ -93,8 +89,6 @@ xed_statusbar_class_init (XedStatusbarClass *klass)
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
object_class->dispose = xed_statusbar_dispose;
|
||||
|
||||
g_type_class_add_private (object_class, sizeof (XedStatusbarPrivate));
|
||||
}
|
||||
|
||||
#define CURSOR_POSITION_LABEL_WIDTH_CHARS 18
|
||||
@@ -105,7 +99,7 @@ xed_statusbar_init (XedStatusbar *statusbar)
|
||||
GtkWidget *hbox;
|
||||
GtkWidget *error_image;
|
||||
|
||||
statusbar->priv = XED_STATUSBAR_GET_PRIVATE (statusbar);
|
||||
statusbar->priv = xed_statusbar_get_instance_private (statusbar);
|
||||
|
||||
gtk_widget_set_margin_top (GTK_WIDGET (statusbar), 0);
|
||||
gtk_widget_set_margin_bottom (GTK_WIDGET (statusbar), 0);
|
||||
|
@@ -27,8 +27,6 @@
|
||||
#include "xed-tab-label.h"
|
||||
#include "xed-close-button.h"
|
||||
|
||||
#define XED_TAB_LABEL_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE((object), XED_TYPE_TAB_LABEL, XedTabLabelPrivate))
|
||||
|
||||
/* Signals */
|
||||
enum
|
||||
{
|
||||
@@ -57,7 +55,7 @@ struct _XedTabLabelPrivate
|
||||
|
||||
static guint signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
G_DEFINE_TYPE (XedTabLabel, xed_tab_label, GTK_TYPE_BOX)
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (XedTabLabel, xed_tab_label, GTK_TYPE_BOX)
|
||||
|
||||
static void
|
||||
xed_tab_label_finalize (GObject *object)
|
||||
@@ -244,8 +242,6 @@ xed_tab_label_class_init (XedTabLabelClass *klass)
|
||||
XED_TYPE_TAB,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT_ONLY));
|
||||
|
||||
g_type_class_add_private (object_class, sizeof(XedTabLabelPrivate));
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -258,7 +254,7 @@ xed_tab_label_init (XedTabLabel *tab_label)
|
||||
GtkWidget *label;
|
||||
GtkWidget *dummy_label;
|
||||
|
||||
tab_label->priv = XED_TAB_LABEL_GET_PRIVATE (tab_label);
|
||||
tab_label->priv = xed_tab_label_get_instance_private (tab_label);
|
||||
|
||||
tab_label->priv->close_button_sensitive = TRUE;
|
||||
|
||||
|
@@ -46,8 +46,6 @@
|
||||
#include "xed-settings.h"
|
||||
#include "xed-view-frame.h"
|
||||
|
||||
#define XED_TAB_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), XED_TYPE_TAB, XedTabPrivate))
|
||||
|
||||
#define XED_TAB_KEY "XED_TAB_KEY"
|
||||
|
||||
struct _XedTabPrivate
|
||||
@@ -114,7 +112,7 @@ struct _SaverData
|
||||
guint force_no_backup : 1;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE(XedTab, xed_tab, GTK_TYPE_BOX)
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (XedTab, xed_tab, GTK_TYPE_BOX)
|
||||
|
||||
enum
|
||||
{
|
||||
@@ -361,8 +359,6 @@ xed_tab_class_init (XedTabClass *klass)
|
||||
TRUE,
|
||||
G_PARAM_READABLE |
|
||||
G_PARAM_STATIC_STRINGS));
|
||||
|
||||
g_type_class_add_private (object_class, sizeof (XedTabPrivate));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1169,7 +1165,7 @@ xed_tab_init (XedTab *tab)
|
||||
XedView *view;
|
||||
GtkSourceFile *file;
|
||||
|
||||
tab->priv = XED_TAB_GET_PRIVATE (tab);
|
||||
tab->priv = xed_tab_get_instance_private (tab);
|
||||
|
||||
tab->priv->editor = g_settings_new ("org.x.editor.preferences.editor");
|
||||
tab->priv->state = XED_TAB_STATE_NORMAL;
|
||||
|
@@ -48,6 +48,8 @@ static const GtkActionEntry xed_always_sensitive_menu_entries[] =
|
||||
{ "Tools", NULL, N_("_Tools") },
|
||||
{ "Documents", NULL, N_("_Documents") },
|
||||
{ "Help", NULL, N_("_Help") },
|
||||
{ "XAppFavoritesMenu", NULL, N_("Favorites")},
|
||||
{ "FileRecentsMenu", NULL, N_("Recents")},
|
||||
|
||||
/* File menu */
|
||||
{ "FileNew", "document-new-symbolic", N_("_New"), "<control>N",
|
||||
|
@@ -18,8 +18,6 @@
|
||||
|
||||
#define XED_VIEW_SCROLL_MARGIN 0.02
|
||||
|
||||
#define XED_VIEW_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), XED_TYPE_VIEW, XedViewPrivate))
|
||||
|
||||
enum
|
||||
{
|
||||
TARGET_URI_LIST = 100
|
||||
@@ -34,7 +32,7 @@ struct _XedViewPrivate
|
||||
guint view_realized : 1;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (XedView, xed_view, GTK_SOURCE_TYPE_VIEW)
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (XedView, xed_view, GTK_SOURCE_TYPE_VIEW)
|
||||
|
||||
/* Signals */
|
||||
enum
|
||||
@@ -111,7 +109,7 @@ xed_view_init (XedView *view)
|
||||
|
||||
xed_debug (DEBUG_VIEW);
|
||||
|
||||
view->priv = XED_VIEW_GET_PRIVATE (view);
|
||||
view->priv = xed_view_get_instance_private (view);
|
||||
|
||||
view->priv->editor_settings = g_settings_new ("org.x.editor.preferences.editor");
|
||||
|
||||
@@ -600,8 +598,6 @@ xed_view_class_init (XedViewClass *klass)
|
||||
g_cclosure_marshal_VOID__BOXED,
|
||||
G_TYPE_NONE, 1, G_TYPE_STRV);
|
||||
|
||||
g_type_class_add_private (klass, sizeof (XedViewPrivate));
|
||||
|
||||
binding_set = gtk_binding_set_by_class (klass);
|
||||
|
||||
gtk_binding_entry_add_signal (binding_set,
|
||||
|
@@ -32,6 +32,7 @@
|
||||
#define __XED_WINDOW_PRIVATE_H__
|
||||
|
||||
#include <libpeas/peas-extension-set.h>
|
||||
#include <libxapp/xapp-favorites.h>
|
||||
|
||||
#include "xed/xed-window.h"
|
||||
#include "xed-message-bus.h"
|
||||
@@ -101,6 +102,10 @@ struct _XedWindowPrivate
|
||||
guint recents_menu_ui_id;
|
||||
gulong recents_handler_id;
|
||||
|
||||
GtkActionGroup *favorites_action_group;
|
||||
guint favorites_menu_ui_id;
|
||||
gulong favorites_handler_id;
|
||||
|
||||
XedTab *active_tab;
|
||||
gint num_tabs;
|
||||
|
||||
|
@@ -36,8 +36,6 @@
|
||||
#define XED_WINDOW_DEFAULT_WIDTH 650
|
||||
#define XED_WINDOW_DEFAULT_HEIGHT 500
|
||||
|
||||
#define XED_WINDOW_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), XED_TYPE_WINDOW, XedWindowPrivate))
|
||||
|
||||
/* Signals */
|
||||
enum
|
||||
{
|
||||
@@ -62,7 +60,7 @@ enum
|
||||
TARGET_URI_LIST = 100
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE(XedWindow, xed_window, GTK_TYPE_APPLICATION_WINDOW)
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (XedWindow, xed_window, GTK_TYPE_APPLICATION_WINDOW)
|
||||
|
||||
static void recent_manager_changed (GtkRecentManager *manager, XedWindow *window);
|
||||
|
||||
@@ -211,6 +209,14 @@ xed_window_dispose (GObject *object)
|
||||
window->priv->recents_handler_id = 0;
|
||||
}
|
||||
|
||||
if (window->priv->favorites_handler_id != 0)
|
||||
{
|
||||
XAppFavorites *favorites;
|
||||
favorites = xapp_favorites_get_default ();
|
||||
g_signal_handler_disconnect (favorites, window->priv->favorites_handler_id);
|
||||
window->priv->favorites_handler_id = 0;
|
||||
}
|
||||
|
||||
g_clear_object (&window->priv->manager);
|
||||
g_clear_object (&window->priv->message_bus);
|
||||
g_clear_object (&window->priv->window_group);
|
||||
@@ -353,8 +359,6 @@ xed_window_class_init (XedWindowClass *klass)
|
||||
XED_TYPE_WINDOW_STATE,
|
||||
XED_WINDOW_STATE_NORMAL,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
|
||||
|
||||
g_type_class_add_private (object_class, sizeof(XedWindowPrivate));
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -882,7 +886,7 @@ update_recent_files_menu (XedWindow *window)
|
||||
gtk_action_group_add_action (p->recents_action_group, action);
|
||||
g_object_unref (action);
|
||||
|
||||
gtk_ui_manager_add_ui (p->manager, p->recents_menu_ui_id, "/MenuBar/FileMenu/FileRecentsPlaceholder",
|
||||
gtk_ui_manager_add_ui (p->manager, p->recents_menu_ui_id, "/MenuBar/FileMenu/FileRecentsMenu/FileRecentsPlaceholder",
|
||||
action_name, action_name, GTK_UI_MANAGER_MENUITEM, FALSE);
|
||||
|
||||
g_free (action_name);
|
||||
@@ -915,6 +919,70 @@ toolbar_visibility_changed (GtkWidget *toolbar,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
favorite_activated (GtkAction *action,
|
||||
gpointer user_data)
|
||||
{
|
||||
GFile *location;
|
||||
|
||||
location = g_file_new_for_uri (gtk_action_get_name (action));
|
||||
xed_commands_load_location (XED_WINDOW (user_data), location, NULL, 0);
|
||||
|
||||
g_object_unref (location);
|
||||
}
|
||||
|
||||
static void
|
||||
update_favorites_menu (XedWindow *window)
|
||||
{
|
||||
XedWindowPrivate *p = window->priv;
|
||||
XAppFavorites *favorites;
|
||||
GList *actions, *l;
|
||||
GList *items = NULL;
|
||||
|
||||
xed_debug (DEBUG_WINDOW);
|
||||
|
||||
g_return_if_fail (p->favorites_action_group != NULL);
|
||||
|
||||
if (p->favorites_menu_ui_id != 0)
|
||||
{
|
||||
gtk_ui_manager_remove_ui (p->manager, p->favorites_menu_ui_id);
|
||||
}
|
||||
|
||||
actions = gtk_action_group_list_actions (p->favorites_action_group);
|
||||
for (l = actions; l != NULL; l = l->next)
|
||||
{
|
||||
g_signal_handlers_disconnect_by_func(GTK_ACTION (l->data), G_CALLBACK (favorite_activated), window);
|
||||
gtk_action_group_remove_action (p->favorites_action_group, GTK_ACTION(l->data));
|
||||
}
|
||||
g_list_free (actions);
|
||||
|
||||
p->favorites_menu_ui_id = gtk_ui_manager_new_merge_id (p->manager);
|
||||
|
||||
favorites = xapp_favorites_get_default ();
|
||||
|
||||
const gchar *supported_mimetypes[2] = {
|
||||
"text/plain",
|
||||
NULL
|
||||
};
|
||||
|
||||
items = xapp_favorites_create_actions (favorites, supported_mimetypes);
|
||||
|
||||
for (l = items; l != NULL; l = l->next)
|
||||
{
|
||||
GtkAction *action = GTK_ACTION (l->data);
|
||||
const gchar *name = gtk_action_get_name (action);
|
||||
|
||||
g_signal_connect (action, "activate", G_CALLBACK (favorite_activated), window);
|
||||
|
||||
gtk_action_group_add_action (p->favorites_action_group, action);
|
||||
|
||||
gtk_ui_manager_add_ui (p->manager, p->favorites_menu_ui_id, "/MenuBar/FileMenu/XAppFavoritesMenu/XAppFavorites",
|
||||
name, name, GTK_UI_MANAGER_MENUITEM, FALSE);
|
||||
}
|
||||
|
||||
g_list_free_full (items, g_object_unref);
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
create_toolbar_button (GtkAction *action)
|
||||
{
|
||||
@@ -947,6 +1015,7 @@ create_menu_bar_and_toolbar (XedWindow *window,
|
||||
GtkWidget *box;
|
||||
GtkWidget *separator;
|
||||
GtkWidget *button;
|
||||
XAppFavorites *favorites;
|
||||
|
||||
xed_debug (DEBUG_WINDOW);
|
||||
|
||||
@@ -1021,6 +1090,19 @@ create_menu_bar_and_toolbar (XedWindow *window,
|
||||
window);
|
||||
update_recent_files_menu (window);
|
||||
|
||||
action_group = gtk_action_group_new ("FavoriteFilesActions");
|
||||
gtk_action_group_set_translation_domain (action_group, NULL);
|
||||
window->priv->favorites_action_group = action_group;
|
||||
gtk_ui_manager_insert_action_group (manager, action_group, 0);
|
||||
g_object_unref (action_group);
|
||||
|
||||
favorites = xapp_favorites_get_default ();
|
||||
window->priv->favorites_handler_id = g_signal_connect_swapped (favorites,
|
||||
"changed", G_CALLBACK (update_favorites_menu),
|
||||
window);
|
||||
|
||||
update_favorites_menu (window);
|
||||
|
||||
/* list of open documents menu */
|
||||
action_group = gtk_action_group_new ("DocumentsListActions");
|
||||
gtk_action_group_set_translation_domain (action_group, NULL);
|
||||
@@ -3221,7 +3303,7 @@ xed_window_init (XedWindow *window)
|
||||
|
||||
xed_debug (DEBUG_WINDOW);
|
||||
|
||||
window->priv = XED_WINDOW_GET_PRIVATE (window);
|
||||
window->priv = xed_window_get_instance_private (window);
|
||||
window->priv->active_tab = NULL;
|
||||
window->priv->num_tabs = 0;
|
||||
window->priv->removing_tabs = FALSE;
|
||||
|
Reference in New Issue
Block a user