ekiga r6648 - trunk/lib/engine/gui/gtk-frontend



Author: jpuydt
Date: Mon Aug 18 20:27:27 2008
New Revision: 6648
URL: http://svn.gnome.org/viewvc/ekiga?rev=6648&view=rev

Log:
Handle the case where the notebook ends up empty after closing a chat

Modified:
   trunk/lib/engine/gui/gtk-frontend/chat-window.cpp

Modified: trunk/lib/engine/gui/gtk-frontend/chat-window.cpp
==============================================================================
--- trunk/lib/engine/gui/gtk-frontend/chat-window.cpp	(original)
+++ trunk/lib/engine/gui/gtk-frontend/chat-window.cpp	Mon Aug 18 20:27:27 2008
@@ -174,16 +174,20 @@
   GtkWidget* label = NULL;
 
   num = gtk_notebook_get_current_page (GTK_NOTEBOOK (self->priv->notebook));
-  page = gtk_notebook_get_nth_page (GTK_NOTEBOOK (self->priv->notebook), num);
-  hbox = gtk_notebook_get_tab_label (GTK_NOTEBOOK (self->priv->notebook), page);
-  label = (GtkWidget*)g_object_get_data (G_OBJECT (hbox), "label-widget");
-  gtk_label_set_text (GTK_LABEL (label),
-		      (const gchar*)g_object_get_data (G_OBJECT (label),
+  if (num != -1) { /* the notebook may be empty */
+
+    page = gtk_notebook_get_nth_page (GTK_NOTEBOOK (self->priv->notebook), num);
+    hbox = gtk_notebook_get_tab_label (GTK_NOTEBOOK (self->priv->notebook),
+				       page);
+    label = (GtkWidget*)g_object_get_data (G_OBJECT (hbox), "label-widget");
+    gtk_label_set_text (GTK_LABEL (label),
+			(const gchar*)g_object_get_data (G_OBJECT (label),
 						       "base-title"));
-  g_object_set_data (G_OBJECT (label), "unread-count",
-		     GUINT_TO_POINTER (0));
+    g_object_set_data (G_OBJECT (label), "unread-count",
+		       GUINT_TO_POINTER (0));
 
-  update_unread (self);
+    update_unread (self);
+  }
 
   return FALSE;
 }



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