]> git.0d.be Git - empathy.git/blobdiff - src/empathy-call-window-fullscreen.c
roster-window: fix crash if empathy_chatroom_manager_find() failed
[empathy.git] / src / empathy-call-window-fullscreen.c
index e1c3d7a391a100605a420975f36d52626a7c3460..5ecc123ad72d1fe2163b73dd70965de3c215fa59 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * empathy-call-window-fullscreen.c - Source for EmpathyCallWindowFullscreen
- * Copyright (C) 2009 Collabora Ltd.
+ * Copyright (C) 2009-2011 Collabora Ltd.
  *
  * Some code is based on the Totem Movie Player, especially
  * totem-fullscreen.c which has the following copyright:
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
+#include "config.h"
 #include "empathy-call-window-fullscreen.h"
 
-#include <gtk/gtk.h>
+#include <tp-account-widgets/tpaw-builder.h>
 
-#include <libempathy/empathy-utils.h>
-#include <libempathy-gtk/empathy-ui-utils.h>
+#include "empathy-ui-utils.h"
+#include "empathy-utils.h"
 
 /* The number of seconds for which the "leave fullscreen" popup should
    be shown */
@@ -68,14 +69,17 @@ empathy_call_window_fullscreen_set_cursor_visible (
     gboolean show_cursor)
 {
   EmpathyCallWindowFullscreenPriv *priv = GET_PRIV (fs);
+  GdkWindow *window;
 
-  if (priv->video_widget != NULL && !show_cursor)
-    {
-      gdk_window_set_cursor (gtk_widget_get_window (priv->video_widget),
-          gdk_cursor_new (GDK_BLANK_CURSOR));
-    }
+  if (priv->video_widget == NULL)
+    return;
+
+  window = gtk_widget_get_window (priv->video_widget);
+
+  if (!show_cursor)
+    gdk_window_set_cursor (window, gdk_cursor_new (GDK_BLANK_CURSOR));
   else
-    gdk_window_set_cursor (gtk_widget_get_window (priv->video_widget), NULL);
+    gdk_window_set_cursor (window, NULL);
 }
 
 static void
@@ -183,7 +187,7 @@ empathy_call_window_fullscreen_init (EmpathyCallWindowFullscreen *self)
   gchar *filename;
 
   filename = empathy_file_lookup ("empathy-call-window-fullscreen.ui", "src");
-  gui = empathy_builder_get_file (filename,
+  gui = tpaw_builder_get_file (filename,
     "leave_fullscreen_window", &priv->leave_fullscreen_popup,
     "leave_fullscreen_button", &self->leave_fullscreen_button,
     NULL);
@@ -284,6 +288,15 @@ empathy_call_window_fullscreen_set_fullscreen (EmpathyCallWindowFullscreen *fs,
   fs->is_fullscreen = set_fullscreen;
 }
 
+static void
+video_widget_destroy_cb (GtkWidget *widget,
+    EmpathyCallWindowFullscreen *self)
+{
+  EmpathyCallWindowFullscreenPriv *priv = GET_PRIV (self);
+
+  priv->video_widget = NULL;
+}
+
 void
 empathy_call_window_fullscreen_set_video_widget (
     EmpathyCallWindowFullscreen *fs,
@@ -291,4 +304,7 @@ empathy_call_window_fullscreen_set_video_widget (
 {
   EmpathyCallWindowFullscreenPriv *priv = GET_PRIV (fs);
   priv->video_widget = video_widget;
+
+  tp_g_signal_connect_object (video_widget, "destroy",
+      G_CALLBACK (video_widget_destroy_cb), fs, 0);
 }