[Fedora-directory-commits] esc/src/lib/notifytray notifyareaicon.c, 1.1, 1.2 notifytray.c, 1.1, 1.2

Jack Magne (jmagne) fedora-directory-commits at redhat.com
Wed Sep 27 17:48:31 UTC 2006


Author: jmagne

Update of /cvs/dirsec/esc/src/lib/notifytray
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv27433

Modified Files:
	notifyareaicon.c notifytray.c 
Log Message:
Latest updates.


Index: notifyareaicon.c
===================================================================
RCS file: /cvs/dirsec/esc/src/lib/notifytray/notifyareaicon.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- notifyareaicon.c	13 Sep 2006 18:06:08 -0000	1.1
+++ notifyareaicon.c	27 Sep 2006 17:48:29 -0000	1.2
@@ -16,6 +16,7 @@
  * END COPYRIGHT BLOCK **/
 
 #include <string.h>
+#include <unistd.h>
 #include <gdk/gdkx.h>
 #include "notifyareaicon.h"
 
@@ -170,6 +171,44 @@
   
   icon->manager_wnd = XGetSelectionOwner (xdisplay, icon->selection_atom);
 
+  if(icon->manager_wnd == None)
+  {
+
+      /* Let's loop through for up to 7 seconds until the
+         notification applet comes on line */
+
+      const int maxIters = 7;
+      const int sleepInterval = 1000000;
+
+      int i = 0;
+      for(i = 0; i < maxIters ; i++)
+      {
+
+          XUngrabServer (xdisplay);
+          XFlush (xdisplay);
+          g_print("XGetSelectionOwner failed try again iter: %d ... \n",i);
+
+          usleep(sleepInterval);
+
+
+          XGrabServer (xdisplay);
+          icon->manager_wnd = XGetSelectionOwner (xdisplay, icon->selection_atom); 
+
+          if(icon->manager_wnd == None)
+          {
+              g_print("XGetSelectionOwner failed try again! \n");
+          }
+          else
+          {
+
+              g_print("XGetSelectionOwner succeeded ! \n");
+              break;
+          }
+
+      }
+
+  }
+
   if (icon->manager_wnd != None)
     XSelectInput (xdisplay,
 		  icon->manager_wnd, StructureNotifyMask);
@@ -207,6 +246,16 @@
   icon = (NotifyAreaIcon *) g_object_new(notify_area_icon_get_type ()
 , NULL);
 
+
+  g_print ("result of g_object_new() %p",icon);
+
+
+  if(!icon)
+  {
+       g_print ("icon is null returning...");
+       return icon;
+  }
+
   gtk_window_set_title (GTK_WINDOW (icon), name);
 
   gtk_plug_construct (GTK_PLUG (icon), 0);  
@@ -225,6 +274,8 @@
 
   notify_area_icon_update_manager_wnd(icon); 
 
+   g_print ("attempted to update_manager_wnd: %p",(void *)icon->manager_wnd);
+
   root = gdk_window_lookup (gdk_x11_get_default_root_xwindow ());
  
   icon->tooltips = gtk_tooltips_new ();


Index: notifytray.c
===================================================================
RCS file: /cvs/dirsec/esc/src/lib/notifytray/notifytray.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- notifytray.c	13 Sep 2006 18:06:08 -0000	1.1
+++ notifytray.c	27 Sep 2006 17:48:29 -0000	1.2
@@ -118,11 +118,17 @@
 notify_icon_create()
 {
 	if (notify) {
+             g_print ("Notify icon already created!");
             return;
 	}
 
 	notify = notify_area_icon_new("coolkey");
 
+        if(!notify)
+        {
+             g_print ("notify_area_icon_new() failed!");
+        }
+
         if(!notify_box)
         {
 	     notify_box = gtk_event_box_new();
@@ -155,13 +161,22 @@
 int notify_icon_created_ok()
 {
   if(!notify)
+  {
+       g_print ("notify_icon_created_ok returning 0 because notify is null.");
       return 0;
 
+   }
+
   if(notify->manager_wnd)
     return 1;
   else
+  {
+
+    g_print ("notify_icon_created_ok returning 0 because notify->manager_wnd is null.");
     return 0;
 
+  }
+
 }
 
 int notify_icon_show()




More information about the Fedora-directory-commits mailing list