unity-launcher-integration-20140503.1800.diff

Kentaro HAYASHI, 05/03/2014 06:13 PM

Download (3.09 KB)

View differences:

configure.ac (working copy)
442 442
  fi
443 443
fi
444 444

  
445
AC_ARG_ENABLE(unity-launcher,
446
	[  --enable-unity-launcher Enable Unity Launcher integration support],
447
	[ac_cv_enable_unity_launcher=$enableval], [ac_cv_enable_unity_launcher=no])
448
if test x"$ac_cv_enable_unity_launcher" = xyes ; then
449
  PKG_CHECK_MODULES(UNITY, unity >= 5.12.0,
450
	[AC_DEFINE(USE_UNITY_LAUNCHER, 1, Enable Unity Launcher integration feature.)],[])
451
fi
452

  
445 453
dnl Check for d_type member in struct dirent
446 454
AC_MSG_CHECKING([whether struct dirent has d_type member])
447 455
AC_CACHE_VAL(ac_cv_dirent_d_type,[
......
532 540
echo "GtkSpell      : $ac_cv_enable_gtkspell"
533 541
echo "Oniguruma     : $ac_cv_enable_oniguruma"
534 542
echo "GThread       : $use_threads"
543
echo "Unity Launcher: $ac_cv_enable_unity_launcher"
535 544
echo ""
536 545
echo "The binary will be installed in $prefix/bin"
537 546
echo ""
src/Makefile.am (working copy)
142 142
	-I$(top_srcdir)/libsylph \
143 143
	$(GTK_CFLAGS) \
144 144
	$(GDK_PIXBUF_CFLAGS) \
145
	$(GPGME_CFLAGS)
145
	$(GPGME_CFLAGS) \
146
	$(UNITY_CFLAGS)
146 147

  
147 148
if NATIVE_WIN32
148 149
SYLPHEED_RES = sylpheed.res
......
157 158
	$(GTK_LIBS) \
158 159
	$(GLIB_LIBS) \
159 160
	$(GPGME_LIBS) \
161
	$(UNITY_LIBS) \
160 162
	$(LDAP_LIBS) \
161 163
	$(LIBICONV) \
162 164
	$(SYLPHEED_LIBS) \
src/inc.c (working copy)
35 35
#include <unistd.h>
36 36
#include <string.h>
37 37

  
38
#ifdef USE_UNITY_LAUNCHER
39
#  include <unity.h>
40
#endif
41

  
38 42
#include "main.h"
39 43
#include "inc.h"
40 44
#include "mainwindow.h"
......
172 176
static void inc_autocheck_timer_set_interval	(guint		 interval);
173 177
static gint inc_autocheck_func			(gpointer	 data);
174 178

  
179
static void update_unity_launcher_integration(void);
175 180

  
176 181
/**
177 182
 * inc_finished:
......
296 301
				 sizeof(buf));
297 302
		execute_command_line(buf, TRUE);
298 303
	}
304

  
305
#if USE_UNITY_LAUNCHER
306
	update_unity_launcher_integration();
307
#endif
299 308
}
300 309

  
301 310
static GSList *inc_add_message_count(GSList *list, PrefsAccount *account,
......
1930 1939

  
1931 1940
	return FALSE;
1932 1941
}
1942

  
1943
#if USE_UNITY_LAUNCHER
1944
static void update_unity_launcher_integration(void)
1945
{
1946
	UnityLauncherEntry *launcher;
1947
	gchar *folder_full_status;
1948
	gchar **folders;
1949
	gchar **fields;
1950
	gchar *folder_status;
1951
	guint n_folders;
1952

  
1953
	folder_full_status = folder_get_status(NULL, TRUE);
1954
	folders = g_strsplit(folder_full_status, "\n", 0);
1955
	g_free(folder_full_status);
1956

  
1957
	n_folders = g_strv_length(folders);
1958
	if (n_folders < 3)
1959
		return;
1960

  
1961
	/* extract field from status line: new unread total */
1962
	fields = g_strsplit(g_strstrip(folders[n_folders-2]), " ", 0);
1963
	g_strfreev(folders);
1964

  
1965
	launcher = unity_launcher_entry_get_for_desktop_id("sylpheed.desktop");
1966
	if (launcher) {
1967
		/* show count of new mails */
1968
		unity_launcher_entry_set_count(launcher, atol(fields[0]));
1969
		unity_launcher_entry_set_count_visible(launcher, TRUE);
1970
	}
1971
	g_strfreev(fields);
1972
}
1973
#endif