Skip to content
Snippets Groups Projects
Commit 536f4007 authored by Emmanuel Milou's avatar Emmanuel Milou
Browse files

[#3621] Use GTKInfoBar to display call information

parent aa8340a9
No related branches found
No related tags found
No related merge requests found
...@@ -194,6 +194,7 @@ im_widget_init (IMWidget *im) ...@@ -194,6 +194,7 @@ im_widget_init (IMWidget *im)
im->web_view = webkit_web_view_new(); im->web_view = webkit_web_view_new();
GtkWidget *textscrollwin = gtk_scrolled_window_new (NULL, NULL); GtkWidget *textscrollwin = gtk_scrolled_window_new (NULL, NULL);
GtkWidget *webscrollwin = gtk_scrolled_window_new (NULL, NULL); GtkWidget *webscrollwin = gtk_scrolled_window_new (NULL, NULL);
im->info_bar = gtk_info_bar_new ();
/* A bar with the entry text and the button to send the message */ /* A bar with the entry text and the button to send the message */
GtkWidget *hbox = gtk_hbox_new (FALSE, 10); GtkWidget *hbox = gtk_hbox_new (FALSE, 10);
...@@ -206,6 +207,7 @@ im_widget_init (IMWidget *im) ...@@ -206,6 +207,7 @@ im_widget_init (IMWidget *im)
gtk_container_add (GTK_CONTAINER (textscrollwin), im->textarea); gtk_container_add (GTK_CONTAINER (textscrollwin), im->textarea);
gtk_container_add (GTK_CONTAINER (webscrollwin), im->web_view); gtk_container_add (GTK_CONTAINER (webscrollwin), im->web_view);
gtk_container_add (GTK_CONTAINER (hbox), textscrollwin); gtk_container_add (GTK_CONTAINER (hbox), textscrollwin);
gtk_box_pack_start (GTK_BOX(im), im->info_bar, FALSE, FALSE, 2);
gtk_box_pack_start (GTK_BOX(im), webscrollwin, TRUE, TRUE, 5); gtk_box_pack_start (GTK_BOX(im), webscrollwin, TRUE, TRUE, 5);
gtk_box_pack_end (GTK_BOX(im), hbox, FALSE, FALSE, 2); gtk_box_pack_end (GTK_BOX(im), hbox, FALSE, FALSE, 2);
g_signal_connect (im->web_view, "navigation-policy-decision-requested", G_CALLBACK (web_view_nav_requested_cb), NULL); g_signal_connect (im->web_view, "navigation-policy-decision-requested", G_CALLBACK (web_view_nav_requested_cb), NULL);
...@@ -216,7 +218,6 @@ im_widget_init (IMWidget *im) ...@@ -216,7 +218,6 @@ im_widget_init (IMWidget *im)
im->js_context = webkit_web_frame_get_global_context (im->web_frame); im->js_context = webkit_web_frame_get_global_context (im->web_frame);
im->js_global = JSContextGetGlobalObject (im->js_context); im->js_global = JSContextGetGlobalObject (im->js_context);
webkit_web_view_load_uri (WEBKIT_WEB_VIEW(im->web_view), "file://" DATA_DIR "/webkit/im/im.html"); webkit_web_view_load_uri (WEBKIT_WEB_VIEW(im->web_view), "file://" DATA_DIR "/webkit/im/im.html");
} }
GtkWidget * GtkWidget *
...@@ -276,6 +277,7 @@ im_widget_display (callable_obj_t **call) ...@@ -276,6 +277,7 @@ im_widget_display (callable_obj_t **call)
/* Add it to the main instant messaging window */ /* Add it to the main instant messaging window */
gchar *label = get_peer_information (tmp); gchar *label = get_peer_information (tmp);
im_widget_infobar (im, label);
im_window_add (im, label); im_window_add (im, label);
} }
else { else {
...@@ -284,4 +286,28 @@ im_widget_display (callable_obj_t **call) ...@@ -284,4 +286,28 @@ im_widget_display (callable_obj_t **call)
} }
} }
}
void
im_widget_infobar (IMWidget *im, gchar *label) {
GtkWidget *infobar = im->info_bar;
GtkWidget *content_area = gtk_info_bar_get_content_area (GTK_INFO_BAR (infobar));
callable_obj_t *call = im->call;
gchar *msg1 = g_strdup_printf ("Calling %s", label);
GtkWidget *call_label = gtk_label_new (msg1);
gchar *msg2 = g_strdup_printf ("Call state: %i", call->_state);
GtkWidget *state_label = gtk_label_new (msg2);
gtk_container_add (GTK_CONTAINER (content_area), call_label);
gtk_container_add (GTK_CONTAINER (content_area), state_label);
/* show an info message */
gtk_info_bar_set_message_type (GTK_INFO_BAR (infobar),
GTK_MESSAGE_INFO);
gtk_widget_show (infobar);
free (msg1);
free (msg2);
} }
...@@ -57,6 +57,7 @@ struct _IMWidget { ...@@ -57,6 +57,7 @@ struct _IMWidget {
/* Private */ /* Private */
GtkWidget *textarea; GtkWidget *textarea;
GtkWidget *web_view; GtkWidget *web_view;
GtkWidget *info_bar;
callable_obj_t *call; /* The call attached to this conversation */ callable_obj_t *call; /* The call attached to this conversation */
WebKitWebFrame *web_frame; // Our web frame WebKitWebFrame *web_frame; // Our web frame
JSGlobalContextRef js_context; // The frame's global JS context JSGlobalContextRef js_context; // The frame's global JS context
...@@ -82,6 +83,7 @@ void im_widget_send_message (callable_obj_t *call, const gchar *message); ...@@ -82,6 +83,7 @@ void im_widget_send_message (callable_obj_t *call, const gchar *message);
gchar* im_widget_add_message_time (); gchar* im_widget_add_message_time ();
void im_widget_infobar (IMWidget *im, gchar *label);
G_END_DECLS G_END_DECLS
......
...@@ -32,7 +32,7 @@ body { ...@@ -32,7 +32,7 @@ body {
} }
#header { #header {
display: none;
margin: 40px; margin: 40px;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment