[latexila] Completion: use the new GtkSourceCompletionItem API
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [latexila] Completion: use the new GtkSourceCompletionItem API
- Date: Fri, 21 Oct 2016 18:47:51 +0000 (UTC)
commit b0eac7d561e4bd697976cbd72d0ae3d709ef1d54
Author: Sébastien Wilmet <swilmet gnome org>
Date: Fri Oct 21 20:16:42 2016 +0200
Completion: use the new GtkSourceCompletionItem API
GtkSourceView 3.24 is not yet released, git master is needed. But Vala
doesn't like that, it triggers the following error:
error: Gtk.SourceCompletionItem.new2 is not available in
gtksourceview-3.0 3.23.1. Use gtksourceview-3.0 >= 3.24
So add temporarily the --disable-since-check valac flag. Thanks, Vala.
configure.ac | 2 +-
src/Makefile.am | 3 +++
src/completion.vala | 22 +++++++++++++---------
3 files changed, 17 insertions(+), 10 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 525b1b2..145ebcd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -27,7 +27,7 @@ LT_INIT
# Update also the --target-glib option in src/Makefile.am.
GLIB_REQUIRED_VERSION="2.40"
GTK_REQUIRED_VERSION="3.20"
-GTKSOURCEVIEW_REQUIRED_VERSION="3.22"
+GTKSOURCEVIEW_REQUIRED_VERSION="3.23.1"
GSPELL_REQUIRED_VERSION="1.0"
VALA_REQUIRED_VERSION="0.26"
GEE_REQUIRED_VERSION="0.10"
diff --git a/src/Makefile.am b/src/Makefile.am
index e649e5c..e539db3 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -2,8 +2,11 @@ SUBDIRS = evince gedit liblatexila ui
bin_PROGRAMS = latexila
+# TODO remember to remove --disable-since-check when GtkSourceView 3.24 is
+# released...
VALAFLAGS = \
--pkg gtk+-3.0 \
+ --disable-since-check \
--pkg gtksourceview-3.0 \
--pkg gspell-1 \
--pkg gee-0.8 \
diff --git a/src/completion.vala b/src/completion.vala
index 6393fe5..a198604 100644
--- a/src/completion.vala
+++ b/src/completion.vala
@@ -275,8 +275,11 @@ public class CompletionProvider : GLib.Object, SourceCompletionProvider
else
pixbuf = _icon_choice;
- SourceCompletionItem item = new SourceCompletionItem (
- choice.name, choice.name, pixbuf, arg_info ?? cmd_info);
+ SourceCompletionItem item = SourceCompletionItem.new2 ();
+ item.set_label (choice.name);
+ item.set_text (choice.name);
+ item.set_icon (pixbuf);
+ item.set_info (arg_info ?? cmd_info);
items.prepend (item);
}
@@ -327,8 +330,9 @@ public class CompletionProvider : GLib.Object, SourceCompletionProvider
// No match, show a message so the completion widget doesn't disappear.
else
{
- var dummy_proposal = new SourceCompletionItem (_("No matching proposal"),
- "", null, null);
+ SourceCompletionItem dummy_proposal = SourceCompletionItem.new2 ();
+ dummy_proposal.set_label (_("No matching proposal"));
+ dummy_proposal.set_text ("");
filtered_proposals.prepend (dummy_proposal);
}
@@ -922,11 +926,11 @@ public class CompletionProvider : GLib.Object, SourceCompletionProvider
Gdk.Pixbuf pixbuf = _current_command.package != null
? _icon_package_required : _icon_cmd;
- var item = new SourceCompletionItem (_current_command.name,
- get_command_text_to_insert (_current_command),
- pixbuf,
- get_command_info (_current_command));
-
+ SourceCompletionItem item = SourceCompletionItem.new2 ();
+ item.set_label (_current_command.name);
+ item.set_text (get_command_text_to_insert (_current_command));
+ item.set_icon (pixbuf);
+ item.set_info (get_command_info (_current_command));
_proposals.prepend (item);
// We don't need to store commands that have no arguments,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]