From c6c23a6850ae81945e3f79b6efbb1a10c4951fad Mon Sep 17 00:00:00 2001 From: Artem Anufrij Date: Mon, 31 Jul 2017 23:49:48 +0200 Subject: [PATCH] removed unused packages --- CMakeLists.txt | 22 ++++++++-------------- src/Application.vala | 2 +- src/CMakeLists.txt | 7 +------ src/DesktopFile.vala | 1 - src/MainWindow.vala | 4 ++-- src/WebApp.vala | 19 +++++++++++++------ src/WebAppWindow.vala | 14 +++++++------- src/{ => Widgets}/Assistant.vala | 4 ++-- 8 files changed, 34 insertions(+), 39 deletions(-) rename src/{ => Widgets}/Assistant.vala (99%) diff --git a/CMakeLists.txt b/CMakeLists.txt index e628822..596b05e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required (VERSION 2.8) cmake_policy (VERSION 2.8) -project(com.github.artemanufrij.webpin) +project (com.github.artemanufrij.webpin) include (GNUInstallDirs) set (DATADIR "${CMAKE_INSTALL_FULL_DATAROOTDIR}") set (PKGDATADIR "${DATADIR}/${CMAKE_PROJECT_NAME}") @@ -11,21 +11,14 @@ add_definitions ("-DGETTEXT_PACKAGE=\"${GETTEXT_PACKAGE}\"") list (APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake) find_package(PkgConfig) -pkg_check_modules(DEPS REQUIRED - gobject-2.0 - glib-2.0 - gio-2.0 - gtk+-3.0>=3.12 - gthread-2.0 - granite - gee-0.8 - webkit2gtk-4.0 - libsoup-2.4 - gdk-pixbuf-2.0 +pkg_check_modules(DEPS REQUIRED + gtk+-3.0>=3.12 + granite + webkit2gtk-4.0 ) -# -add_subdirectory(po) +add_definitions (-w) + add_definitions(${DEPS_CFLAGS}) link_libraries(${DEPS_LIBRARIES}) @@ -37,5 +30,6 @@ include(ValaVersion) ensure_vala_version("0.26.0" MINIMUM) add_subdirectory (src) +add_subdirectory (po) add_subdirectory (data) add_subdirectory (schemas) diff --git a/src/Application.vala b/src/Application.vala index ce030a6..9b402c8 100644 --- a/src/Application.vala +++ b/src/Application.vala @@ -54,7 +54,7 @@ namespace Webpin { return; } - mainwindow = new MainWindow (); + mainwindow = new MainWindow (); mainwindow.set_application(this); } } diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 932d582..d1fa984 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,9 +1,9 @@ vala_precompile(VALA_C ${CMAKE_PROJECT_NAME} Widgets/ApplicationIcon.vala Widgets/ApplicationsView.vala + Widgets/Assistant.vala Application.vala MainWindow.vala - Assistant.vala DesktopFile.vala InfoDialog.vala Settings.vala @@ -14,12 +14,7 @@ vala_precompile(VALA_C ${CMAKE_PROJECT_NAME} PACKAGES gtk+-3.0 granite - gio-2.0 - gee-0.8 - posix webkit2gtk-4.0 - libsoup-2.4 - gdk-pixbuf-2.0 OPTIONS --vapidir=${CMAKE_SOURCE_DIR}/vapi diff --git a/src/DesktopFile.vala b/src/DesktopFile.vala index 1565c4c..36da0c4 100644 --- a/src/DesktopFile.vala +++ b/src/DesktopFile.vala @@ -43,7 +43,6 @@ namespace Webpin { X-GNOME-FullName=webpin WebpinThemeColor=none"""; - private GLib.KeyFile file; public string name { get; private set; } diff --git a/src/MainWindow.vala b/src/MainWindow.vala index 09083f3..5d6c4eb 100644 --- a/src/MainWindow.vala +++ b/src/MainWindow.vala @@ -35,7 +35,7 @@ namespace Webpin { private Gtk.Button back_button; private Gtk.Button add_button; - private WebbyAssistant assistant; + private Assistant assistant; private ApplicationsView apps_view; public MainWindow () { @@ -73,7 +73,7 @@ namespace Webpin { }); apps_view = new ApplicationsView(); - assistant = new WebbyAssistant(); + assistant = new Assistant(); stack = new Gtk.Stack (); stack.set_transition_duration (500); diff --git a/src/WebApp.vala b/src/WebApp.vala index 36cacfb..9618525 100644 --- a/src/WebApp.vala +++ b/src/WebApp.vala @@ -149,17 +149,24 @@ namespace Webpin { });*/ - var snap = (Cairo.ImageSurface) yield app_view.get_snapshot (WebKit.SnapshotRegion.VISIBLE, - WebKit.SnapshotOptions.NONE, null); + uint8[] data = {0, 0, 0}; + int snap_width = 0; + try { + var snap = (Cairo.ImageSurface) yield app_view.get_snapshot (WebKit.SnapshotRegion.VISIBLE, WebKit.SnapshotOptions.NONE, null); + + // data ist in BGRA apparently (according to testing). Docs said ARGB, but that + // appears not to be the case + data = snap.get_data (); + snap_width = snap.get_width (); + } catch (Error e) { + warning (e.message); + } - // data ist in BGRA apparently (according to testing). Docs said ARGB, but that - // appears not to be the case - unowned uint8[] data = snap.get_data (); uint8 r = data[2]; uint8 g = data[1]; uint8 b = data[0]; - for (var i = 4; i < snap.get_width () * 3 * 4; i += 4) { + for (var i = 4; i < snap_width * 3 * 4; i += 4) { r = (r + data[i + 2]) / 2; g = (g + data[i + 1]) / 2; b = (b + data[i + 0]) / 2; diff --git a/src/WebAppWindow.vala b/src/WebAppWindow.vala index eb73175..3057bab 100644 --- a/src/WebAppWindow.vala +++ b/src/WebAppWindow.vala @@ -58,8 +58,8 @@ namespace Webpin { Gtk.Settings.get_default ().set ("gtk-application-prefer-dark-theme", should_use_dark_theme (web_app.ui_color)); } catch (GLib.Error err) { warning("Loading style failed"); - } - } + } + } web_app.theme_color_changed.connect( (color)=> { try { @@ -77,8 +77,8 @@ namespace Webpin { this.set_titlebar (headerbar); var info = DesktopFile.get_app_by_url(webapp_uri); - var width = info.get_string("WebbyWindowWidth"); - var height = info.get_string("WebbyWindowHeight"); + var width = info.get_string("WebpinWindowWidth"); + var height = info.get_string("WebpinWindowHeight"); if(width !=null && height != null) set_default_size (int.parse(width), int.parse(height)); @@ -134,8 +134,8 @@ namespace Webpin { public void update_window_state (int width, int height) { var file = web_app.get_desktop_file(); - file.edit_propertie ("WebbyWindowWidth", width.to_string()); - file.edit_propertie ("WebbyWindowHeight", height.to_string()); + file.edit_propertie ("WebpinWindowWidth", width.to_string()); + file.edit_propertie ("WebpinWindowHeight", height.to_string()); } public override bool key_press_event (Gdk.EventKey event) { @@ -155,7 +155,7 @@ namespace Webpin { if (handled) return true; - return (base.key_press_event != null) ? base.key_press_event (event) : true; + return (base.key_press_event != null) ? base.key_press_event (event) : true; } private bool should_use_dark_theme (string theme_color) { diff --git a/src/Assistant.vala b/src/Widgets/Assistant.vala similarity index 99% rename from src/Assistant.vala rename to src/Widgets/Assistant.vala index 372b8d1..8b7fc0a 100644 --- a/src/Assistant.vala +++ b/src/Widgets/Assistant.vala @@ -27,7 +27,7 @@ */ namespace Webpin { - public class WebbyAssistant : Gtk.Box { + public class Assistant : Gtk.Box { public enum assistant_mode { new_app, edit_app } @@ -55,7 +55,7 @@ namespace Webpin { private assistant_mode mode { get; set; default = assistant_mode.new_app; } - public WebbyAssistant () { + public Assistant () { GLib.Object (orientation: Gtk.Orientation.VERTICAL); apps = DesktopFile.get_applications ();