Commit e4765c96 authored by Sebastian Ramacher's avatar Sebastian Ramacher

Merge branch 'release/0.3.4'

parents c18a70d7 409e88ed
stages:
- build
- test
# Archlinux
build:archlinux:
tags:
- pwmt
stage: build
image: registry.pwmt.org/pwmt/gitlab-runner-images/archlinux:latest
script:
- mkdir -p build && cd build
- meson ..
- ninja
artifacts:
expire_in: 1 day
paths:
- build
except:
- tags
test:archlinux:
tags:
- pwmt
stage: test
image: registry.pwmt.org/pwmt/gitlab-runner-images/archlinux:latest
script:
- cd build
- ninja test
dependencies:
- build:archlinux
except:
- tags
# Debian 10 (Buster)
build:debian-buster:
tags:
- pwmt
stage: build
image: registry.pwmt.org/pwmt/gitlab-runner-images/debian:buster
script:
- mkdir -p build && cd build
- meson ..
- ninja
artifacts:
expire_in: 1 day
paths:
- build
except:
- tags
test:debian-buster:
tags:
- pwmt
stage: test
image: registry.pwmt.org/pwmt/gitlab-runner-images/debian:buster
script:
- cd build
- ninja test
dependencies:
- build:debian-buster
except:
- tags
# Ubuntu 18.04 LTS (Bionic Beaver)
build:ubuntu-bionic:
tags:
- pwmt
stage: build
image: registry.pwmt.org/pwmt/gitlab-runner-images/ubuntu:bionic
script:
- mkdir -p build && cd build
- meson ..
- ninja
artifacts:
expire_in: 1 day
paths:
- build
except:
- tags
test:ubuntu-bionic:
tags:
- pwmt
stage: test
image: registry.pwmt.org/pwmt/gitlab-runner-images/ubuntu:bionic
script:
- cd build
- ninja test
dependencies:
- build:ubuntu-bionic
except:
- tags
# Ubuntu 19.10 (Eoan Ermine)
build:ubuntu-eoan:
tags:
- pwmt
stage: build
image: registry.pwmt.org/pwmt/gitlab-runner-images/ubuntu:eoan
script:
- mkdir -p build && cd build
- meson ..
- ninja
artifacts:
expire_in: 1 day
paths:
- build
except:
- tags
test:ubuntu-eoan:
tags:
- pwmt
stage: test
image: registry.pwmt.org/pwmt/gitlab-runner-images/ubuntu:eoan
script:
- cd build
- ninja test
dependencies:
- build:ubuntu-eoan
except:
- tags
Copyright (c) 2010-2018 pwmt.org
Copyright (c) 2010-2020 pwmt.org
This software is provided 'as-is', without any express or implied warranty. In
no event will the authors be held liable for any damages arising from the use of
......
......@@ -178,7 +178,7 @@ girara_list_contains(girara_list_t* list, void* data)
}
void*
girara_list_find(girara_list_t* list, girara_compare_function_t compare, const void* data)
girara_list_find(const girara_list_t* list, girara_compare_function_t compare, const void* data)
{
g_return_val_if_fail(list != NULL && compare != NULL, NULL);
if (list->start == NULL) {
......
......@@ -141,7 +141,7 @@ void girara_list_sort(girara_list_t* list, girara_compare_function_t compare) GI
* @param data data passed as the second argument to the compare function
* @return the element if found or NULL
*/
void* girara_list_find(girara_list_t* list, girara_compare_function_t compare,
void* girara_list_find(const girara_list_t* list, girara_compare_function_t compare,
const void* data) GIRARA_VISIBLE;
/**
......
......@@ -2,6 +2,7 @@
#include <ctype.h>
#include <glib.h>
#include <glib/gstdio.h>
#include <glib/gi18n-lib.h>
#include <limits.h>
#include <pwd.h>
......@@ -68,18 +69,38 @@ girara_xdg_open_with_working_directory(const char* uri, const char* working_dire
}
/* g_spawn_async expects char** */
char* argv[] = { g_strdup("xdg-open"), g_strdup(uri), NULL };
static char xdg_open[] = "xdg-open";
char* argv[] = { xdg_open, g_strdup(uri), NULL };
GError* error = NULL;
const bool res = g_spawn_async(working_directory, argv, NULL, G_SPAWN_SEARCH_PATH, NULL,
bool res = g_spawn_async(working_directory, argv, NULL, G_SPAWN_SEARCH_PATH, NULL,
NULL, NULL, &error);
if (error != NULL) {
girara_warning("Failed to execute command: %s", error->message);
girara_warning("Failed to execute 'xdg-open %s': %s", uri, error->message);
g_error_free(error);
error = NULL;
}
if (res == false) {
/* fall back to `gio open` */
char* current_dir = working_directory != NULL ? g_get_current_dir() : NULL;
if (working_directory != NULL) {
g_chdir(working_directory);
}
res = g_app_info_launch_default_for_uri(uri, NULL, &error);
if (error != NULL) {
girara_warning("Failed to open '%s': %s", uri, error->message);
g_error_free(error);
}
if (working_directory != NULL) {
g_chdir(current_dir);
g_free(current_dir);
}
}
g_free(argv[1]);
g_free(argv[0]);
return res;
}
......
......@@ -40,7 +40,8 @@ char* girara_get_home_directory(const char* user) GIRARA_VISIBLE;
char* girara_get_xdg_path(girara_xdg_path_t path) GIRARA_VISIBLE;
/**
* Opens a URI with xdg-open.
* Opens a URI with xdg-open. If xdg-open is not available, it falls back to the equivalent of gio
* open.
*
* @param uri the URI to be opened.
* @return true on success, false otherwise
......@@ -48,7 +49,8 @@ char* girara_get_xdg_path(girara_xdg_path_t path) GIRARA_VISIBLE;
bool girara_xdg_open(const char* uri) GIRARA_VISIBLE;
/**
* Opens a URI with xdg-open in a different working directory.
* Opens a URI with xdg-open in a different working directory. If xdg-open is not available, it
* falls back to the equivalent of gio open.
*
* @param uri the URI to be opened.
* @param working_directory working directory
......
project('girara', 'c',
version: '0.3.3',
version: '0.3.4',
meson_version: '>=0.48',
default_options: 'c_std=c11',
)
......@@ -160,5 +160,7 @@ pkg.generate(
requires_private: pc_requires_private,
)
girara_dependency = declare_dependency(link_with: girara, include_directories: include_directories)
subdir('doc')
subdir('tests')
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment