Clone in a terminal:
Commit c2e0e67
Johan Mattsson - 2013-08-28T17:24:52+00:00
c2e0e67036f83b5b257b41e16361e4e079a69d06johan.mattsson.m@gmail.com

remove webkit callbacks

Changed files (13)

Diff

diff --git a/birdfont/GtkWindow.vala b/birdfont/GtkWindow.valaindex ed93033..b4e7cb6 100644--- a/birdfont/GtkWindow.vala+++ b/birdfont/GtkWindow.vala@@ -81,10 +81,6 @@ public class GtkWindow : Gtk.Window, NativeWindow { 		html_canvas = new WebView (); 		WebKit.set_cache_model (CacheModel.DOCUMENT_VIEWER); 		html_canvas.get_settings ().enable_default_context_menu = false;-				-		html_canvas.title_changed.connect ((p, s) => {-			webkit_callback (s);-		}); 		 		html_box = new ScrolledWindow (null, null); 		html_box.set_policy (PolicyType.NEVER, PolicyType.AUTOMATIC);@@ -96,7 +92,7 @@ public class GtkWindow : Gtk.Window, NativeWindow { 			File layout_uri; 			string uri = ""; 			FontDisplay fd = tab.get_display ();-			bool html = fd.is_html_canvas ();+			bool html = fd.get_name () == "Preview"; 			MainWindow.glyph_canvas.set_current_glyph (fd); 			 			scrollbar.set_visible (fd.has_scrollbar ());diff --git a/libbirdfont/BackgroundSelection.vala b/libbirdfont/BackgroundSelection.valaindex 5739533..eb9909f 100644--- a/libbirdfont/BackgroundSelection.vala+++ b/libbirdfont/BackgroundSelection.vala@@ -37,10 +37,11 @@ class BackgroundSelection : FontDisplay { 		add_icon = (!) i; 	} +	public override string get_label () {+		return _("Backgrounds");+	}+	 	public override string get_name () {-		#if translations-			_("Backgrounds");-		#endif 		return "Backgrounds"; 	} diff --git a/libbirdfont/DescriptionTab.vala b/libbirdfont/DescriptionTab.valaindex 934b576..01c843a 100644--- a/libbirdfont/DescriptionTab.vala+++ b/libbirdfont/DescriptionTab.vala@@ -22,12 +22,11 @@ public class DescriptionTab : FontDisplay { 	} 	 	public override string get_name () {-		_("Description"); 		return "Description"; 	}-	-	public override bool is_html_canvas () {-		return false;++	public override string get_label () {+		return _("Description"); 	}  	public override string get_html () {diff --git a/libbirdfont/FileTab.vala b/libbirdfont/FileTab.valaindex 8e76df8..d5b927b 100644--- a/libbirdfont/FileTab.vala+++ b/libbirdfont/FileTab.vala@@ -248,8 +248,11 @@ public class FileTab : FontDisplay { 		cr.restore (); 	} +	public override string get_label () {+		return _("Files");+	}+	 	public override string get_name () {-		_("Files"); 		return "Files"; 	} diff --git a/libbirdfont/FontDisplay.vala b/libbirdfont/FontDisplay.valaindex eb3e770..45d5dfb 100644--- a/libbirdfont/FontDisplay.vala+++ b/libbirdfont/FontDisplay.vala@@ -16,24 +16,18 @@ using Cairo;  namespace BirdFont { -/** Javascripts in webkit do use this callback. */-public class PropertyFunction {-	public delegate void PropertyCallback (string val);-	public PropertyCallback call;-}- public abstract class FontDisplay : GLib.Object { 	-	List<string> property = new List<string> ();-	List<PropertyFunction> call = new List<PropertyFunction> ();-	 	/** Queue redraw area */ 	public signal void redraw_area (double x, double y, double w, double h); 	-	/** Name of symbol or set of symbols in display selections like the tab panel. */ 	public virtual string get_name () { 		return ""; 	}++	public virtual string get_label () {+		return "";+	} 	 	public virtual bool has_scrollbar () { 		return false;@@ -41,10 +35,6 @@ public abstract class FontDisplay : GLib.Object { 	 	public virtual void scroll_to (double percent) { 	}-	-	public virtual bool is_html_canvas () {-		return false;-	}  	public static string path_to_uri (string path) { 		string uri = path;@@ -149,49 +139,6 @@ public abstract class FontDisplay : GLib.Object { 		return f;		 	} -	public void add_html_callback (string prop, PropertyFunction.PropertyCallback cb) {-		PropertyFunction pf = new PropertyFunction ();-		pf.call = cb;-		property.append (prop);-		call.append (pf);-	}-	-	public void process_property (string prop) {-		string k, v;-		int i, j;-		PropertyFunction cb;-		-		if (prop == "" || prop == "done") {-			return;-		}-		-		i = prop.index_of (":");-		-		if (i <= 0) {-			return;-		}-		-		k = prop.substring (0, i);-		v = prop.substring (i + 1);-		-		j = 0;-		-		foreach (string p in property) {-			if (p == k) {-				break;-			}-			j++;-		}-		-		if (j >= property.length ()) {-			warning (@"key  \"$k\" not found in property list, value: $v");-			return;-		}-		-		cb = call.nth (j).data;-		cb.call (v);-	}- 	public static File find_file (string? dir, string name) { 		return SearchPaths.find_file (dir, name);	 	}diff --git a/libbirdfont/KerningDisplay.vala b/libbirdfont/KerningDisplay.valaindex 59b7ccf..bed913a 100644--- a/libbirdfont/KerningDisplay.vala+++ b/libbirdfont/KerningDisplay.vala@@ -41,6 +41,10 @@ public class KerningDisplay : FontDisplay { 		row.append (w); 	} +	public override string get_label () {+		return _("Kerning");+	}+	 	public override string get_name () { 		return "Kerning"; 	}diff --git a/libbirdfont/KerningList.vala b/libbirdfont/KerningList.valaindex 94d0a8e..a864fa1 100644--- a/libbirdfont/KerningList.vala+++ b/libbirdfont/KerningList.vala@@ -84,8 +84,11 @@ public class KerningList : FontDisplay { 		cr.show_text (kerning); 	} +	public override string get_label () {+		return _("Kerning Pairs");+	}+ 	public override string get_name () {-		_("Kerning Pairs"); // translate later 		return "Kerning Pairs"; 	} diff --git a/libbirdfont/LanguageSelectionTab.vala b/libbirdfont/LanguageSelectionTab.valaindex 5679b1c..d766c8f 100644--- a/libbirdfont/LanguageSelectionTab.vala+++ b/libbirdfont/LanguageSelectionTab.vala@@ -87,9 +87,12 @@ public class LanguageSelectionTab : FontDisplay { 		cr.show_text (language); 	} +	public override string get_label () {+		return _("Character Set");+	}+	 	public override string get_name () {-		_("Character set");-		return "Character set";+		return "Character Set"; 	}  	public override bool has_scrollbar () {diff --git a/libbirdfont/MenuTab.vala b/libbirdfont/MenuTab.valaindex b629db2..d8d07eb 100644--- a/libbirdfont/MenuTab.vala+++ b/libbirdfont/MenuTab.vala@@ -25,14 +25,14 @@ public class MenuTab : FontDisplay { 	public static void set_suppress_event (bool e) { 		suppress_event = e; 	}-	++	public override string get_label () {+		return _("Menu");+	}+		 	public override string get_name () { 		return "Menu"; 	}-	-	public override bool is_html_canvas () {-		return true;-	}  	public override string get_html () { 		return "".dup ();diff --git a/libbirdfont/NativeWindow.vala b/libbirdfont/NativeWindow.valaindex eabfd6f..566fce9 100644--- a/libbirdfont/NativeWindow.vala+++ b/libbirdfont/NativeWindow.vala@@ -48,11 +48,6 @@ public interface NativeWindow : GLib.Object {  	/** Exit the application. */ 	public abstract void quit ();-	-	protected void webkit_callback (string s) {-		FontDisplay fd = MainWindow.get_current_display ();-		fd.process_property (s);-	} }  }diff --git a/libbirdfont/OverView.vala b/libbirdfont/OverView.valaindex ff2c192..689fae1 100644--- a/libbirdfont/OverView.vala+++ b/libbirdfont/OverView.vala@@ -230,6 +230,10 @@ public class OverView : FontDisplay { 	public override void next_view () { 	} +	public override string get_label () {+		return _("Overview");+	}+	 	public override string get_name () { 		return "Overview"; 	}diff --git a/libbirdfont/Preview.vala b/libbirdfont/Preview.valaindex b935fb2..0f8a53b 100644--- a/libbirdfont/Preview.vala+++ b/libbirdfont/Preview.vala@@ -22,10 +22,6 @@ public class Preview : FontDisplay { 	public override string get_name () { 		return "Preview"; 	}-	-	public override bool is_html_canvas () {-		return true;-	}  	public override void selected_canvas () { 	}diff --git a/libbirdfont/TabBar.vala b/libbirdfont/TabBar.valaindex e70b14e..6d45808 100644--- a/libbirdfont/TabBar.vala+++ b/libbirdfont/TabBar.vala@@ -438,7 +438,7 @@ public class TabBar : GLib.Object { 		int s = (tabs.length () == 0) ? 0 : selected + 1; 		 		if (tab_width < 0) {-			tab_width = 9 * _(display_item.get_name ()).char_count ();+			tab_width = 9 * display_item.get_label ().char_count (); 			tab_width += 30; 		} 				@@ -489,11 +489,6 @@ public class TabBar : GLib.Object { 		 	} 	-	// translation is done here since tabs are selected by name-	string translate (string s) {-		return _(s);-	}-	 	private void draw_tabs (Context cr) { 		double close_opacity; 		double offset = 19;@@ -559,7 +554,7 @@ public class TabBar : GLib.Object { 			cr.set_source_rgba (0, 0, 0, 1); 			cr.set_font_size (14); 			cr.move_to (8, height - 6);-			cr.show_text (translate (t.get_label ()));+			cr.show_text (t.get_label ()); 			cr.stroke (); 			 			// edges@@ -591,24 +586,6 @@ public class TabBar : GLib.Object { 			i++; 		} 	}-	-	public void add_empty_tab (string name) {-		add_tab (new EmptyTab (name));-	}-}--public class EmptyTab : FontDisplay {-	-	public string name;-	-	public EmptyTab (string name) {-		this.name = name;-	}-	-	public override string get_name () {-		return name;-	} } - }

Contact

Email: johan.mattsson.m@gmail.com
Mastodon: typo.social/@birdfont
GitHub: johanmattssonm
LinkedIn: johan-mattsson-2ab324112