Mercurial > pidgin
diff pidgin/gtkwhiteboard.c @ 15822:32c366eeeb99
sed -ie 's/gaim/purple/g'
author | Sean Egan <seanegan@gmail.com> |
---|---|
date | Mon, 19 Mar 2007 07:01:17 +0000 |
parents | cebfc6af3eb5 |
children | 66dff3dfdea6 |
line wrap: on
line diff
--- a/pidgin/gtkwhiteboard.c Mon Mar 19 06:11:46 2007 +0000 +++ b/pidgin/gtkwhiteboard.c Mon Mar 19 07:01:17 2007 +0000 @@ -1,7 +1,7 @@ /* - * gaim + * purple * - * Gaim is the legal property of its developers, whose names are too numerous + * Purple is the legal property of its developers, whose names are too numerous * to list here. Please refer to the COPYRIGHT file distributed with this * source distribution. * @@ -32,9 +32,9 @@ /****************************************************************************** * Prototypes *****************************************************************************/ -static void pidgin_whiteboard_create(GaimWhiteboard *wb); +static void pidgin_whiteboard_create(PurpleWhiteboard *wb); -static void pidgin_whiteboard_destroy(GaimWhiteboard *wb); +static void pidgin_whiteboard_destroy(PurpleWhiteboard *wb); static gboolean whiteboard_close_cb(GtkWidget *widget, GdkEvent *event, PidginWhiteboard *gtkwb); /*static void pidginwhiteboard_button_start_press(GtkButton *button, gpointer data); */ @@ -46,14 +46,14 @@ static gboolean pidgin_whiteboard_brush_motion(GtkWidget *widget, GdkEventMotion *event, gpointer data); static gboolean pidgin_whiteboard_brush_up(GtkWidget *widget, GdkEventButton *event, gpointer data); -static void pidgin_whiteboard_draw_brush_point(GaimWhiteboard *wb, +static void pidgin_whiteboard_draw_brush_point(PurpleWhiteboard *wb, int x, int y, int color, int size); -static void pidgin_whiteboard_draw_brush_line(GaimWhiteboard *wb, int x0, int y0, +static void pidgin_whiteboard_draw_brush_line(PurpleWhiteboard *wb, int x0, int y0, int x1, int y1, int color, int size); -static void pidgin_whiteboard_set_dimensions(GaimWhiteboard *wb, int width, int height); -static void pidgin_whiteboard_set_brush(GaimWhiteboard *wb, int size, int color); -static void pidgin_whiteboard_clear(GaimWhiteboard *wb); +static void pidgin_whiteboard_set_dimensions(PurpleWhiteboard *wb, int width, int height); +static void pidgin_whiteboard_set_brush(PurpleWhiteboard *wb, int size, int color); +static void pidgin_whiteboard_clear(PurpleWhiteboard *wb); static void pidgin_whiteboard_button_clear_press(GtkWidget *widget, gpointer data); static void pidgin_whiteboard_button_save_press(GtkWidget *widget, gpointer data); @@ -77,7 +77,7 @@ static int MotionCount; /* Tracks how many brush motions made */ static int BrushState = BRUSH_STATE_UP; -static GaimWhiteboardUiOps ui_ops = +static PurpleWhiteboardUiOps ui_ops = { pidgin_whiteboard_create, pidgin_whiteboard_destroy, @@ -91,14 +91,14 @@ /****************************************************************************** * API *****************************************************************************/ -GaimWhiteboardUiOps *pidgin_whiteboard_get_ui_ops(void) +PurpleWhiteboardUiOps *pidgin_whiteboard_get_ui_ops(void) { return &ui_ops; } -static void pidgin_whiteboard_create(GaimWhiteboard *wb) +static void pidgin_whiteboard_create(PurpleWhiteboard *wb) { - GaimBuddy *buddy; + PurpleBuddy *buddy; GtkWidget *window; GtkWidget *drawing_area; GtkWidget *vbox_controls; @@ -125,14 +125,14 @@ wb->ui_data = gtkwb; /* Get dimensions (default?) for the whiteboard canvas */ - if (!gaim_whiteboard_get_dimensions(wb, >kwb->width, >kwb->height)) + if (!purple_whiteboard_get_dimensions(wb, >kwb->width, >kwb->height)) { /* Give some initial board-size */ gtkwb->width = 300; gtkwb->height = 250; } - if (!gaim_whiteboard_get_brush(wb, >kwb->brush_size, >kwb->brush_color)) + if (!purple_whiteboard_get_brush(wb, >kwb->brush_size, >kwb->brush_color)) { /* Give some initial brush-info */ gtkwb->brush_size = 2; @@ -146,10 +146,10 @@ /* Try and set window title as the name of the buddy, else just use their * username */ - buddy = gaim_find_buddy(wb->account, wb->who); + buddy = purple_find_buddy(wb->account, wb->who); if (buddy != NULL) - gtk_window_set_title((GtkWindow*)(window), gaim_buddy_get_contact_alias(buddy)); + gtk_window_set_title((GtkWindow*)(window), purple_buddy_get_contact_alias(buddy)); else gtk_window_set_title((GtkWindow*)(window), wb->who); @@ -272,7 +272,7 @@ */ } -static void pidgin_whiteboard_destroy(GaimWhiteboard *wb) +static void pidgin_whiteboard_destroy(PurpleWhiteboard *wb) { PidginWhiteboard *gtkwb; @@ -300,13 +300,13 @@ static gboolean whiteboard_close_cb(GtkWidget *widget, GdkEvent *event, PidginWhiteboard *gtkwb) { - GaimWhiteboard *wb; + PurpleWhiteboard *wb; g_return_val_if_fail(gtkwb != NULL, FALSE); wb = gtkwb->wb; g_return_val_if_fail(wb != NULL, FALSE); - gaim_whiteboard_destroy(wb); + purple_whiteboard_destroy(wb); return FALSE; } @@ -318,15 +318,15 @@ #if 0 static void pidginwhiteboard_button_start_press(GtkButton *button, gpointer data) { - GaimConversation *conv = data; - GaimAccount *account = gaim_conversation_get_account(conv); - GaimConnection *gc = gaim_account_get_connection(account); - char *to = (char*)(gaim_conversation_get_name(conv)); + PurpleConversation *conv = data; + PurpleAccount *account = purple_conversation_get_account(conv); + PurpleConnection *gc = purple_account_get_connection(account); + char *to = (char*)(purple_conversation_get_name(conv)); /* Only handle this if local client requested Doodle session (else local * client would have sent one) */ - GaimWhiteboard *wb = gaim_whiteboard_get(account, to); + PurpleWhiteboard *wb = purple_whiteboard_get(account, to); /* Write a local message to this conversation showing that a request for a * Doodle session has been made @@ -334,8 +334,8 @@ /* XXXX because otherwise gettext will see this string, even though it's * in an #if 0 block. Remove the XXXX if you want to use this code. * But, it really shouldn't be a Yahoo-specific string. ;) */ - gaim_conv_im_write(GAIM_CONV_IM(conv), "", XXXX_("Sent Doodle request."), - GAIM_MESSAGE_NICK | GAIM_MESSAGE_RECV, time(NULL)); + purple_conv_im_write(PURPLE_CONV_IM(conv), "", XXXX_("Sent Doodle request."), + PURPLE_MESSAGE_NICK | PURPLE_MESSAGE_RECV, time(NULL)); yahoo_doodle_command_send_request(gc, to); yahoo_doodle_command_send_ready(gc, to); @@ -343,7 +343,7 @@ /* Insert this 'session' in the list. At this point, it's only a requested * session. */ - wb = gaim_whiteboard_create(account, to, DOODLE_STATE_REQUESTING); + wb = purple_whiteboard_create(account, to, DOODLE_STATE_REQUESTING); } #endif @@ -393,7 +393,7 @@ PidginWhiteboard *gtkwb = (PidginWhiteboard*)data; GdkPixmap *pixmap = gtkwb->pixmap; - GaimWhiteboard *wb = gtkwb->wb; + PurpleWhiteboard *wb = gtkwb->wb; GList *draw_list = wb->draw_list; if(BrushState != BRUSH_STATE_UP) @@ -411,7 +411,7 @@ /* Check if draw_list has contents; if so, clear it */ if(draw_list) { - gaim_whiteboard_draw_list_destroy(draw_list); + purple_whiteboard_draw_list_destroy(draw_list); draw_list = NULL; } @@ -446,7 +446,7 @@ PidginWhiteboard *gtkwb = (PidginWhiteboard*)data; GdkPixmap *pixmap = gtkwb->pixmap; - GaimWhiteboard *wb = gtkwb->wb; + PurpleWhiteboard *wb = gtkwb->wb; GList *draw_list = wb->draw_list; if(event->is_hint) @@ -462,7 +462,7 @@ { if((BrushState != BRUSH_STATE_DOWN) && (BrushState != BRUSH_STATE_MOTION)) { - gaim_debug_error("gtkwhiteboard", "***Bad brush state transition %d to MOTION\n", BrushState); + purple_debug_error("gtkwhiteboard", "***Bad brush state transition %d to MOTION\n", BrushState); BrushState = BRUSH_STATE_MOTION; @@ -484,12 +484,12 @@ draw_list = g_list_append(draw_list, GINT_TO_POINTER(dy)); /* Send draw list to the draw_list handler */ - gaim_whiteboard_send_draw_list(gtkwb->wb, draw_list); + purple_whiteboard_send_draw_list(gtkwb->wb, draw_list); /* The brush stroke is finished, clear the list for another one */ if(draw_list) { - gaim_whiteboard_draw_list_destroy(draw_list); + purple_whiteboard_draw_list_destroy(draw_list); draw_list = NULL; } @@ -526,12 +526,12 @@ PidginWhiteboard *gtkwb = (PidginWhiteboard*)data; GdkPixmap *pixmap = gtkwb->pixmap; - GaimWhiteboard *wb = gtkwb->wb; + PurpleWhiteboard *wb = gtkwb->wb; GList *draw_list = wb->draw_list; if((BrushState != BRUSH_STATE_DOWN) && (BrushState != BRUSH_STATE_MOTION)) { - gaim_debug_error("gtkwhiteboard", "***Bad brush state transition %d to UP\n", BrushState); + purple_debug_error("gtkwhiteboard", "***Bad brush state transition %d to UP\n", BrushState); BrushState = BRUSH_STATE_UP; @@ -563,13 +563,13 @@ */ /* Send draw list to prpl draw_list handler */ - gaim_whiteboard_send_draw_list(gtkwb->wb, draw_list); + purple_whiteboard_send_draw_list(gtkwb->wb, draw_list); pidgin_whiteboard_set_canvas_as_icon(gtkwb); /* The brush stroke is finished, clear the list for another one */ if(draw_list) - gaim_whiteboard_draw_list_destroy(draw_list); + purple_whiteboard_draw_list_destroy(draw_list); wb->draw_list = NULL; } @@ -577,7 +577,7 @@ return TRUE; } -static void pidgin_whiteboard_draw_brush_point(GaimWhiteboard *wb, int x, int y, int color, int size) +static void pidgin_whiteboard_draw_brush_point(PurpleWhiteboard *wb, int x, int y, int color, int size) { PidginWhiteboard *gtkwb = wb->ui_data; GtkWidget *widget = gtkwb->drawing_area; @@ -630,7 +630,7 @@ } /* Uses Bresenham's algorithm (as provided by Wikipedia) */ -static void pidgin_whiteboard_draw_brush_line(GaimWhiteboard *wb, int x0, int y0, int x1, int y1, int color, int size) +static void pidgin_whiteboard_draw_brush_line(PurpleWhiteboard *wb, int x0, int y0, int x1, int y1, int color, int size) { int temp; @@ -696,7 +696,7 @@ } } -static void pidgin_whiteboard_set_dimensions(GaimWhiteboard *wb, int width, int height) +static void pidgin_whiteboard_set_dimensions(PurpleWhiteboard *wb, int width, int height) { PidginWhiteboard *gtkwb = wb->ui_data; @@ -704,7 +704,7 @@ gtkwb->height = height; } -static void pidgin_whiteboard_set_brush(GaimWhiteboard *wb, int size, int color) +static void pidgin_whiteboard_set_brush(PurpleWhiteboard *wb, int size, int color) { PidginWhiteboard *gtkwb = wb->ui_data; @@ -712,7 +712,7 @@ gtkwb->brush_color = color; } -static void pidgin_whiteboard_clear(GaimWhiteboard *wb) +static void pidgin_whiteboard_clear(PurpleWhiteboard *wb) { PidginWhiteboard *gtkwb = wb->ui_data; GdkPixmap *pixmap = gtkwb->pixmap; @@ -740,7 +740,7 @@ pidgin_whiteboard_set_canvas_as_icon(gtkwb); /* Do protocol specific clearing procedures */ - gaim_whiteboard_send_clear(gtkwb->wb); + purple_whiteboard_send_clear(gtkwb->wb); } static void pidgin_whiteboard_button_save_press(GtkWidget *widget, gpointer data) @@ -797,16 +797,16 @@ gtkwb->width, gtkwb->height); if(gdk_pixbuf_save(pixbuf, filename, "jpeg", NULL, "quality", "100", NULL)) - gaim_debug_info("gtkwhiteboard", "File Saved...\n"); + purple_debug_info("gtkwhiteboard", "File Saved...\n"); else - gaim_debug_info("gtkwhiteboard", "File not Saved... Error\n"); + purple_debug_info("gtkwhiteboard", "File not Saved... Error\n"); g_free(filename); } else if(result == GTK_RESPONSE_CANCEL) { gtk_widget_destroy(dialog); - gaim_debug_info("gtkwhiteboard", "File not Saved... Canceled\n"); + purple_debug_info("gtkwhiteboard", "File not Saved... Canceled\n"); } } @@ -839,15 +839,15 @@ int old_size = 5; int old_color = 0; int new_color; - GaimWhiteboard *wb = gtkwb->wb; + PurpleWhiteboard *wb = gtkwb->wb; gtk_color_selection_get_current_color(selection, &color); new_color = (color.red & 0xFF00) << 8; new_color |= (color.green & 0xFF00); new_color |= (color.blue & 0xFF00) >> 8; - gaim_whiteboard_get_brush(wb, &old_size, &old_color); - gaim_whiteboard_send_brush(wb, old_size, new_color); + purple_whiteboard_get_brush(wb, &old_size, &old_color); + purple_whiteboard_send_brush(wb, old_size, new_color); } static void color_selection_dialog_destroy(GtkWidget *w, GtkWidget *destroy)