mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-05-06 21:33:08 +00:00
Add shortcut for quickly accessing chatroom from the friendlist
This commit is contained in:
parent
71cf28204c
commit
323ce9f16f
3 changed files with 33 additions and 0 deletions
|
|
@ -19,6 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
#include "linphone.h"
|
||||
#include <bctoolbox/bc_vfs.h>
|
||||
#include <gdk/gdkkeysyms.h>
|
||||
|
||||
static GtkWidget *linphone_gtk_create_contact_menu(GtkWidget *contact_list);
|
||||
|
||||
|
|
@ -139,6 +140,35 @@ void linphone_gtk_remove_contact(GtkWidget *button){
|
|||
}
|
||||
}
|
||||
|
||||
gboolean linphone_gtk_on_key_press(GtkWidget *widget, GdkEvent *event, gpointer user_data) {
|
||||
|
||||
if (event->type == GDK_KEY_PRESS && ((GdkEventKey*)event)->state & GDK_CONTROL_MASK
|
||||
&& ((GdkEventKey*)event)->hardware_keycode >= 10 && ((GdkEventKey*)event)->hardware_keycode <= 19) {
|
||||
|
||||
GtkWidget *main_window = linphone_gtk_get_main_window();
|
||||
GtkWidget *friendlist = linphone_gtk_get_widget(main_window,"contact_list");
|
||||
GtkTreeModel *model = gtk_tree_view_get_model(GTK_TREE_VIEW(friendlist));
|
||||
int key = ((GdkEventKey*)event)->hardware_keycode - 10;
|
||||
GtkTreeIter iter;
|
||||
|
||||
if (gtk_tree_model_get_iter_first(model, &iter)) {
|
||||
int index = 0;
|
||||
LinphoneFriend *lf = NULL;
|
||||
do{
|
||||
if (index == key) {
|
||||
const LinphoneAddress *uri;
|
||||
gtk_tree_model_get (model, &iter,FRIEND_ID , &lf, -1);
|
||||
uri = linphone_friend_get_address(lf);
|
||||
linphone_gtk_friend_list_set_chat_conversation(uri);
|
||||
return TRUE;
|
||||
}
|
||||
index++;
|
||||
}while(gtk_tree_model_iter_next(model,&iter) && index <= 9);
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void linphone_gtk_delete_history(GtkWidget *button){
|
||||
GtkWidget *w=linphone_gtk_get_main_window();
|
||||
GtkTreeSelection *select;
|
||||
|
|
|
|||
|
|
@ -371,3 +371,5 @@ LINPHONE_PUBLIC void linphone_gtk_mark_chat_read(LinphoneChatRoom *cr);
|
|||
#ifdef __APPLE__
|
||||
LINPHONE_PUBLIC void linphone_gtk_update_badge_count();
|
||||
#endif
|
||||
|
||||
LINPHONE_PUBLIC gboolean linphone_gtk_on_key_press(GtkWidget *widget, GdkEvent *event, gpointer user_data);
|
||||
|
|
@ -2263,6 +2263,7 @@ core_start:
|
|||
the_ui=linphone_gtk_create_window("main", NULL);
|
||||
|
||||
g_object_set_data(G_OBJECT(the_ui),"is_created",GINT_TO_POINTER(FALSE));
|
||||
g_signal_connect(G_OBJECT (the_ui), "key_press_event", G_CALLBACK (linphone_gtk_on_key_press), NULL);
|
||||
|
||||
linphone_gtk_create_log_window();
|
||||
linphone_core_enable_logs_with_cb(linphone_gtk_log_handler);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue