[PATCH] Modification to GnomeICU applet behavior



  This (untested!!) patch changes the GnomeICU panel applet's behavior so that
double-clicking on it when a message is pending displays the message instead of
unhiding the main window.  The change is so minor that I can't think of any
reason why it shouldn't work, but Murphy's law probably applies. :-)
(unfortunately, no-one is around to send me messages so I can test it)
-- 
  Moths and flame.
  The glory blinds them.

             -- C. J. Cherryh, _The Dreaming Tree_
Index: applet.c
===================================================================
RCS file: /cvs/gnome/gnomeicu/src/applet.c,v
retrieving revision 1.8
diff -u -r1.8 applet.c
--- applet.c	1999/03/25 23:47:10	1.8
+++ applet.c	1999/03/31 18:47:56
@@ -146,6 +146,7 @@
 
 void applet_clicked_cb( GtkWidget *widget, GdkEventButton *ev, gpointer data )
 {
+        int cx=0;
 #ifdef TRACE_FUNCTION
 	printf( "applet_clicked_cb\n" );
 #endif
@@ -156,10 +157,18 @@
 	if( ev->button != 1 || ev->type != GDK_2BUTTON_PRESS )
 		return;
 
-	if( !GTK_WIDGET_VISIBLE( app ) )
-		gtk_widget_show( app );
+	while( cx<Num_Contacts && Contacts[cx].messages==0 )
+	  cx++;
+
+	if(cx==Num_Contacts)
+	  {
+	    if( !GTK_WIDGET_VISIBLE( app ) )
+	      gtk_widget_show( app );
+	    else
+	      gtk_widget_hide( app );
+	  }
 	else
-		gtk_widget_hide( app );
+	  show_contact_message( cx, data );
 }
 
 extern void about( GtkWidget *widget, struct sokandlb *data );
@@ -171,7 +180,7 @@
 	gtk_signal_connect( GTK_OBJECT( window ), "expose_event",
 	                    GTK_SIGNAL_FUNC( applet_exposed_cb ), data );
 	gtk_signal_connect( GTK_OBJECT( window ), "button_press_event",
-	                    GTK_SIGNAL_FUNC( applet_clicked_cb ), NULL );
+	                    GTK_SIGNAL_FUNC( applet_clicked_cb ), data );
 	gtk_signal_connect( GTK_OBJECT( window ), "change_orient",
 	                    GTK_SIGNAL_FUNC( applet_change_orient ), NULL );
 
Index: gtkfunc.c
===================================================================
RCS file: /cvs/gnome/gnomeicu/src/gtkfunc.c,v
retrieving revision 1.8
diff -u -r1.8 gtkfunc.c
--- gtkfunc.c	1999/03/25 23:47:15	1.8
+++ gtkfunc.c	1999/03/31 18:47:58
@@ -1891,6 +2000,38 @@
 }
 #endif
 
+void show_contact_message( int cx, struct sokandlb *data )
+{
+  char *buf;
+  if( Contacts[ cx ].messages )
+    {
+      char *nick=gtk_entry_get_text(GTK_ENTRY(Contacts[cx].info_nick));
+      int cy;
+
+      buf=g_malloc(strlen(nick)+strlen("Message from ")+3);
+
+      sprintf( buf, "Message from %s:", nick );
+
+      icq_msgbox( Contacts[ cx ].message[ 0 ], buf, data );
+
+      free( Contacts[ cx ].message[ 0 ] );
+      for( cy = 0; cy < Contacts[ cx ].messages; cy ++ )
+	Contacts[ cx ].message[ cy ] = Contacts[ cx ].message[ cy + 1 ];
+      Contacts[ cx ].message[ Contacts[ cx ].messages ] = NULL;
+
+      if( Contacts[ cx ].messages == 0 )
+	{
+	  Contacts[ cx ].icon_p = GetIcon_p( Contacts[ cx ].status );
+	  Contacts[ cx ].icon_b = GetIcon_b( Contacts[ cx ].status );
+	  Contacts[ cx ].need_update = 1;
+	}
+      
+      Show_Quick_Status( data );
+
+      g_free(buf);
+    }
+}
+
 gint icq_sendmessage_window( GtkWidget *clist, GdkEventButton *event, struct sokandlb *data )
 {
 	int row, column;
@@ -2006,7 +2148,7 @@
 			gtk_widget_show( item_box );
 			gtk_menu_append( GTK_MENU( personal_menu ), item );
 			gtk_signal_connect( GTK_OBJECT( item ), "activate",
-			                    GTK_SIGNAL_FUNC( send_url_window ),
+			                    GTK_SIGNAL_FUNC( send_url_window_default ),
 			                    data );
 			gtk_widget_show( item );
 
@@ -2038,7 +2180,7 @@
 			gtk_widget_show( item_box );
 			gtk_menu_append( GTK_MENU( personal_menu ), item );
 			gtk_signal_connect( GTK_OBJECT( item ), "activate",
-			                    GTK_SIGNAL_FUNC( request_file ),
+			                    GTK_SIGNAL_FUNC( request_file_default ),
 			                    data );
 			gtk_widget_show( item );
 
@@ -2162,21 +2304,8 @@
 
 	if( Contacts[ cx ].messages )
 	{
-		sprintf( buf, "Message from %s:", nick );
-		icq_msgbox( Contacts[ cx ].message[ 0 ], buf, data );
-		free( Contacts[ cx ].message[ 0 ] );
-		for( cy = 0; cy < Contacts[ cx ].messages; cy ++ )
-			Contacts[ cx ].message[ cy ] = Contacts[ cx ].message[ cy + 1 ];
-		Contacts[ cx ].message[ Contacts[ cx ].messages ] = NULL;
-		if( Contacts[ cx ].messages == 0 )
-		{
-			Contacts[ cx ].icon_p = GetIcon_p( Contacts[ cx ].status );
-			Contacts[ cx ].icon_b = GetIcon_b( Contacts[ cx ].status );
-			Contacts[ cx ].need_update = 1;
-		}
-	
-		Show_Quick_Status( data );
-		return FALSE;
+	  show_contact_message( cx, data );
+	  return FALSE;
 	}
 
 	sprintf(label_str, "Send Message to: %s", nick );
Index: gtkfunc.h
===================================================================
RCS file: /cvs/gnome/gnomeicu/src/gtkfunc.h,v
retrieving revision 1.3
diff -u -r1.3 gtkfunc.h
--- gtkfunc.h	1999/03/19 18:58:51	1.3
+++ gtkfunc.h	1999/03/31 18:47:58
@@ -28,6 +30,7 @@
 void icq_msgbox( char *message_text, char *sender,
                  struct sokandlb *data );
 GtkWidget *create_menu ( struct sokandlb *data );
+void show_contact_message( int cx, struct sokandlb *data );
 gint icq_sendmessage_window( GtkWidget *clist, GdkEventButton *event,
                              struct sokandlb *data );
 int stay_connected( struct sokandlb *data );


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]