ekiga r6622 - in trunk: . src/gui



Author: dsandras
Date: Sun Aug 17 11:48:44 2008
New Revision: 6622
URL: http://svn.gnome.org/viewvc/ekiga?rev=6622&view=rev

Log:
Change icon when the user is in a call.
Fixed icon size when receiving a message.
Removed gdk_threads_enter occurences.


Modified:
   trunk/ChangeLog
   trunk/src/gui/statusicon.cpp

Modified: trunk/src/gui/statusicon.cpp
==============================================================================
--- trunk/src/gui/statusicon.cpp	(original)
+++ trunk/src/gui/statusicon.cpp	Sun Aug 17 11:48:44 2008
@@ -47,6 +47,7 @@
 #include "ekiga.h"
 
 #include "gtk-frontend.h"
+#include "call-core.h"
 
 #include <sigc++/sigc++.h>
 #include <vector>
@@ -126,6 +127,20 @@
 statusicon_set_status (StatusIcon *widget,
                        const std::string & short_status);
 
+static void
+statusicon_set_inacall (StatusIcon *widget,
+                        bool inacall);
+
+static void 
+established_call_cb (Ekiga::CallManager & manager,
+                     Ekiga::Call & call,
+                     gpointer self);
+
+static void 
+cleared_call_cb (Ekiga::CallManager & manager,
+                 Ekiga::Call & call,
+                 std::string reason,
+                 gpointer self);
 
 /*
  * GObject stuff
@@ -307,12 +322,10 @@
 {
   StatusIcon *statusicon = STATUSICON (data);
 
-  gdk_threads_enter ();
   if (statusicon->priv->blinking)
     gtk_status_icon_set_from_stock (GTK_STATUS_ICON (statusicon), statusicon->priv->blink_image);
   else
     statusicon_set_status (statusicon, statusicon->priv->status);
-  gdk_threads_leave ();
 
   statusicon->priv->blinking = !statusicon->priv->blinking;
 
@@ -328,6 +341,25 @@
 }
 
 
+static void 
+established_call_cb (Ekiga::CallManager & /*manager*/,
+                     Ekiga::Call & /*call*/,
+                     gpointer self)
+{
+  statusicon_set_inacall (STATUSICON (self), true);
+}
+
+
+static void 
+cleared_call_cb (Ekiga::CallManager & /*manager*/,
+                 Ekiga::Call & /*call*/,
+                 std::string /*reason*/,
+                 gpointer self)
+{
+  statusicon_set_inacall (STATUSICON (self), false);
+}
+
+
 /*
  * Local functions
  */
@@ -445,6 +477,35 @@
 }
 
 
+void
+statusicon_set_inacall (StatusIcon *statusicon,
+                        bool inacall)
+{
+  GtkFrontend *frontend = NULL;
+  GtkWidget *chat_window = NULL;
+  GdkPixbuf *pixbuf = NULL;
+
+  g_return_if_fail (statusicon != NULL);
+
+  frontend = dynamic_cast<GtkFrontend*>(statusicon->priv->core.get ("gtk-frontend"));
+  // FIXME use main_window here
+  chat_window = GTK_WIDGET (frontend->get_chat_window ());
+
+  /* Update the status icon */ 
+  if (inacall) {
+
+    pixbuf = gtk_widget_render_icon (chat_window, GM_STOCK_STATUS_INACALL, 
+                                     GTK_ICON_SIZE_MENU, NULL); 
+    gtk_status_icon_set_from_pixbuf (GTK_STATUS_ICON (statusicon), pixbuf);
+    g_object_unref (pixbuf);
+  }
+  else {
+    
+    statusicon_set_status (statusicon, statusicon->priv->status);
+  }
+}
+
+
 /*
  * Public API
  */
@@ -468,6 +529,7 @@
 
   GtkFrontend *frontend = dynamic_cast<GtkFrontend*>(core.get ("gtk-frontend"));
   Ekiga::PersonalDetails *details = dynamic_cast<Ekiga::PersonalDetails*> (core.get ("personal-details"));
+  Ekiga::CallCore *call_core = dynamic_cast<Ekiga::CallCore*> (core.get ("call-core"));
   GtkWidget *chat_window = GTK_WIDGET (frontend->get_chat_window ());
 
   statusicon_set_status (self, details->get_short_status ());
@@ -475,6 +537,14 @@
                                                (gpointer) self));
   self->priv->connections.push_back (conn);
 
+  conn = call_core->established_call.connect (sigc::bind (sigc::ptr_fun (established_call_cb), 
+                                                          (gpointer) self));
+  self->priv->connections.push_back (conn);
+
+  conn = call_core->cleared_call.connect (sigc::bind (sigc::ptr_fun (cleared_call_cb), 
+                                                      (gpointer) self));
+  self->priv->connections.push_back (conn);
+
   g_signal_connect (self, "popup-menu",
                     G_CALLBACK (show_popup_menu_cb), self->priv->popup_menu);
 



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