rendered paste body? ephy-mono/AssemblyInfo.cs
? ephy-mono/EphyExtension.cs
cvs server: Diffing .
cvs server: Diffing ephy-mono
Index: ephy-mono/Epiphany.metadata
===================================================================
RCS file: /cvs/gnome/epiphany-mono/ephy-mono/Epiphany.metadata,v
retrieving revision 1.4
diff -u -r1.4 Epiphany.metadata
--- ephy-mono/Epiphany.metadata 14 Jun 2005 19:42:29 -0000 1.4
+++ ephy-mono/Epiphany.metadata 18 Jun 2005 12:02:49 -0000
@@ -1,7 +1,11 @@
<?xml version="1.0"?>
<metadata>
+ <!-- Sane return types -->
<attr path="/api/namespace/object/method[@cname='ephy_window_get_statusbar']/return-type" name="type">EphyStatusbar*</attr>
-
+ <attr path="/api/namespace/object/method[@cname='ephy_window_get_ui_manager']/return-type" name="type">GtkUIManager*</attr>
+
+ <!-- Changes the EphyExtension interface name to allow an abstract class be used with helper methods -->
+ <attr path="/api/namespace/interface[@cname='EphyExtension']" name="name">IEphyExtension</attr>
<!-- Hide this function while mono fails to generate the correct xml for it
http://bugzilla.ximian.com/show_bug.cgi?id=75266 -->
@@ -18,4 +22,4 @@
<attr path="/api/namespace/object/method[@cname='mozilla_embed_persist_completed']" name="hidden">1</attr>
<attr path="/api/namespace/object/method[@cname='mozilla_embed_persist_get_type']" name="hidden">1</attr>
<attr path="/api/namespace/object/method[@cname='mozilla_embed_single_get_type']" name="hidden">1</attr>
-</metadata>
\ No newline at end of file
+</metadata>
Index: ephy-mono/Makefile.am
===================================================================
RCS file: /cvs/gnome/epiphany-mono/ephy-mono/Makefile.am,v
retrieving revision 1.12
diff -u -r1.12 Makefile.am
--- ephy-mono/Makefile.am 17 Jun 2005 18:06:25 -0000 1.12
+++ ephy-mono/Makefile.am 18 Jun 2005 12:02:50 -0000
@@ -16,6 +16,8 @@
build_sources = $(addprefix $(srcdir)/, $(sources)) AssemblyInfo.cs
+ADDITIONS = EphyExtension.cs
+
customs = \
#
@@ -38,11 +40,12 @@
epiphany-mono.snk: $(top_srcdir)/epiphany-mono.snk
cp $(top_srcdir)/epiphany-mono.snk .
-generated-stamp: $(API) $(build_customs)
+generated-stamp: $(API) $(build_customs) $(ADDITIONS)
rm -f generated/* && \
$(GAPI_CODEGEN) --generate $(API) $(GTK_SHARP_CFLAGS) \
--outdir=generated --customdir=$(srcdir) --assembly-name=$(ASSEMBLY_NAME) && \
touch generated-stamp
+ cp $(ADDITIONS) generated/
$(ASSEMBLY): $(build_sources) generated-stamp epiphany-mono.snk
$(CSC) /unsafe /out:$(ASSEMBLY) /target:library $(GTK_SHARP_LIBS) \
cvs server: Diffing examples
Index: examples/EphyRssExtension.cs
===================================================================
RCS file: /cvs/gnome/epiphany-mono/examples/EphyRssExtension.cs,v
retrieving revision 1.2
diff -u -r1.2 EphyRssExtension.cs
--- examples/EphyRssExtension.cs 23 Apr 2005 21:19:59 -0000 1.2
+++ examples/EphyRssExtension.cs 18 Jun 2005 12:02:50 -0000
@@ -4,20 +4,17 @@
using Epiphany;
namespace EphyRssExtension {
- public class RssExtension : GLib.Object, EphyExtension {
+ public class RssExtension : EphyExtension {
private Hashtable feeds;
- private Hashtable windows;
- //TODO: Somehow get the IntPtr.Zero constructor get called in a parent class
//TODO: Provide a LOG-like routine ?
- public RssExtension () : base (IntPtr.Zero) {
+ public RssExtension () {
Console.WriteLine ("New EphyRss Extension");
this.feeds = new Hashtable ();
- this.windows = new Hashtable ();
}
- public void AttachWindow (EphyWindow window)
+ public override void AttachWindow (EphyWindow window)
{
ActionGroup group = new ActionGroup ("EphyRssExtensionActions");
@@ -29,8 +26,7 @@
group.Add (entries);
- //TODO: return directly a UIManager
- UIManager uim = window.UiManager as UIManager;
+ UIManager uim = window.UiManager;
uim.InsertActionGroup (group, 0);
uint id = uim.NewMergeId();
@@ -50,7 +46,7 @@
data.Action.Sensitive = true;
- windows[window] = data;
+ SetWindowData (window, data);
}
private void CreateStatusIcon (EphyWindow window, ref WindowData data)
@@ -68,8 +64,7 @@
Tooltips tip = new Tooltips ();
tip.SetTip (evbox, "Subscribe to site's news feed", "");
- //TODO: return a ephy Statusbar directly
- (window.Statusbar as EphyStatusbar).Add (frame);
+ window.Statusbar.Add (frame);
evbox.ButtonPressEvent += new ButtonPressEventHandler (OnStatusClicked);
@@ -79,9 +74,9 @@
data.Frame = frame;
}
- public void DetachWindow (EphyWindow window)
+ public override void DetachWindow (EphyWindow window)
{
- WindowData data = (WindowData) windows[window];
+ WindowData data = (WindowData) GetWindowData (window);
UIManager uim = window.UiManager as UIManager;
uim.RemoveUi (data.Id);
@@ -91,7 +86,7 @@
data.Evbox.ButtonPressEvent -= new ButtonPressEventHandler (OnStatusClicked);
}
- public void DetachTab (EphyWindow window, EphyTab tab)
+ public override void DetachTab (EphyWindow window, EphyTab tab)
{
System.Console.WriteLine ("Mono Extension: Detach tab");
@@ -100,7 +95,7 @@
tab.Embed.GeContentChange -= OnContentChange;
}
- public void AttachTab (EphyWindow window, EphyTab tab)
+ public override void AttachTab (EphyWindow window, EphyTab tab)
{
System.Console.WriteLine ("Mono Extension: Attach tab: {0}", tab.DocumentType );
@@ -130,7 +125,7 @@
Console.WriteLine ("Should (de-)activate menu item/statusbar");
bool show = (feeds[window.ActiveEmbed] as IList).Count > 0;
- WindowData data = (WindowData) windows[window];
+ WindowData data = (WindowData) GetWindowData (window);
data.Action.Sensitive = show;
data.Frame.Visible = show;
@@ -152,7 +147,18 @@
//UpdateAvailability ();
}
+
+ private class WindowEventHandler {
+ private EphyWindow window;
+
+ public WindowEventHandler (EphyWindow window)
+ {
+ this.window = window;
+ }
+
+ }
+
private struct Feed {
public string Title;
public string Type;
Index: examples/test.cs
===================================================================
RCS file: /cvs/gnome/epiphany-mono/examples/test.cs,v
retrieving revision 1.7
diff -u -r1.7 test.cs
--- examples/test.cs 23 Apr 2005 21:19:59 -0000 1.7
+++ examples/test.cs 18 Jun 2005 12:02:50 -0000
@@ -10,8 +10,7 @@
public uint id;
};
- public class Test : GLib.Object,
- EphyExtension {
+ public class Test : EphyExtension {
static ActionEntry[] entries = new ActionEntry[] {
new ActionEntry ("monoaction", null, "Test Mono", null, null,
@@ -22,13 +21,8 @@
{
Console.WriteLine ("Testing Mono");
}
-
-
- public Test () : base (IntPtr.Zero) {
- System.Console.WriteLine ("Mono Extension: Instantiated Test.Test");
- }
- public void AttachWindow (EphyWindow window)
+ public override void AttachWindow (EphyWindow window)
{
ActionGroup group = new ActionGroup ("MonoActions");
group.Add (entries);
@@ -42,19 +36,18 @@
WindowData data = new WindowData();
data.group = group;
data.id = id;
- window.Data["mono-key"] = data;
+ SetWindowData(window, data);
System.Console.WriteLine ("Mono Extension: Attach window");
}
- public void DetachWindow (EphyWindow window)
+ public override void DetachWindow (EphyWindow window)
{
- WindowData data = (WindowData)window.Data["mono-key"];
+ WindowData data = (WindowData) RemoveWindowData(window);
UIManager uim = (Gtk.UIManager) window.UiManager;
uim.RemoveUi (data.id);
uim.RemoveActionGroup (data.group);
- window.Data.Remove( "mono-key" );
System.Console.WriteLine ("Mono Extension: Detach window");
}
@@ -64,14 +57,14 @@
System.Console.WriteLine( "Mono Extension: {0}", args.Location );
}
- public void DetachTab (EphyWindow window, EphyTab tab)
+ public override void DetachTab (EphyWindow window, EphyTab tab)
{
System.Console.WriteLine ("Mono Extension: Detach tab");
EphyEmbed embed = tab.Embed;
embed.GeLocation -= this.OnGeLocation;
}
- public void AttachTab (EphyWindow window, EphyTab tab)
+ public override void AttachTab (EphyWindow window, EphyTab tab)
{
System.Console.WriteLine ("Mono Extension: Attach tab {0}", tab.DocumentType );
EphyEmbed embed = tab.Embed;
cvs server: Diffing include
cvs server: Diffing loader
cvs server: Diffing po
using System;
using System.Collections;
using Gtk;
using Epiphany;
namespace Epiphany {
public abstract class EphyExtension : GLib.Object, IEphyExtension
{
private Hashtable windows;
public EphyExtension () : base (IntPtr.Zero)
{
this.windows = new Hashtable();
}
//Provide here any method that could be interseting for extension developpers
//Easily save and retreive data associated to various epiphany windows
public void SetWindowData (EphyWindow window, object o)
{
this.windows[window] = o;
}
public object GetWindowData (EphyWindow window)
{
return this.windows[window];
}
public object RemoveWindowData (EphyWindow window)
{
object o = this.windows[window];
this.windows.Remove(window);
return o;
}
//Methods have to be implemented in plugin
public abstract void AttachWindow (EphyWindow window);
public abstract void DetachWindow (EphyWindow window);
public abstract void DetachTab (EphyWindow window, EphyTab tab);
public abstract void AttachTab (EphyWindow window, EphyTab tab);
}
}