[ekiga/ds-gtk-application] Call Window: Fixed call window creation.
- From: Damien Sandras <dsandras src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ekiga/ds-gtk-application] Call Window: Fixed call window creation.
- Date: Sun, 7 Dec 2014 11:09:54 +0000 (UTC)
commit fc2fef1837c2035df5becdd2e1a0669849da7830
Author: Damien Sandras <dsandras seconix com>
Date: Sun Dec 7 12:07:54 2014 +0100
Call Window: Fixed call window creation.
Creation of the window has been moved to the EkigaApp GObject. The
broken window creation on incoming calls has been fixed.
lib/engine/gui/gtk-frontend/call-window.cpp | 66 ++++++++++++---------------
lib/engine/gui/gtk-frontend/call-window.h | 1 +
lib/engine/gui/gtk-frontend/ekiga-app.cpp | 19 ++++++++
lib/engine/gui/gtk-frontend/ekiga-app.h | 2 -
lib/engine/gui/gtk-frontend/main_window.cpp | 4 --
5 files changed, 50 insertions(+), 42 deletions(-)
---
diff --git a/lib/engine/gui/gtk-frontend/call-window.cpp b/lib/engine/gui/gtk-frontend/call-window.cpp
index 684674b..ee7ddaa 100644
--- a/lib/engine/gui/gtk-frontend/call-window.cpp
+++ b/lib/engine/gui/gtk-frontend/call-window.cpp
@@ -309,7 +309,8 @@ static void ekiga_call_window_clear_signal_levels (EkigaCallWindow *self);
static void ekiga_call_window_clear_stats (EkigaCallWindow *self);
static void ekiga_call_window_update_title (EkigaCallWindow *self,
- unsigned calling_state);
+ unsigned calling_state,
+ const std::string & remote_party = std::string ());
static void ekiga_call_window_update_stats (EkigaCallWindow *self,
float lost,
@@ -767,9 +768,7 @@ on_ringing_call_cb (G_GNUC_UNUSED boost::shared_ptr<Ekiga::CallManager> manager,
g_return_if_fail (self);
- self->priv->calling_state = Ringing;
-
- ekiga_call_window_update_calling_state (self, self->priv->calling_state);
+ ekiga_call_window_update_calling_state (self, Ringing);
}
@@ -788,15 +787,16 @@ on_setup_call_cb (boost::shared_ptr<Ekiga::CallManager> manager,
return; // No call setup needed if already in a call
self->priv->current_call = call;
- self->priv->calling_state = Called;
+ ekiga_call_window_update_calling_state (self, Called);
+ ekiga_call_window_update_title (self, Called, call->get_remote_party_name ());
}
else {
self->priv->current_call = call;
- self->priv->calling_state = Calling;
+ ekiga_call_window_update_calling_state (self, Calling);
+ ekiga_call_window_update_title (self, Calling, call->get_remote_uri ());
}
- ekiga_call_window_update_calling_state (self, self->priv->calling_state);
conn = call->questions.connect (boost::bind (&on_handle_questions, _1, (gpointer) self));
self->priv->connections.add (conn);
@@ -810,9 +810,8 @@ on_established_call_cb (boost::shared_ptr<Ekiga::CallManager> /*manager*/,
{
EkigaCallWindow *self = EKIGA_CALL_WINDOW (data);
- gtk_window_set_title (GTK_WINDOW (self), call->get_remote_party_name ().c_str ());
-
ekiga_call_window_update_calling_state (self, Connected);
+ ekiga_call_window_update_title (self, Connected, call->get_remote_party_name ());
self->priv->current_call = call;
@@ -832,6 +831,7 @@ on_cleared_call_cb (G_GNUC_UNUSED boost::shared_ptr<Ekiga::CallManager> manager,
}
ekiga_call_window_update_calling_state (self, Standby);
+ ekiga_call_window_update_title (self, Standby);
ekiga_call_window_set_bandwidth (self, 0.0, 0.0, 0.0, 0.0);
ekiga_call_window_clear_stats (self);
@@ -859,8 +859,8 @@ static void on_missed_call_cb (boost::shared_ptr<Ekiga::CallManager> /*manager*
}
self->priv->menu.reset ();
- gtk_window_set_title (GTK_WINDOW (self), _("Call Window"));
ekiga_call_window_update_calling_state (self, Standby);
+ ekiga_call_window_update_title (self, Standby);
}
static void
@@ -958,8 +958,6 @@ on_stats_refresh_cb (gpointer data)
if (self->priv->calling_state == Connected && self->priv->current_call) {
- gtk_header_bar_set_title (GTK_HEADER_BAR (self->priv->call_panel_toolbar),
- self->priv->current_call->get_remote_party_name ().c_str ());
gtk_header_bar_set_subtitle (GTK_HEADER_BAR (self->priv->call_panel_toolbar),
self->priv->current_call->get_duration ().c_str ());
ekiga_call_window_set_bandwidth (self,
@@ -1098,7 +1096,6 @@ ekiga_call_window_update_calling_state (EkigaCallWindow *self,
break;
}
- ekiga_call_window_update_title (self, calling_state);
self->priv->calling_state = calling_state;
}
@@ -1121,43 +1118,42 @@ ekiga_call_window_clear_stats (EkigaCallWindow *self)
static void
ekiga_call_window_update_title (EkigaCallWindow *self,
- unsigned calling_state)
+ unsigned calling_state,
+ const std::string & remote_party)
{
g_return_if_fail (self != NULL);
gchar *title = NULL;
switch (calling_state)
{
- case Standby:
- title = g_strdup (_("Call Window"));
- break;
-
case Calling:
- if (self->priv->current_call)
- title = g_strdup_printf (_("Calling %s"),
- self->priv->current_call->get_remote_uri ().c_str ());
-
-
+ if (!remote_party.empty ())
+ title = g_strdup_printf (_("Calling %s"), remote_party.c_str ());
break;
case Connected:
- if (self->priv->current_call)
- title = g_strdup_printf (_("Connected with %s"),
- self->priv->current_call->get_remote_party_name ().c_str ());
+ if (!remote_party.empty ())
+ title = g_strdup_printf (_("Connected With %s"), remote_party.c_str ());
break;
case Ringing:
+ break;
case Called:
+ if (!remote_party.empty ())
+ title = g_strdup_printf (_("Call From %s"), remote_party.c_str ());
break;
+ case Standby:
default:
+ title = g_strdup (_("Call Window"));
break;
}
- if (title) {
- gtk_header_bar_set_title (GTK_HEADER_BAR (self->priv->call_panel_toolbar), title);
- g_free (title);
- }
+ if (!title)
+ title = g_strdup (_("Call Window"));
+
+ gtk_header_bar_set_title (GTK_HEADER_BAR (self->priv->call_panel_toolbar), title);
+ g_free (title);
}
static void
@@ -1486,8 +1482,6 @@ ekiga_call_window_init_gui (EkigaCallWindow *self)
gtk_header_bar_set_show_close_button (GTK_HEADER_BAR (self->priv->call_panel_toolbar), TRUE);
gtk_window_set_titlebar (GTK_WINDOW (self), self->priv->call_panel_toolbar);
gtk_window_set_icon_name (GTK_WINDOW (self), GM_ICON_LOGO);
- gtk_header_bar_set_title (GTK_HEADER_BAR (self->priv->call_panel_toolbar),
- _("Call Window"));
gtk_widget_show (self->priv->call_panel_toolbar);
/* The info bar */
@@ -1675,10 +1669,10 @@ call_window_new (GmApplication *app)
g_return_val_if_fail (GM_IS_APPLICATION (app), NULL);
self = EKIGA_CALL_WINDOW (g_object_new (EKIGA_TYPE_CALL_WINDOW,
- "application", GTK_APPLICATION (app),
- "key", USER_INTERFACE ".call-window",
- "hide_on_delete", false,
- "hide_on_esc", false, NULL));
+ "application", GTK_APPLICATION (app),
+ "key", USER_INTERFACE ".call-window",
+ "hide_on_delete", false,
+ "hide_on_esc", false, NULL));
Ekiga::ServiceCorePtr core = gm_application_get_core (app);
self->priv->libnotify = core->get ("libnotify");
diff --git a/lib/engine/gui/gtk-frontend/call-window.h b/lib/engine/gui/gtk-frontend/call-window.h
index 14a9f35..d28eab5 100644
--- a/lib/engine/gui/gtk-frontend/call-window.h
+++ b/lib/engine/gui/gtk-frontend/call-window.h
@@ -41,6 +41,7 @@
#include "gmwindow.h"
#include "ekiga-app.h"
+#include "call-core.h"
G_BEGIN_DECLS
diff --git a/lib/engine/gui/gtk-frontend/ekiga-app.cpp b/lib/engine/gui/gtk-frontend/ekiga-app.cpp
index f61da3b..175bddd 100644
--- a/lib/engine/gui/gtk-frontend/ekiga-app.cpp
+++ b/lib/engine/gui/gtk-frontend/ekiga-app.cpp
@@ -113,8 +113,23 @@ struct _GmApplicationPrivate
G_DEFINE_TYPE (GmApplication, gm_application, GTK_TYPE_APPLICATION);
+GtkWidget *gm_application_show_call_window (GmApplication *self);
+
+
/* Private helpers */
static void
+on_created_call_cb (G_GNUC_UNUSED boost::shared_ptr<Ekiga::CallManager> manager,
+ G_GNUC_UNUSED boost::shared_ptr<Ekiga::Call> call,
+ gpointer data)
+{
+ g_return_if_fail (GM_IS_APPLICATION (data));
+
+ GmApplication *self = GM_APPLICATION (data);
+
+ gm_application_show_call_window (self);
+}
+
+static void
call_window_destroyed_cb (G_GNUC_UNUSED GtkWidget *widget,
gpointer data)
{
@@ -282,6 +297,10 @@ ekiga_main (int argc,
gm_application_show_assistant_window (app);
general_settings->set_int ("version", schema_version);
}
+ boost::shared_ptr<Ekiga::CallCore> call_core =
+ app->priv->core->get<Ekiga::CallCore> ("call-core");
+ if (call_core)
+ call_core->created_call.connect (boost::bind (&on_created_call_cb, _1, _2, (gpointer) app));
core->close ();
g_application_run (G_APPLICATION (app), argc, argv);
diff --git a/lib/engine/gui/gtk-frontend/ekiga-app.h b/lib/engine/gui/gtk-frontend/ekiga-app.h
index 02006c2..ef45b1e 100644
--- a/lib/engine/gui/gtk-frontend/ekiga-app.h
+++ b/lib/engine/gui/gtk-frontend/ekiga-app.h
@@ -85,8 +85,6 @@ gboolean gm_application_show_help (GmApplication *app,
void gm_application_show_about (GmApplication *app);
-GtkWidget *gm_application_show_call_window (GmApplication *app);
-
void gm_application_show_chat_window (GmApplication *app);
GtkWidget *gm_application_get_chat_window (GmApplication *app);
diff --git a/lib/engine/gui/gtk-frontend/main_window.cpp b/lib/engine/gui/gtk-frontend/main_window.cpp
index 34c635b..8b9d4ba 100644
--- a/lib/engine/gui/gtk-frontend/main_window.cpp
+++ b/lib/engine/gui/gtk-frontend/main_window.cpp
@@ -375,8 +375,6 @@ static void on_created_call_cb (boost::shared_ptr<Ekiga::CallManager> manager,
}
else {
- gm_application_show_call_window (mw->priv->app);
-
mw->priv->current_call = call;
mw->priv->calling_state = Calling;
}
@@ -411,8 +409,6 @@ static void on_established_call_cb (boost::shared_ptr<Ekiga::CallManager> /*mana
/* Manage sound events */
mw->priv->audiooutput_core->stop_play_event("incoming_call_sound");
mw->priv->audiooutput_core->stop_play_event("ring_tone_sound");
-
- gm_application_show_call_window (mw->priv->app);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]