Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: Waldteufel/shower
base: 689f40557e
...
head fork: Waldteufel/shower
compare: 72a3fcf989
  • 2 commits
  • 3 files changed
  • 0 commit comments
  • 1 contributor
Showing with 72 additions and 18 deletions.
  1. +54 −0 PKGBUILD
  2. +7 −5 app.vala
  3. +11 −13 browser.vala
View
54 PKGBUILD
@@ -0,0 +1,54 @@
+# Maintainer: Benjamin Richter <br@waldteufel.eu>
+pkgname=shower-git
+pkgver=20120209
+pkgrel=1
+pkgdesc="Eine Web-Brause"
+arch=('any')
+url="http://github.com/Waldteufel/shower"
+license=()
+groups=()
+depends=('>=libwebkit-1.6.3' '>=vala-0.14.2' '>=libunique-1.1.6' '>=gtk2-2.24.10')
+makedepends=('git')
+provides=()
+conflicts=()
+replaces=()
+backup=()
+options=()
+install=
+source=()
+noextract=()
+md5sums=() #generate with 'makepkg -g'
+
+_gitroot=http://github.com/Waldteufel/shower
+_gitname=shower
+
+build() {
+ cd "$srcdir"
+ msg "Connecting to GIT server...."
+
+ if [[ -d "$_gitname" ]]; then
+ cd "$_gitname" && git pull origin
+ msg "The local files are updated."
+ else
+ git clone "$_gitroot" "$_gitname"
+ fi
+
+ msg "GIT checkout done or server timeout"
+ msg "Starting build..."
+
+ rm -rf "$srcdir/$_gitname-build"
+ git clone "$srcdir/$_gitname" "$srcdir/$_gitname-build"
+ cd "$srcdir/$_gitname-build"
+
+ #
+ # BUILD HERE
+ #
+ make
+}
+
+package() {
+ cd "$srcdir/$_gitname-build"
+ install -D --mode=755 shower "$pkgdir/usr/bin/shower"
+}
+
+# vim:set ts=2 sw=2 et:
View
12 app.vala
@@ -18,11 +18,13 @@ abstract class Application : Unique.App {
public new void watch_window(Gtk.Window window) {
base.watch_window(window);
++nwindows;
- window.destroy.connect(() => {
- --nwindows;
- if (nwindows == 0)
- Gtk.main_quit();
- });
+ window.destroy.connect(this.window_destroyed);
+ }
+
+ public void window_destroyed() {
+ --nwindows;
+ if (nwindows == 0)
+ Gtk.main_quit();
}
protected abstract void handle_cmd(string cmd);
View
24 browser.vala
@@ -24,7 +24,6 @@ class BrowserWindow : Gtk.Window {
}
private WebKit.WebView web;
-
private Gtk.Container statusbar;
private Gtk.Label statuslabel;
private Gtk.Entry cmdentry;
@@ -33,7 +32,7 @@ class BrowserWindow : Gtk.Window {
private Regex adblock;
abstract class Mode : Object {
- public BrowserWindow browser { get; construct; }
+ public weak BrowserWindow browser { get; construct; }
protected abstract void enter();
construct { this.enter(); }
@@ -228,6 +227,7 @@ class BrowserWindow : Gtk.Window {
st.enable_html5_local_storage = false;
st.enable_html5_database = false;
st.enable_offline_web_application_cache = false;
+ st.enable_page_cache = true;
st.user_stylesheet_uri = "file://" + Path.build_filename(Environment.get_user_config_dir(), "shower", "style.css");
@@ -255,6 +255,7 @@ class BrowserWindow : Gtk.Window {
stderr.printf("Malformed adblock file at %s\n", adblock_path);
}
+
var scr = new Gtk.ScrolledWindow(null, null);
scr.add(web);
vbox.pack_start(scr, true, true, 0);
@@ -317,7 +318,7 @@ class BrowserWindow : Gtk.Window {
web.button_press_event.connect(this.handle_click);
this.key_press_event.connect((press) => {
- return this.mode.key_pressed(press.state & Gdk.ModifierType.MODIFIER_MASK, press.keyval);
+ return mode.key_pressed(press.state & Gdk.ModifierType.MODIFIER_MASK, press.keyval);
});
this.mode = new InteractMode(this);
@@ -365,18 +366,15 @@ class BrowserWindow : Gtk.Window {
}
private bool handle_download(WebKit.Download download) {
- var chooser = new Gtk.FileChooserDialog(null, this, Gtk.FileChooserAction.SAVE,
- Gtk.Stock.CANCEL, Gtk.ResponseType.CANCEL,
- Gtk.Stock.SAVE, Gtk.ResponseType.ACCEPT);
- chooser.do_overwrite_confirmation = true;
- chooser.set_current_folder("/tmp");
- chooser.set_current_name(download.suggested_filename);
- if (chooser.run() == Gtk.ResponseType.ACCEPT) {
- download.set_destination_uri(chooser.get_uri());
- chooser.destroy();
+ var filename = Path.get_basename(download.suggested_filename);
+ var dialog = new Gtk.MessageDialog(this, Gtk.DialogFlags.MODAL, Gtk.MessageType.QUESTION, Gtk.ButtonsType.YES_NO, "%s", filename);
+ dialog.title = "Download?";
+ if (dialog.run() == Gtk.ResponseType.YES) {
+ download.set_destination_uri("file://" + Path.build_filename("/tmp", filename));
+ dialog.destroy();
return true;
} else {
- chooser.destroy();
+ dialog.destroy();
return false;
}
}

No commit comments for this range

Something went wrong with that request. Please try again.