Mercurial > pidgin.yaz
changeset 12912:5f3d5f30590a
[gaim-migrate @ 15265]
SF Patch #1407968 from Sadrul
Fixes SF Bug #1407678
Essentially, if you reordered tabs in the window, the gestures would move
you to the wrong tab. The plugin's concept of the ordering didn't update.
committer: Tailor Script <tailor@pidgin.im>
author | Richard Laager <rlaager@wiktel.com> |
---|---|
date | Tue, 17 Jan 2006 15:43:55 +0000 |
parents | 14a103c0e4d5 |
children | b1bc87b15818 |
files | plugins/gestures/gestures.c |
diffstat | 1 files changed, 27 insertions(+), 36 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/gestures/gestures.c Tue Jan 17 06:37:43 2006 +0000 +++ b/plugins/gestures/gestures.c Tue Jan 17 15:43:55 2006 +0000 @@ -53,34 +53,42 @@ } static void +switch_page(GaimGtkWindow *win, GtkDirectionType dir) +{ + int count, current; + +#if GTK_CHECK_VERSION(2,2,0) + count = gtk_notebook_get_n_pages(GTK_NOTEBOOK(win->notebook)); +#else + count = g_list_length(GTK_NOTEBOOK(win->notebook)->children); +#endif + current = gtk_notebook_get_current_page(GTK_NOTEBOOK(win->notebook)); + + if (dir == GTK_DIR_LEFT) + { + gtk_notebook_set_current_page(GTK_NOTEBOOK(win->notebook), current - 1); + } + else if (dir == GTK_DIR_RIGHT) + { + if (current == count - 1) + gtk_notebook_set_current_page(GTK_NOTEBOOK(win->notebook), 0); + else + gtk_notebook_set_current_page(GTK_NOTEBOOK(win->notebook), current + 1); + } +} + +static void stroke_prev_tab(GtkWidget *widget, void *data) { GaimConversation *conv; GaimGtkConversation *gtkconv; GaimGtkWindow *win; - GList *conversations; conv = (GaimConversation *)data; gtkconv = GAIM_GTK_CONVERSATION(conv); win = gtkconv->win; - for (conversations = win->gtkconvs; - conversations != NULL; - conversations = conversations->next) - { - if (conversations->data == gtkconv) - { - if (conversations->prev != NULL) { - gaim_gtk_conv_window_switch_gtkconv(win, - conversations->prev->data); - } else { - gaim_gtk_conv_window_switch_gtkconv(win, - g_list_last(conversations)->data); - } - - return; - } - } + switch_page(win, GTK_DIR_LEFT); } static void @@ -88,28 +96,11 @@ { GaimConversation *conv; GaimGtkWindow *win; - GList *conversations; conv = (GaimConversation *)data; win = GAIM_GTK_CONVERSATION(conv)->win; - for (conversations = win->gtkconvs; - conversations != NULL; - conversations = conversations->next) - { - if (((GaimGtkConversation *)conversations->data)->active_conv == conv) - { - if (conversations->next != NULL) { - gaim_gtk_conv_window_switch_gtkconv(win, - conversations->next->data); - } else { - gaim_gtk_conv_window_switch_gtkconv(win, - g_list_first(conversations)->data); - } - - return; - } - } + switch_page(win, GTK_DIR_RIGHT); } static void