forked from mirrors/linphone-iphone
gtk friendlist: only make call and chat button visible when clicked.
This commit is contained in:
parent
fc277b7ce0
commit
2bfcf29cb5
2 changed files with 133 additions and 49 deletions
|
|
@ -29,6 +29,8 @@ enum{
|
|||
FRIEND_CHATROOM,
|
||||
FRIEND_SIP_ADDRESS,
|
||||
FRIEND_CHAT,
|
||||
FRIEND_CALL_BUTTON,
|
||||
FRIEND_CHAT_BUTTON_VISIBLE,
|
||||
FRIEND_LIST_NCOL
|
||||
};
|
||||
|
||||
|
|
@ -181,29 +183,53 @@ static void linphone_gtk_call_selected(GtkTreeView *treeview){
|
|||
}
|
||||
|
||||
void linphone_gtk_friend_list_update_chat_picture(){
|
||||
GtkTreeIter iter;
|
||||
GtkTreeIter iter, selected_iter;
|
||||
GtkWidget *w = linphone_gtk_get_main_window();
|
||||
GtkWidget *friendlist=linphone_gtk_get_widget(w,"contact_list");
|
||||
GtkTreeModel *model=gtk_tree_view_get_model(GTK_TREE_VIEW(friendlist));
|
||||
GtkTreeSelection *select=gtk_tree_view_get_selection(GTK_TREE_VIEW(friendlist));
|
||||
LinphoneChatRoom *cr=NULL;
|
||||
bool_t is_composing;
|
||||
int nbmsg=0;
|
||||
GtkTreePath *selected_path = NULL;
|
||||
|
||||
if (gtk_tree_selection_get_selected(select, &model, &selected_iter)){
|
||||
selected_path = gtk_tree_model_get_path(model, &selected_iter);
|
||||
}
|
||||
|
||||
if (gtk_tree_model_get_iter_first(model,&iter)) {
|
||||
do{
|
||||
const char *icon_name = NULL;
|
||||
bool_t is_visible = FALSE;
|
||||
gtk_tree_model_get (model, &iter,FRIEND_CHATROOM , &cr, -1);
|
||||
|
||||
nbmsg=linphone_chat_room_get_unread_messages_count(cr);
|
||||
is_composing=linphone_chat_room_is_remote_composing(cr);
|
||||
if(nbmsg != 0){
|
||||
if (is_composing == TRUE) icon_name = "linphone-chat-new-message-and-writing";
|
||||
else icon_name = "linphone-chat-new-message";
|
||||
is_visible = TRUE;
|
||||
} else {
|
||||
if (is_composing == TRUE) icon_name = "linphone-chat-writing";
|
||||
else icon_name = "linphone-chat-nothing";
|
||||
if (is_composing == TRUE) {
|
||||
icon_name = "linphone-chat-writing";
|
||||
is_visible = TRUE;
|
||||
}
|
||||
else {
|
||||
icon_name = "linphone-chat-nothing";
|
||||
if (selected_path){
|
||||
GtkTreePath *path = gtk_tree_model_get_path(model, &iter);
|
||||
if (gtk_tree_path_compare(path, selected_path) == 0){
|
||||
is_visible = TRUE;
|
||||
}
|
||||
gtk_tree_path_free(path);
|
||||
}
|
||||
}
|
||||
}
|
||||
gtk_list_store_set(GTK_LIST_STORE(model),&iter,FRIEND_CHAT,icon_name,-1);
|
||||
gtk_list_store_set(GTK_LIST_STORE(model),&iter,FRIEND_CHAT,icon_name,
|
||||
FRIEND_CHAT_BUTTON_VISIBLE, is_visible, -1);
|
||||
}while(gtk_tree_model_iter_next(model,&iter));
|
||||
}
|
||||
if (selected_path) gtk_tree_path_free(selected_path);
|
||||
}
|
||||
|
||||
static gboolean grab_focus(GtkWidget *w){
|
||||
|
|
@ -333,16 +359,34 @@ void linphone_gtk_chat_selected(GtkWidget *item){
|
|||
}
|
||||
}
|
||||
|
||||
void linphone_gtk_contact_activated(GtkTreeView *treeview,
|
||||
|
||||
void linphone_gtk_contact_activated(GtkTreeView *friendlist,
|
||||
GtkTreePath *path,
|
||||
GtkTreeViewColumn *column,
|
||||
gpointer user_data)
|
||||
{
|
||||
//linphone_gtk_call_selected(treeview);
|
||||
gpointer user_data){
|
||||
}
|
||||
|
||||
static void linphone_gtk_enable_buttons_for_selection(GtkTreeView *friendlist){
|
||||
GtkTreeSelection *select=gtk_tree_view_get_selection(GTK_TREE_VIEW(friendlist));
|
||||
GtkListStore * store=GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(friendlist)));
|
||||
GtkTreeIter iter;
|
||||
GtkTreeModel *model = gtk_tree_view_get_model(GTK_TREE_VIEW(friendlist));
|
||||
|
||||
if (gtk_tree_model_get_iter_first(model, &iter)){
|
||||
do{
|
||||
gtk_list_store_set(store, &iter, FRIEND_CALL_BUTTON, FALSE, -1);
|
||||
}while (gtk_tree_model_iter_next(model, &iter));
|
||||
}
|
||||
|
||||
if (gtk_tree_selection_get_selected (select, &model, &iter)){
|
||||
gtk_list_store_set(store, &iter, FRIEND_CALL_BUTTON, TRUE, -1);
|
||||
}
|
||||
linphone_gtk_friend_list_update_chat_picture();
|
||||
}
|
||||
|
||||
void linphone_gtk_contact_clicked(GtkTreeView *treeview){
|
||||
linphone_gtk_set_selection_to_uri_bar(treeview);
|
||||
linphone_gtk_enable_buttons_for_selection(treeview);
|
||||
if(GPOINTER_TO_INT(g_object_get_data(G_OBJECT(treeview),"numcol"))==1){
|
||||
linphone_gtk_call_selected(treeview);
|
||||
} else {
|
||||
|
|
|
|||
122
gtk/main.ui
122
gtk/main.ui
|
|
@ -38,6 +38,10 @@
|
|||
<column type="gchararray"/>
|
||||
<!-- column-name chat_icon -->
|
||||
<column type="gchararray"/>
|
||||
<!-- column-name call_button_visible -->
|
||||
<column type="gboolean"/>
|
||||
<!-- column-name chat_button_visible -->
|
||||
<column type="gboolean"/>
|
||||
</columns>
|
||||
<data>
|
||||
<row>
|
||||
|
|
@ -45,18 +49,24 @@
|
|||
<col id="1">Toto</col>
|
||||
<col id="4">toto@sip.linphone.org</col>
|
||||
<col id="5">linphone-chat-nothing</col>
|
||||
<col id="6">False</col>
|
||||
<col id="7">False</col>
|
||||
</row>
|
||||
<row>
|
||||
<col id="0">linphone-status-offline</col>
|
||||
<col id="1">Toto2</col>
|
||||
<col id="4">toto2@sip.linphone.org</col>
|
||||
<col id="5">linphone-chat-nothing</col>
|
||||
<col id="6">False</col>
|
||||
<col id="7">False</col>
|
||||
</row>
|
||||
<row>
|
||||
<col id="0">linphone-status-offline</col>
|
||||
<col id="1">Toto3</col>
|
||||
<col id="4">toto3@sip.linphone.org</col>
|
||||
<col id="5">linphone-chat-nothing</col>
|
||||
<col id="6">False</col>
|
||||
<col id="7">False</col>
|
||||
</row>
|
||||
</data>
|
||||
</object>
|
||||
|
|
@ -85,47 +95,6 @@
|
|||
<property name="can_focus">False</property>
|
||||
<property name="stock">gtk-info</property>
|
||||
</object>
|
||||
<object class="GtkListStore" id="model3">
|
||||
<columns>
|
||||
<!-- column-name gchararray -->
|
||||
<column type="gchararray"/>
|
||||
</columns>
|
||||
<data>
|
||||
<row>
|
||||
<col id="0" translatable="yes">Default</col>
|
||||
</row>
|
||||
</data>
|
||||
</object>
|
||||
<object class="GtkImage" id="properties_image">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="yalign">0.49000000953674316</property>
|
||||
<property name="stock">gtk-properties</property>
|
||||
</object>
|
||||
<object class="GtkImage" id="remove_image">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="tooltip_text" translatable="yes">Delete</property>
|
||||
<property name="stock">gtk-remove</property>
|
||||
</object>
|
||||
<object class="GtkImage" id="remove_image1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="tooltip_text" translatable="yes">Delete</property>
|
||||
<property name="stock">gtk-remove</property>
|
||||
</object>
|
||||
<object class="GtkImage" id="start_call_image">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="pixel_size">32</property>
|
||||
<property name="icon_name">linphone-start-call</property>
|
||||
</object>
|
||||
<object class="GtkImage" id="start_chat_image">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="pixel_size">32</property>
|
||||
<property name="icon_name">linphone-start-chat</property>
|
||||
</object>
|
||||
<object class="GtkWindow" id="main">
|
||||
<property name="width_request">640</property>
|
||||
<property name="height_request">480</property>
|
||||
|
|
@ -146,6 +115,7 @@
|
|||
<object class="GtkMenuItem" id="options_menu">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="label" translatable="yes">_Options</property>
|
||||
<property name="use_underline">True</property>
|
||||
<signal name="activate" handler="linphone_gtk_options_activate" swapped="no"/>
|
||||
|
|
@ -158,6 +128,7 @@
|
|||
<property name="label">gtk-preferences</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="use_stock">True</property>
|
||||
<signal name="activate" handler="linphone_gtk_show_parameters" swapped="no"/>
|
||||
|
|
@ -167,6 +138,7 @@
|
|||
<object class="GtkMenuItem" id="provisionning_item">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="label" translatable="yes">Set configuration URI</property>
|
||||
<property name="use_underline">True</property>
|
||||
<signal name="activate" handler="linphone_gtk_set_configuration_uri" swapped="no"/>
|
||||
|
|
@ -176,6 +148,7 @@
|
|||
<object class="GtkImageMenuItem" id="disconnect_item">
|
||||
<property name="label">gtk-disconnect</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="use_stock">True</property>
|
||||
<signal name="activate" handler="linphone_gtk_logout_clicked" swapped="no"/>
|
||||
|
|
@ -191,6 +164,7 @@
|
|||
<object class="GtkCheckMenuItem" id="enable_video_item">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="label" translatable="yes">Always start video</property>
|
||||
<property name="use_underline">True</property>
|
||||
<signal name="toggled" handler="linphone_gtk_enable_video" swapped="no"/>
|
||||
|
|
@ -200,6 +174,7 @@
|
|||
<object class="GtkCheckMenuItem" id="selfview_item">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="label" translatable="yes">Enable self-view</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="active">True</property>
|
||||
|
|
@ -210,6 +185,7 @@
|
|||
<object class="GtkCheckMenuItem" id="show_keypad_menu_item">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="label" translatable="yes">Show keypad</property>
|
||||
<property name="use_underline">True</property>
|
||||
<signal name="toggled" handler="linphone_gtk_show_keypad_checked" swapped="no"/>
|
||||
|
|
@ -225,6 +201,7 @@
|
|||
<object class="GtkImageMenuItem" id="quit_item">
|
||||
<property name="label">gtk-quit</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="use_stock">True</property>
|
||||
<signal name="activate" handler="gtk_main_quit" swapped="no"/>
|
||||
|
|
@ -238,6 +215,7 @@
|
|||
<object class="GtkMenuItem" id="menuitem4">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="label" translatable="yes">_Help</property>
|
||||
<property name="use_underline">True</property>
|
||||
<child type="submenu">
|
||||
|
|
@ -249,6 +227,7 @@
|
|||
<property name="label">gtk-about</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="use_stock">True</property>
|
||||
<signal name="activate" handler="linphone_gtk_show_about" swapped="no"/>
|
||||
|
|
@ -259,6 +238,7 @@
|
|||
<property name="label" translatable="yes">Show debug window</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="image">info_image</property>
|
||||
<property name="use_stock">False</property>
|
||||
<signal name="activate" handler="linphone_gtk_log_show" swapped="no"/>
|
||||
|
|
@ -269,6 +249,7 @@
|
|||
<property name="label" translatable="yes">_Homepage</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="image">home_image</property>
|
||||
<property name="use_stock">False</property>
|
||||
|
|
@ -279,6 +260,7 @@
|
|||
<object class="GtkImageMenuItem" id="versioncheck_item">
|
||||
<property name="label" translatable="yes">Check _Updates</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="image">execute_image</property>
|
||||
<property name="use_stock">False</property>
|
||||
|
|
@ -289,6 +271,7 @@
|
|||
<object class="GtkImageMenuItem" id="assistant_item">
|
||||
<property name="label" translatable="yes">Account assistant</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="image">connect_image</property>
|
||||
<property name="use_stock">False</property>
|
||||
<signal name="activate" handler="linphone_gtk_show_assistant" swapped="no"/>
|
||||
|
|
@ -299,6 +282,7 @@
|
|||
<property name="label" translatable="yes">Audio assistant</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="image">properties_image</property>
|
||||
<property name="use_stock">False</property>
|
||||
<signal name="activate" handler="linphone_gtk_show_audio_assistant" swapped="no"/>
|
||||
|
|
@ -388,6 +372,7 @@
|
|||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="tooltip_text" translatable="yes">Initiate a new call</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="image">add_call_image</property>
|
||||
<signal name="clicked" handler="linphone_gtk_start_call" swapped="no"/>
|
||||
</object>
|
||||
|
|
@ -402,6 +387,7 @@
|
|||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="image">start_call_image</property>
|
||||
<signal name="clicked" handler="linphone_gtk_start_call" swapped="no"/>
|
||||
</object>
|
||||
|
|
@ -416,6 +402,7 @@
|
|||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="image">start_chat_image</property>
|
||||
<signal name="clicked" handler="linphone_gtk_start_chat" swapped="no"/>
|
||||
</object>
|
||||
|
|
@ -512,6 +499,9 @@
|
|||
<property name="icon_name">linphone-start-call2</property>
|
||||
<property name="stock_size">3</property>
|
||||
</object>
|
||||
<attributes>
|
||||
<attribute name="visible">6</attribute>
|
||||
</attributes>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
|
|
@ -522,6 +512,7 @@
|
|||
<property name="stock_size">3</property>
|
||||
</object>
|
||||
<attributes>
|
||||
<attribute name="visible">7</attribute>
|
||||
<attribute name="icon-name">5</attribute>
|
||||
</attributes>
|
||||
</child>
|
||||
|
|
@ -547,6 +538,7 @@
|
|||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="resize_mode">immediate</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="image">add_image1</property>
|
||||
<property name="xalign">1</property>
|
||||
<signal name="clicked" handler="linphone_gtk_add_button_clicked" swapped="no"/>
|
||||
|
|
@ -562,6 +554,7 @@
|
|||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="image">edit_image1</property>
|
||||
<signal name="clicked" handler="linphone_gtk_edit_button_clicked" swapped="no"/>
|
||||
</object>
|
||||
|
|
@ -576,6 +569,7 @@
|
|||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="image">remove_image1</property>
|
||||
<signal name="clicked" handler="linphone_gtk_remove_button_clicked" swapped="no"/>
|
||||
</object>
|
||||
|
|
@ -674,6 +668,7 @@
|
|||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="relief">none</property>
|
||||
<signal name="clicked" handler="linphone_gtk_directory_search_button_clicked" swapped="no"/>
|
||||
<child>
|
||||
|
|
@ -740,6 +735,7 @@
|
|||
<property name="label" translatable="yes">Add contact</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<signal name="clicked" handler="linphone_gtk_add_contact" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
|
|
@ -773,6 +769,7 @@
|
|||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="use_stock">True</property>
|
||||
<signal name="clicked" handler="linphone_gtk_clear_call_logs" swapped="no"/>
|
||||
</object>
|
||||
|
|
@ -894,6 +891,7 @@
|
|||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="relief">none</property>
|
||||
<signal name="clicked" handler="linphone_gtk_my_presence_clicked" swapped="no"/>
|
||||
</object>
|
||||
|
|
@ -930,6 +928,7 @@
|
|||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="relief">none</property>
|
||||
<signal name="clicked" handler="on_proxy_refresh_button_clicked" swapped="no"/>
|
||||
</object>
|
||||
|
|
@ -971,4 +970,45 @@
|
|||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<object class="GtkListStore" id="model3">
|
||||
<columns>
|
||||
<!-- column-name gchararray -->
|
||||
<column type="gchararray"/>
|
||||
</columns>
|
||||
<data>
|
||||
<row>
|
||||
<col id="0" translatable="yes">Default</col>
|
||||
</row>
|
||||
</data>
|
||||
</object>
|
||||
<object class="GtkImage" id="properties_image">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="yalign">0.49000000953674316</property>
|
||||
<property name="stock">gtk-properties</property>
|
||||
</object>
|
||||
<object class="GtkImage" id="remove_image">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="tooltip_text" translatable="yes">Delete</property>
|
||||
<property name="stock">gtk-remove</property>
|
||||
</object>
|
||||
<object class="GtkImage" id="remove_image1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="tooltip_text" translatable="yes">Delete</property>
|
||||
<property name="stock">gtk-remove</property>
|
||||
</object>
|
||||
<object class="GtkImage" id="start_call_image">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="pixel_size">32</property>
|
||||
<property name="icon_name">linphone-start-call</property>
|
||||
</object>
|
||||
<object class="GtkImage" id="start_chat_image">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="pixel_size">32</property>
|
||||
<property name="icon_name">linphone-start-chat</property>
|
||||
</object>
|
||||
</interface>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue