Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

2006-04-13 Zac Bowling <zac@zacbowling.com>

        * sample/Makefile.am: added Glib to WebThumbnailer
        * sample/WebThumbnailer.cs: Add timming hacks and updated save
        function (Savev seems broken, but Save is better). Fixed other minor
        issues.
        * sample/webthumbnailer.sh: Added, detects mozilla/firefox directory
        to find libgtkembedmoz.so
        * sample/gtkmoztest.sh: Added, detects mozilla/firefox directory to
        find libgtkembedmoz.so
        * sample/MozWindow.cs: updated GTK# to not use obsolete toolbar
        functions


svn path=/trunk/gtkmozembed-sharp/; revision=59441
  • Loading branch information...
commit 137c2fc94bab8d89286d7c8bebc0022b155799aa 1 parent cded831
@zbowling zbowling authored
View
13 ChangeLog
@@ -1,3 +1,16 @@
+2006-04-13 Zac Bowling <zac@zacbowling.com>
+
+ * sample/Makefile.am: added Glib to WebThumbnailer
+ * sample/WebThumbnailer.cs: Add timming hacks and updated save
+ function (Savev seems broken, but Save is better). Fixed other minor
+ issues.
+ * sample/webthumbnailer.sh: Added, detects mozilla/firefox directory
+ to find libgtkembedmoz.so
+ * sample/gtkmoztest.sh: Added, detects mozilla/firefox directory to
+ find libgtkembedmoz.so
+ * sample/MozWindow.cs: updated GTK# to not use obsolete toolbar
+ functions
+
2005-05-14 Ben Maurer <bmaurer@ximian.com>
* configure.in: Bump for release and tag.
View
1  sample/Makefile.am
@@ -15,5 +15,6 @@ GtkMozApp.exe: $(srcdir)/GtkMozApp.cs $(srcdir)/MozWindow.cs
WebThumbnailer.exe: $(srcdir)/WebThumbnailer.cs
$(MCS) -lib:@top_builddir@/gtkmozembed \
-r:gecko-sharp.dll \
+ -pkg:glib-sharp-2.0 \
-pkg:gtk-sharp-2.0 $(srcdir)/WebThumbnailer.cs \
-out:WebThumbnailer.exe
View
39 sample/MozWindow.cs
@@ -100,20 +100,29 @@ private void CreateWindow (uint chrome)
Toolbar toolbar = new Toolbar();
toolbar.ToolbarStyle = ToolbarStyle.Both;
toolbar.Orientation = Orientation.Horizontal;
+ toolbar.ShowArrow = false;
hbox.PackStart(toolbar, false, false, 0);
- toolbar.AppendItem("Go Back", "Go Back", "Go Back",
- new Label("Go Back"), new SignalFunc (back_clicked_cb));
-
- toolbar.AppendItem("Stop", "Stop", "Stop",
- new Label("Stop"), new SignalFunc (stop_clicked_cb));
-
- toolbar.AppendItem("Forward", "Go Forward", "Go Forward",
- new Label("Go Forward"), new SignalFunc (forward_clicked_cb));
-
- toolbar.AppendItem("Reload", "Reload", "Reload",
- new Label("Reload"), new SignalFunc (reload_clicked_cb));
+ ToolButton backButton = new ToolButton("Go Back");
+ backButton.Clicked += new EventHandler (back_clicked_cb);
+ backButton.Label = "Go Back";
+ toolbar.Insert(backButton, -1);
+ ToolButton stopButton = new ToolButton("Stop");
+ stopButton.Clicked += new EventHandler (stop_clicked_cb);
+ stopButton.Label = "Stop";
+ toolbar.Insert(stopButton, -1);
+
+ ToolButton forwardButton = new ToolButton("Forward");
+ forwardButton.Clicked += new EventHandler (forward_clicked_cb);
+ forwardButton.Label = "Forward";
+ toolbar.Insert(forwardButton, -1);
+
+ ToolButton reloadButton = new ToolButton("Reload");
+ reloadButton.Clicked += new EventHandler (reload_clicked_cb);
+ reloadButton.Label = "Reload";
+ toolbar.Insert(reloadButton, -1);
+
editbox = new Entry();
editbox.Activated += new EventHandler(entry_act);
hbox.PackStart (editbox, true, true, 0);
@@ -259,22 +268,22 @@ void entry_act (object obj, EventArgs args)
moz.LoadUrl(editbox.Text);
}
- void back_clicked_cb ()
+ void back_clicked_cb (object obj, EventArgs args)
{
moz.GoBack();
}
- void stop_clicked_cb ()
+ void stop_clicked_cb (object obj, EventArgs args)
{
moz.StopLoad();
}
- void forward_clicked_cb ()
+ void forward_clicked_cb (object obj, EventArgs args)
{
moz.GoForward();
}
- void reload_clicked_cb ()
+ void reload_clicked_cb (object obj, EventArgs args)
{
moz.Reload(0);
}
View
29 sample/WebThumbnailer.cs
@@ -11,11 +11,12 @@
using System;
using Gtk;
using Gecko;
+using GLib;
class X {
static WebControl wc;
- static string output = "shot.png";
- static string url;
+ static string output = null;
+ static string url = null;
static int width = -1;
static int height = -1;
@@ -56,33 +57,42 @@ static void Main (string [] args)
}
if (url == null)
Help ();
+ if (output == null)
+ output = "shot.png";
Application.Init();
Window w = new Window ("test");
wc = new WebControl ();
wc.LoadUrl (args [0]);
- wc.NetStop += MakeShot;
wc.Show ();
+ wc.LocChange += WaitABit;
wc.SetSizeRequest (1024, 768);
w.Add (wc);
w.ShowAll ();
+ //GLib.Timeout.Add(700, new TimeoutHandler(MakeShot));
Application.Run();
}
static void Help ()
{
- Console.WriteLine ("Usage is: webshot [-width N] [-height N] url [shot]");
+ Console.WriteLine ("Usage is: WebThumbnailer [-width N] [-height N] url [shot]");
Environment.Exit (0);
}
- static void MakeShot (object sender, EventArgs a)
+ static void WaitABit (object sender, EventArgs e)
{
+ GLib.Timeout.Add(1000, new TimeoutHandler(MakeShot));
+ }
+
+ static bool MakeShot ()
+ {
+ Console.WriteLine(wc.Location);
Gdk.Window win = wc.GdkWindow;
int iwidth = wc.Allocation.Width;
int iheight = wc.Allocation.Height;
Gdk.Pixbuf p = new Gdk.Pixbuf (Gdk.Colorspace.Rgb, false, 8, iwidth, iheight);
Gdk.Pixbuf scaled;
-
+
p.GetFromDrawable (win, win.Colormap, 0, 0, 0, 0, iwidth, iheight);
if (width == -1){
if (height == -1)
@@ -95,8 +105,9 @@ static void MakeShot (object sender, EventArgs a)
else
scaled = p.ScaleSimple (width, height, Gdk.InterpType.Hyper);
}
-
- scaled.Savev (output, "png", null, null);
- Application.Quit ();
+
+ scaled.Save (output, "png");
+ Application.Quit ();
+ return true;
}
}
View
26 sample/gtkmozapp.sh
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+if test -n "$MOZILLA_FIVE_HOME"; then
+ MOZILLA_HOME=$MOZILLA_FIVE_HOME
+elif [ -f @MOZILLA_HOME@/chrome/comm.jar ]; then
+ MOZILLA_HOME=@MOZILLA_HOME@
+elif [ $(which mozilla) ] && grep MOZILLA_FIVE_HOME= "$(which mozilla)" > /dev/null ; then
+ MOZILLA_HOME=$(grep MOZILLA_FIVE_HOME= $(which mozilla) | cut -d '"' -f 2)
+elif [ $(which firefox) ] && grep MOZILLA_FIVE_HOME= "$(which firefox)" > /dev/null ; then
+ MOZILLA_HOME=$(grep MOZILLA_FIVE_HOME= $(which firefox) | cut -d '"' -f 2)
+else
+ echo "Cannot find mozilla installation directory. Please set MOZILLA_FIVE_HOME to your mozilla directory"
+ exit 1
+fi
+
+
+if [ -n $LD_LIBRARY_PATH ]; then
+ export LD_LIBRARY_PATH=$MOZILLA_HOME:$LD_LIBRARY_PATH
+else
+ export LD_LIBRARY_PATH=$MOZILLA_HOME
+fi
+
+
+export MOZILLA_FIVE_HOME=$MOZILLA_HOME
+
+exec mono GtkMozApp.exe
View
26 sample/webthumbnailer.sh
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+if test -n "$MOZILLA_FIVE_HOME"; then
+ MOZILLA_HOME=$MOZILLA_FIVE_HOME
+elif [ -f @MOZILLA_HOME@/chrome/comm.jar ]; then
+ MOZILLA_HOME=@MOZILLA_HOME@
+elif [ $(which mozilla) ] && grep MOZILLA_FIVE_HOME= "$(which mozilla)" > /dev/null ; then
+ MOZILLA_HOME=$(grep MOZILLA_FIVE_HOME= $(which mozilla) | cut -d '"' -f 2)
+elif [ $(which firefox) ] && grep MOZILLA_FIVE_HOME= "$(which firefox)" > /dev/null ; then
+ MOZILLA_HOME=$(grep MOZILLA_FIVE_HOME= $(which firefox) | cut -d '"' -f 2)
+else
+ echo "Cannot find mozilla installation directory. Please set MOZILLA_FIVE_HOME to your mozilla directory"
+ exit 1
+fi
+
+
+if [ -n $LD_LIBRARY_PATH ]; then
+ export LD_LIBRARY_PATH=$MOZILLA_HOME:$LD_LIBRARY_PATH
+else
+ export LD_LIBRARY_PATH=$MOZILLA_HOME
+fi
+
+
+export MOZILLA_FIVE_HOME=$MOZILLA_HOME
+
+exec mono WebThumbnailer.exe $@
Please sign in to comment.
Something went wrong with that request. Please try again.