mirror of
https://github.com/profanity-im/profanity.git
synced 2024-12-04 14:46:46 -05:00
Use a folder to add icons
NOTE: it is not working in this release, I have to get how to retrieve icons from folder.
This commit is contained in:
parent
d1177d3ade
commit
718a708b93
@ -140,6 +140,8 @@ otr_unittest_sources = \
|
|||||||
|
|
||||||
themes_sources = themes/*
|
themes_sources = themes/*
|
||||||
|
|
||||||
|
icons_sources = icons/*
|
||||||
|
|
||||||
script_sources = bootstrap.sh configure-debug install-all.sh
|
script_sources = bootstrap.sh configure-debug install-all.sh
|
||||||
|
|
||||||
man_sources = docs/profanity.1
|
man_sources = docs/profanity.1
|
||||||
@ -168,6 +170,8 @@ endif
|
|||||||
if INCLUDE_GIT_VERSION
|
if INCLUDE_GIT_VERSION
|
||||||
BUILT_SOURCES = $(git_include)
|
BUILT_SOURCES = $(git_include)
|
||||||
endif
|
endif
|
||||||
|
profanity_iconsdir = @ICONS_PATH@
|
||||||
|
profanity_icons_DATA = $(icons_sources)
|
||||||
|
|
||||||
TESTS = tests/unittests/unittests
|
TESTS = tests/unittests/unittests
|
||||||
check_PROGRAMS = tests/unittests/unittests
|
check_PROGRAMS = tests/unittests/unittests
|
||||||
@ -187,7 +191,7 @@ endif
|
|||||||
|
|
||||||
man_MANS = $(man_sources)
|
man_MANS = $(man_sources)
|
||||||
|
|
||||||
EXTRA_DIST = $(man_sources) $(themes_sources) $(script_sources) profrc.example LICENSE.txt
|
EXTRA_DIST = $(man_sources) $(icons_sources) $(themes_sources) $(script_sources) profrc.example LICENSE.txt
|
||||||
|
|
||||||
if INCLUDE_GIT_VERSION
|
if INCLUDE_GIT_VERSION
|
||||||
EXTRA_DIST += .git/HEAD .git/index
|
EXTRA_DIST += .git/HEAD .git/index
|
||||||
|
@ -192,6 +192,9 @@ AS_IF([test "x$with_themes" = xno -o "x$with_themes" = xyes -o "x$with_themes" =
|
|||||||
AC_SUBST(THEMES_PATH)
|
AC_SUBST(THEMES_PATH)
|
||||||
AM_CONDITIONAL([THEMES_INSTALL], "$THEMES_INSTALL")
|
AM_CONDITIONAL([THEMES_INSTALL], "$THEMES_INSTALL")
|
||||||
|
|
||||||
|
ICONS_PATH='${pkgdatadir}/icons'
|
||||||
|
AC_SUBST(ICONS_PATH)
|
||||||
|
|
||||||
### cmocka is required only for tests, profanity shouldn't be linked with it
|
### cmocka is required only for tests, profanity shouldn't be linked with it
|
||||||
### TODO: pass cmocka_CFLAGS and cmocka_LIBS to Makefile.am
|
### TODO: pass cmocka_CFLAGS and cmocka_LIBS to Makefile.am
|
||||||
PKG_CHECK_MODULES([cmocka], [cmocka], [],
|
PKG_CHECK_MODULES([cmocka], [cmocka], [],
|
||||||
@ -213,7 +216,7 @@ AM_CFLAGS="-Wall -Wno-deprecated-declarations"
|
|||||||
AS_IF([test "x$PACKAGE_STATUS" = xdevelopment],
|
AS_IF([test "x$PACKAGE_STATUS" = xdevelopment],
|
||||||
[AM_CFLAGS="$AM_CFLAGS -Wunused -Werror"])
|
[AM_CFLAGS="$AM_CFLAGS -Wunused -Werror"])
|
||||||
AM_CPPFLAGS="$AM_CPPFLAGS $glib_CFLAGS $curl_CFLAGS $libnotify_CFLAGS ${GTK_CFLAGS}"
|
AM_CPPFLAGS="$AM_CPPFLAGS $glib_CFLAGS $curl_CFLAGS $libnotify_CFLAGS ${GTK_CFLAGS}"
|
||||||
AM_CPPFLAGS="$AM_CPPFLAGS -DTHEMES_PATH=\"\\\"$THEMES_PATH\\\"\""
|
AM_CPPFLAGS="$AM_CPPFLAGS -DICONS_PATH=\"\\\"$ICONS_PATH\\\"\" -DTHEMES_PATH=\"\\\"$THEMES_PATH\\\"\""
|
||||||
LIBS="$glib_LIBS $curl_LIBS $libnotify_LIBS $LIBS ${GTK_LIBS}"
|
LIBS="$glib_LIBS $curl_LIBS $libnotify_LIBS $LIBS ${GTK_LIBS}"
|
||||||
|
|
||||||
AC_SUBST(AM_CFLAGS)
|
AC_SUBST(AM_CFLAGS)
|
||||||
@ -234,5 +237,6 @@ echo "LIBS : $LIBS"
|
|||||||
echo "XML Parser : $PARSER"
|
echo "XML Parser : $PARSER"
|
||||||
echo "Install themes : $THEMES_INSTALL"
|
echo "Install themes : $THEMES_INSTALL"
|
||||||
echo "Themes path : $THEMES_PATH"
|
echo "Themes path : $THEMES_PATH"
|
||||||
|
echo "Icons path : $ICONS_PATH"
|
||||||
echo ""
|
echo ""
|
||||||
echo "Now you can run \`make' to build profanity"
|
echo "Now you can run \`make' to build profanity"
|
||||||
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
@ -403,6 +403,8 @@ _create_directories(void)
|
|||||||
|
|
||||||
GString *themes_dir = g_string_new(xdg_config);
|
GString *themes_dir = g_string_new(xdg_config);
|
||||||
g_string_append(themes_dir, "/profanity/themes");
|
g_string_append(themes_dir, "/profanity/themes");
|
||||||
|
GString *icons_dir = g_string_new(xdg_config);
|
||||||
|
g_string_append(icons_dir, "/profanity/icons");
|
||||||
GString *chatlogs_dir = g_string_new(xdg_data);
|
GString *chatlogs_dir = g_string_new(xdg_data);
|
||||||
g_string_append(chatlogs_dir, "/profanity/chatlogs");
|
g_string_append(chatlogs_dir, "/profanity/chatlogs");
|
||||||
GString *logs_dir = g_string_new(xdg_data);
|
GString *logs_dir = g_string_new(xdg_data);
|
||||||
@ -411,6 +413,9 @@ _create_directories(void)
|
|||||||
if (!mkdir_recursive(themes_dir->str)) {
|
if (!mkdir_recursive(themes_dir->str)) {
|
||||||
log_error("Error while creating directory %s", themes_dir->str);
|
log_error("Error while creating directory %s", themes_dir->str);
|
||||||
}
|
}
|
||||||
|
if (!mkdir_recursive(icons_dir->str)) {
|
||||||
|
log_error("Error while creating directory %s", icons_dir->str);
|
||||||
|
}
|
||||||
if (!mkdir_recursive(chatlogs_dir->str)) {
|
if (!mkdir_recursive(chatlogs_dir->str)) {
|
||||||
log_error("Error while creating directory %s", chatlogs_dir->str);
|
log_error("Error while creating directory %s", chatlogs_dir->str);
|
||||||
}
|
}
|
||||||
@ -419,6 +424,7 @@ _create_directories(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
g_string_free(themes_dir, TRUE);
|
g_string_free(themes_dir, TRUE);
|
||||||
|
g_string_free(icons_dir, TRUE);
|
||||||
g_string_free(chatlogs_dir, TRUE);
|
g_string_free(chatlogs_dir, TRUE);
|
||||||
g_string_free(logs_dir, TRUE);
|
g_string_free(logs_dir, TRUE);
|
||||||
|
|
||||||
|
28
src/tray.c
28
src/tray.c
@ -40,12 +40,22 @@
|
|||||||
#include "window_list.h"
|
#include "window_list.h"
|
||||||
|
|
||||||
static GtkStatusIcon *prof_tray = NULL;
|
static GtkStatusIcon *prof_tray = NULL;
|
||||||
static gchar *icon_filename = "src/proIcon.png";
|
static GString *icon_filename = NULL;
|
||||||
static gchar *icon_msg_filename = "src/proIconMsg.png";
|
static GString *icon_msg_filename = NULL;
|
||||||
static int unread_messages;
|
static int unread_messages;
|
||||||
static bool shutting_down;
|
static bool shutting_down;
|
||||||
static guint timer;
|
static guint timer;
|
||||||
|
|
||||||
|
static gchar*
|
||||||
|
_get_icons_dir(void)
|
||||||
|
{
|
||||||
|
gchar *xdg_config = xdg_get_config_home();
|
||||||
|
GString *icons_dir = g_string_new(xdg_config);
|
||||||
|
g_free(xdg_config);
|
||||||
|
g_string_append(icons_dir, "/profanity/icons");
|
||||||
|
return g_string_free(icons_dir, true);
|
||||||
|
}
|
||||||
|
|
||||||
gboolean tray_change_icon(gpointer data)
|
gboolean tray_change_icon(gpointer data)
|
||||||
{
|
{
|
||||||
if (shutting_down) {
|
if (shutting_down) {
|
||||||
@ -55,9 +65,9 @@ gboolean tray_change_icon(gpointer data)
|
|||||||
unread_messages = wins_get_total_unread();
|
unread_messages = wins_get_total_unread();
|
||||||
|
|
||||||
if (unread_messages) {
|
if (unread_messages) {
|
||||||
gtk_status_icon_set_from_file(prof_tray, icon_msg_filename);
|
gtk_status_icon_set_from_file(prof_tray, icon_msg_filename->str);
|
||||||
} else {
|
} else {
|
||||||
gtk_status_icon_set_from_file(prof_tray, icon_filename);
|
gtk_status_icon_set_from_file(prof_tray, icon_filename->str);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -65,9 +75,15 @@ gboolean tray_change_icon(gpointer data)
|
|||||||
|
|
||||||
void create_tray(void)
|
void create_tray(void)
|
||||||
{
|
{
|
||||||
prof_tray = gtk_status_icon_new_from_file(icon_filename);
|
gchar *icons_dir = _get_icons_dir();
|
||||||
|
icon_filename = g_string_new(icons_dir);
|
||||||
|
icon_msg_filename = g_string_new(icons_dir);
|
||||||
|
g_string_append(icon_filename, "/proIcon.png");
|
||||||
|
g_string_append(icon_msg_filename, "/proIconMsg.png");
|
||||||
|
prof_tray = gtk_status_icon_new_from_file(icon_filename->str);
|
||||||
shutting_down = false;
|
shutting_down = false;
|
||||||
timer = g_timeout_add(5000, tray_change_icon, NULL);
|
timer = g_timeout_add(5000, tray_change_icon, NULL);
|
||||||
|
g_free(icons_dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
void destroy_tray(void)
|
void destroy_tray(void)
|
||||||
@ -78,4 +94,6 @@ void destroy_tray(void)
|
|||||||
gtk_widget_destroy(GTK_WIDGET(prof_tray));
|
gtk_widget_destroy(GTK_WIDGET(prof_tray));
|
||||||
prof_tray = NULL;
|
prof_tray = NULL;
|
||||||
}
|
}
|
||||||
|
g_string_free(icon_filename, false);
|
||||||
|
g_string_free(icon_msg_filename, false);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user