Commit 78e4e2d9 authored by Ghislain MARY's avatar Ghislain MARY

Several improvements in GTK UI.

 - Simplify update of missed calls number.
 - Remove useless entries in context menu of contact list.
 - Change icons to clear call history and chat message list.
parent 5339fed4
......@@ -238,19 +238,9 @@ gboolean linphone_gtk_call_log_button_pressed(GtkWidget *widget, GdkEventButton
}
void linphone_gtk_call_log_clear_missed_call(){
GtkWidget *mw=linphone_gtk_get_main_window();
GtkNotebook *notebook=GTK_NOTEBOOK(linphone_gtk_get_widget(mw,"viewswitch"));
GtkWidget *page=gtk_notebook_get_nth_page(notebook,0);
GtkWidget *box=gtk_hbox_new(FALSE,0);
GtkWidget *image=gtk_image_new_from_icon_name("linphone-history",GTK_ICON_SIZE_MENU);
GtkWidget *l;
const gchar*text=gtk_label_get_text(GTK_LABEL(linphone_gtk_get_widget(mw,"label3")));
l=gtk_label_new(text);
gtk_box_pack_start(GTK_BOX(box),image,FALSE,FALSE,0);
gtk_box_pack_start(GTK_BOX(box),l,FALSE,FALSE,0);
gtk_notebook_set_tab_label(notebook,page,box);
gtk_widget_show_all(box);
GtkWidget *mw = linphone_gtk_get_main_window();
GtkWidget *label = linphone_gtk_get_widget(mw, "history_tab_label");
gtk_label_set_text(GTK_LABEL(label), _("Recent calls"));
}
gboolean linphone_gtk_call_log_reset_missed_call(GtkWidget *w, GdkEvent *event,gpointer user_data){
......@@ -263,25 +253,10 @@ gboolean linphone_gtk_call_log_reset_missed_call(GtkWidget *w, GdkEvent *event,g
}
void linphone_gtk_call_log_display_missed_call(int nb){
GtkWidget *mw=linphone_gtk_get_main_window();
GtkNotebook *notebook=GTK_NOTEBOOK(linphone_gtk_get_widget(mw,"viewswitch"));
GtkWidget *page=gtk_notebook_get_nth_page(notebook,0);
GtkWidget *ebox=gtk_event_box_new();
GtkWidget *box=gtk_hbox_new(FALSE,0);
GtkWidget *image=gtk_image_new_from_icon_name("linphone-history",GTK_ICON_SIZE_MENU);
GtkWidget *l;
gchar *buf;
buf=g_markup_printf_escaped(_("<b>Recent calls (%i)</b>"),nb);
l=gtk_label_new(NULL);
gtk_label_set_markup(GTK_LABEL(l),buf);
gtk_box_pack_start(GTK_BOX(box),image,FALSE,FALSE,0);
gtk_box_pack_start(GTK_BOX(box),l,FALSE,FALSE,0);
gtk_container_add(GTK_CONTAINER(ebox),box);
gtk_notebook_set_tab_label(notebook,page,ebox);
gtk_widget_add_events(ebox,GDK_BUTTON_PRESS_MASK);
g_signal_connect(G_OBJECT(ebox),"button_press_event",(GCallback)linphone_gtk_call_log_reset_missed_call,NULL);
gtk_widget_show_all(ebox);
GtkWidget *mw = linphone_gtk_get_main_window();
GtkWidget *label = linphone_gtk_get_widget(mw, "history_tab_label");
gchar *buf = g_markup_printf_escaped(_("<b>Recent calls (%i)</b>"), nb);
gtk_label_set_markup(GTK_LABEL(label), buf);
}
void linphone_gtk_call_log_update(GtkWidget *w){
......
......@@ -814,8 +814,6 @@ void linphone_gtk_contact_ok(GtkWidget *button){
static GtkWidget *linphone_gtk_create_contact_menu(GtkWidget *contact_list){
GtkWidget *menu=gtk_menu_new();
GtkWidget *menu_item;
gchar *call_label=NULL;
gchar *text_label=NULL;
gchar *edit_label=NULL;
gchar *delete_label=NULL;
gchar *delete_hist_label=NULL;
......@@ -840,32 +838,12 @@ static GtkWidget *linphone_gtk_create_contact_menu(GtkWidget *contact_list){
add_contact_label=g_strdup_printf(_("Add a new contact"));
if (gtk_tree_selection_get_selected (select, &model, &iter)){
gtk_tree_model_get(model, &iter,FRIEND_NAME , &name, -1);
call_label=g_strdup_printf(_("Call %s"),name);
text_label=g_strdup_printf(_("Send text to %s"),name);
edit_label=g_strdup_printf(_("Edit contact '%s'"),name);
delete_label=g_strdup_printf(_("Delete contact '%s'"),name);
delete_hist_label=g_strdup_printf(_("Delete chat history of '%s'"),name);
g_free(name);
show_menu_separator=TRUE;
}
if (call_label){
menu_item=gtk_image_menu_item_new_with_label(call_label);
image=gtk_image_new_from_icon_name("linphone-start-call",GTK_ICON_SIZE_MENU);
gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(menu_item),image);
gtk_widget_show(image);
gtk_widget_show(menu_item);
gtk_menu_shell_append(GTK_MENU_SHELL(menu),menu_item);
g_signal_connect_swapped(G_OBJECT(menu_item),"activate",(GCallback)linphone_gtk_call_selected,contact_list);
}
if (text_label){
menu_item=gtk_image_menu_item_new_with_label(text_label);
image=gtk_image_new_from_icon_name("linphone-start-chat",GTK_ICON_SIZE_MENU);
gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(menu_item),image);
gtk_widget_show(image);
gtk_widget_show(menu_item);
gtk_menu_shell_append(GTK_MENU_SHELL(menu),menu_item);
g_signal_connect_swapped(G_OBJECT(menu_item),"activate",(GCallback)linphone_gtk_chat_selected,contact_list);
}
if (edit_label){
menu_item=gtk_image_menu_item_new_with_label(edit_label);
image=gtk_image_new_from_icon_name("linphone-edit",GTK_ICON_SIZE_MENU);
......@@ -886,8 +864,11 @@ static GtkWidget *linphone_gtk_create_contact_menu(GtkWidget *contact_list){
}
if (delete_hist_label){
GtkWidget *menu_item_separator=gtk_separator_menu_item_new();
gtk_widget_show(menu_item_separator);
gtk_menu_shell_append(GTK_MENU_SHELL(menu),menu_item_separator);
menu_item=gtk_image_menu_item_new_with_label(delete_hist_label);
image=gtk_image_new_from_stock(GTK_STOCK_CLEAR,GTK_ICON_SIZE_MENU);
image=gtk_image_new_from_icon_name("linphone-delete",GTK_ICON_SIZE_MENU);
gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(menu_item),image);
gtk_widget_show(image);
gtk_widget_show(menu_item);
......@@ -924,8 +905,6 @@ static GtkWidget *linphone_gtk_create_contact_menu(GtkWidget *contact_list){
gtk_menu_attach_to_widget (GTK_MENU (menu), contact_list, NULL);
g_free(add_contact_label);
if (call_label) g_free(call_label);
if (text_label) g_free(text_label);
if (edit_label) g_free(edit_label);
if (delete_label) g_free(delete_label);
return menu;
......
......@@ -15,6 +15,12 @@
<property name="can_focus">False</property>
<property name="icon_name">linphone-contact-add</property>
</object>
<object class="GtkImage" id="clear_call_history_image">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xpad">4</property>
<property name="icon_name">linphone-delete</property>
</object>
<object class="GtkImage" id="connect_image">
<property name="visible">True</property>
<property name="can_focus">False</property>
......@@ -781,11 +787,11 @@
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="erase_call_logs_button">
<property name="label">gtk-clear</property>
<property name="label" translatable="yes">Clear call history</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
<property name="image">clear_call_history_image</property>
<signal name="clicked" handler="linphone_gtk_clear_call_logs" swapped="no"/>
</object>
<packing>
......@@ -814,36 +820,43 @@
</packing>
</child>
<child type="tab">
<object class="GtkHBox" id="hbox6">
<object class="GtkEventBox" id="history_tab_eventbox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="events">GDK_BUTTON_PRESS_MASK | GDK_STRUCTURE_MASK</property>
<signal name="button-press-event" handler="linphone_gtk_call_log_reset_missed_call" swapped="no"/>
<child>
<object class="GtkImage" id="history_tab_icon">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">linphone-history</property>
<property name="icon-size">1</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="padding">4</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label3">
<object class="GtkHBox" id="history_tab_hbox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="yalign">0.49000000953674316</property>
<property name="label" translatable="yes">Recent calls</property>
<child>
<object class="GtkImage" id="history_tab_icon">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">linphone-history</property>
<property name="icon-size">1</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="padding">4</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="history_tab_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="yalign">0.49000000953674316</property>
<property name="label" translatable="yes">Recent calls</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment