[gedit-valencia/f20] Update to 0.8.0
Michel Alexandre Salim
salimma at fedoraproject.org
Wed Nov 26 18:52:33 UTC 2014
commit ae9baa1ebb2aefc866859c46ef3e5da4bd357829
Author: Michel Alexandre Salim <salimma at fedoraproject.org>
Date: Wed Nov 26 23:27:12 2014 +0700
Update to 0.8.0
.gitignore | 2 +-
gedit-valencia.spec | 61 +++--
sources | 2 +-
valencia-0.8.0-gedit312.patch | 629 ++++++++++++++++++++++++++++++++++++++++
valencia-0.8.0-gedit314.patch | 20 ++
valencia-0.8.0-ownership.patch | 11 +
6 files changed, 700 insertions(+), 25 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index e71c6ab..2c46f54 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1 @@
-/valencia-0.4.0-9b1f910.tar.xz
+/valencia-0.8.0.tar.xz
diff --git a/gedit-valencia.spec b/gedit-valencia.spec
index ccf4393..c556086 100644
--- a/gedit-valencia.spec
+++ b/gedit-valencia.spec
@@ -1,40 +1,49 @@
# when Koji is building SRPM, dependencies won't be installed yet
%if %($(pkg-config gedit) ; echo $?)
# This will get overridden by pkg-config; defaulting to minimum req
-%global gedit_version 2.91.0
+%global gedit_version 3.10.4
%else
%global gedit_version %(pkg-config gedit --modversion)
%endif
%global debug_package %{nil}
-%global major_ver 0.4
+%global major_ver 0.8
+
+%if 0%{?fedora} < 21
+%global vala_api 0.22
+%else
+%global vala_api 0.26
+%endif
# git rev-parse --short ...
-%global commit_hash 9b1f910
-%global alphatag 20130618git%{commit_hash}
+#global commit_hash 94442bf
+#global alphatag 20131223git%%{commit_hash}
Name: gedit-valencia
Version: %{major_ver}.0
-Release: 2.%{alphatag}%{?dist}
-#Release: 2%{?dist}
+#Release: 1.%%{alphatag}%%{?dist}
+Release: 1%{?dist}
Summary: A gedit plugin providing lightweight Vala IDE
Group: Development/Tools
License: LGPLv2+
-URL: http://redmine.yorba.org/projects/valencia/wiki
+URL: https://wiki.gnome.org/action/show/Projects/Valencia
# git archive --format=tar --prefix=valencia-%%{version}-%%{commit_hash}/ %%{commit_hash} | xz > ../valencia-%%{version}-%%{commit_hash}.tar.xz
-Source0: valencia-%{version}-%{commit_hash}.tar.xz
-#Source0: http://yorba.org/download/valencia/%{major_ver}/valencia-%{version}.tar.xz
-Patch0: %{name}-0.4.0-vala-0.22.patch
+#Source0: valencia-%%{version}-%%{commit_hash}.tar.xz
+Source0: https://download.gnome.org/sources/valencia/%{major_ver}/valencia-%{version}.tar.xz
+# from https://bugzilla.gnome.org/attachment.cgi?id=285664&action=edit
+Patch0: valencia-0.8.0-gedit312.patch
+# WIP for Fedora 21+ (not usable yet, not applied on F20 build)
+# API changes in Gedit 3.14 (and perhaps Vala 0.26 too)
+Patch1: valencia-0.8.0-gedit314.patch
+Patch2: valencia-0.8.0-ownership.patch
BuildRequires: pkgconfig(gedit)
-BuildRequires: pkgconfig(gee-0.8)
+BuildRequires: pkgconfig(gee-0.8) >= 0.8.6
+BuildRequires: pkgconfig(gtk+-3.0)
BuildRequires: pkgconfig(gtksourceview-3.0)
-%if 0%{?fedora} > 19
-BuildRequires: pkgconfig(libvala-0.22)
-%else
-BuildRequires: pkgconfig(libvala-0.20)
-%endif
+BuildRequires: pkgconfig(libpeas-1.0)
+BuildRequires: pkgconfig(libvala-%{vala_api})
BuildRequires: pkgconfig(vte-2.90)
Requires: gedit >= %{gedit_version}
@@ -42,14 +51,16 @@ Requires: gedit >= %{gedit_version}
Valencia is a gedit plugin that turns gedit into a lightweight IDE for Vala.
Using Valencia, you can easily browse between symbols in a Vala program. You
can build a Vala program inside gedit and can easily jump to lines with
-build errors. You can also get tooltips for methods and get autocompletion
-suggestions by invoking autocomplete in the appropriate context.
+build errors. You can also get tooltips for methods and get auto-completion
+suggestions by invoking auto-complete in the appropriate context.
%prep
-%setup -q -n valencia-%{version}-%{commit_hash}
-%if 0%{?fedora} > 19
-%patch0 -p1 -b .vala22
+%setup -q -n valencia-%{version}
+%if 0%{?fedora} >= 21
+%patch0 -p1 -b .gedit312
+%patch1 -p1 -b .gedit14
+%patch2 -p1 -b .ownership
%endif
@@ -60,7 +71,7 @@ for f in $RPM_OPT_FLAGS; do
VFLAGS="$VFLAGS -X $f "
fi
done
-make %{?_smp_mflags} VFLAGS="$VFLAGS"
+make %{?_smp_mflags} LIBVALA=libvala-%{vala_api} VFLAGS="$VFLAGS"
%install
@@ -69,6 +80,7 @@ PLUGINDIR=$RPM_BUILD_ROOT%{_libdir}/gedit/plugins
mkdir -p $PLUGINDIR
# no debuginfo generation; need to strip the library by hand
strip libvalencia.so
+chmod 755 libvalencia.so
cp -p libvalencia.so valencia.plugin $PLUGINDIR
@@ -84,6 +96,9 @@ rm -rf $RPM_BUILD_ROOT
%changelog
+* Wed Nov 26 2014 Michel Alexandre Salim <salimma at fedoraproject.org> - 0.8.0-1
+- Update to 0.8.0
+
* Tue Sep 3 2013 Michel Salim <salimma at fedoraproject.org> - 0.4.0-2.20130618git9b1f910
- Update to latest snapshot, merging support for newer Vala and Gedit APIs
- Use Vala API 0.22 on Fedora 20+
@@ -109,7 +124,7 @@ rm -rf $RPM_BUILD_ROOT
* Thu Jul 19 2012 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 0.3.0-12.20120430gite8a0f500555be
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
-* Sun May 6 2012 Michel Salim <salimma at fedoraproject.org> - 0.3.0-11.20120430git%{commit_hash}%{?dist}
+* Sun May 6 2012 Michel Salim <salimma at fedoraproject.org> - 0.3.0-11.20120430gite8a0f500555be
- Update for Vala 0.17.x
* Wed Feb 1 2012 Michel Salim <salimma at fedoraproject.org> - 0.3.0-10.20111212gitd6504e0ccdb0a
diff --git a/sources b/sources
index 312806d..f93cad4 100644
--- a/sources
+++ b/sources
@@ -1 +1 @@
-b841d04c456cece98e5511e8f0035b4f valencia-0.4.0-9b1f910.tar.xz
+8e1bbab5fe19b5d2c7e380dd2898b68d valencia-0.8.0.tar.xz
diff --git a/valencia-0.8.0-gedit312.patch b/valencia-0.8.0-gedit312.patch
new file mode 100644
index 0000000..fef8fd6
--- /dev/null
+++ b/valencia-0.8.0-gedit312.patch
@@ -0,0 +1,629 @@
+From 75e29feafc831959b200f2fd06f4aa2b95e7129d Mon Sep 17 00:00:00 2001
+From: Georges Basile Stavracas Neto <georges.stavracas at gmail.com>
+Date: Mon, 8 Sep 2014 14:10:28 -0300
+Subject: [PATCH] Update Valencia to the lastest API changes.
+
+---
+ Makefile | 3 +-
+ browser.vala | 16 +--
+ gtk_util.vala | 6 -
+ valencia.vala | 444 ++++++++++++++++++++++++++++++++--------------------------
+ 4 files changed, 254 insertions(+), 215 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index 5755e5f..dd85fc7 100644
+--- a/Makefile
++++ b/Makefile
+@@ -21,8 +21,7 @@ PACKAGES = --pkg gedit --pkg gee-0.8 --pkg gtk+-3.0 --pkg gtksourceview-3.0 \
+ --pkg libpeas-1.0 --pkg $(LIBVALA) --pkg vte-2.90
+
+ PACKAGE_VERSIONS = \
+- gedit >= 2.91.0 \
+- gedit <= 3.10.4 \
++ gedit >= 3.12.0 \
+ gee-0.8 >= 0.8.6 \
+ gtksourceview-3.0 >= 3.0.0 \
+ gtk+-3.0 >= 3.0.0 \
+diff --git a/browser.vala b/browser.vala
+index b3efd9e..0377801 100644
+--- a/browser.vala
++++ b/browser.vala
+@@ -35,16 +35,16 @@ class SymbolBrowser : Object {
+ }
+
+ public void activate() {
+- weak Gedit.Panel panel = instance.window.get_side_panel();
+- panel.add_item_with_stock_icon(symbol_vbox, "symbols", "Symbols", Gtk.Stock.FIND);
++ weak Gtk.Stack stack = instance.window.get_side_panel() as Gtk.Stack;
++ stack.add_titled(symbol_vbox, "symbols", "Symbols");
+ symbol_vbox.show_all();
+
+- panel.show.connect(on_panel_open);
+- panel.hide.connect(on_panel_hide);
++ stack.show.connect(on_panel_open);
++ stack.hide.connect(on_panel_hide);
+ }
+
+ public void deactivate() {
+- instance.window.get_side_panel().remove_item(symbol_vbox);
++ (instance.window.get_side_panel() as Gtk.Stack).remove(symbol_vbox);
+ }
+
+ void on_text_changed() {
+@@ -165,10 +165,10 @@ class SymbolBrowser : Object {
+ }
+
+ public void set_parent_instance_focus() {
+- Gedit.Panel panel = instance.window.get_side_panel();
+- panel.show();
++ Gtk.Stack stack = instance.window.get_side_panel() as Gtk.Stack;
++ stack.show();
+
+- panel.activate_item(symbol_vbox);
++ stack.visible_child = symbol_vbox;
+ instance.window.set_focus(find_entry);
+ }
+
+diff --git a/gtk_util.vala b/gtk_util.vala
+index cbf0092..8a07c60 100644
+--- a/gtk_util.vala
++++ b/gtk_util.vala
+@@ -57,12 +57,6 @@ string buffer_contents(Gtk.TextBuffer buffer) {
+ return buffer.get_text(start, end, true);
+ }
+
+-Gtk.MenuItem get_menu_item(Gtk.UIManager manager, string path) {
+- Gtk.MenuItem item = (Gtk.MenuItem) manager.get_widget(path);
+- assert(item != null);
+- return item;
+-}
+-
+ public void show_error_dialog(string message) {
+ Gtk.MessageDialog err_dialog = new Gtk.MessageDialog(null, Gtk.DialogFlags.MODAL,
+ Gtk.MessageType.ERROR, Gtk.ButtonsType.OK,
+diff --git a/valencia.vala b/valencia.vala
+index 500d863..f4c56b4 100644
+--- a/valencia.vala
++++ b/valencia.vala
+@@ -79,6 +79,111 @@ class ScanInfo : Object {
+
+ public Expression outer() { return parse_info.outer; }
+ }
++
++public class AppInstance : Peas.ExtensionBase, Gedit.AppActivatable {
++ Gedit.App _app;
++
++ GLib.Menu menu;
++
++ GLib.MenuItem go_to_definition_menu_item;
++ GLib.MenuItem find_symbol_menu_item;
++ GLib.MenuItem go_to_outer_scope_menu_item;
++ GLib.MenuItem go_back_menu_item;
++ GLib.MenuItem go_forward_menu_item;
++ GLib.MenuItem next_error_menu_item;
++ GLib.MenuItem prev_error_menu_item;
++ GLib.MenuItem display_tooltip_menu_item;
++
++ GLib.MenuItem build_menu_item;
++ GLib.MenuItem clean_menu_item;
++ GLib.MenuItem run_menu_item;
++ GLib.MenuItem settings_menu_item;
++
++ Gedit.MenuExtension menu_extension;
++
++ public Gedit.App app {
++ construct { _app = value; }
++ owned get { return _app; }
++ }
++
++ private AppInstance() {
++ Object();
++ }
++
++ public void activate() {
++ // Gear menu
++ menu_extension = this.extend_menu("tools-section");
++ initialize_menu_items();
++ }
++
++ void initialize_menu_items() {
++ menu = new GLib.Menu();
++ GLib.Menu search_menu = new GLib.Menu();
++ GLib.Menu project_menu = new GLib.Menu();
++
++ menu.append_section(null, search_menu);
++ menu.append_section(null, project_menu);
++
++ GLib.MenuItem valencia_menu_item = new GLib.MenuItem("_Valencia", null);
++ valencia_menu_item.set_submenu(menu);
++ menu_extension.append_menu_item(valencia_menu_item);
++
++ go_to_definition_menu_item = new GLib.MenuItem("Go to _Definition", "win.go_to_definition");
++ search_menu.append_item(go_to_definition_menu_item);
++ app.add_accelerator("F12", "win.go_to_definition", null);
++
++ find_symbol_menu_item = new GLib.MenuItem("Find _Symbol...", "win.find_symbol");
++ search_menu.append_item(find_symbol_menu_item);
++ app.add_accelerator("<ctrl><alt>s", "win.find_symbol", null);
++
++ go_to_outer_scope_menu_item = new GLib.MenuItem("Go to _Outer Scope", "win.go_to_outer_scope");
++ search_menu.append_item(go_to_outer_scope_menu_item);
++ app.add_accelerator("<ctrl>F12", "win.go_to_outer_scope", null);
++
++ go_back_menu_item = new GLib.MenuItem("Go _Back", "win.go_back");
++ search_menu.append_item(go_back_menu_item);
++ app.add_accelerator("<alt>Left", "win.go_back", null);
++
++ go_forward_menu_item = new GLib.MenuItem("Go F_orward", "win.go_forward");
++ search_menu.append_item(go_forward_menu_item);
++ app.add_accelerator("<alt>Right", "win.go_forward", null);
++
++ next_error_menu_item = new GLib.MenuItem("_Next Error", "win.next_error");
++ search_menu.append_item(next_error_menu_item);
++ app.add_accelerator("<ctrl><alt>e", "win.next_error", null);
++
++ prev_error_menu_item = new GLib.MenuItem("_Previous Error", "win.prev_error");
++ search_menu.append_item(prev_error_menu_item);
++ app.add_accelerator("<ctrl><alt>p", "win.prev_error", null);
++
++ display_tooltip_menu_item = new GLib.MenuItem("_AutoComplete", "win.autocomplete");
++ search_menu.append_item(display_tooltip_menu_item);
++ app.add_accelerator("<ctrl>space", "win.autocomplete", null);
++
++ build_menu_item = new GLib.MenuItem("_Build", "win.build");
++ project_menu.append_item(build_menu_item);
++ app.add_accelerator("<ctrl><alt>b", "win.build", null);
++
++ clean_menu_item = new GLib.MenuItem("_Clean", "win.clear");
++ project_menu.append_item(clean_menu_item);
++ app.add_accelerator("<ctrl><alt>c", "win.clear", null);
++
++ run_menu_item = new GLib.MenuItem("_Run", "win.run");
++ project_menu.append_item(run_menu_item);
++ app.add_accelerator("<ctrl><alt>r", "win.run", null);
++
++ settings_menu_item = new GLib.MenuItem("_Settings", "win.settings");
++ project_menu.append_item(settings_menu_item);
++ app.add_accelerator("<ctrl><alt>t", "win.settings", null);
++
++ MenuItem wipe_valencia_item = new GLib.MenuItem("Wipe _Valencia Symbols", "win.wipe_symbols");
++ project_menu.append_item(wipe_valencia_item);
++ }
++
++ void deactivate() {
++ menu_extension = null;
++ }
++}
+
+ public class Instance : Peas.ExtensionBase, Gedit.WindowActivatable {
+ static Gee.ArrayList<Instance> instances = new Gee.ArrayList<Instance>();
+@@ -92,26 +197,8 @@ public class Instance : Peas.ExtensionBase, Gedit.WindowActivatable {
+
+ Program last_program_to_build;
+
+- Gtk.ActionGroup action_group;
+-
+- Gtk.MenuItem go_to_definition_menu_item;
+- Gtk.MenuItem find_symbol_menu_item;
+- Gtk.MenuItem go_to_outer_scope_menu_item;
+- Gtk.MenuItem go_back_menu_item;
+- Gtk.MenuItem go_forward_menu_item;
+- Gtk.MenuItem next_error_menu_item;
+- Gtk.MenuItem prev_error_menu_item;
+- Gtk.MenuItem display_tooltip_menu_item;
+-
+- Gtk.MenuItem build_menu_item;
+- Gtk.MenuItem clean_menu_item;
+- Gtk.MenuItem run_menu_item;
+- Gtk.MenuItem settings_menu_item;
+-
+- uint ui_id;
+-
+ int saving;
+- bool child_process_running;
++ public bool child_process_running;
+
+ // Output pane
+ Gtk.TextTag error_tag;
+@@ -168,70 +255,6 @@ public class Instance : Peas.ExtensionBase, Gedit.WindowActivatable {
+ new HashMap<weak Gedit.Document, bool>();
+
+ Gedit.View view_to_scroll;
+-
+- // Menu item entries
+- const Gtk.ActionEntry[] entries = {
+- { "SearchGoToDefinition", null, "Go to _Definition", "F12",
+- "Jump to a symbol's definition", on_go_to_definition },
+- { "SearchFindSymbol", Gtk.Stock.FIND, "Find _Symbol...", "<ctrl><alt>s",
+- "Search for a symbol by name", on_find_symbol },
+- { "SearchGoToEnclosingMethod", null, "Go to _Outer Scope", "<ctrl>F12",
+- "Jump to the enclosing method or class", on_go_to_outer_scope },
+- { "SearchGoBack", Gtk.Stock.GO_BACK, "Go _Back", "<alt>Left",
+- "Go back after jumping to a definition", on_go_back },
+- { "SearchGoForward", Gtk.Stock.GO_FORWARD, "Go F_orward", "<alt>Right",
+- "Go forward to a definition after jumping backwards", on_go_forward },
+- { "SearchNextError", null, "_Next Error", "<ctrl><alt>e",
+- "Go to the next compiler error in the ouput and view panes", on_next_error },
+- { "SearchPrevError", null, "_Previous Error", "<ctrl><alt>p",
+- "Go to the previous compiler error in the ouput and view panes", on_prev_error },
+- { "SearchAutocomplete", null, "_AutoComplete", "<ctrl>space",
+- "Display method or symbol information", on_display_tooltip_or_autocomplete },
+-
+- { "Project", null, "_Project" }, // top-level menu
+-
+- { "ProjectBuild", Gtk.Stock.CONVERT, "_Build", "<ctrl><alt>b",
+- "Build the project", on_build },
+- { "ProjectClean", Gtk.Stock.CLEAR, "_Clean", "<ctrl><alt>c",
+- "Clean build output", on_clean },
+- { "ProjectRun", Gtk.Stock.EXECUTE, "_Run", "<ctrl><alt>r",
+- "Run the program", on_run },
+- { "ProjectSettings", Gtk.Stock.PROPERTIES, "_Settings", "<ctrl><alt>t",
+- "Customize the build and clean commands", on_project_settings },
+- { "ProjectWipeValencia", null, "Wipe _Valencia Symbols", null,
+- "Wipe Valencia's discovered symbols and rebuild", on_wipe_valencia }
+- };
+-
+- const string ui = """
+- <ui>
+- <menubar name="MenuBar">
+- <menu name="SearchMenu" action="Search">
+- <placeholder name="SearchOps_8">
+- <menuitem name="SearchGoToDefinitionMenu" action="SearchGoToDefinition"/>
+- <menuitem name="SearchFindSymbolMenu" action="SearchFindSymbol"/>
+- <menuitem name="SearchGoToEnclosingMethodMenu" action="SearchGoToEnclosingMethod"/>
+- <menuitem name="SearchGoBackMenu" action="SearchGoBack"/>
+- <menuitem name="SearchGoForwardMenu" action="SearchGoForward"/>
+- <separator/>
+- <menuitem name="SearchNextErrorMenu" action="SearchNextError"/>
+- <menuitem name="SearchPrevErrorMenu" action="SearchPrevError"/>
+- <separator/>
+- <menuitem name="SearchAutocompleteMenu" action="SearchAutocomplete"/>
+- </placeholder>
+- </menu>
+- <placeholder name="ExtraMenu_1">
+- <menu name="ProjectMenu" action="Project">
+- <menuitem name="ProjectBuildMenu" action="ProjectBuild"/>
+- <menuitem name="ProjectCleanMenu" action="ProjectClean"/>
+- <menuitem name="ProjectRunMenu" action="ProjectRun"/>
+- <menuitem name="ProjectSettingsMenu" action="ProjectSettings"/>
+- <separator/>
+- <menuitem name="ProjectWipeValenciaMenu" action="ProjectWipeValencia"/>
+- </menu>
+- </placeholder>
+- </menubar>
+- </ui>
+- """;
+
+ public Instance() {
+ Object();
+@@ -271,8 +294,8 @@ public class Instance : Peas.ExtensionBase, Gedit.WindowActivatable {
+ output_pane.add(output_view);
+ output_pane.show_all();
+
+- Gedit.Panel panel = window.get_bottom_panel();
+- panel.add_item_with_stock_icon(output_pane, "build", "Build", Gtk.Stock.CONVERT);
++ Gtk.Stack stack = window.get_bottom_panel() as Gtk.Stack;
++ stack.add_titled(output_pane, "build", "Build");
+
+ // Run pane
+ run_terminal = new Vte.Terminal();
+@@ -284,7 +307,7 @@ public class Instance : Peas.ExtensionBase, Gedit.WindowActivatable {
+ run_pane.add(run_terminal);
+ run_pane.show_all();
+
+- panel.add_item_with_stock_icon(run_pane, "run", "Run", Gtk.Stock.EXECUTE);
++ stack.add_titled(run_pane, "run", "Run");
+
+ // Symbol pane
+ symbol_browser = new SymbolBrowser(this);
+@@ -299,22 +322,11 @@ public class Instance : Peas.ExtensionBase, Gedit.WindowActivatable {
+ instance_connections = new SignalConnection(this);
+ tab_connections = new ArrayList<SignalConnection>();
+
+- // Toolbar menu
+- Gtk.UIManager manager = window.get_ui_manager();
+-
+- action_group = new Gtk.ActionGroup("valencia");
+- action_group.add_actions(entries, this);
+- manager.insert_action_group(action_group, 0);
+-
+- try {
+- ui_id = manager.add_ui_from_string(ui, -1);
+- } catch (Error e) {
+- error("error in add_ui_from_string: %s", e.message);
+- }
+-
+- initialize_menu_items(manager);
++ init_actions();
+ init_error_regex();
+-
++ window.active_tab_changed.connect(on_active_tab_changed);
++ window.focus_in_event.connect(on_focus_in_event);
++
+ instance_connections.add_signal(window, "tab-added", (Callback) tab_added_callback, this);
+ instance_connections.add_signal(window, "tab-removed", (Callback) tab_removed_callback, this);
+
+@@ -322,6 +334,125 @@ public class Instance : Peas.ExtensionBase, Gedit.WindowActivatable {
+ tab_added_callback(window, Gedit.Tab.get_from_document(document), this);
+ }
+ }
++
++ void init_actions() {
++ GLib.SimpleAction action = new GLib.SimpleAction("go_to_definition", null);
++ action.activate.connect(on_go_to_definition);
++ window.add_action(action);
++
++ action = new GLib.SimpleAction("find_symbol", null);
++ action.activate.connect(on_find_symbol);
++ window.add_action(action);
++
++ action = new GLib.SimpleAction("go_to_outer_scope", null);
++ action.activate.connect(on_go_to_outer_scope);
++ window.add_action(action);
++
++ action = new GLib.SimpleAction("go_back", null);
++ action.activate.connect(on_go_back);
++ window.add_action(action);
++
++ action = new GLib.SimpleAction("go_forward", null);
++ action.activate.connect(on_go_forward);
++ window.add_action(action);
++
++ action = new GLib.SimpleAction("next_error", null);
++ action.activate.connect(on_next_error);
++ window.add_action(action);
++
++ action = new GLib.SimpleAction("prev_error", null);
++ action.activate.connect(on_prev_error);
++ window.add_action(action);
++
++ action = new GLib.SimpleAction("autocomplete", null);
++ action.activate.connect(on_display_tooltip_or_autocomplete);
++ window.add_action(action);
++
++ action = new GLib.SimpleAction("build", null);
++ action.activate.connect(on_build);
++ window.add_action(action);
++
++ action = new GLib.SimpleAction("clear", null);
++ action.activate.connect(on_clean);
++ window.add_action(action);
++
++ action = new GLib.SimpleAction("run", null);
++ action.activate.connect(on_run);
++ window.add_action(action);
++
++ action = new GLib.SimpleAction("settings", null);
++ action.activate.connect(on_project_settings);
++ window.add_action(action);
++
++ action = new GLib.SimpleAction("wipe_symbols", null);
++ action.activate.connect(on_wipe_valencia);
++ window.add_action(action);
++ }
++
++ void on_active_tab_changed(Gedit.Tab tab) {
++ update_actions();
++ }
++
++ bool on_focus_in_event(Gdk.EventFocus event) {
++ update_actions();
++ return false;
++ }
++
++ void update_actions() {
++ GLib.SimpleAction action;
++ bool document_is_vala_file = active_document_is_vala_file();
++
++ action = window.lookup_action("go_to_definition") as GLib.SimpleAction;
++ action.set_enabled(document_is_vala_file);
++
++ action = window.lookup_action("find_symbol") as GLib.SimpleAction;
++ action.set_enabled(document_is_vala_file);
++
++ action = window.lookup_action("go_to_outer_scope") as GLib.SimpleAction;
++ action.set_enabled(document_is_vala_file);
++
++ action = window.lookup_action("go_back") as GLib.SimpleAction;
++ action.set_enabled(can_go_back());
++
++ action = window.lookup_action("go_forward") as GLib.SimpleAction;
++ action.set_enabled(can_go_forward());
++
++ action = window.lookup_action("autocomplete") as GLib.SimpleAction;
++ action.set_enabled(document_is_vala_file);
++
++ bool activate_error_search = active_filename() != null &&
++ program_exists_for_active_document() && errors_exist();
++
++ action = window.lookup_action("next_error") as GLib.SimpleAction;
++ action.set_enabled(activate_error_search);
++
++ action = window.lookup_action("prev_error") as GLib.SimpleAction;
++ action.set_enabled(activate_error_search);
++
++ bool active_file_not_null = active_filename() != null;
++
++ action = window.lookup_action("build") as GLib.SimpleAction;
++ action.set_enabled(active_file_not_null);
++
++ action = window.lookup_action("clear") as GLib.SimpleAction;
++ action.set_enabled(active_file_not_null);
++
++ action = window.lookup_action("run") as GLib.SimpleAction;
++ // Make sure the program for the file exists first, otherwise disable the run button
++ if (active_file_not_null && program_exists_for_active_document()) {
++ Program program = get_active_document_program();
++ program.reparse_makefile();
++ string binary_path = program.get_binary_run_path();
++
++ action.set_enabled(!child_process_running && binary_path != null &&
++ program.get_binary_is_executable());
++ } else {
++ action.set_enabled(false);
++ }
++
++ action = window.lookup_action("settings") as GLib.SimpleAction;
++ action.set_enabled(active_file_not_null);
++ }
+
+ public static Instance? find(Gedit.Window window) {
+ foreach (Instance i in instances)
+@@ -329,50 +460,6 @@ public class Instance : Peas.ExtensionBase, Gedit.WindowActivatable {
+ return i;
+ return null;
+ }
+-
+- void initialize_menu_items(Gtk.UIManager manager) {
+- Gtk.MenuItem search_menu = get_menu_item(manager, "/MenuBar/SearchMenu");
+- search_menu.activate.connect(on_search_menu_activated);
+-
+- Gtk.MenuItem project_menu = get_menu_item(manager, "/MenuBar/ExtraMenu_1/ProjectMenu");
+- project_menu.activate.connect(on_project_menu_activated);
+-
+- go_to_definition_menu_item = get_menu_item(manager,
+- "/MenuBar/SearchMenu/SearchOps_8/SearchGoToDefinitionMenu");
+-
+- find_symbol_menu_item = get_menu_item(manager,
+- "/MenuBar/SearchMenu/SearchOps_8/SearchFindSymbolMenu");
+-
+- go_to_outer_scope_menu_item = get_menu_item(manager,
+- "/MenuBar/SearchMenu/SearchOps_8/SearchGoToEnclosingMethodMenu");
+-
+- go_back_menu_item = get_menu_item(manager,
+- "/MenuBar/SearchMenu/SearchOps_8/SearchGoBackMenu");
+-
+- go_forward_menu_item = get_menu_item(manager,
+- "/MenuBar/SearchMenu/SearchOps_8/SearchGoForwardMenu");
+-
+- next_error_menu_item = get_menu_item(manager,
+- "/MenuBar/SearchMenu/SearchOps_8/SearchNextErrorMenu");
+-
+- prev_error_menu_item = get_menu_item(manager,
+- "/MenuBar/SearchMenu/SearchOps_8/SearchPrevErrorMenu");
+-
+- display_tooltip_menu_item = get_menu_item(manager,
+- "/MenuBar/SearchMenu/SearchOps_8/SearchAutocompleteMenu");
+-
+- build_menu_item = get_menu_item(manager,
+- "/MenuBar/ExtraMenu_1/ProjectMenu/ProjectBuildMenu");
+-
+- clean_menu_item = get_menu_item(manager,
+- "/MenuBar/ExtraMenu_1/ProjectMenu/ProjectCleanMenu");
+-
+- run_menu_item = get_menu_item(manager,
+- "/MenuBar/ExtraMenu_1/ProjectMenu/ProjectRunMenu");
+-
+- settings_menu_item = get_menu_item(manager,
+- "/MenuBar/ExtraMenu_1/ProjectMenu/ProjectSettingsMenu");
+- }
+
+ static void tab_added_callback(Gedit.Window window, Gedit.Tab tab, Instance instance) {
+ Gedit.Document document = tab.get_document();
+@@ -646,9 +733,9 @@ public class Instance : Peas.ExtensionBase, Gedit.WindowActivatable {
+
+ void show_output_pane() {
+ output_pane.show();
+- Gedit.Panel panel = window.get_bottom_panel();
+- panel.activate_item(output_pane);
+- panel.show();
++ Gtk.Stack stack = window.get_bottom_panel() as Gtk.Stack;
++ stack.visible_child = output_pane;
++ stack.show();
+ }
+
+ void spawn_process(string command, string working_directory, ProcessFinished callback) {
+@@ -668,9 +755,9 @@ public class Instance : Peas.ExtensionBase, Gedit.WindowActivatable {
+ output_buffer.set_text("", 0);
+
+ output_pane.show();
+- Gedit.Panel panel = window.get_bottom_panel();
+- panel.activate_item(output_pane);
+- panel.show();
++ Gtk.Stack stack = window.get_bottom_panel() as Gtk.Stack;
++ stack.visible_child = output_pane;
++ stack.show();
+
+ Pid child_pid;
+ int input_fd;
+@@ -1277,9 +1364,9 @@ public class Instance : Peas.ExtensionBase, Gedit.WindowActivatable {
+
+ run_terminal.reset(true, true);
+ run_pane.show();
+- Gedit.Panel panel = window.get_bottom_panel();
+- panel.activate_item(run_pane);
+- panel.show();
++ Gtk.Stack stack = window.get_bottom_panel() as Gtk.Stack;
++ stack.visible_child = run_pane;
++ stack.show();
+
+ child_process_running = true;
+ }
+@@ -1541,55 +1628,13 @@ void on_clean() {
+ return filename != null && Program.find_existing(filename) != null;
+ }
+
+- void on_search_menu_activated() {
+- bool document_is_vala_file = active_document_is_vala_file();
+- go_to_definition_menu_item.set_sensitive(document_is_vala_file);
+- find_symbol_menu_item.set_sensitive(document_is_vala_file);
+- go_to_outer_scope_menu_item.set_sensitive(document_is_vala_file);
+-
+- go_back_menu_item.set_sensitive(can_go_back());
+- go_forward_menu_item.set_sensitive(can_go_forward());
+-
+- bool activate_error_search = active_filename() != null &&
+- program_exists_for_active_document() && errors_exist();
+-
+- next_error_menu_item.set_sensitive(activate_error_search);
+- prev_error_menu_item.set_sensitive(activate_error_search);
+-
+- display_tooltip_menu_item.set_sensitive(document_is_vala_file);
+- }
+-
+- void on_project_menu_activated() {
+- bool active_file_not_null = active_filename() != null;
+- build_menu_item.set_sensitive(active_file_not_null);
+- clean_menu_item.set_sensitive(active_file_not_null);
+-
+- // Make sure the program for the file exists first, otherwise disable the run button
+- if (active_file_not_null && program_exists_for_active_document()) {
+- Program program = get_active_document_program();
+- program.reparse_makefile();
+- string binary_path = program.get_binary_run_path();
+-
+- run_menu_item.set_sensitive(!child_process_running && binary_path != null &&
+- program.get_binary_is_executable());
+- } else {
+- run_menu_item.set_sensitive(false);
+- }
+-
+- settings_menu_item.set_sensitive(active_file_not_null);
+- }
+-
+ public void update_state() {
+ }
+
+ public void deactivate() {
+- Gtk.UIManager manager = window.get_ui_manager();
+- manager.remove_ui(ui_id);
+- manager.remove_action_group(action_group);
+-
+- Gedit.Panel panel = window.get_bottom_panel();
+- panel.remove_item(output_pane);
+- panel.remove_item(run_pane);
++ Gtk.Stack stack = window.get_bottom_panel() as Gtk.Stack;
++ stack.remove(output_pane);
++ stack.remove(run_pane);
+
+ symbol_browser.deactivate();
+
+@@ -1602,4 +1647,5 @@ void on_clean() {
+ public void peas_register_types (TypeModule module) {
+ var o = module as Peas.ObjectModule;
+ o.register_extension_type(typeof(Gedit.WindowActivatable), typeof(Instance));
++ o.register_extension_type(typeof(Gedit.AppActivatable), typeof(AppInstance));
+ }
+--
+2.1.0
+
diff --git a/valencia-0.8.0-gedit314.patch b/valencia-0.8.0-gedit314.patch
new file mode 100644
index 0000000..4156e3d
--- /dev/null
+++ b/valencia-0.8.0-gedit314.patch
@@ -0,0 +1,20 @@
+--- valencia-0.8.0/valencia.vala.gedit314 2014-11-27 00:46:30.620042228 +0700
++++ valencia-0.8.0/valencia.vala 2014-11-27 01:13:53.471404293 +0700
+@@ -834,7 +834,7 @@
+ if (!d.is_untitled() && d.get_modified()) {
+ ++saving;
+ Signal.connect(d, "saved", (Callback) saved_callback, this);
+- d.do_save(0);
++ d.save();
+ }
+ if (saving == 0)
+ build();
+@@ -885,7 +885,7 @@
+ return;
+ }
+
+- Gedit.Encoding encoding = null;
++ Gtk.SourceEncoding encoding = null;
+ tab = window.create_tab_from_location(File.new_for_path(filename), encoding, 0, 0, false, true);
+ target_filename = filename;
+ destination = dest;
diff --git a/valencia-0.8.0-ownership.patch b/valencia-0.8.0-ownership.patch
new file mode 100644
index 0000000..5d91566
--- /dev/null
+++ b/valencia-0.8.0-ownership.patch
@@ -0,0 +1,11 @@
+--- valencia-0.8.0/autocomplete.vala.ownership 2014-08-22 04:56:02.000000000 +0700
++++ valencia-0.8.0/autocomplete.vala 2014-11-27 01:17:36.678542891 +0700
+@@ -34,7 +34,7 @@
+ window.hide();
+ }
+
+- unowned string? get_completion_target(Gtk.TextBuffer buffer) {
++ string? get_completion_target(Gtk.TextBuffer buffer) {
+ Gtk.TextIter start = get_insert_iter(buffer);
+ Gtk.TextIter end = start;
+
More information about the scm-commits
mailing list