Hi Marat. I tried to apply your patch today but it failed with : error: patch failed: sflphone-client-gnome/src/widget/imwidget.c:37 error: sflphone-client-gnome/src/widget/imwidget.c: patch does not apply error: patch failed: sflphone-client-gnome/src/widget/imwidget.h:59 error: sflphone-client-gnome/src/widget/imwidget.h: patch does not apply
Otherwise I pushed all of your other changes in the master. Do you think you could provided us with a newer version of the patch ? Also, it might be easier if you could also use format-patch instead of diff when creating the patch. On behalf of the team here, we thank you a lot for your great work Pierre-Luc Bacon ----- Original Message ----- From: "Marat Radchenko" <[email protected]> To: [email protected] Sent: Wednesday, December 1, 2010 3:20:10 PM Subject: [SFLphone] [PATCH] Fixed compilation on Maemo 5 (GTK+ < 2.16, webkit < 1.1.7) --- astylerc | 2 +- .../src/config/accountconfigdialog.c | 11 +- sflphone-client-gnome/src/config/assistant.c | 6 +- sflphone-client-gnome/src/contacts/searchbar.c | 110 +++++++--- sflphone-client-gnome/src/imwindow.c | 4 + sflphone-client-gnome/src/widget/imwidget.c | 229 +++++++++++--------- sflphone-client-gnome/src/widget/imwidget.h | 8 +- 7 files changed, 227 insertions(+), 143 deletions(-) diff --git a/astylerc b/astylerc index 460124f..5e202b5 100644 --- a/astylerc +++ b/astylerc @@ -11,6 +11,6 @@ indent-classes # Indent 'class' and 'struct' blocks so that the blocks indent-switches # Indent 'switch' blocks so that the 'case X:' statements are indented in the switch block break-blocks # Pad empty lines around header blocks (e.g. 'if', 'while'...). brackets=linux -unpad=paren +unpad-paren formatted -d diff --git a/sflphone-client-gnome/src/config/accountconfigdialog.c b/sflphone-client-gnome/src/config/accountconfigdialog.c index 9ab3de9..c154ed6 100644 --- a/sflphone-client-gnome/src/config/accountconfigdialog.c +++ b/sflphone-client-gnome/src/config/accountconfigdialog.c @@ -43,8 +43,7 @@ #include <audioconf.h> // From version 2.16, gtk provides the functionalities libsexy used to provide -#if GTK_CHECK_VERSION(2,16,0) -#else +#if !GTK_CHECK_VERSION(2,16,0) #include <libsexy/sexy-icon-entry.h> #endif @@ -1189,7 +1188,13 @@ GtkWidget* create_advanced_tab (account_t **a) void ringtone_enabled (GtkWidget *widget UNUSED, gpointer fileChooser, const gchar *accountID UNUSED) { - gboolean isEnabled = gtk_widget_get_sensitive (GTK_WIDGET (fileChooser)); + gboolean isEnabled; + +#if GTK_CHECK_VERSION(2,16,0) + isEnabled = gtk_widget_get_sensitive (GTK_WIDGET (fileChooser)); +#else + isEnabled = GTK_WIDGET_SENSITIVE (fileChooser); +#endif if (isEnabled) { gtk_widget_set_sensitive (GTK_WIDGET (fileChooser), FALSE); diff --git a/sflphone-client-gnome/src/config/assistant.c b/sflphone-client-gnome/src/config/assistant.c index 71d3d65..aba4a06 100644 --- a/sflphone-client-gnome/src/config/assistant.c +++ b/sflphone-client-gnome/src/config/assistant.c @@ -365,7 +365,7 @@ GtkWidget* build_sip_account_configuration (void) gtk_entry_set_icon_from_pixbuf (GTK_ENTRY (wiz->sip_username), GTK_ENTRY_ICON_PRIMARY, gdk_pixbuf_new_from_file (ICONS_DIR "/stock_person.svg", NULL)); #else wiz->sip_username = sexy_icon_entry_new(); - image = gtk_image_new_from_file (ICONS_DIR "/stock_person.svg"); + GtkWidget* image = gtk_image_new_from_file (ICONS_DIR "/stock_person.svg"); sexy_icon_entry_set_icon (SEXY_ICON_ENTRY (wiz->sip_username), SEXY_ICON_ENTRY_PRIMARY , GTK_IMAGE (image)); #endif gtk_label_set_mnemonic_widget (GTK_LABEL (label), wiz->sip_username); @@ -380,8 +380,6 @@ GtkWidget* build_sip_account_configuration (void) wiz->sip_password = gtk_entry_new(); gtk_entry_set_icon_from_stock (GTK_ENTRY (wiz->sip_password), GTK_ENTRY_ICON_PRIMARY, GTK_STOCK_DIALOG_AUTHENTICATION); #else - - wiz->sip_password = sexy_icon_entry_new(); image = gtk_image_new_from_stock (GTK_STOCK_DIALOG_AUTHENTICATION , GTK_ICON_SIZE_SMALL_TOOLBAR); sexy_icon_entry_set_icon (SEXY_ICON_ENTRY (wiz->sip_password), SEXY_ICON_ENTRY_PRIMARY , GTK_IMAGE (image)); @@ -479,7 +477,7 @@ GtkWidget* build_iax_account_configuration (void) gtk_entry_set_icon_from_pixbuf (GTK_ENTRY (wiz->iax_username), GTK_ENTRY_ICON_PRIMARY, gdk_pixbuf_new_from_file (ICONS_DIR "/stock_person.svg", NULL)); #else wiz->iax_username = sexy_icon_entry_new(); - image = gtk_image_new_from_file (ICONS_DIR "/stock_person.svg"); + GtkWidget* image = gtk_image_new_from_file (ICONS_DIR "/stock_person.svg"); sexy_icon_entry_set_icon (SEXY_ICON_ENTRY (wiz->iax_username), SEXY_ICON_ENTRY_PRIMARY , GTK_IMAGE (image)); #endif gtk_label_set_mnemonic_widget (GTK_LABEL (label), wiz->iax_username); diff --git a/sflphone-client-gnome/src/contacts/searchbar.c b/sflphone-client-gnome/src/contacts/searchbar.c index e0f6960..8f391dc 100644 --- a/sflphone-client-gnome/src/contacts/searchbar.c +++ b/sflphone-client-gnome/src/contacts/searchbar.c @@ -52,7 +52,25 @@ GdkPixbuf *incoming_pixbuf = NULL; GdkPixbuf *outgoing_pixbuf = NULL; GdkPixbuf *missed_pixbuf = NULL; +#if !GTK_CHECK_VERSION(2,16,0) +static const gchar *gtk_menu_item_get_label (GtkMenuItem *menu_item) +{ + GList *children; + GList *l; + + children = gtk_container_get_children (GTK_CONTAINER (menu_item)); + for (l = g_list_first (children); l != NULL; l = g_list_next (l)) { + GtkWidget *child = GTK_WIDGET (l->data); + + if (GTK_IS_LABEL (child)) { + return gtk_label_get_label (GTK_LABEL (child)); + } + } + + return NULL; +} +#endif void searchbar_addressbook_activated (GtkEntry *entry, gchar *arg1 UNUSED, gpointer data UNUSED) { @@ -136,16 +154,18 @@ void update_searchbar_addressbook_list() cboxSignalId = gtk_signal_connect (GTK_OBJECT (cbox), "changed", G_CALLBACK (cbox_changed_cb), NULL); } - static void select_search_type (GtkWidget *item, GtkEntry *entry UNUSED) { DEBUG ("Searchbar: %s", gtk_menu_item_get_label (GTK_MENU_ITEM (item))); - - +#if GTK_CHECK_VERSION(2,16,0) gtk_entry_set_icon_tooltip_text (GTK_ENTRY (addressbookentry), GTK_ENTRY_ICON_PRIMARY, gtk_menu_item_get_label (GTK_MENU_ITEM (item))); - +#else + /* TODO */ + gtk_widget_set_tooltip_text (addressbookentry, + gtk_menu_item_get_label (GTK_MENU_ITEM (item))); +#endif if (strcmp ("Search is", gtk_menu_item_get_label (GTK_MENU_ITEM (item))) == 0) set_current_addressbook_test (E_BOOK_QUERY_IS); @@ -155,19 +175,25 @@ static void select_search_type (GtkWidget *item, GtkEntry *entry UNUSED) set_current_addressbook_test (E_BOOK_QUERY_CONTAINS); addressbook_search (GTK_ENTRY (addressbookentry)); - - } static void search_all (GtkWidget *item UNUSED, GtkEntry *entry) { HistorySearchType = SEARCH_ALL; + gchar *tooltip_text = g_markup_printf_escaped ("%s\n%s", + _ ("Search all"), + _ ("Click here to change the search type")); +#if GTK_CHECK_VERSION(2,16,0) gtk_entry_set_icon_from_stock (entry, GTK_ENTRY_ICON_PRIMARY, GTK_STOCK_FIND); - gtk_entry_set_icon_tooltip_text (entry, GTK_ENTRY_ICON_PRIMARY, - g_markup_printf_escaped ("%s\n%s", - _ ("Search all"), - _ ("Click here to change the search type"))); + gtk_entry_set_icon_tooltip_text (entry, GTK_ENTRY_ICON_PRIMARY, tooltip_text); +#else + GtkWidget *image = gtk_image_new_from_stock (GTK_STOCK_FIND , GTK_ICON_SIZE_SMALL_TOOLBAR); + sexy_icon_entry_set_icon (SEXY_ICON_ENTRY (entry), SEXY_ICON_ENTRY_PRIMARY , GTK_IMAGE (image)); + gtk_widget_set_tooltip_text (image, tooltip_text); +#endif + + g_free (tooltip_text); history_search (HistorySearchType); } @@ -175,39 +201,68 @@ static void search_all (GtkWidget *item UNUSED, GtkEntry *entry) static void search_by_missed (GtkWidget *item UNUSED, GtkEntry *entry) { HistorySearchType = SEARCH_MISSED; + gchar *tooltip_text = g_markup_printf_escaped ("%s\n%s", + _ ("Search by missed call"), + _ ("Click here to change the search type")); +#if GTK_CHECK_VERSION(2,16,0) gtk_entry_set_icon_from_pixbuf (entry, GTK_ENTRY_ICON_PRIMARY, missed_pixbuf); - gtk_entry_set_icon_tooltip_text (entry, GTK_ENTRY_ICON_PRIMARY, - g_markup_printf_escaped ("%s\n%s", - _ ("Search by missed call"), - _ ("Click here to change the search type"))); + gtk_entry_set_icon_tooltip_text (entry, GTK_ENTRY_ICON_PRIMARY, tooltip_text); +#else + GtkWidget *image = gtk_image_new_from_pixbuf (missed_pixbuf); + sexy_icon_entry_set_icon (SEXY_ICON_ENTRY (entry), SEXY_ICON_ENTRY_PRIMARY , GTK_IMAGE (image)); + gtk_widget_set_tooltip_text (image, tooltip_text); +#endif + + g_free (tooltip_text); + history_search (HistorySearchType); } static void search_by_incoming (GtkWidget *item UNUSED, GtkEntry *entry) { HistorySearchType = SEARCH_INCOMING; + gchar *tooltip_text = g_markup_printf_escaped ("%s\n%s", + _ ("Search by incoming call"), + _ ("Click here to change the search type")); +#if GTK_CHECK_VERSION(2,16,0) gtk_entry_set_icon_from_pixbuf (entry, GTK_ENTRY_ICON_PRIMARY, incoming_pixbuf); - gtk_entry_set_icon_tooltip_text (entry, GTK_ENTRY_ICON_PRIMARY, - g_markup_printf_escaped ("%s\n%s", - _ ("Search by incoming call"), - _ ("Click here to change the search type"))); + gtk_entry_set_icon_tooltip_text (entry, GTK_ENTRY_ICON_PRIMARY, tooltip_text); +#else + GtkWidget *image = gtk_image_new_from_pixbuf (incoming_pixbuf); + sexy_icon_entry_set_icon (SEXY_ICON_ENTRY (entry), SEXY_ICON_ENTRY_PRIMARY , GTK_IMAGE (image)); + gtk_widget_set_tooltip_text (image, tooltip_text); +#endif + + g_free (tooltip_text); + history_search (HistorySearchType); } static void search_by_outgoing (GtkWidget *item UNUSED, GtkEntry *entry) { HistorySearchType = SEARCH_OUTGOING; + gchar *tooltip_text = g_markup_printf_escaped ("%s\n%s", + _ ("Search by outgoing call"), + _ ("Click here to change the search type")); +#if GTK_CHECK_VERSION(2,16,0) gtk_entry_set_icon_from_pixbuf (entry, GTK_ENTRY_ICON_PRIMARY, outgoing_pixbuf); - gtk_entry_set_icon_tooltip_text (entry, GTK_ENTRY_ICON_PRIMARY, - g_markup_printf_escaped ("%s\n%s", - _ ("Search by outgoing call"), - _ ("Click here to change the search type"))); + gtk_entry_set_icon_tooltip_text (entry, GTK_ENTRY_ICON_PRIMARY, tooltip_text); +#else + GtkWidget *image = gtk_image_new_from_pixbuf (outgoing_pixbuf); + sexy_icon_entry_set_icon (SEXY_ICON_ENTRY (entry), SEXY_ICON_ENTRY_PRIMARY , GTK_IMAGE (image)); + gtk_widget_set_tooltip_text (image, tooltip_text); +#endif + + g_free (tooltip_text); + history_search (HistorySearchType); } +#if GTK_CHECK_VERSION(2,16,0) + static void icon_press_cb (GtkEntry *entry, gint position, GdkEventButton *event, gpointer data UNUSED) { DEBUG ("Searchbar: Icon pressed"); @@ -231,6 +286,7 @@ static void text_changed_cb (GtkEntry *entry, GParamSpec *pspec UNUSED) gtk_entry_set_icon_sensitive (entry, GTK_ENTRY_ICON_SECONDARY, has_text); } +#endif GtkWidget *addressbook_menu_new (void) @@ -289,11 +345,12 @@ void searchbar_init (calltab_t *tab) GtkWidget* history_searchbar_new (void) { - GtkWidget *ret, *item, *image; + GtkWidget *ret, *image; ret = gtk_hbox_new (FALSE, 0); #if GTK_CHECK_VERSION(2,16,0) + GtkWidget *item; searchbox = gtk_entry_new(); gtk_entry_set_icon_from_stock (GTK_ENTRY (searchbox), GTK_ENTRY_ICON_SECONDARY, GTK_STOCK_CLEAR); @@ -429,8 +486,6 @@ GtkWidget* contacts_searchbar_new () gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (cbox), cell, TRUE); gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (cbox), cell, "text", 0, NULL); - - #if GTK_CHECK_VERSION(2,16,0) // GdkPixbuf *pixbuf; @@ -444,6 +499,8 @@ GtkWidget* contacts_searchbar_new () gtk_entry_set_icon_tooltip_text (GTK_ENTRY (addressbookentry), GTK_ENTRY_ICON_PRIMARY, tooltip_text); + g_free (tooltip_text); + // Set the clean insensitive text_changed_cb (GTK_ENTRY (addressbookentry), NULL); @@ -475,9 +532,6 @@ GtkWidget* contacts_searchbar_new () gtk_box_pack_start (GTK_BOX (ret), align, TRUE, TRUE, 0); gtk_box_pack_start (GTK_BOX (ret), addressbookentry, TRUE, TRUE, 0); - g_free (tooltip_text); - - // current_addressbook = gtk_combo_box_get_active_text (GTK_COMBO_BOX (cbox)); // set_current_addressbook (current_addressbook); diff --git a/sflphone-client-gnome/src/imwindow.c b/sflphone-client-gnome/src/imwindow.c index c76b665..adb0dc6 100644 --- a/sflphone-client-gnome/src/imwindow.c +++ b/sflphone-client-gnome/src/imwindow.c @@ -152,7 +152,11 @@ im_window_is_active () gboolean im_window_is_visible () { +#if GTK_CHECK_VERSION(2,16,0) return gtk_widget_get_visible (im_window); +#else + return GTK_WIDGET_VISIBLE (im_window); +#endif } void diff --git a/sflphone-client-gnome/src/widget/imwidget.c b/sflphone-client-gnome/src/widget/imwidget.c index 367a200..ded7f21 100644 --- a/sflphone-client-gnome/src/widget/imwidget.c +++ b/sflphone-client-gnome/src/widget/imwidget.c @@ -37,42 +37,51 @@ #define WEBKIT_DIR "file://" DATA_DIR "/webkit/" -static void -on_frame_loading_done (GObject *gobject UNUSED, GParamSpec *pspec UNUSED, gpointer user_data) +static void add_initial_messages (IMWidget *im) { - IMWidget *im = IM_WIDGET (user_data); callable_obj_t *call; conference_obj_t *conf; - if (im->first_message && im->first_message_from) { - switch (webkit_web_frame_get_load_status (WEBKIT_WEB_FRAME (im->web_frame))) { - case WEBKIT_LOAD_PROVISIONAL: - case WEBKIT_LOAD_COMMITTED: - break; - case WEBKIT_LOAD_FINISHED: - call = calllist_get (current_calls, im->call_id); - conf = conferencelist_get (im->call_id); - - if (call) - im_widget_add_message (im, im->first_message_from, im->first_message, 0); - - if (conf) - im_widget_add_message (im, im->first_message_from, im->first_message, 0); - - g_free (im->first_message); - g_free (im->first_message_from); - im->first_message = NULL; - im->first_message_from = NULL; - DEBUG ("JavaScrip loading frame finished"); - break; - case WEBKIT_LOAD_FIRST_VISUALLY_NON_EMPTY_LAYOUT: - // case WEBKIT_LOAD_FAILED: // only available in webkit-1.0-2 - break; - } - } + if (!im->first_message || !im->first_message_from) + return; + + call = calllist_get (current_calls, im->call_id); + conf = conferencelist_get (im->call_id); + + if (call) + im_widget_add_message (im, im->first_message_from, im->first_message, 0); + + if (conf) + im_widget_add_message (im, im->first_message_from, im->first_message, 0); + + g_free (im->first_message); + g_free (im->first_message_from); + im->first_message = NULL; + im->first_message_from = NULL; + DEBUG ("JavaScrip loading frame finished"); +} + +#if WEBKIT_CHECK_VERSION(1,1,7) + +static void +on_frame_load_status_changed (GObject *gobject UNUSED, GParamSpec *pspec UNUSED, gpointer user_data) +{ + if (webkit_web_frame_get_load_status (WEBKIT_WEB_FRAME (im->web_frame)) == WEBKIT_LOAD_FINISHED) + add_initial_messages (IM_WIDGET (user_data)); +} +#else + +static void +on_frame_load_finished (WebKitWebView *web_view UNUSED, + WebKitWebFrame *frame UNUSED, + gpointer user_data) +{ + add_initial_messages (IM_WIDGET (user_data)); } +#endif + gchar * escape_single_quotes (const gchar *message) { @@ -252,7 +261,10 @@ im_widget_init (IMWidget *im) im->web_view = webkit_web_view_new(); GtkWidget *textscrollwin = gtk_scrolled_window_new (NULL, NULL); GtkWidget *webscrollwin = gtk_scrolled_window_new (NULL, NULL); + +#if GTK_CHECK_VERSION(2,18,0) im->info_bar = gtk_info_bar_new (); +#endif /* A bar with the entry text and the button to send the message */ GtkWidget *hbox = gtk_hbox_new (FALSE, 10); @@ -267,7 +279,11 @@ im_widget_init (IMWidget *im) gtk_container_add (GTK_CONTAINER (textscrollwin), im->textarea); gtk_container_add (GTK_CONTAINER (webscrollwin), im->web_view); gtk_container_add (GTK_CONTAINER (hbox), textscrollwin); + +#if GTK_CHECK_VERSION(2,18,0) gtk_box_pack_start (GTK_BOX (im), im->info_bar, FALSE, FALSE, 2); +#endif + gtk_box_pack_start (GTK_BOX (im), webscrollwin, TRUE, TRUE, 5); 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); @@ -280,7 +296,11 @@ im_widget_init (IMWidget *im) im->containText = FALSE; - g_signal_connect (G_OBJECT (im->web_frame), "notify", G_CALLBACK (on_frame_loading_done), im); +#if WEBKIT_CHECK_VERSION(1,1,7) + g_signal_connect (G_OBJECT (im->web_frame), "notify", G_CALLBACK (on_frame_load_status_changed), im); +#else + g_signal_connect (G_OBJECT (im->web_frame), "load-finished", G_CALLBACK (on_frame_load_finished), im); +#endif } GtkWidget * @@ -326,6 +346,82 @@ im_widget_get_type (void) return im_widget_type; } +#if GTK_CHECK_VERSION(2,18,0) + +static void im_widget_infobar (IMWidget *im) +{ + + /* Fetch the GTKInfoBar of this very IM Widget */ + GtkWidget *infobar = im->info_bar; + GtkWidget *content_area = gtk_info_bar_get_content_area (GTK_INFO_BAR (infobar)); + + /* Fetch call/conference information */ + callable_obj_t *im_widget_call = calllist_get (current_calls, im->call_id); + conference_obj_t *im_widget_conf = conferencelist_get (im->call_id); + + /* Create the label widgets with the call information saved in the IM Widget struct */ + gchar *msg1; + + if (im_widget_call) + msg1 = g_strdup_printf ("Calling %s %s", im_widget_call->_peer_number, im_widget_call->_peer_name); + else if (im_widget_conf) + msg1 = g_strdup_printf ("Conferencing"); // im_widget_conf->_confID); + else + msg1 = g_strdup (""); + + GtkWidget *call_label = gtk_label_new (msg1); + + if (im_widget_call) + im->info_state = call_state_image_widget (im_widget_call->_state); + + if (im_widget_conf) + im->info_state = conf_state_image_widget (im_widget_conf->_state); + + /* Add a nice icon from our own icon factory */ + GtkWidget *logoUser = gtk_image_new_from_stock (GTK_STOCK_USER, GTK_ICON_SIZE_LARGE_TOOLBAR); + + /* Pack it all */ + gtk_container_add (GTK_CONTAINER (content_area), logoUser); + gtk_container_add (GTK_CONTAINER (content_area), call_label); + gtk_container_add (GTK_CONTAINER (content_area), im->info_state); + + /* Message level by default: INFO */ + gtk_info_bar_set_message_type (GTK_INFO_BAR (infobar), GTK_MESSAGE_INFO); + + /* Show the info bar */ + gtk_widget_show (infobar); + + /* Clean up */ + free (msg1); +} + +void im_widget_update_state (IMWidget *im, gboolean active) +{ + /* if active = true, it means that we are the call is in current state, so sflphone can send text messages */ + if (active) { + gtk_widget_set_sensitive (im->info_state, TRUE); + gtk_info_bar_set_message_type (GTK_INFO_BAR (im->info_bar), + GTK_MESSAGE_INFO); + } + /* if active = false, the call is over, we can't send text messages anymore */ + else { + if (im) { + gtk_widget_set_sensitive (im->info_state, FALSE); + gtk_info_bar_set_message_type (GTK_INFO_BAR (im->info_bar), + GTK_MESSAGE_WARNING); + gtk_widget_set_tooltip_text (im->info_state, "Call has terminated"); + } + } +} + +#else + +void im_widget_update_state (IMWidget *im UNUSED, gboolean active UNUSED) +{ +} + +#endif + gboolean im_widget_display (IMWidget **im, const gchar *message, const gchar *id, const gchar *from) { @@ -353,8 +449,10 @@ im_widget_display (IMWidget **im, const gchar *message, const gchar *id, const g /* Update the widget with some useful call information: ie the call ID */ imwidget->call_id = id; +#if GTK_CHECK_VERSION(2,16,0) /* Create the GtkInfoBar, used to display call information, and status of the IM widget */ im_widget_infobar (imwidget); +#endif /* Add it to the main instant messaging window */ im_window_add (GTK_WIDGET (imwidget)); @@ -381,54 +479,6 @@ im_widget_display (IMWidget **im, const gchar *message, const gchar *id, const g // return FALSE; } -void -im_widget_infobar (IMWidget *im) -{ - - /* Fetch the GTKInfoBar of this very IM Widget */ - GtkWidget *infobar = im->info_bar; - GtkWidget *content_area = gtk_info_bar_get_content_area (GTK_INFO_BAR (infobar)); - - /* Fetch call/conference information */ - callable_obj_t *im_widget_call = calllist_get (current_calls, im->call_id); - conference_obj_t *im_widget_conf = conferencelist_get (im->call_id); - - /* Create the label widgets with the call information saved in the IM Widget struct */ - gchar *msg1; - - if (im_widget_call) - msg1 = g_strdup_printf ("Calling %s %s", im_widget_call->_peer_number, im_widget_call->_peer_name); - else if (im_widget_conf) - msg1 = g_strdup_printf ("Conferencing"); // im_widget_conf->_confID); - else - msg1 = g_strdup (""); - - GtkWidget *call_label = gtk_label_new (msg1); - - if (im_widget_call) - im->info_state = call_state_image_widget (im_widget_call->_state); - - if (im_widget_conf) - im->info_state = conf_state_image_widget (im_widget_conf->_state); - - /* Add a nice icon from our own icon factory */ - GtkWidget *logoUser = gtk_image_new_from_stock (GTK_STOCK_USER, GTK_ICON_SIZE_LARGE_TOOLBAR); - - /* Pack it all */ - gtk_container_add (GTK_CONTAINER (content_area), logoUser); - gtk_container_add (GTK_CONTAINER (content_area), call_label); - gtk_container_add (GTK_CONTAINER (content_area), im->info_state); - - /* Message level by default: INFO */ - gtk_info_bar_set_message_type (GTK_INFO_BAR (infobar), GTK_MESSAGE_INFO); - - /* Show the info bar */ - gtk_widget_show (infobar); - - /* Clean up */ - free (msg1); -} - GtkWidget* call_state_image_widget (call_state_t state) { @@ -470,26 +520,3 @@ conf_state_image_widget (conference_state_t state) return image; } - -void -im_widget_update_state (IMWidget *im, gboolean active) -{ - /* if active = true, it means that we are the call is in current state, so sflphone can send text messages */ - if (active) { - gtk_widget_set_sensitive (im->info_state, TRUE); - gtk_info_bar_set_message_type (GTK_INFO_BAR (im->info_bar), - GTK_MESSAGE_INFO); - } - /* if active = false, the call is over, we can't send text messages anymore */ - else { - if (im) { - gtk_widget_set_sensitive (im->info_state, FALSE); - gtk_info_bar_set_message_type (GTK_INFO_BAR (im->info_bar), - GTK_MESSAGE_WARNING); - gtk_widget_set_tooltip_text (im->info_state, "Call has terminated"); - } - } -} - - - diff --git a/sflphone-client-gnome/src/widget/imwidget.h b/sflphone-client-gnome/src/widget/imwidget.h index ea0909f..e31f1da 100644 --- a/sflphone-client-gnome/src/widget/imwidget.h +++ b/sflphone-client-gnome/src/widget/imwidget.h @@ -59,8 +59,10 @@ struct _IMWidget { GtkWidget *tab; GtkWidget *textarea; GtkWidget *web_view; +#if GTK_CHECK_VERSION(2,18,0) GtkWidget *info_bar; GtkWidget *info_state; +#endif gchar *call_id; gchar *first_message; // Message displayed at widget's creation time gchar *first_message_from; // Sender of the first message (usefull in case of a conference) @@ -111,12 +113,6 @@ void im_widget_send_message (gchar *id, const gchar *message); gchar* im_widget_add_message_time (); -/*! @function -...@abstract Build the GtkInfoBar used to display call information and IM Widget status -...@param The IM Widget -*/ -void im_widget_infobar (IMWidget *im); - GtkWidget* call_state_image_widget (call_state_t state); GtkWidget* conf_state_image_widget (conference_state_t state); -- 1.6.6 _______________________________________________ SFLphone mailing list [email protected] http://lists.savoirfairelinux.net/mailman/listinfo/sflphone _______________________________________________ SFLphone mailing list [email protected] http://lists.savoirfairelinux.net/mailman/listinfo/sflphone
