From: Tim R. <ma...@us...> - 2005-10-02 22:38:21
|
Update of /cvsroot/gaim/gaim/plugins In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27172/plugins Modified Files: Makefile.am extplacement.c notify.c Log Message: goodbye GaimConvWindow. Still some problems with this patch: - Scarey warnings console with gaim -d when closing tab - I tried to seperate gtkconv and gtkconvwin, but failed, as a result it has its own header, but the code is in the same file, which is rather weird. Also some code got moved around for no good reason. Feel free to move it back or reorganize it. - I broke the gesters plugin, and just disabled it. Hopefully someone with more time will fix it, it shouldn't take long, but I didn't feel like bothering. - This list is incomplete. Index: Makefile.am =================================================================== RCS file: /cvsroot/gaim/gaim/plugins/Makefile.am,v retrieving revision 1.108 retrieving revision 1.109 diff -u -d -p -r1.108 -r1.109 --- Makefile.am 4 Sep 2005 02:03:46 -0000 1.108 +++ Makefile.am 2 Oct 2005 00:32:48 -0000 1.109 @@ -20,7 +20,7 @@ MUSICMESSAGING_DIR = musicmessaging endif SUBDIRS = \ - docklet $(GEVOLUTION_DIR) gestures \ + docklet $(GEVOLUTION_DIR) \ $(PERL_DIR) ssl $(TCL_DIR) ticker \ $(MUSICMESSAGING_DIR) Index: extplacement.c =================================================================== RCS file: /cvsroot/gaim/gaim/plugins/extplacement.c,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -p -r1.8 -r1.9 --- extplacement.c 3 Sep 2004 21:21:20 -0000 1.8 +++ extplacement.c 2 Oct 2005 00:32:48 -0000 1.9 @@ -25,48 +25,50 @@ #include "conversation.h" #include "version.h" #include "gtkplugin.h" +#include "gtkconv.h" +#include "gtkconvwin.h" static void -conv_placement_by_number(GaimConversation *conv) +conv_placement_by_number(GaimGtkConversation *conv) { - GaimConvWindow *win = NULL; + GaimGtkWindow *win = NULL; if (gaim_prefs_get_bool("/plugins/gtk/extplacement/placement_number_separate")) - win = gaim_get_last_window_with_type(gaim_conversation_get_type(conv)); + win = gaim_gtk_conv_window_last_with_type(gaim_conversation_get_type(conv->active_conv)); else - win = g_list_last(gaim_get_windows())->data; + win = g_list_last(gaim_gtk_conv_windows_get_list())->data; if (win == NULL) { - win = gaim_conv_window_new(); + win = gaim_gtk_conv_window_new(); - gaim_conv_window_add_conversation(win, conv); - gaim_conv_window_show(win); + gaim_gtk_conv_window_add_gtkconv(win, conv); + gaim_gtk_conv_window_show(win); } else { int max_count = gaim_prefs_get_int("/plugins/gtk/extplacement/placement_number"); - int count = gaim_conv_window_get_conversation_count(win); + int count = gaim_gtk_conv_window_get_gtkconv_count(win); if (count < max_count) - gaim_conv_window_add_conversation(win, conv); + gaim_gtk_conv_window_add_gtkconv(win, conv); else { GList *l = NULL; - for (l = gaim_get_windows(); l != NULL; l = l->next) { - win = (GaimConvWindow *)l->data; + for (l = gaim_gtk_conv_windows_get_list(); l != NULL; l = l->next) { + win = l->data; if (gaim_prefs_get_bool("/plugins/gtk/extplacement/placement_number_separate") && - gaim_conversation_get_type(gaim_conv_window_get_active_conversation(win)) != gaim_conversation_get_type(conv)) + gaim_conversation_get_type(gaim_gtk_conv_window_get_active_conversation(win)) != gaim_conversation_get_type(conv->active_conv)) continue; - count = gaim_conv_window_get_conversation_count(win); + count = gaim_gtk_conv_window_get_gtkconv_count(win); if (count < max_count) { - gaim_conv_window_add_conversation(win, conv); + gaim_gtk_conv_window_add_gtkconv(win, conv); return; } } - win = gaim_conv_window_new(); + win = gaim_gtk_conv_window_new(); - gaim_conv_window_add_conversation(win, conv); - gaim_conv_window_show(win); + gaim_gtk_conv_window_add_gtkconv(win, conv); + gaim_gtk_conv_window_show(win); } } } @@ -74,7 +76,7 @@ conv_placement_by_number(GaimConversatio static gboolean plugin_load(GaimPlugin *plugin) { - gaim_conv_placement_add_fnc("number", _("By conversation count"), + gaim_gtkconv_placement_add_fnc("number", _("By conversation count"), &conv_placement_by_number); gaim_prefs_trigger_callback("/gaim/gtk/conversations/placement"); return TRUE; @@ -83,7 +85,7 @@ plugin_load(GaimPlugin *plugin) static gboolean plugin_unload(GaimPlugin *plugin) { - gaim_conv_placement_remove_fnc("number"); + gaim_gtkconv_placement_remove_fnc("number"); gaim_prefs_trigger_callback("/gaim/gtk/conversations/placement"); return TRUE; } Index: notify.c =================================================================== RCS file: /cvsroot/gaim/gaim/plugins/notify.c,v retrieving revision 1.65 retrieving revision 1.66 diff -u -d -p -r1.65 -r1.66 --- notify.c 5 Sep 2005 05:38:10 -0000 1.65 +++ notify.c 2 Oct 2005 00:32:48 -0000 1.66 @@ -40,7 +40,7 @@ * blank or something. * 22:23:53 <deryni> Also I think gaim might re-set that sort of frequently, * but I'd have to look. - * 22:25:16 <seanegan> deryni: I keep my conversations in one workspace and am + * 22:25:16 <seanegan> deryni: I keep my conversations in one workspace and am * frequently in an another, and the icon flashing in the pager would be a * neat visual clue. */ @@ -97,6 +97,7 @@ #include "prefs.h" #include "signals.h" #include "version.h" +#include "debug.h" #include "gtkplugin.h" #include "gtkutils.h" @@ -111,7 +112,7 @@ static GaimPlugin *my_plugin = NULL; /* notification set/unset */ static int notify(GaimConversation *conv, gboolean increment); -static void notify_win(GaimConvWindow *gaimwin); +static void notify_win(GaimGtkWindow *gaimwin); static void unnotify(GaimConversation *conv, gboolean reset); static int unnotify_cb(GtkWidget *widget, gpointer data, GaimConversation *conv); @@ -124,30 +125,31 @@ static void apply_method(); static void apply_notify(); /* string function */ -static void handle_string(GaimConvWindow *gaimwin); +static void handle_string(GaimGtkWindow *gaimwin); /* count function */ -static void handle_count(GaimConvWindow *gaimwin); +static void handle_count(GaimGtkWindow *gaimwin); /* urgent function */ -static void handle_urgent(GaimConvWindow *gaimwin, gboolean add); +static void handle_urgent(GaimGtkWindow *gaimwin, gboolean add); /* raise function */ -static void handle_raise(GaimConvWindow *gaimwin); +static void handle_raise(GaimGtkWindow *gaimwin); /****************************************/ /* Begin doing stuff below this line... */ /****************************************/ static int -count_messages(GaimConvWindow *gaimwin) +count_messages(GaimGtkWindow *gaimwin) { gint count = 0; - GList *convs = NULL; + GList *convs = NULL, *l; - for (convs = gaim_conv_window_get_conversations(gaimwin); - convs != NULL; convs = convs->next) { - GaimConversation *conv = convs->data; - count += GPOINTER_TO_INT(gaim_conversation_get_data(conv, "notify-message-count")); + for (convs = gaimwin->gtkconvs; convs != NULL; convs = convs->next) { + GaimGtkConversation *conv = convs->data; + for (l = conv->convs; l != NULL; l = l->next) { + count += GPOINTER_TO_INT(gaim_conversation_get_data(l->data, "notify-message-count")); + } } return count; @@ -156,7 +158,7 @@ count_messages(GaimConvWindow *gaimwin) static int notify(GaimConversation *conv, gboolean increment) { - GaimConvWindow *gaimwin = NULL; + GaimGtkWindow *gaimwin = NULL; gint count; gboolean has_focus; @@ -166,7 +168,7 @@ notify(GaimConversation *conv, gboolean /* We want to remove the notifications, but not reset the counter */ unnotify(conv, FALSE); - gaimwin = gaim_conversation_get_window(conv); + gaimwin = GAIM_GTK_CONVERSATION(conv)->win; /* If we aren't doing notifications for this type of conversation, return */ if (((gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM) && @@ -175,7 +177,7 @@ notify(GaimConversation *conv, gboolean !gaim_prefs_get_bool("/plugins/gtk/X11/notify/type_chat"))) return 0; - g_object_get(G_OBJECT(GAIM_GTK_WINDOW(gaimwin)->window), + g_object_get(G_OBJECT(gaimwin->window), "has-toplevel-focus", &has_focus, NULL); if (gaim_prefs_get_bool("/plugins/gtk/X11/notify/type_focused") || @@ -193,7 +195,7 @@ notify(GaimConversation *conv, gboolean } static void -notify_win(GaimConvWindow *gaimwin) +notify_win(GaimGtkWindow *gaimwin) { if (count_messages(gaimwin) <= 0) return; @@ -212,12 +214,12 @@ static void unnotify(GaimConversation *conv, gboolean reset) { GaimConversation *active_conv = NULL; - GaimConvWindow *gaimwin = NULL; + GaimGtkWindow *gaimwin = NULL; g_return_if_fail(conv != NULL); - gaimwin = gaim_conversation_get_window(conv); - active_conv = gaim_conv_window_get_active_conversation(gaimwin); + gaimwin = GAIM_GTK_CONVERSATION(conv)->win; + active_conv = gaim_gtk_conv_window_get_active_conversation(gaimwin); /* reset the conversation window title */ gaim_conversation_autoset_title(active_conv); @@ -293,7 +295,12 @@ attach_signals(GaimConversation *conv) guint id; gtkconv = GAIM_GTK_CONVERSATION(conv); - gtkwin = GAIM_GTK_WINDOW(gaim_conversation_get_window(conv)); + if (!gtkconv) { + gaim_debug_misc("notify", "Failed to find gtkconv\n"); + return 0; + } + + gtkwin = gtkconv->win; if (gaim_prefs_get_bool("/plugins/gtk/X11/notify/notify_focus")) { /* TODO should really find a way to make this work no matter where the @@ -343,7 +350,9 @@ detach_signals(GaimConversation *conv) GSList *ids = NULL; gtkconv = GAIM_GTK_CONVERSATION(conv); - gtkwin = GAIM_GTK_WINDOW(gaim_conversation_get_window(conv)); + if (!gtkconv) + return; + gtkwin = gtkconv->win; ids = gaim_conversation_get_data(conv, "notify-window-signals"); for (; ids != NULL; ids = ids->next) @@ -367,16 +376,6 @@ detach_signals(GaimConversation *conv) static void conv_created(GaimConversation *conv) { - GaimConvWindow *gaimwin = NULL; - GaimGtkWindow *gtkwin = NULL; - - gaimwin = gaim_conversation_get_window(conv); - - if (gaimwin == NULL) - return; - - gtkwin = GAIM_GTK_WINDOW(gaimwin); - gaim_conversation_set_data(conv, "notify-message-count", GINT_TO_POINTER(0)); /* always attach the signals, notify() will take care of conversation type @@ -388,7 +387,7 @@ static void conv_switched(GaimConversation *old_conv, GaimConversation *new_conv) { #if 0 - GaimConvWindow *gaimwin = gaim_conversation_get_window(new_conv); + GaimGtkWindow *gaimwin = gaim_conversation_get_window(new_conv); #endif /* @@ -414,22 +413,25 @@ conv_switched(GaimConversation *old_conv static void deleting_conv(GaimConversation *conv) { - GaimConvWindow *gaimwin = NULL; + GaimGtkWindow *gaimwin = NULL; detach_signals(conv); unnotify(conv, TRUE); - gaimwin = gaim_conversation_get_window(conv); + gaimwin = GAIM_GTK_CONVERSATION(conv)->win; +#if 0 + /* i think this line crashes */ if (count_messages(gaimwin)) notify_win(gaimwin); +#endif } #if 0 static void conversation_dragging(GaimConversation *active_conv, - GaimConvWindow *old_gaimwin, - GaimConvWindow *new_gaimwin) + GaimGtkWindow *old_gaimwin, + GaimGtkWindow *new_gaimwin) { if (old_gaimwin != new_gaimwin) { if (old_gaimwin == NULL) { @@ -475,14 +477,14 @@ conversation_dragging(GaimConversation * #endif static void -handle_string(GaimConvWindow *gaimwin) +handle_string(GaimGtkWindow *gaimwin) { GtkWindow *window = NULL; gchar newtitle[256]; g_return_if_fail(gaimwin != NULL); - window = GTK_WINDOW(GAIM_GTK_WINDOW(gaimwin)->window); + window = GTK_WINDOW(gaimwin->window); g_return_if_fail(window != NULL); g_snprintf(newtitle, sizeof(newtitle), "%s%s", @@ -492,14 +494,14 @@ handle_string(GaimConvWindow *gaimwin) } static void -handle_count(GaimConvWindow *gaimwin) +handle_count(GaimGtkWindow *gaimwin) { GtkWindow *window; char newtitle[256]; g_return_if_fail(gaimwin != NULL); - window = GTK_WINDOW(GAIM_GTK_WINDOW(gaimwin)->window); + window = GTK_WINDOW(gaimwin->window); g_return_if_fail(window != NULL); g_snprintf(newtitle, sizeof(newtitle), "[%d] %s", @@ -508,30 +510,29 @@ handle_count(GaimConvWindow *gaimwin) } static void -handle_urgent(GaimConvWindow *gaimwin, gboolean add) +handle_urgent(GaimGtkWindow *win, gboolean add) { XWMHints *hints; - GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(gaimwin); - g_return_if_fail(gtkwin != NULL); - g_return_if_fail(gtkwin->window != NULL); - g_return_if_fail(gtkwin->window->window != NULL); + g_return_if_fail(win != NULL); + g_return_if_fail(win->window != NULL); + g_return_if_fail(win->window->window != NULL); - hints = XGetWMHints(GDK_WINDOW_XDISPLAY(gtkwin->window->window), - GDK_WINDOW_XWINDOW(gtkwin->window->window)); + hints = XGetWMHints(GDK_WINDOW_XDISPLAY(win->window->window), + GDK_WINDOW_XWINDOW(win->window->window)); if (add) hints->flags |= XUrgencyHint; else hints->flags &= ~XUrgencyHint; - XSetWMHints(GDK_WINDOW_XDISPLAY(gtkwin->window->window), - GDK_WINDOW_XWINDOW(gtkwin->window->window), hints); + XSetWMHints(GDK_WINDOW_XDISPLAY(win->window->window), + GDK_WINDOW_XWINDOW(win->window->window), hints); XFree(hints); } static void -handle_raise(GaimConvWindow *gaimwin) +handle_raise(GaimGtkWindow *gaimwin) { - gaim_conv_window_raise(gaimwin); + gaim_gtk_conv_window_raise(gaimwin); } static void @@ -596,7 +597,7 @@ options_entry_cb(GtkWidget *widget, GdkE static void apply_method() { GList *convs = gaim_get_conversations(); - GaimConvWindow *gaimwin = NULL; + GaimGtkWindow *gaimwin = NULL; for (convs = gaim_get_conversations(); convs != NULL; convs = convs->next) { GaimConversation *conv = (GaimConversation *)convs->data; @@ -604,7 +605,7 @@ apply_method() { /* remove notifications */ unnotify(conv, FALSE); - gaimwin = gaim_conversation_get_window(conv); + gaimwin = GAIM_GTK_CONVERSATION(conv)->win; if (GPOINTER_TO_INT(gaim_conversation_get_data(conv, "notify-message-count")) != 0) /* reattach appropriate notifications */ notify(conv, FALSE); |