summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Dywan <christian@twotoasts.de>2017-10-06 00:22:54 +0000
committerRabbitBot <>2017-10-06 00:22:54 +0000
commit410f6f309dec3f79ab84a4a7815f0e9ec82b9c15 (patch)
tree09651977bd29089d079c8897378adb66403cbf1c
parente4e328acecec8c093ee7abe142d7ff6313897df1 (diff)
parent0c4d3b94b85305a005e97a77c31464b709729676 (diff)
downloadmidori-git-410f6f309dec3f79ab84a4a7815f0e9ec82b9c15.tar.gz
Snap packaging
-rw-r--r--config/CMakeLists.txt2
-rw-r--r--midori/midori-app.c22
-rw-r--r--midori/midori-view.c9
-rw-r--r--snap/snapcraft.yaml109
4 files changed, 121 insertions, 21 deletions
diff --git a/config/CMakeLists.txt b/config/CMakeLists.txt
index cf59514b..4f1cd7fc 100644
--- a/config/CMakeLists.txt
+++ b/config/CMakeLists.txt
@@ -6,7 +6,7 @@ set (XDG_CONFIG_DIR "xdg/${CMAKE_PROJECT_NAME}")
file (GLOB_RECURSE CONFIG_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *)
list (REMOVE_ITEM CONFIG_FILES "CMakeLists.txt")
-if (${CMAKE_INSTALL_PREFIX} STREQUAL "/usr")
+if (CMAKE_INSTALL_PREFIX STREQUAL "/usr")
set(CMAKE_INSTALL_SYSCONFDIR "/etc")
endif()
diff --git a/midori/midori-app.c b/midori/midori-app.c
index 1bd6e6e9..3faae38c 100644
--- a/midori/midori-app.c
+++ b/midori/midori-app.c
@@ -593,26 +593,14 @@ midori_app_create_instance (MidoriApp* app)
return;
const gchar* config = midori_paths_get_config_dir_for_reading ();
- gchar* config_hash = g_compute_checksum_for_string (G_CHECKSUM_MD5, config, -1);
- gchar* name_hash = g_compute_checksum_for_string (G_CHECKSUM_MD5, app_name, -1);
- katze_assign (app_name, g_strconcat (PACKAGE_NAME,
- "_", config_hash, "_", name_hash, NULL));
+ gchar* config_hash = g_strdup_printf ("%u", g_str_hash (config));
+ gchar* config_hash_truncated = g_strndup (config_hash, 5);
+ katze_assign (app_name, g_strdup_printf (
+ "de.twotoasts.%s-%s", PACKAGE_NAME, config_hash_truncated));
g_free (config_hash);
- g_free (name_hash);
+ g_free (config_hash_truncated);
g_object_notify (G_OBJECT (app), "name");
- GdkDisplay* display = gdk_display_get_default ();
- #ifdef GDK_WINDOWING_X11
- /* On X11: :0 or :0.0 which is equivalent */
- gchar* display_name = g_strndup (gdk_display_get_name (display), 2);
- #else
- gchar* display_name = g_strdup (gdk_display_get_name (display));
- #endif
- g_strdelimit (display_name, ":.\\/", '_');
- gchar* instance_name = g_strdup_printf ("de.twotoasts.%s_%s", app_name, display_name);
- g_free (display_name);
- katze_assign (app_name, instance_name);
-
if (midori_debug ("app"))
g_print ("app registering %s\n", app_name);
g_object_set (app,
diff --git a/midori/midori-view.c b/midori/midori-view.c
index 2ac80a91..9af39810 100644
--- a/midori/midori-view.c
+++ b/midori/midori-view.c
@@ -442,11 +442,14 @@ midori_view_apply_icon (MidoriView* view,
#endif
0);
- pixbuf = gtk_icon_info_load_icon (icon_info, &error);
+ if (icon_info)
+ pixbuf = gtk_icon_info_load_icon (icon_info, &error);
g_strfreev (icon_names);
if (pixbuf == NULL) {
- g_warning ("Could not load pixbuf for icon '%s': %s\n", icon_name, error->message);
- g_clear_error (&error);
+ if (error != NULL) {
+ g_warning ("Could not load pixbuf for icon '%s': %s\n", icon_name, error->message);
+ g_clear_error (&error);
+ }
/* view->icon cannot be set to NULL, so we simply leave it as-is */
return;
diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml
new file mode 100644
index 00000000..9acccb96
--- /dev/null
+++ b/snap/snapcraft.yaml
@@ -0,0 +1,109 @@
+name: midori
+version: bzr
+version-script: |
+ set -x
+ VERSION=$(grep -r "^set(VERSION" CMakeLists.txt | sed -r "s@.+ ([0-9.]+)\)@\1@")
+ REVISION=$(bzr revno)
+ echo $VERSION~r$REVISION
+summary: a lightweight, fast, and free web browser
+description: |
+ Midori is a fast little WebKit browser with support for HTML5. It can manage
+ many open tabs and windows. The URL bar completes history, bookmarks, search
+ engines and open tabs out of the box. Web developers can use the powerful
+ web inspector that is a part of WebKit. Individual pages can easily be turned
+ into web apps and new profiles can be created on demand.
+
+ A number of extensions are included by default:
+
+ * Adblock with support for ABP filter lists and custom rules is built-in.
+ * You can download files with Aria2 or SteadyFlow.
+ * User scripts and styles support a la Greasemonkey.
+ * Managing cookies and scripts via NoJS and Cookie Security Manager.
+ * Switching open tabs in a vertical panel or a popup window.
+
+grade: stable
+confinement: strict
+icon: icons/scalable/apps/midori.svg
+
+apps:
+ midori:
+ command: desktop-launch snapcraft-preload midori
+ plugs:
+ - home
+ - pulseaudio
+ - network
+ - camera
+ - removable-media
+ - unity7
+ - wayland
+ - mir
+ - screen-inhibit-control
+ - password-manager-service
+ - gsettings
+ - network-bind
+ - location-observe
+ - network-status
+ desktop: share/applications/midori.desktop
+ environment:
+ LD_LIBRARY_PATH: $SNAP/usr/lib/x86_64-linux-gnu/webkit2gtk-4.0/:$LD_LIBRARY_PATH
+ # Work-around GPU crash https://bugs.webkit.org/show_bug.cgi?id=126122
+ WEBKIT_DISABLE_COMPOSITING_MODE: 1
+ GTK_CSD: 1
+ # No Netscape plugins
+ MOZ_PLUGIN_PATH: /
+
+slots:
+ dbus:
+ name: de.twotoasts.midori
+ bus: session
+
+parts:
+ midori:
+ plugin: cmake
+ configflags:
+ - -DCMAKE_INSTALL_DATADIR=/usr/share
+ - -DHALF_BRO_INCOM_WEBKIT2=1
+ - -DUSE_ZEITGEIST=0
+ build-packages:
+ - bzr
+ - valac
+ - libwebkit2gtk-4.0-dev
+ - libsoup-gnome2.4-dev
+ - libgcr-3-dev
+ - libsqlite3-dev
+ - librsvg2-bin
+ - intltool
+ install: |
+ echo "[settings]\n" \
+ "toolbar-items=" \
+ "TabNew,Back,NextForward,ReloadStop,BookmarkAdd,Location,Trash,CompactMenu\n" \
+ "show-statusbar=false\n" \
+ > $SNAPCRAFT_PART_INSTALL/etc/xdg/midori/config
+ stage-packages:
+ - libwebkit2gtk-4.0-37
+ - libcanberra-gtk3-module
+ - myspell-en-us
+ - gnome-icon-theme-symbolic
+ - gstreamer1.0-x
+ - gstreamer1.0-plugins-base
+ - gstreamer1.0-plugins-good
+ - gstreamer1.0-plugins-bad
+ - gstreamer1.0-plugins-ugly
+ - gstreamer1.0-pulseaudio
+ - pulseaudio-module-x11
+ - libmirclient9
+ stage:
+ - -share/applications/midori-private.desktop
+ - -usr/lib/x86_64-linux-gnu/libcups.so.2
+ - -usr/share/doc/libcups2/changelog.Debian.gz
+ - -usr/share/doc
+ after:
+ - desktop-gtk3
+ - snapcraft-preload
+ snapcraft-preload:
+ source: https://github.com/kalikiana/snapcraft-preload.git
+ source-branch: webkitgtk2
+ plugin: cmake
+ build-packages:
+ - gcc-multilib
+ - g++-multilib