Skip to content
This repository has been archived by the owner on Jun 4, 2022. It is now read-only.

Commit

Permalink
First!
Browse files Browse the repository at this point in the history
  • Loading branch information
alcinnz committed Nov 6, 2016
0 parents commit a84ff8e
Show file tree
Hide file tree
Showing 6 changed files with 187 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/build
*~
60 changes: 60 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# project name
project (odysseus)

# the oldest stable cmake version we support
cmake_minimum_required (VERSION 2.6)

# tell cmake where its modules can be found in our project directory
list (APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
list (APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/src)

# where we install data directory (if we have any)
set (DATADIR "${CMAKE_INSTALL_PREFIX}/share")

# what to call that directory where we install data too
set (PKGDATADIR "${DATADIR}/odysseus")

set (EXEC_NAME "odysseus")
set (RELEASE_NAME "A web browser for elementary OS")
set (VERSION "0.1")
set (VERSION_INFO "development")

# we're about to use pkgconfig to make sure dependencies are installed so let's find pkgconfig first
find_package(PkgConfig)

# now let's actually check for the required dependencies
pkg_check_modules(DEPS REQUIRED gtk+-3.0 granite webkit2gtk-4.0)

add_definitions(${DEPS_CFLAGS})
link_libraries(${DEPS_LIBRARIES})
link_directories(${DEPS_LIBRARY_DIRS})

# make sure we have vala
find_package(Vala REQUIRED)
# make sure we use vala
include(ValaVersion)
# make sure it's the desired version of vala
ensure_vala_version("0.16" MINIMUM)

# files we want to compile
include(ValaPrecompile)
vala_precompile(VALA_C ${EXEC_NAME}
src/Odysseus.vala
src/BrowserWindow.vala

# tell what libraries to use when compiling
PACKAGES
gtk+-3.0
granite
webkit2gtk-4.0
)

# tell cmake what to call the executable we just made
add_executable(${EXEC_NAME} ${VALA_C})
target_link_libraries(${EXEC_NAME} ${DEPS_LIBRARIES})

# install the binaries we just made
install (TARGETS ${EXEC_NAME} RUNTIME DESTINATION bin)

# install our .desktop file so the Applications menu will see it
install (FILES ${CMAKE_CURRENT_SOURCE_DIR}/data/odysseus.desktop DESTINATION ${DATADIR}/applications/)
40 changes: 40 additions & 0 deletions README
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
Odysseus Web Browser
====================

**Designed for elementary OS**

The goals (beyond following the elementary OS HIG) for Odysseus are:
1. Make the chrome look like nothing more than standard elementary OS window dressing
2. Provide tools to help users find where they want to go on the web
3. Support restricting how webpages can invade user privacy, catering to all skill levels
4. Reduce inconsistancies between WebKit and elementary OS

The design of the browsing tools described in goal 2 would be informed by the following principles:
* Avoid requiring any maintainance from the user
* Provide different tools for different circumstances
* Utilize a Web UX (over a native GTK UX) for it's links and to simplify the chrome
* Tags are easier to manage and assign then a folder hierarchy
* Screenshots are quicker to recognize then labels
* Let users semi-manually customize their search experience
* Utilize web standards whereever possible
* Keep data local where possible, and be explicit when data is shared

Technical Design
----------------

Odysseus mainly serves to integrate three Vala modules:
* GTK/Granite - for browser chrome
* (raw) SQLite - for user data
* WebKit - to render the Web

It may further use LibSoup and various parsers to implement browsing aids.

To offer per-page permissions as well as enriching discovery tools while not slowing down page load unnecessarily, Odysseus offers data structures to combine checks together as much as possible. Specifically it will offer:
* Something between a trie & a deterministic finite automaton to optimize URL matching
* An XPath trie to optimize matching webpage content
* And a hashtable to optimize matching MIMEtypes

Most of these extensions will either adjust the behaviour of the WebView or extend the address bar. Specifically extensions should be able to:
* Insert "tokens" to the left - to aid searching bookmarks & history
* Add extra toggle buttons to the right - to allow users to add tag vocabularies, search engines, content blockers, etc
* Extend the autocompletions for any query
10 changes: 10 additions & 0 deletions data/odysseus.desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[Desktop Entry]
Type=Application
Name=Odysseus
Comment=Browse knowledge and entertainment on the Web
Exec=odysseus
Icon=internet-web-browser
Terminal=false
Categories=Network;WebBrowser;GTK;GNOME;
Keywords=WWW;Web;Internet;Browser;
StartupNotify=true
45 changes: 45 additions & 0 deletions src/BrowserWindow.vala
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
public class Odysseus.BrowserWindow : Gtk.Window {
public weak Odysseus.Application app;

public WebKit.WebView web;
public Gtk.Button back;
public Gtk.Button forward;
public Gtk.Button reload;
public Gtk.Entry addressbar;

public BrowserWindow(Odysseus.Application ody_app) {
this.app = ody_app;
set_application(this.app);
this.title = "(Loading)";
this.set_size_request(900, 800);
this.icon_name = "internet-web-browser";

init_layout();
register_events();
}

private void init_layout() {
back = new Gtk.Button.from_icon_name ("go-previous");
forward = new Gtk.Button.from_icon_name ("go-next");
reload = new Gtk.Button.from_icon_name ("view-refresh");
addressbar = new Gtk.Entry();

Gtk.HeaderBar header = new Gtk.HeaderBar();
header.show_close_button = true;
header.pack_start(back);
header.pack_start(forward);
header.pack_start(reload);
header.set_custom_title(addressbar);
set_titlebar(header);

web = new WebKit.WebView();
add(web);
}

private void register_events() {
show.connect(() => {
web.load_uri ("https://ddg.gg/");
});
web.bind_property ("uri", this, "title");
}
}
30 changes: 30 additions & 0 deletions src/Odysseus.vala
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
public class Odysseus.Application : Granite.Application {

public BrowserWindow mainWindow;

construct {
application_id = "com.github.alcinnz.odysseus";
flags = ApplicationFlags.FLAGS_NONE;
/*Intl.setlocale (LocaleCategory.ALL, "");
Intl.textdomain (Build.GETTEXT_PACKAGE);*/

program_name = "Odysseus";
app_years = "2016";

/* TODO specify more metadata */
}

public override void activate () {
if (mainWindow == null) {
mainWindow = new BrowserWindow(this);
}
mainWindow.show_all();
}

/* TODO Handle HTTP(S) URLs */
}

public static int main(string[] args) {
var application = new Odysseus.Application();
return application.run(args);
}

0 comments on commit a84ff8e

Please sign in to comment.