From 8b6be3d5707f6194719ca91b8e699ed83c02a400 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Wed, 28 Jun 2017 13:35:23 +0200 Subject: Turn project from perl-Arctica-Browser-Overlay into arctica-browser. --- Makefile.PL | 6 +- README | 12 +- README.md | 9 + VERSION | 1 + bin/arctica-browser | 80 +++++++++ bin/arctica-testbrowser | 80 --------- bin/forkedmmoverlay.pl | 12 +- debian/arctica-browser-overlay.install | 2 + debian/arctica-browser.install | 2 + debian/arctica-testbrowser.install | 2 - debian/changelog | 6 + debian/control | 58 ++++--- debian/copyright | 4 +- debian/libarctica-browser-overlay-perl.install | 2 - lib/Arctica/Browser/Core/Version.pm | 65 +++++++ lib/Arctica/Browser/Overlay/Proxy.pm | 103 ----------- lib/Arctica/Browser/Overlay/ToolBar.pm | 229 ------------------------- lib/Arctica/Browser/Overlay/Version.pm | 65 ------- lib/Arctica/Browser/Overlay/WebView.pm | 184 -------------------- 19 files changed, 221 insertions(+), 701 deletions(-) create mode 100644 README.md create mode 100644 VERSION create mode 100755 bin/arctica-browser delete mode 100755 bin/arctica-testbrowser create mode 100644 debian/arctica-browser-overlay.install create mode 100644 debian/arctica-browser.install delete mode 100644 debian/arctica-testbrowser.install delete mode 100644 debian/libarctica-browser-overlay-perl.install create mode 100644 lib/Arctica/Browser/Core/Version.pm delete mode 100644 lib/Arctica/Browser/Overlay/Proxy.pm delete mode 100644 lib/Arctica/Browser/Overlay/ToolBar.pm delete mode 100644 lib/Arctica/Browser/Overlay/Version.pm delete mode 100644 lib/Arctica/Browser/Overlay/WebView.pm 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 => '' }, ); diff --git a/README b/README index a3bbaad..a378987 100644 --- a/README +++ b/README @@ -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; @@ -14,10 +14,10 @@ DESCRIPTION - $Arctica::Browser::Overlay:: + $Arctica::Browser::Core:: . - $Arctica::Browser::Overlay:: + $Arctica::Browser::Core:: . 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 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). diff --git a/VERSION b/VERSION new file mode 100644 index 0000000..b87eee8 --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +0.0.0.1 \ No newline at end of file diff --git a/bin/arctica-browser b/bin/arctica-browser new file mode 100755 index 0000000..97b1b58 --- /dev/null +++ b/bin/arctica-browser @@ -0,0 +1,80 @@ +#!/usr/bin/perl -X -T + +use strict; +use Data::Dumper; +use Arctica::Core::eventInit qw(genARandom BugOUT); +use Arctica::Telekinesis::Application::Gtk3; +my $ACO = Arctica::Core::eventInit->new({ + app_name=>'telekinesis-test-app', + app_class =>'tekiapp', + app_version=>'0.0.1.1'}); + + + +my $TeKiGtk3 = Arctica::Telekinesis::Application::Gtk3->new($ACO,{ + services => { + multimedia => { + conf => { + files_only => 1, + }, + }, + }, + }); + +LoadCSS(); +my $main_window = Gtk3::Window->new('toplevel'); +$main_window->signal_connect(destroy => sub {Gtk3->main_quit();}); +$main_window->set_title('TEST WINDOW'); + +my $window_id = $TeKiGtk3->add_window($main_window); +my $target_id = $TeKiGtk3->new_target($window_id,"multimedia"); +$TeKiGtk3->{'targets'}{$target_id}{'tmplnkid'} = "null";#TMP GARBAGE + + +my $vBox = Gtk3::Box->new( 'vertical', 0 ); +$main_window->add($vBox); +$vBox->show(); + + +$vBox->pack_start($TeKiGtk3->get_widget($target_id), 1, 1, 0 ); + + +$main_window->set_border_width(0); +$main_window->resize(640,480); +$main_window->show_all(); + +# We'll wan't to start this within the AppGtk3 thingie... but for now it can stay out here... +my $timeout = Glib::Timeout->add(50, sub {$TeKiGtk3->check_n_send();return 1;}); +my $timeout2 = Glib::Timeout->add(900, sub { + my ($os_x,$os_y) = $main_window->get_position; + my $x = ($os_x+1); + my $y = ($os_y+1); + $main_window->move($x,$y); + return 0; +}); +my $timeout3 = Glib::Timeout->add(1000, sub { + my ($os_x,$os_y) = $main_window->get_position; + + my $x = ($os_x-1); + my $y = ($os_y-1); + $main_window->move($x,$y); + + return 0; +}); + +$ACO->{'Glib'}{'MainLoop'}->run; + + +sub LoadCSS { + my $Gtk3_CSS_Provider = Gtk3::CssProvider->new; + my $Display = Gtk3::Gdk::Display::get_default(); + my $Screen = $Display->get_default_screen; + $Gtk3_CSS_Provider->load_from_data ([map ord, split //,"GtkSocket{ + background-color: #000000; + background-repeat: no-repeat; + background-position: center; + 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/arctica-testbrowser b/bin/arctica-testbrowser deleted file mode 100755 index d996281..0000000 --- a/bin/arctica-testbrowser +++ /dev/null @@ -1,80 +0,0 @@ -#!/usr/bin/perl -X -T - -use strict; -use Data::Dumper; -use Arctica::Core::eventInit qw(genARandom BugOUT); -use Arctica::Telekinesis::Application::Gtk3; -my $ACO = Arctica::Core::eventInit->new({ - app_name=>'telekinesis-test-app', - app_class =>'tekiapp', - app_version=>'0.0.1.1'}); - - - -my $TeKiGtk3 = Arctica::Telekinesis::Application::Gtk3->new($ACO,{ - services => { - multimedia => { - conf => { - files_only => 1, - }, - }, - }, - }); - -LoadCSS(); -my $main_window = Gtk3::Window->new('toplevel'); -$main_window->signal_connect(destroy => sub {Gtk3->main_quit();}); -$main_window->set_title('TEST WINDOW'); - -my $window_id = $TeKiGtk3->add_window($main_window); -my $target_id = $TeKiGtk3->new_target($window_id,"multimedia"); -$TeKiGtk3->{'targets'}{$target_id}{'tmplnkid'} = "null";#TMP GARBAGE - - -my $vBox = Gtk3::Box->new( 'vertical', 0 ); -$main_window->add($vBox); -$vBox->show(); - - -$vBox->pack_start($TeKiGtk3->get_widget($target_id), 1, 1, 0 ); - - -$main_window->set_border_width(0); -$main_window->resize(640,480); -$main_window->show_all(); - -# We'll wan't to start this within the AppGtk3 thingie... but for now it can stay out here... -my $timeout = Glib::Timeout->add(50, sub {$TeKiGtk3->check_n_send();return 1;}); -my $timeout2 = Glib::Timeout->add(900, sub { - my ($os_x,$os_y) = $main_window->get_position; - my $x = ($os_x+1); - my $y = ($os_y+1); - $main_window->move($x,$y); - return 0; -}); -my $timeout3 = Glib::Timeout->add(1000, sub { - my ($os_x,$os_y) = $main_window->get_position; - - my $x = ($os_x-1); - my $y = ($os_y-1); - $main_window->move($x,$y); - - return 0; -}); - -$ACO->{'Glib'}{'MainLoop'}->run; - - -sub LoadCSS { - my $Gtk3_CSS_Provider = Gtk3::CssProvider->new; - my $Display = Gtk3::Gdk::Display::get_default(); - my $Screen = $Display->get_default_screen; - $Gtk3_CSS_Provider->load_from_data ([map ord, split //,"GtkSocket{ - background-color: #000000; - background-repeat: no-repeat; - background-position: center; - background-image: url('/usr/share/arctica-testbrowser/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/arctica-browser-overlay.install b/debian/arctica-browser-overlay.install new file mode 100644 index 0000000..0077164 --- /dev/null +++ b/debian/arctica-browser-overlay.install @@ -0,0 +1,2 @@ +# FIXME: this is far from suboptimal... +bin/forkedmmoverlay.pl usr/bin/ 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 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 Uploaders: Mike Gabriel 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 -Source: https://github.com/ArcticaProject/perl-Arctica-Browser-Overlay +Source: https://github.com/ArcticaProject/arctica-browser Files: * Copyright: diff --git a/debian/libarctica-browser-overlay-perl.install b/debian/libarctica-browser-overlay-perl.install deleted file mode 100644 index 0077164..0000000 --- a/debian/libarctica-browser-overlay-perl.install +++ /dev/null @@ -1,2 +0,0 @@ -# FIXME: this is far from suboptimal... -bin/forkedmmoverlay.pl usr/bin/ diff --git a/lib/Arctica/Browser/Core/Version.pm b/lib/Arctica/Browser/Core/Version.pm new file mode 100644 index 0000000..574b6a1 --- /dev/null +++ b/lib/Arctica/Browser/Core/Version.pm @@ -0,0 +1,65 @@ +################################################################################ +# _____ _ +# |_ _| |_ ___ +# | | | ' \/ -_) +# |_| |_||_\___| +# _ _ ____ _ _ +# / \ _ __ ___| |_(_) ___ __ _ | _ \ _ __ ___ (_) ___ ___| |_ +# / _ \ | '__/ __| __| |/ __/ _` | | |_) | '__/ _ \| |/ _ \/ __| __| +# / ___ \| | | (__| |_| | (_| (_| | | __/| | | (_) | | __/ (__| |_ +# /_/ \_\_| \___|\__|_|\___\__,_| |_| |_| \___// |\___|\___|\__| +# |__/ +# 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. +# +# Copyright (C) 2015-2016 Mike Gabriel +# +################################################################################ +package Arctica::Browser::Core::Version; +use strict; + +use vars qw[$VERSION]; + +$VERSION = '0.0.0.1'; 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. -# -# Copyright (C) 2015-2016 Mike Gabriel -# -################################################################################ -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. -# -# Copyright (C) 2015-2016 Mike Gabriel -# -################################################################################ -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/Version.pm b/lib/Arctica/Browser/Overlay/Version.pm deleted file mode 100644 index 06c956b..0000000 --- a/lib/Arctica/Browser/Overlay/Version.pm +++ /dev/null @@ -1,65 +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. -# -# Copyright (C) 2015-2016 Mike Gabriel -# -################################################################################ -package Arctica::Browser::Overlay::Version; -use strict; - -use vars qw[$VERSION]; - -$VERSION = '0.0.0.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. -# -# Copyright (C) 2015-2016 Mike Gabriel -# -################################################################################ -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; -- cgit v1.2.3