aboutsummaryrefslogtreecommitdiff
path: root/lib/Arctica
diff options
context:
space:
mode:
authorMike Gabriel <mike.gabriel@das-netzwerkteam.de>2017-06-28 13:35:23 +0200
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2017-06-28 13:46:28 +0200
commit8b6be3d5707f6194719ca91b8e699ed83c02a400 (patch)
tree64db9d253dbea41787d024ab3977a8755ef2b29b /lib/Arctica
parenteb84fe468a7d8a331abd1dae31f01d3cf66b4904 (diff)
downloadarctica-browser-8b6be3d5707f6194719ca91b8e699ed83c02a400.tar.gz
arctica-browser-8b6be3d5707f6194719ca91b8e699ed83c02a400.tar.bz2
arctica-browser-8b6be3d5707f6194719ca91b8e699ed83c02a400.zip
Turn project from perl-Arctica-Browser-Overlay into arctica-browser.
Diffstat (limited to 'lib/Arctica')
-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.pm103
-rw-r--r--lib/Arctica/Browser/Overlay/ToolBar.pm229
-rw-r--r--lib/Arctica/Browser/Overlay/WebView.pm184
4 files changed, 1 insertions, 517 deletions
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;