diff options
author | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2017-06-28 13:35:23 +0200 |
---|---|---|
committer | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2017-06-28 13:46:28 +0200 |
commit | 8b6be3d5707f6194719ca91b8e699ed83c02a400 (patch) | |
tree | 64db9d253dbea41787d024ab3977a8755ef2b29b | |
parent | eb84fe468a7d8a331abd1dae31f01d3cf66b4904 (diff) | |
download | arctica-browser-8b6be3d5707f6194719ca91b8e699ed83c02a400.tar.gz arctica-browser-8b6be3d5707f6194719ca91b8e699ed83c02a400.tar.bz2 arctica-browser-8b6be3d5707f6194719ca91b8e699ed83c02a400.zip |
Turn project from perl-Arctica-Browser-Overlay into arctica-browser.
-rw-r--r-- | Makefile.PL | 6 | ||||
-rw-r--r-- | README | 12 | ||||
-rw-r--r-- | README.md | 9 | ||||
-rw-r--r-- | VERSION | 1 | ||||
-rwxr-xr-x | bin/arctica-browser (renamed from bin/arctica-testbrowser) | 2 | ||||
-rwxr-xr-x | bin/forkedmmoverlay.pl | 12 | ||||
-rw-r--r-- | debian/arctica-browser-overlay.install (renamed from debian/libarctica-browser-overlay-perl.install) | 0 | ||||
-rw-r--r-- | debian/arctica-browser.install | 2 | ||||
-rw-r--r-- | debian/arctica-testbrowser.install | 2 | ||||
-rw-r--r-- | debian/changelog | 6 | ||||
-rw-r--r-- | debian/control | 58 | ||||
-rw-r--r-- | debian/copyright | 4 | ||||
-rw-r--r-- | lib/Arctica/Browser/Core/Version.pm (renamed from lib/Arctica/Browser/Overlay/Version.pm) | 2 | ||||
-rw-r--r-- | lib/Arctica/Browser/Overlay/Proxy.pm | 103 | ||||
-rw-r--r-- | lib/Arctica/Browser/Overlay/ToolBar.pm | 229 | ||||
-rw-r--r-- | lib/Arctica/Browser/Overlay/WebView.pm | 184 |
16 files changed, 76 insertions, 556 deletions
diff --git a/Makefile.PL b/Makefile.PL index 4371651..101aaa2 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -3,12 +3,12 @@ use ExtUtils::MakeMaker; WriteMakefile ( AUTHOR => 'Arctica Project Developers', - ABSTRACT => "Arctica Browser: client-side Overlay", - NAME => 'Arctica::Browser::Overlay', + ABSTRACT => "Arctica Web Browser: Core Module", + NAME => 'Arctica::Browser::Core', (eval { ExtUtils::MakeMaker->VERSION(6.21) } ? (LICENSE => 'perl') : ()), PREREQ_PM => { 'Test::More' => '0.47', }, - VERSION_FROM => 'lib/Arctica/Browser/Overlay/Version.pm', + VERSION_FROM => 'lib/Arctica/Browser/Core/Version.pm', clean => { FILES => '' }, ); @@ -1,8 +1,8 @@ NAME - Arctica::Browser::Overlay - Core Perl modules for the Arctica Framework + Arctica::Browser::Core - The Arctica Web Browser's Core Module SYNOPSIS - use Arctica::Browser::Overlay; + use Arctica::Browser::Core; <usage-example-code> @@ -14,10 +14,10 @@ DESCRIPTION <Some overall explanation> - $Arctica::Browser::Overlay::<var1> + $Arctica::Browser::Core::<var1> <Explanation on var1>. - $Arctica::Browser::Overlay::<var2> + $Arctica::Browser::Core::<var2> <Explanation on var2>. Class Methods @@ -47,7 +47,9 @@ DESCRIPTION Explanation on this... SEE ALSO - Arctica::Telekinesis::Server, Arctica::Telekinesis::Client, perl + Arctica::Telekinesis::Server, Arctica::Telekinesis::Client, + Arctica::Browser::Proxy, Arctica::Browser::WebView, Arctica::Browser::ToolBar, + perl AUTHOR AUTHOR_FULLNAME <AUTHOR_MAILADDRESS> diff --git a/README.md b/README.md new file mode 100644 index 0000000..6629b54 --- /dev/null +++ b/README.md @@ -0,0 +1,9 @@ +# Arctica Web Browser + +The Arctica Web Browser brings back performant web browser experience to remote (Linux based) desktop sessions. + +## Installation + +There is nothing really to install, except from a test version. + +So brave test users may dive in deeper [by studying the ArcticaBrowser documentation](https://github.com/ArcticaProject/ArcticaDocs/blob/master/ArcticaBrowser). @@ -0,0 +1 @@ +0.0.0.1
\ No newline at end of file diff --git a/bin/arctica-testbrowser b/bin/arctica-browser index d996281..97b1b58 100755 --- a/bin/arctica-testbrowser +++ b/bin/arctica-browser @@ -73,7 +73,7 @@ sub LoadCSS { background-color: #000000; background-repeat: no-repeat; background-position: center; - background-image: url('/usr/share/arctica-testbrowser/eyesore_t.png'); + background-image: url('/usr/share/arctica-browser/eyesore_t.png'); }"]); Gtk3::StyleContext::add_provider_for_screen( $Screen, $Gtk3_CSS_Provider, Gtk3::STYLE_PROVIDER_PRIORITY_USER); diff --git a/bin/forkedmmoverlay.pl b/bin/forkedmmoverlay.pl index 0f1c35b..a7f66af 100755 --- a/bin/forkedmmoverlay.pl +++ b/bin/forkedmmoverlay.pl @@ -10,16 +10,16 @@ use Glib; use Glib::Object::Introspection; use Glib qw(TRUE FALSE); -use Arctica::Browser::Overlay::ToolBar; -use Arctica::Browser::Overlay::WebView; -use Arctica::Browser::Overlay::Proxy; +use Arctica::Browser::ToolBar; +use Arctica::Browser::WebView; +use Arctica::Browser::Proxy; Glib::Object::Introspection->setup( basename => "GdkX11", version => "3.0", package => "Gtk3::Gdk"); -my $proxy = Arctica::Browser::Overlay::Proxy->new; +my $proxy = Arctica::Browser::Proxy->new; my $gnx_xid = `/usr/bin/xwininfo -root -all|/bin/grep NXAgent`; if ($gnx_xid =~ /^\s*(0x[0-9a-f]*)\s.*/) { @@ -78,8 +78,8 @@ $window->set_default_size(80, 60); $window->set_title('Browser'); $window->signal_connect(destroy => sub { Gtk3->main_quit() }); -my $toolbar = Arctica::Browser::Overlay::ToolBar->new; -my $webview = Arctica::Browser::Overlay::WebView->new($toolbar); +my $toolbar = Arctica::Browser::ToolBar->new; +my $webview = Arctica::Browser::WebView->new($toolbar); my $vbox = Gtk3::Box->new( 'vertical', 0); $vbox->set_border_width(0); diff --git a/debian/libarctica-browser-overlay-perl.install b/debian/arctica-browser-overlay.install index 0077164..0077164 100644 --- a/debian/libarctica-browser-overlay-perl.install +++ b/debian/arctica-browser-overlay.install diff --git a/debian/arctica-browser.install b/debian/arctica-browser.install new file mode 100644 index 0000000..2d987de --- /dev/null +++ b/debian/arctica-browser.install @@ -0,0 +1,2 @@ +bin/arctica-browser usr/bin/ +data/* usr/share/arctica-browser/ diff --git a/debian/arctica-testbrowser.install b/debian/arctica-testbrowser.install deleted file mode 100644 index 2b67919..0000000 --- a/debian/arctica-testbrowser.install +++ /dev/null @@ -1,2 +0,0 @@ -bin/* usr/bin/ -data/* usr/share/arctica-testbrowser/ diff --git a/debian/changelog b/debian/changelog index b487128..c15a779 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +arctica-browser (0.0.0.2-1) UNRELEASED; urgency=medium + + * Turn perl-Arctica-Browser-Overlay into actual Arctica Browser project. + + -- Mike Gabriel <mike.gabriel@das-netzwerkteam.de> Wed, 28 Jun 2017 13:30:34 +0200 + libarctica-browser-overlay-perl (0.0.0.1-0) unstable; urgency=medium * No changelog entries here... See upstream ChangeLog file. diff --git a/debian/control b/debian/control index 1a38778..f657a83 100644 --- a/debian/control +++ b/debian/control @@ -1,4 +1,4 @@ -Source: libarctica-browser-overlay-perl +Source: arctica-browser Section: perl Priority: optional Build-Depends: @@ -10,44 +10,62 @@ Maintainer: Arctica Project Developers <devs@lists.arctica-project.org> Uploaders: Mike Gabriel <mike.gabriel@das-netzwerkteam.de> Homepage: https://arctica-project.org/ -Vcs-Git: https://github.com/ArcticaProject/perl-Arctica-Browser-Overlay -Vcs-Browser: https://github.com/ArcticaProject/perl-Arctica-Browser-Overlay +Vcs-Git: https://github.com/ArcticaProject/arctica-browser +Vcs-Browser: https://github.com/ArcticaProject/arctica-browser Standards-Version: 3.9.8 -Package: libarctica-browser-overlay-perl +Package: libarctica-browser-core-perl Architecture: all Depends: ${perl:Depends}, ${misc:Depends}, - libarctica-core-perl, - libarctica-core-jabus-socket-perl, - libglib-perl, - libgtk3-perl, - libgtk3-webkit-perl, - libglib-object-introspection-perl, - x11-utils, - xdotool, -Description: Arctica Browser (client-side overlay) + libarctica-telekinesis-application-gtk3-perl, +Description: Arctica Web Browser: Core Module The Arctica Project brings forth a remote computing framework of enterprise grade and quality. The Arctica Framework is a highly modularized and thus pluggable for developing alls sort of remote services. . - This package provides all Perl modules needed for the client-side - Arctica Web Browser Overlay. + This package provides the core Perl module of the Arctica Web Browser. -Package: arctica-testbrowser +Package: arctica-browser Architecture: all Depends: ${perl:Depends}, ${misc:Depends}, - libarctica-telekinesis-application-gtk3-perl, + libarctica-browser-core-perl (= ${source:Version}), tinyproxy, -Description: Arctica Browser (test browser) +Breaks: arctica-testbrowser, +Replaces: arctica-testbrowser, +Description: Arctica Web Browser + The Arctica Project brings forth a remote computing framework of + enterprise grade and quality. The Arctica Framework is a highly + modularized and thus pluggable for developing alls sort of remote + services. + . + This package provides the Arctica Web Browser. + +Package: arctica-browser-overlay +Architecture: all +Depends: + ${perl:Depends}, + ${misc:Depends}, + libarctica-browser-proxy-perl, + libarctica-browser-toolbar-perl, + libarctica-browser-webview-perl, + libarctica-core-perl, + libarctica-core-jabus-socket-perl, + libglib-perl, + libgtk3-perl, + libglib-object-introspection-perl, + x11-utils, + xdotool, +Breaks: libarctica-browser-overlay-perl, +Replaces: libarctica-browser-overlay-perl, +Description: Arctica Web Browser: Client-Side Overlay The Arctica Project brings forth a remote computing framework of enterprise grade and quality. The Arctica Framework is a highly modularized and thus pluggable for developing alls sort of remote services. . - This package provides a standalone to-be-installed server-side test - browser that launches its web overlay on the client-side. + This package provides the client-side overlay for Arctica Web Browser. diff --git a/debian/copyright b/debian/copyright index 60590ce..814ecd9 100644 --- a/debian/copyright +++ b/debian/copyright @@ -1,7 +1,7 @@ Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ -Upstream-Name: perl-Arctica-Browser-Overlay +Upstream-Name: Arctica Web Browser Upstream-Contact: Arctica Project Developers <devs@lists.arctica-project.org> -Source: https://github.com/ArcticaProject/perl-Arctica-Browser-Overlay +Source: https://github.com/ArcticaProject/arctica-browser Files: * Copyright: diff --git a/lib/Arctica/Browser/Overlay/Version.pm b/lib/Arctica/Browser/Core/Version.pm index 06c956b..574b6a1 100644 --- a/lib/Arctica/Browser/Overlay/Version.pm +++ b/lib/Arctica/Browser/Core/Version.pm @@ -57,7 +57,7 @@ # Copyright (C) 2015-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de> # ################################################################################ -package Arctica::Browser::Overlay::Version; +package Arctica::Browser::Core::Version; use strict; use vars qw[$VERSION]; diff --git a/lib/Arctica/Browser/Overlay/Proxy.pm b/lib/Arctica/Browser/Overlay/Proxy.pm deleted file mode 100644 index 9034a1e..0000000 --- a/lib/Arctica/Browser/Overlay/Proxy.pm +++ /dev/null @@ -1,103 +0,0 @@ -################################################################################ -# _____ _ -# |_ _| |_ ___ -# | | | ' \/ -_) -# |_| |_||_\___| -# _ _ ____ _ _ -# / \ _ __ ___| |_(_) ___ __ _ | _ \ _ __ ___ (_) ___ ___| |_ -# / _ \ | '__/ __| __| |/ __/ _` | | |_) | '__/ _ \| |/ _ \/ __| __| -# / ___ \| | | (__| |_| | (_| (_| | | __/| | | (_) | | __/ (__| |_ -# /_/ \_\_| \___|\__|_|\___\__,_| |_| |_| \___// |\___|\___|\__| -# |__/ -# The Arctica Modular Remote Computing Framework -# -################################################################################ -# -# Copyright (C) 2015-2016 The Arctica Project -# http://http://arctica-project.org/ -# -# This code is dual licensed: strictly GPL-2 or AGPL-3+ -# -# GPL-2 -# ----- -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; version 2 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the -# Free Software Foundation, Inc., -# -# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. -# -# AGPL-3+ -# ------- -# This programm is free software; you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# This programm is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program; if not, write to the -# Free Software Foundation, Inc., -# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. -# -# Copyright (C) 2015-2016 Guangzhou Nianguan Electronics Technology Co.Ltd. -# <opensource@gznianguan.com> -# Copyright (C) 2015-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de> -# -################################################################################ -package Arctica::Browser::Overlay::Proxy; -use strict; -use Glib 'TRUE', 'FALSE'; -# Be very selective about what (if any) gets exported by default: -our @EXPORT = qw(); -# And be mindful of what we let the caller request, too: -our @EXPORT_OK = qw( ); - -sub new { - my $class_name = $_[0]; -# $arctica_core_object = $_[1]; - my $self = { - isArctica => 1, - aobject_name => "browser_proxy", - webview => FALSE, - }; - bless($self, $class_name); - - $self->_set_proxy(8888); - - return $self; -} - -sub _set_proxy { - my $self = $_[0]; - my $port = $_[1]; - my $username = $_[2]; - my $password = $_[3]; - my $hostname = "localhost"; - my $auth_string; - if ($username and $password) { - $auth_string = "$username:$password\@"; - } - my $proxy_string = "http://$auth_string$hostname:$port"; - $ENV{'HTTP_PROXY'} = $proxy_string; - $ENV{'http_proxy'} = $proxy_string; - $ENV{'HTTPS_PROXY'} = $proxy_string; - $ENV{'https_proxy'} = $proxy_string; - -} - - - -1; diff --git a/lib/Arctica/Browser/Overlay/ToolBar.pm b/lib/Arctica/Browser/Overlay/ToolBar.pm deleted file mode 100644 index 0800496..0000000 --- a/lib/Arctica/Browser/Overlay/ToolBar.pm +++ /dev/null @@ -1,229 +0,0 @@ -################################################################################ -# _____ _ -# |_ _| |_ ___ -# | | | ' \/ -_) -# |_| |_||_\___| -# _ _ ____ _ _ -# / \ _ __ ___| |_(_) ___ __ _ | _ \ _ __ ___ (_) ___ ___| |_ -# / _ \ | '__/ __| __| |/ __/ _` | | |_) | '__/ _ \| |/ _ \/ __| __| -# / ___ \| | | (__| |_| | (_| (_| | | __/| | | (_) | | __/ (__| |_ -# /_/ \_\_| \___|\__|_|\___\__,_| |_| |_| \___// |\___|\___|\__| -# |__/ -# The Arctica Modular Remote Computing Framework -# -################################################################################ -# -# Copyright (C) 2015-2016 The Arctica Project -# http://http://arctica-project.org/ -# -# This code is dual licensed: strictly GPL-2 or AGPL-3+ -# -# GPL-2 -# ----- -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; version 2 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the -# Free Software Foundation, Inc., -# -# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. -# -# AGPL-3+ -# ------- -# This programm is free software; you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# This programm is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program; if not, write to the -# Free Software Foundation, Inc., -# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. -# -# Copyright (C) 2015-2016 Guangzhou Nianguan Electronics Technology Co.Ltd. -# <opensource@gznianguan.com> -# Copyright (C) 2015-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de> -# -################################################################################ -package Arctica::Browser::Overlay::ToolBar; -use strict; -use Gtk3; -use Glib 'TRUE', 'FALSE'; -use Data::Dumper; -# Be very selective about what (if any) gets exported by default: -our @EXPORT = qw(); -# And be mindful of what we let the caller request, too: -our @EXPORT_OK = qw( ); - -sub new { - my $class_name = $_[0]; -# $arctica_core_object = $_[1]; - my $self = { - isArctica => 1, - aobject_name => "browser_toolbar", - webview => FALSE, - }; - bless($self, $class_name); - - $self->_gen_toolbar_main; - - return $self; -} - - -sub return_toolbar { - my $self = $_[0]; - if ($self->{'_gtk'}{'toolbar'}{'main'}) { - return $self->{'_gtk'}{'toolbar'}{'main'}; - } else { - die("Can't return a toolbar that does not exist, can we?"); - } -} - -sub _gen_toolbar_main { - my $self = $_[0]; - $self->{'_gtk'}{'toolbar'}{'main'} = Gtk3::Toolbar->new; - $self->{'_gtk'}{'toolbar'}{'main'}->set_icon_size('small-toolbar'); - $self->{'_gtk'}{'toolbar'}{'main'}->set_show_arrow(FALSE); - $self->{'_gtk'}{'toolbar'}{'main'}->set_orientation('GTK_ORIENTATION_HORIZONTAL'); - - $self->_gen_history_buttons($self->{'_gtk'}{'toolbar'}{'main'}); - - $self->{'_gtk'}{'toolbar'}{'main'}->insert(Gtk3::SeparatorToolItem->new ,-1 ); - - $self->_gen_url_entry_area($self->{'_gtk'}{'toolbar'}{'main'}); - - $self->{'_gtk'}{'urlentry'}{'url_entry'}->grab_focus; -} - -sub _gen_url_entry_area { - my $self = $_[0]; - my $the_toolbar = $_[1]; - $self->{'_gtk'}{'urlentry'}{'containerbox'} = Gtk3::ToolItem->new(); - $self->{'_gtk'}{'urlentry'}{'containerbox'}->set_expand(1); - - $self->{'_gtk'}{'urlentry'}{'url_entry'} = Gtk3::Entry->new(); - $self->{'_gtk'}{'urlentry'}{'url_entry'}->signal_connect( "activate" => sub {$self->_sigfunc_url_entry_activate;}, undef ); - $self->{'_gtk'}{'urlentry'}{'url_entry'}->signal_connect( 'icon-press' => sub {$self->_sigfunc_url_entry_icon_press(@_)} ); - - $self->{'_gtk'}{'urlentry'}{'containerbox'}->add($self->{'_gtk'}{'urlentry'}{'url_entry'}); - - $the_toolbar->insert($self->{'_gtk'}{'urlentry'}{'containerbox'}, -1); -} - -sub _gen_history_buttons { - my $self = $_[0]; - my $the_toolbar = $_[1]; - $self->{'_gtk'}{'history'}{'btn_back'} = Gtk3::ToolButton->new_from_stock('gtk-go-back'); - $self->{'_gtk'}{'history'}{'btn_back'}->signal_connect( "clicked" => sub {$self->_sigfunc_history_back;}, undef ); - $the_toolbar->insert($self->{'_gtk'}{'history'}{'btn_back'}, -1); - - $self->{'_gtk'}{'history'}{'btn_forward'} = Gtk3::ToolButton->new_from_stock('gtk-go-forward'); - $self->{'_gtk'}{'history'}{'btn_forward'}->signal_connect( "clicked" => sub {$self->_sigfunc_history_forward;}, undef ); - $the_toolbar->insert($self->{'_gtk'}{'history'}{'btn_forward'}, -1); -} - -sub ext_sigfunc { - my $self = $_[0]; - my $func = $_[1]; - my $func_data = $_[2]; -# print "TOOLBAR SIGFUNC:\t$_[1]\n"; -# print Dumper($_[2]); - if ($func eq "load_progress") { - $self->_url_entry_progress_update($func_data); - } elsif ($func eq "load_committed") { - $self->_url_entry_status_change($func,$func_data); - } elsif ($func eq "load_finished") { - $self->_url_entry_status_change($func,$func_data); - } -} - -sub _url_entry_status_change { - my $self = $_[0]; - my $state = $_[1]; - my $uri = $_[2]; - if ($state eq "load_committed") { - $self->{'_gtk'}{'urlentry'}{'_status'} = "committed"; - $self->{'_gtk'}{'urlentry'}{'url_entry'}->set_text($uri); - $self->{'_gtk'}{'urlentry'}{'url_entry'}->set_icon_from_stock('secondary','gtk-stop'); - } elsif ($state eq "load_finished") { - $self->{'_gtk'}{'urlentry'}{'_status'} = "finished"; - $self->{'_gtk'}{'urlentry'}{'url_entry'}->set_text($uri); - $self->{'_gtk'}{'urlentry'}{'url_entry'}->set_icon_from_stock('secondary','gtk-refresh'); - } -} - - -sub _url_entry_progress_update { - my $self = $_[0]; - my $load_fraction = $_[1]; - if ($self->{'_gtk'}{'urlentry'}{'url_entry'}) { - if ($load_fraction < 1) { - $self->{'_gtk'}{'urlentry'}{'url_entry'}->set_progress_fraction($load_fraction); - } else { - $self->{'_gtk'}{'urlentry'}{'url_entry'}->set_progress_fraction(0); - } - } -} - -sub _sigfunc_url_entry_icon_press { - my $self = $_[0]; - my $which_icon = $_[2]; - if ($which_icon eq "secondary") { - if ($self->{'_gtk'}{'urlentry'}{'_status'} eq "commited") { - if ($self->{'webview'}) { - $self->{'webview'}->ext_sigfunc('stop'); - } - } elsif ($self->{'_gtk'}{'urlentry'}{'_status'} eq "finished") { - if ($self->{'webview'}) { - $self->{'webview'}->ext_sigfunc('reload'); - } - } - } -} - -sub _sigfunc_url_entry_activate { - my $self = $_[0]; - if ($self->{'webview'}) { - my $uri = $self->{'_gtk'}{'urlentry'}{'url_entry'}->get_text; - unless ($uri =~ /^[a-z]*\:\/\/.*/) {# do better URL validation here! - $uri = "http://$uri"; - } - $self->{'webview'}->ext_sigfunc('load_uri',$uri); - } else { - warn("No WebView attached to this toolbar?"); - } -} - -sub _sigfunc_history_back { - my $self = $_[0]; - if ($self->{'webview'}) { - $self->{'webview'}->ext_sigfunc('history_back'); - } else { - warn("No WebView attached to this toolbar?"); - } -} - -sub _sigfunc_history_forward { - my $self = $_[0]; - if ($self->{'webview'}) { - $self->{'webview'}->ext_sigfunc('history_forward'); - } else { - warn("No WebView attached to this toolbar?"); - } -} - - -1; diff --git a/lib/Arctica/Browser/Overlay/WebView.pm b/lib/Arctica/Browser/Overlay/WebView.pm deleted file mode 100644 index 751947b..0000000 --- a/lib/Arctica/Browser/Overlay/WebView.pm +++ /dev/null @@ -1,184 +0,0 @@ -################################################################################ -# _____ _ -# |_ _| |_ ___ -# | | | ' \/ -_) -# |_| |_||_\___| -# _ _ ____ _ _ -# / \ _ __ ___| |_(_) ___ __ _ | _ \ _ __ ___ (_) ___ ___| |_ -# / _ \ | '__/ __| __| |/ __/ _` | | |_) | '__/ _ \| |/ _ \/ __| __| -# / ___ \| | | (__| |_| | (_| (_| | | __/| | | (_) | | __/ (__| |_ -# /_/ \_\_| \___|\__|_|\___\__,_| |_| |_| \___// |\___|\___|\__| -# |__/ -# The Arctica Modular Remote Computing Framework -# -################################################################################ -# -# Copyright (C) 2015-2016 The Arctica Project -# http://http://arctica-project.org/ -# -# This code is dual licensed: strictly GPL-2 or AGPL-3+ -# -# GPL-2 -# ----- -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; version 2 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the -# Free Software Foundation, Inc., -# -# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. -# -# AGPL-3+ -# ------- -# This programm is free software; you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# This programm is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program; if not, write to the -# Free Software Foundation, Inc., -# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. -# -# Copyright (C) 2015-2016 Guangzhou Nianguan Electronics Technology Co.Ltd. -# <opensource@gznianguan.com> -# Copyright (C) 2015-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de> -# -################################################################################ -package Arctica::Browser::Overlay::WebView; -use strict; -use Gtk3; -use Glib 'TRUE', 'FALSE'; -use Gtk3::WebKit; -use Data::Dumper; -# Be very selective about what (if any) gets exported by default: -our @EXPORT = qw(); -# And be mindful of what we let the caller request, too: -our @EXPORT_OK = qw( ); - -sub new { - my $class_name = $_[0]; - my $related_toolbar = $_[1]; - - my $self = { - isArctica => 1, - aobject_name => "browser_webview", - }; - bless($self, $class_name); - - if ($related_toolbar) { - if ($related_toolbar->{'aobject_name'} eq "browser_toolbar") { - $self->{'toolbar'} = $related_toolbar; - $related_toolbar->{'webview'} = $self; - } else { - die("Thats not a toolbar you're trying to pass of as one, is it?"); - } - } else { - $related_toolbar = FALSE; - } - - - $self->_gen_webview_main; - - return $self; -} - - -sub return_webview { - my $self = $_[0]; - if ($self->{'_gtk'}{'webview'}{'main_container'}) { - return $self->{'_gtk'}{'webview'}{'main_container'}; - } else { - die("Can't return a webview that does not exist, can we?"); - } -} - -sub _gen_webview_main { - my $self = $_[0]; - - $self->{'_gtk'}{'webview'}{'main_container'} = Gtk3::Overlay->new(); - - $self->{'_gtk'}{'webview'}{'thewebview'} = Gtk3::WebKit::WebView->new(); - $self->{'_gtk'}{'webview'}{'thewebview'}->load_uri("http://duckduckgo.com/");# - $self->{'_gtk'}{'webview'}{'scroller'} = Gtk3::ScrolledWindow->new(); - $self->{'_gtk'}{'webview'}{'scroller'}->add($self->{'_gtk'}{'webview'}{'thewebview'}); - $self->{'_gtk'}{'webview'}{'main_container'}->add($self->{'_gtk'}{'webview'}{'scroller'}); - - $self->{'_gtk'}{'webview'}{'bottom_overlay_text'} = Gtk3::Label->new(); - $self->{'_gtk'}{'webview'}{'bottom_overlay_text'}->set_halign('start'); - $self->{'_gtk'}{'webview'}{'bottom_overlay_text'}->set_valign('end'); - $self->{'_gtk'}{'webview'}{'main_container'}->add_overlay($self->{'_gtk'}{'webview'}{'bottom_overlay_text'}); - - - $self->{'_gtk'}{'webview'}{'thewebview'}->signal_connect( 'hovering-over-link' => sub {$self->_sigfunc_webview_hover_over_link($_[2]);}, undef ); - $self->{'_gtk'}{'webview'}{'thewebview'}->signal_connect( 'notify::load-status' => sub {$self->_sigfunc_webview_notify_load_status;}, undef ); - $self->{'_gtk'}{'webview'}{'thewebview'}->signal_connect( 'notify::progress' => sub {$self->_sigfunc_webview_notify_progress;}, undef ); -# $self->{'_gtk'}{'webview'}{'thewebview'}->signal_connect( 'notify::title' => sub {} , undef ); - -} - -sub ext_sigfunc { - my $self = $_[0]; - my $func = $_[1]; - my $func_data = $_[2]; -# print "WEBVIEW SIGFUNC:\t$_[1]\n"; -# print Dumper($_[2]); - if ($func eq "reload") { - $self->{'_gtk'}{'webview'}{'thewebview'}->reload(); - } elsif ($func eq "stop") { - $self->{'_gtk'}{'webview'}{'thewebview'}->stop_loading(); - } elsif ($func eq "load_uri") { - $self->{'_gtk'}{'webview'}{'thewebview'}->load_uri($func_data); - } elsif ($func eq "history_back") { - $self->{'_gtk'}{'webview'}{'thewebview'}->go_back; - } elsif ($func eq "history_forward") { - $self->{'_gtk'}{'webview'}{'thewebview'}->go_forward; - } -} - -sub _sigfunc_webview_notify_load_status { - my $self = $_[0]; - my $status = $self->{'_gtk'}{'webview'}{'thewebview'}->get('load_status'); - if ($status eq 'committed') { - my $uri = $self->{'_gtk'}{'webview'}{'thewebview'}->get_uri(); -# if ($uri) {print "URI:\t$uri\n";} - $self->{'toolbar'}->ext_sigfunc('load_committed',$uri) - } elsif ($status eq 'finished') { - my $uri = $self->{'_gtk'}{'webview'}{'thewebview'}->get_uri(); - $self->{'toolbar'}->ext_sigfunc('load_finished',$uri) - } else { -# print "WTF LS:\t$status\n"; - } -} - -sub _sigfunc_webview_notify_progress { - my $self = $_[0]; - my $progress = $self->{'_gtk'}{'webview'}{'thewebview'}->get('progress'); - if ($progress) { - $self->{'toolbar'}->ext_sigfunc('load_progress',sprintf("%.2f", $progress)); - } -} - -sub _sigfunc_webview_hover_over_link { - my $self = $_[0]; - my $link = $_[1]; - if ($link) { - $self->{'_gtk'}{'webview'}{'bottom_overlay_text'}->set_text($link); - } else { - $self->{'_gtk'}{'webview'}{'bottom_overlay_text'}->set_text(''); - } -} - -1; |