pidgin/gtkblist.c

changeset 38711
76aea257b1c6
parent 38707
6f4d3ab2f2ed
child 38712
ea49cd76cf47
equal deleted inserted replaced
38710:32c5e0e741e1 38711:76aea257b1c6
1866 } 1866 }
1867 return menu; 1867 return menu;
1868 } 1868 }
1869 1869
1870 static gboolean 1870 static gboolean
1871 pidgin_blist_show_context_menu(PurpleBlistNode *node, GdkEvent *event) 1871 pidgin_blist_show_context_menu(GtkWidget *tv, PurpleBlistNode *node, GdkEvent *event)
1872 { 1872 {
1873 struct _pidgin_blist_node *gtknode = purple_blist_node_get_ui_data(node); 1873 struct _pidgin_blist_node *gtknode = purple_blist_node_get_ui_data(node);
1874 GtkWidget *menu = NULL; 1874 GtkWidget *menu = NULL;
1875 gboolean handled = FALSE; 1875 gboolean handled = FALSE;
1876 1876
1909 #endif 1909 #endif
1910 1910
1911 /* Now display the menu */ 1911 /* Now display the menu */
1912 if (menu != NULL) { 1912 if (menu != NULL) {
1913 gtk_widget_show_all(menu); 1913 gtk_widget_show_all(menu);
1914 gtk_menu_popup_at_pointer(GTK_MENU(menu), event); 1914 if (event != NULL) {
1915 /* Pointer event */
1916 gtk_menu_popup_at_pointer(GTK_MENU(menu), event);
1917 } else {
1918 /* Keyboard event */
1919 pidgin_menu_popup_at_treeview_selection(menu, tv);
1920 }
1915 handled = TRUE; 1921 handled = TRUE;
1916 } 1922 }
1917 1923
1918 return handled; 1924 return handled;
1919 } 1925 }
1936 gtk_tree_model_get(GTK_TREE_MODEL(gtkblist->treemodel), &iter, NODE_COLUMN, &node, -1); 1942 gtk_tree_model_get(GTK_TREE_MODEL(gtkblist->treemodel), &iter, NODE_COLUMN, &node, -1);
1937 gtknode = purple_blist_node_get_ui_data(node); 1943 gtknode = purple_blist_node_get_ui_data(node);
1938 1944
1939 /* Right click draws a context menu */ 1945 /* Right click draws a context menu */
1940 if (gdk_event_triggers_context_menu((GdkEvent *)event)) { 1946 if (gdk_event_triggers_context_menu((GdkEvent *)event)) {
1941 handled = pidgin_blist_show_context_menu(node, (GdkEvent *)event); 1947 handled = pidgin_blist_show_context_menu(tv, node, (GdkEvent *)event);
1942 1948
1943 /* CTRL+middle click expands or collapse a contact */ 1949 /* CTRL+middle click expands or collapse a contact */
1944 } else if ((event->button == 2) && (event->type == GDK_BUTTON_PRESS) && 1950 } else if ((event->button == 2) && (event->type == GDK_BUTTON_PRESS) &&
1945 (event->state & GDK_CONTROL_MASK) && (PURPLE_IS_CONTACT(node))) { 1951 (event->state & GDK_CONTROL_MASK) && (PURPLE_IS_CONTACT(node))) {
1946 if (gtknode->contact_expanded) 1952 if (gtknode->contact_expanded)
1999 return FALSE; 2005 return FALSE;
2000 2006
2001 gtk_tree_model_get(GTK_TREE_MODEL(gtkblist->treemodel), &iter, NODE_COLUMN, &node, -1); 2007 gtk_tree_model_get(GTK_TREE_MODEL(gtkblist->treemodel), &iter, NODE_COLUMN, &node, -1);
2002 2008
2003 /* Shift+F10 draws a context menu */ 2009 /* Shift+F10 draws a context menu */
2004 handled = pidgin_blist_show_context_menu(node, NULL); 2010 handled = pidgin_blist_show_context_menu(tv, node, NULL);
2005 2011
2006 return handled; 2012 return handled;
2007 } 2013 }
2008 2014
2009 static void gtk_blist_show_xfer_dialog_cb(GtkAction *item, gpointer data) 2015 static void gtk_blist_show_xfer_dialog_cb(GtkAction *item, gpointer data)
7482 7488
7483 gtknode->recent_signonoff = TRUE; 7489 gtknode->recent_signonoff = TRUE;
7484 7490
7485 if(gtknode->recent_signonoff_timer > 0) 7491 if(gtknode->recent_signonoff_timer > 0)
7486 g_source_remove(gtknode->recent_signonoff_timer); 7492 g_source_remove(gtknode->recent_signonoff_timer);
7487 7493
7488 g_object_ref(buddy); 7494 g_object_ref(buddy);
7489 gtknode->recent_signonoff_timer = g_timeout_add_seconds(10, 7495 gtknode->recent_signonoff_timer = g_timeout_add_seconds(10,
7490 (GSourceFunc)buddy_signonoff_timeout_cb, buddy); 7496 (GSourceFunc)buddy_signonoff_timeout_cb, buddy);
7491 } 7497 }
7492 7498

mercurial