[ffgtk] Fix issues remainig in upstream 0.8.6: - Start call monitor after asistant - Detection of notify per

Louis Lagendijk llagendijk at fedoraproject.org
Fri Oct 18 19:09:27 UTC 2013


commit 03eddb3447b565046bd7c78c5028654421da24cf
Author: Louis Lagendijk <louis.lagendijk at gmail.com>
Date:   Fri Oct 18 21:07:27 2013 +0200

    Fix issues remainig in upstream 0.8.6:
    - Start call monitor after asistant
    - Detection of notify persistance to see if trayicon is visible

 ffgtk-assistant.patch |  100 ++++++++++++++++++++++++++++++++++++++++++++++++
 ffgtk-trayicon.patch  |  101 +++++++++++++++++++++++++++++++++++++++++++++++++
 ffgtk.spec            |   11 +++++-
 3 files changed, 211 insertions(+), 1 deletions(-)
---
diff --git a/ffgtk-assistant.patch b/ffgtk-assistant.patch
new file mode 100644
index 0000000..379ca1c
--- /dev/null
+++ b/ffgtk-assistant.patch
@@ -0,0 +1,100 @@
+Index: ffgtk/assistant.c
+===================================================================
+--- ffgtk/assistant.c	(revision 2127)
++++ ffgtk/assistant.c	(working copy)
+@@ -10,6 +10,7 @@
+  */
+ 
+ #include <ffgtk.h>
++#include <menucallbacks.h>
+ 
+ /** New profile, valid during assistant progress */
+ static struct sProfile *psNewProfile = NULL;
+@@ -552,6 +553,9 @@
+ 	saveProfiles();
+ 
+ 	g_free( pnHost );
++	if (! menuAvailable() ) {
++		CallMonitor();
++	}
+ }
+ 
+ /**
+@@ -560,11 +564,17 @@
+  * \param pUserData user data
+  */
+ static void assistantCancel( GtkAssistant *psAssistant, gpointer pUserData ) {
++	struct sProfile *psActiveProfile = NULL;
+ 	if ( psNewProfile != NULL ) {
+ 		removeProfile( psNewProfile -> pnName );
+ 		psNewProfile = NULL;
+ 	}
+ 	gtk_widget_destroy( GTK_WIDGET( psAssistant ) );
++	if ( ( ( (psActiveProfile = getActiveProfile() ) == NULL ) || psActiveProfile -> pnName == NULL ) &&
++		! menuAvailable() ) {
++		Debug( KERN_DEBUG, "Cancel called on assistant, but no active profile, exiting...\n" );
++		destroy( NULL, NULL );
++	}
+ }
+ 
+ /**
+Index: ffgtk/ffgtk.h
+===================================================================
+--- ffgtk/ffgtk.h	(revision 2127)
++++ ffgtk/ffgtk.h	(working copy)
+@@ -267,6 +267,7 @@
+ void *CallMonitor( void );
+ gchar *getCallerList( struct sProfile *psProfile );
+ void callMonitorRecreateAppMenu (void );
++void displayLoadingDialog( void );
+ void callMonitorInit( void );
+ 
+ 
+Index: ffgtk/menu.c
+===================================================================
+--- ffgtk/menu.c	(revision 2127)
++++ ffgtk/menu.c	(working copy)
+@@ -61,18 +61,26 @@
+  * \brief Initialize menu system, create menu bar and tray icon andi start tooltip thread
+  */
+ void menuInit( void ) {
+-#if GTK_MAJOR_VERSION >= 3
++	trayIconInit();
++	callMonitorInit();
++}
++
++static gboolean displayLoadingFunc( void ) {
+ 	psLoading = gtk_message_dialog_new( NULL, GTK_DIALOG_MODAL,
+ 		GTK_MESSAGE_INFO, GTK_BUTTONS_NONE, _( "Please wait while ffgtk loads..." ) );
+ 	gtk_window_set_title( GTK_WINDOW( psLoading ), _( "FFGTK Loading" ) );
+ 	gtk_window_set_position( GTK_WINDOW( psLoading ), GTK_WIN_POS_CENTER_ALWAYS );
+ 	gtk_dialog_run( GTK_DIALOG( psLoading ) );
++	return FALSE;
++}
++
++void displayLoadingDialog( void ) {
++#if GTK_MAJOR_VERSION >= 3
++	Debug( KERN_DEBUG, "Start loading dialog...\n" );
++	g_idle_add_full(  G_PRIORITY_HIGH, ( GSourceFunc ) displayLoadingFunc, NULL, NULL ); 
+ #endif
+-	trayIconInit();
+-	callMonitorInit();
+ }
+ 
+-
+ /**
+  * \brief recreate app menu
+  */
+Index: ffgtk/profiles.c
+===================================================================
+--- ffgtk/profiles.c	(revision 2127)
++++ ffgtk/profiles.c	(working copy)
+@@ -349,6 +349,8 @@
+ end:
+ 	if ( psProfileList == NULL || g_list_length( psProfileList ) == 0 ) {
+ 		assistant();
++	} else {
++		displayLoadingDialog();
+ 	}
+ }
+ 
diff --git a/ffgtk-trayicon.patch b/ffgtk-trayicon.patch
new file mode 100644
index 0000000..f2802f9
--- /dev/null
+++ b/ffgtk-trayicon.patch
@@ -0,0 +1,101 @@
+Index: ffgtk/trayicon.c
+===================================================================
+--- ffgtk/trayicon.c	(revision 2127)
++++ ffgtk/trayicon.c	(working copy)
+@@ -14,16 +14,20 @@
+ #include <trayicon.h>
+ #include <osdep/osdep.h>
+ 
++#ifdef HAVE_LIBNOTIFY
++#include <notification.h>
++#endif
++
+ /** Widget containing trayicon */
+ static GtkStatusIcon *psTrayIcon = NULL;
+ 
++/** is menu visible */
++gboolean bMenuVisible = FALSE;
++
+ /** main gtk loop */
+ extern GMainLoop *psLoop;
+ static GtkWidget *psMenu = NULL;
+ 
+-/** do we have a tray icom menu */
+-static gboolean bTrayIconMenu = FALSE;
+-
+ #ifdef G_OS_WIN32
+ /* This is a workaround for a bug in windows GTK+. Clicking outside of the
+  * menu does not get rid of it, so instead we get rid of it as soon as the
+@@ -157,7 +161,10 @@
+  */
+ 
+ gboolean menuAvailable( void ) {
+-	return bTrayIconMenu;
++	if (psTrayIcon != NULL ) {
++		return bMenuVisible;
++	}
++	return FALSE;
+ }
+ 
+ /**
+@@ -164,9 +171,13 @@
+  * \brief Initialize tray icon structure and start update tooltip thread
+  */
+ void trayIconInit( void ) {
+-	if ( GTK_MAJOR_VERSION < 3 ) {
+-		createTrayIcon();
+-		g_timeout_add_seconds( 15, updateTooltip, psTrayIcon );
+-		bTrayIconMenu = TRUE;
++	createTrayIcon();
++	g_timeout_add_seconds( 15, updateTooltip, psTrayIcon );
++
++#ifdef HAVE_LIBNOTIFY
++	if ( !notificationNotifyHasPersistance() ) {
++		/* Notification server has persistance, so tray icon is most likely not visible */
++		bMenuVisible = FALSE;
+ 	}
++#endif
+ }
+Index: ffgtk/notification-notify.c
+===================================================================
+--- ffgtk/notification-notify.c	(revision 2127)
++++ ffgtk/notification-notify.c	(working copy)
+@@ -159,6 +159,27 @@
+ }
+ 
+ /**
++ * \brief Test if notification server has persistance
++ * \return boolean
++ */
++
++gboolean notificationNotifyHasPersistance ( void ) {
++	gboolean bHasPersistance = FALSE;
++	GList *psCaps = notify_get_server_caps ();
++
++	if (psCaps == NULL) {
++		Debug( KERN_DEBUG, "Failed to receive server capabilities\n" );
++		return FALSE;
++	}
++
++	bHasPersistance = ( g_list_find_custom ( psCaps, "persistence", (GCompareFunc)strcmp) != NULL);
++	g_list_foreach ( psCaps, (GFunc) g_free, NULL);
++	g_list_free ( psCaps );
++	
++	return bHasPersistance;
++}
++
++/**
+  * \brief Initialize libnotify notifications
+  * \return notification pointer or NULL on error
+  */
+Index: ffgtk/notification.h
+===================================================================
+--- ffgtk/notification.h	(revision 2127)
++++ ffgtk/notification.h	(working copy)
+@@ -17,5 +17,6 @@
+ 
+ struct sNotification *InitNotificationNotify( void );
+ struct sNotification *InitNotificationGtk( void );
++gboolean notificationNotifyHasPersistance ( void );
+ 
+ #endif
diff --git a/ffgtk.spec b/ffgtk.spec
index c4871be..199f118 100644
--- a/ffgtk.spec
+++ b/ffgtk.spec
@@ -13,8 +13,12 @@ License:        GPLv2
 # ./configure
 # make dist
 Source0:        %{name}-%{version}.tar.gz
+# This patch is Fedora specific
 Source1:        ffgtk-README.Fedora
 Patch1:         ffgtk-0.8.3-use-old-spooler.patch
+# The following two patches are upstreamed
+Patch2:         ffgtk-trayicon.patch
+Patch3:         ffgtk-assistant.patch
 
 %global         _hardened_build 1
 
@@ -62,6 +66,8 @@ This plugin has beta quality
 %prep
 %setup -q
 %patch1 -p0 -b .use-old-spooler
+%patch2 -p0 -b .trayicon
+%patch3 -p0 -b .assistant
 install -m644 %{SOURCE1} ./README.Fedora
 
 %build
@@ -164,7 +170,7 @@ fi
 %{_libdir}/ffgtk/plugins/lib_ab_google.so
 
 %changelog
-* Tue Oct 08 2013  Louis Lagendijk <louis.lagendijk at gmail.com> 0.8.6-1
+* Fri Oct 18 2013  Louis Lagendijk <louis.lagendijk at gmail.com> 0.8.6-1
 - New upstream release
 - Call monitor now has a menubar. Program will be closed if no trayicon
   is available and embedded 
@@ -174,6 +180,9 @@ fi
 - Add support for international version of the 05.5x FRITZ!box firmware
 - Fixes issue where with new FW certain calltypes were not stored in calllist
 - Fix trayicon out of sync with open call monitor window
+- 2 fixes not yet in upstream 0.8.6: 
+  One for starting call monitor after the configuration assistant 
+  One for detection of trayicon visibility for starting call monitor
 
 * Mon Aug 19 2013 Milan Crha <mcrha at redhat.com> - 0.8.5-5
 - Rebuild for newer evolution-data-server


More information about the scm-commits mailing list