# HG changeset patch # User Christian Hammond # Date 1081147922 0 # Node ID d7c85220c685caecc67b5bb3114dcc63a1f0b41c # Parent 2714e30991dbdc9b6e4eadfe05a152b49d1a8d9d [gaim-migrate @ 9332] Added a conversation-drag-ended signal. Patch by Etan Reisner. committer: Tailor Script diff -r 2714e30991db -r d7c85220c685 ChangeLog --- a/ChangeLog Mon Apr 05 06:47:54 2004 +0000 +++ b/ChangeLog Mon Apr 05 06:52:02 2004 +0000 @@ -3,6 +3,7 @@ version 0.77cvs New Features: * The System Log returns (Ka-Hing Cheung) + * Added a conversation-drag-ended signal (Etan Reisner) Bug Fixes: * Save Conversation works again (Kevin Stange) diff -r 2714e30991db -r d7c85220c685 src/gtkconv.c --- a/src/gtkconv.c Mon Apr 05 06:47:54 2004 +0000 +++ b/src/gtkconv.c Mon Apr 05 06:52:02 2004 +0000 @@ -1893,62 +1893,61 @@ if (gaim_conv_window_get_conversation_count(win) > 1) { /* Make a new window to stick this to. */ - GaimConvWindow *new_win; - GaimGtkWindow *new_gtkwin; GaimGtkConversation *gtkconv; gint win_width, win_height; gtkconv = GAIM_GTK_CONVERSATION(conv); - new_win = gaim_conv_window_new(); - - gaim_conv_window_add_conversation(new_win, + dest_win = gaim_conv_window_new(); + + gaim_conv_window_add_conversation(dest_win, gaim_conv_window_remove_conversation(win, gaim_conversation_get_index(conv))); - new_gtkwin = GAIM_GTK_WINDOW(new_win); - - gtk_window_get_size(GTK_WINDOW(new_gtkwin->window), + dest_gtkwin = GAIM_GTK_WINDOW(dest_win); + + gtk_window_get_size(GTK_WINDOW(dest_gtkwin->window), &win_width, &win_height); - gtk_window_move(GTK_WINDOW(new_gtkwin->window), + gtk_window_move(GTK_WINDOW(dest_gtkwin->window), e->x_root - (win_width / 2), e->y_root - (win_height / 2)); - gaim_conv_window_show(new_win); + gaim_conv_window_show(dest_win); + } + } else { + dest_gtkwin = GAIM_GTK_WINDOW(dest_win); + + /* Get the destination notebook. */ + dest_notebook = GTK_NOTEBOOK(gtkwin->notebook); + + /* Get the destination page number. */ + dest_page_num = gaim_gtkconv_get_dest_tab_at_xy(dest_win, + e->x_root, e->y_root); + + if (win == dest_win) { + gaim_conv_window_move_conversation(win, + gaim_conversation_get_index(conv), dest_page_num); } - - return TRUE; + else { + size_t pos; + + gaim_conv_window_remove_conversation(win, + gaim_conversation_get_index(conv)); + + pos = gaim_conv_window_add_conversation(dest_win, conv); + + if (pos != dest_page_num) + gaim_conv_window_move_conversation(dest_win, pos, dest_page_num); + + gaim_conv_window_switch_conversation(dest_win, dest_page_num); + } + + gtk_widget_grab_focus(GAIM_GTK_CONVERSATION(conv)->entry); } - dest_gtkwin = GAIM_GTK_WINDOW(dest_win); - - /* Get the destination notebook. */ - dest_notebook = GTK_NOTEBOOK(gtkwin->notebook); - - /* Get the destination page number. */ - dest_page_num = gaim_gtkconv_get_dest_tab_at_xy(dest_win, - e->x_root, e->y_root); - - if (win == dest_win) { - gaim_conv_window_move_conversation(win, - gaim_conversation_get_index(conv), dest_page_num); - } - else { - size_t pos; - - gaim_conv_window_remove_conversation(win, - gaim_conversation_get_index(conv)); - - pos = gaim_conv_window_add_conversation(dest_win, conv); - - if (pos != dest_page_num) - gaim_conv_window_move_conversation(dest_win, pos, dest_page_num); - - gaim_conv_window_switch_conversation(dest_win, dest_page_num); - } - - gtk_widget_grab_focus(GAIM_GTK_CONVERSATION(conv)->entry); + gaim_signal_emit(gaim_gtk_conversations_get_handle(), "conversation-drag-ended", + win, dest_win); return TRUE; } @@ -5728,9 +5727,19 @@ gaim_conv_placement_set_current_func(func); } +void * +gaim_gtk_conversations_get_handle(void) +{ + static int handle; + + return &handle; +} + void gaim_gtk_conversations_init(void) { + void *handle = gaim_gtk_conversations_get_handle(); + /* Conversations */ gaim_prefs_add_none("/gaim/gtk/conversations"); gaim_prefs_add_bool("/gaim/gtk/conversations/icons_on_tabs", TRUE); @@ -5828,4 +5837,20 @@ /* Chat callbacks */ gaim_prefs_connect_callback("/gaim/gtk/conversations/chat/button_type", chat_button_type_pref_cb, NULL); + + /********************************************************************** + * Register signals + **********************************************************************/ + gaim_signal_register(handle, "conversation-drag-ended", + gaim_marshal_VOID__POINTER_POINTER, NULL, 2, + gaim_value_new(GAIM_TYPE_SUBTYPE, + GAIM_SUBTYPE_CONV_WINDOW), + gaim_value_new(GAIM_TYPE_SUBTYPE, + GAIM_SUBTYPE_CONV_WINDOW)); } + +void +gaim_gtk_conversations_uninit(void) +{ + gaim_signals_unregister_by_instance(gaim_gtk_conversations_get_handle()); +} diff -r 2714e30991db -r d7c85220c685 src/gtkconv.h --- a/src/gtkconv.h Mon Apr 05 06:47:54 2004 +0000 +++ b/src/gtkconv.h Mon Apr 05 06:52:02 2004 +0000 @@ -198,11 +198,6 @@ /*@{*/ /** - * Initializes the GTK+ conversation system. - */ -void gaim_gtk_conversations_init(void); - -/** * Returns the UI operations structure for GTK windows. * * @return The GTK window operations structure. @@ -310,4 +305,28 @@ /*@}*/ +/**************************************************************************/ +/** @name GTK+ Conversations Subsystem */ +/**************************************************************************/ +/*@{*/ + +/** + * Returns the gtk conversations subsystem handle. + * + * @return The conversations subsystem handle. + */ +void *gaim_gtk_conversations_get_handle(void); + +/** + * Initializes the GTK+ conversations subsystem. + */ +void gaim_gtk_conversations_init(void); + +/** + * Uninitialized the GTK+ conversation subsystem. + */ +void gaim_gtk_conversations_uninit(void); + +/*@}*/ + #endif /* _GAIM_GTK_CONVERSATION_H_ */