From 54d8f0761300643e1885df4de822901e316c1d33 Mon Sep 17 00:00:00 2001
From: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com>
Date: Tue, 13 May 2008 10:51:04 -0400
Subject: [PATCH] Remove GTK-Critical warnings

Due to toolbar_remove
---
 sflphone-gtk/src/calltree.c | 14 ++++++++++----
 sflphone-gtk/src/dbus.c     |  2 +-
 sflphone-gtk/src/menus.c    |  1 -
 3 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/sflphone-gtk/src/calltree.c b/sflphone-gtk/src/calltree.c
index 41f741de6f..da75f2498c 100644
--- a/sflphone-gtk/src/calltree.c
+++ b/sflphone-gtk/src/calltree.c
@@ -57,6 +57,12 @@ popup_menu (GtkWidget *widget,
   return TRUE;
 }            
 
+  static gboolean
+is_inserted( GtkWidget* button )
+{
+  return ( GTK_WIDGET(button)->parent == GTK_WIDGET( toolbar ) );
+}
+
   static gboolean
 button_pressed(GtkWidget* widget, GdkEventButton *event, gpointer user_data)
 {
@@ -220,13 +226,13 @@ toolbar_update_buttons ()
   gtk_widget_set_sensitive( GTK_WIDGET(unholdButton),     FALSE);
   g_object_ref(holdButton);
   g_object_ref(unholdButton);
-  gtk_container_remove(GTK_CONTAINER(toolbar), GTK_WIDGET(holdButton));
-  gtk_container_remove(GTK_CONTAINER(toolbar), GTK_WIDGET(unholdButton));
+  if( is_inserted( GTK_WIDGET(holdButton) ) )   gtk_container_remove(GTK_CONTAINER(toolbar), GTK_WIDGET(holdButton));
+  if( is_inserted( GTK_WIDGET(unholdButton) ) )	gtk_container_remove(GTK_CONTAINER(toolbar), GTK_WIDGET(unholdButton));
   gtk_toolbar_insert(GTK_TOOLBAR(toolbar), holdButton, 3);
   g_object_ref(callButton);
   g_object_ref(pickupButton);
-  gtk_container_remove(GTK_CONTAINER(toolbar), GTK_WIDGET(callButton));
-  gtk_container_remove(GTK_CONTAINER(toolbar), GTK_WIDGET(pickupButton));
+  if( is_inserted( GTK_WIDGET(callButton) ) )	gtk_container_remove(GTK_CONTAINER(toolbar), GTK_WIDGET(callButton));
+  if( is_inserted( GTK_WIDGET(pickupButton) ) )	gtk_container_remove(GTK_CONTAINER(toolbar), GTK_WIDGET(pickupButton));
   gtk_toolbar_insert(GTK_TOOLBAR(toolbar), callButton, 0);
 
 
diff --git a/sflphone-gtk/src/dbus.c b/sflphone-gtk/src/dbus.c
index c64ef34ecf..2d5f4fe118 100644
--- a/sflphone-gtk/src/dbus.c
+++ b/sflphone-gtk/src/dbus.c
@@ -112,7 +112,7 @@ call_state_cb (DBusGProxy *proxy,
 	(void) time(&c->_stop);
 	update_call_tree( history, c );
       }
-      g_print("from dbus: "); stop_notification();
+      stop_notification();
       sflphone_hung_up (c);
       update_call_tree( history, c );
     }
diff --git a/sflphone-gtk/src/menus.c b/sflphone-gtk/src/menus.c
index 7706de2056..c4e35a202d 100644
--- a/sflphone-gtk/src/menus.c
+++ b/sflphone-gtk/src/menus.c
@@ -537,7 +537,6 @@ view_dialpad  (GtkImageMenuItem *imagemenuitem,
 {
   gboolean state;
   main_window_dialpad( &state );
-  g_print("State of the damn thing %i\n" , state);
   if( state )
     gtk_image_menu_item_set_image( GTK_IMAGE_MENU_ITEM ( dialpadMenu ),
 				  gtk_image_new_from_file( ICONS_DIR "/icon_dialpad_off.svg"));
-- 
GitLab