chore(notification): remove libnotify dependency and notifications

Closes #58
This commit is contained in:
Jeremy Attali 2021-02-16 23:18:17 -05:00 committed by Jeremy Attali
parent 46e5854b3c
commit 1bb534fc7c
8 changed files with 2 additions and 44 deletions

View File

@ -10,7 +10,7 @@ jobs:
- name: GCC
run: |
sudo apt-get update
sudo apt --yes install libgtk-3-dev libnotify-dev meson ninja-build scdoc
sudo apt --yes install libgtk-3-dev meson ninja-build scdoc
pkg-config --list-all
CC=gcc meson build
ninja -C build
@ -21,7 +21,7 @@ jobs:
- uses: actions/checkout@v1
- name: Clang
run: |
sudo apt --yes install libgtk-3-dev libnotify-dev meson ninja-build scdoc clang clang-format clang-tidy
sudo apt --yes install libgtk-3-dev meson ninja-build scdoc clang clang-format clang-tidy
CC=clang meson build
ninja -C build
echo "Making sure clang-format is correct..."

View File

@ -117,7 +117,6 @@ Install dependencies (on Arch, name can vary for other distros):
Optional dependencies:
- `wl-clipboard` (to make sure the copy is saved if you close swappy)
- `libnotify` (not get notified when swappshot is copied or saved)
- `otf-font-awesome` (to draw the paint icons properly)
Then run:

View File

@ -1,3 +0,0 @@
#pragma once
void notification_send(char *title, char *message);

View File

@ -43,12 +43,6 @@ math = cc.find_library('m')
gtk = dependency('gtk+-3.0', version: '>=3.20.0')
gio = dependency('gio-2.0')
libnotify = dependency('libnotify', required: get_option('libnotify'))
if libnotify.found()
add_project_arguments('-DHAVE_LIBNOTIFY', language: 'c')
endif
subdir('res')
subdir('src/po')
@ -66,7 +60,6 @@ executable(
'src/paint.c',
'src/pixbuf.c',
'src/render.c',
'src/notification.c',
'src/util.c',
]),
dependencies: [
@ -74,7 +67,6 @@ executable(
pango,
gio,
gtk,
libnotify,
math,
],
link_args: '-rdynamic',

View File

@ -1,2 +1 @@
option('man-pages', type: 'feature', value: 'auto', description: 'Generate and install man pages')
option('libnotify', type: 'feature', value: 'auto', description: 'Send desktop notifications')

View File

@ -4,7 +4,6 @@
#include <sys/wait.h>
#include <unistd.h>
#include "notification.h"
#include "pixbuf.h"
#include "util.h"
@ -81,9 +80,6 @@ bool clipboard_copy_drawing_area_to_selection(struct swappy_state *state) {
send_pixbuf_to_gdk_clipboard(pixbuf);
}
char message[MAX_PATH];
g_snprintf(message, MAX_PATH, "Swappshot copied to clipboard\n");
notification_send("Swappy", message);
g_object_unref(pixbuf);
return true;

View File

@ -1,16 +0,0 @@
#include "notification.h"
#ifdef HAVE_LIBNOTIFY
#include <libnotify/notify.h>
#endif
void notification_send(char *title, char *message) {
#ifdef HAVE_LIBNOTIFY
notify_init("Hello world!");
NotifyNotification *notification =
notify_notification_new(title, message, "image");
notify_notification_show(notification, NULL);
g_object_unref(G_OBJECT(notification));
notify_uninit();
#endif
}

View File

@ -3,8 +3,6 @@
#include <cairo/cairo.h>
#include <gio/gunixoutputstream.h>
#include "notification.h"
GdkPixbuf *pixbuf_get_from_state(struct swappy_state *state) {
guint width = cairo_image_surface_get_width(state->rendering_surface);
guint height = cairo_image_surface_get_height(state->rendering_surface);
@ -22,13 +20,6 @@ static void write_file(GdkPixbuf *pixbuf, char *path) {
g_critical("unable to save drawing area to pixbuf: %s", error->message);
g_error_free(error);
}
char *msg = "Saved Swappshot to: ";
size_t len = strlen(msg) + strlen(path) + 1;
char *message = g_new(char, len);
g_snprintf(message, len, "%s%s", msg, path);
notification_send("Swappy", message);
g_free(message);
}
void pixbuf_save_state_to_folder(GdkPixbuf *pixbuf, char *folder,