1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-09-15 19:38:07 -04:00

Add configure switch for inline images

Regards https://github.com/profanity-im/profanity/issues/1301
This commit is contained in:
Michael Vetter 2020-12-24 08:23:20 +01:00
parent 540966a46c
commit 64e3cf28ec
4 changed files with 23 additions and 12 deletions

View File

@ -69,6 +69,8 @@ AC_ARG_WITH([themes],
[AS_HELP_STRING([--with-themes[[=PATH]]], [install themes (default yes)])])
AC_ARG_ENABLE([icons-and-clipboard],
[AS_HELP_STRING([--enable-icons-and-clipboard], [enable GTK tray icons and clipboard paste support])])
AC_ARG_ENABLE([inline-images],
[AS_HELP_STRING([--enable-inline-images], [enable inline display of images])])
### plugins
@ -191,9 +193,6 @@ PKG_CHECK_MODULES([glib], [glib-2.0 >= 2.62.0], [],
[AC_MSG_ERROR([glib 2.62.0 or higher is required for profanity])])
PKG_CHECK_MODULES([gio], [gio-2.0], [],
[AC_MSG_ERROR([libgio-2.0 from glib-2.0 is required for profanity])])
#TODO: only under cond
PKG_CHECK_MODULES([pixbuf], [gdk-pixbuf-2.0], [],
[AC_MSG_ERROR([gdk-pixbuf-2.0 from glib-2.0 is required for profanity])])
### Check for other profanity dependencies
AC_SEARCH_LIBS([fmod], [m], [],
@ -206,10 +205,6 @@ PKG_CHECK_MODULES([curl], [libcurl], [],
PKG_CHECK_MODULES([SQLITE], [sqlite3 >= 3.22.0], [],
[AC_MSG_ERROR([sqlite3 3.22.0 or higher is required for profanity])])
#TODO: only under cond
PKG_CHECK_MODULES([chafa], [chafa >= 1.4.1], [],
[AC_MSG_ERROR([chafa needed])])
AS_IF([test "x$enable_icons_and_clipboard" != xno],
[PKG_CHECK_MODULES([GTK], [gtk+-3.0 >= 3.24.0],
[AC_DEFINE([HAVE_GTK], [1], [libgtk module])],
@ -330,6 +325,16 @@ if test "x$enable_omemo" != xno; then
AM_COND_IF([BUILD_OMEMO], [AC_DEFINE([HAVE_OMEMO], [1], [Have OMEMO])])
fi
if test "x$enable_inline_images" = xyes; then
PKG_CHECK_MODULES([pixbuf], [gdk-pixbuf-2.0], [],
[AC_MSG_ERROR([gdk-pixbuf-2.0 from glib-2.0 is required for inline image support])])
PKG_CHECK_MODULES([chafa], [chafa >= 1.4.1], [],
[AC_MSG_ERROR([chafa >= 1.4.1 needed for inline image support])])
AC_DEFINE([HAVE_INLINE_IMAGE], [1], [Have inline image])
fi
AS_IF([test "x$with_themes" = xno],
[THEMES_INSTALL="false"],
[THEMES_INSTALL="true"])

View File

@ -407,7 +407,9 @@ cons_about(void)
getmaxyx(stdscr, rows, cols);
if (prefs_get_boolean(PREF_SPLASH)) {
#ifdef HAVE_INLINE_IMAGE
win_pictest(console);
#endif
_cons_splash_logo();
} else {

View File

@ -44,10 +44,6 @@
#include <glib.h>
//TODO: ifdef
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <chafa.h>
#ifdef HAVE_NCURSESW_NCURSES_H
#include <ncursesw/ncurses.h>
#elif HAVE_NCURSES_H
@ -56,6 +52,11 @@
#include <curses.h>
#endif
#ifdef HAVE_INLINE_IMAGE
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <chafa.h>
#endif
#include "log.h"
#include "config/theme.h"
#include "config/preferences.h"
@ -1958,6 +1959,7 @@ win_insert_last_read_position_marker(ProfWin* window, char* id)
g_date_time_unref(time);
}
#ifdef HAVE_INLINE_IMAGE
void
win_pictest(ProfWin* window)
{
@ -2010,3 +2012,4 @@ win_pictest(ProfWin* window)
GString *gs = chafa_canvas_build_ansi (canvas);
win_println(window, THEME_DEFAULT, "!", gs->str);
}
#endif

View File

@ -93,7 +93,8 @@ void win_sub_page_up(ProfWin* window);
void win_insert_last_read_position_marker(ProfWin* window, char* id);
void win_remove_entry_message(ProfWin* window, const char* const id);
// TODO: ifdef
#ifdef HAVE_INLINE_IMAGE
void win_pictest(ProfWin* window);
#endif
#endif