Mercurial > pidgin.yaz
changeset 4465:6e37eb000b7a
[gaim-migrate @ 4740]
Renamed _ops to _ui_ops for conversation-related stuff. Trying to
standardize on a naming scheme before I do anything else.
committer: Tailor Script <tailor@pidgin.im>
author | Christian Hammond <chipx86@chipx86.com> |
---|---|
date | Thu, 30 Jan 2003 01:43:35 +0000 |
parents | e926d3bdfd14 |
children | 473de7371a97 |
files | src/conversation.c src/conversation.h src/gtkconv.c src/gtkconv.h |
diffstat | 4 files changed, 122 insertions(+), 124 deletions(-) [+] |
line wrap: on
line diff
--- a/src/conversation.c Wed Jan 29 23:34:04 2003 +0000 +++ b/src/conversation.c Thu Jan 30 01:43:35 2003 +0000 @@ -161,7 +161,7 @@ { GaimConversationType type; struct gaim_connection *gc; - struct gaim_conversation_ops *ops; + struct gaim_conversation_ui_ops *ops; char *buf, *buf2, *buffy; gulong length = 0; gboolean binary = FALSE; @@ -174,7 +174,7 @@ return; type = gaim_conversation_get_type(conv); - ops = gaim_conversation_get_ops(conv); + ops = gaim_conversation_get_ui_ops(conv); limit = 32 * 1024; /* You shouldn't be sending more than 32K in your messages. That's a book. */ @@ -427,10 +427,10 @@ win = g_malloc0(sizeof(struct gaim_window)); /* CONV XXX */ - win->ops = gaim_get_gtk_window_ops(); + win->ui_ops = gaim_get_gtk_window_ui_ops(); - if (win->ops != NULL && win->ops->new_window != NULL) - win->ops->new_window(win); + if (win->ui_ops != NULL && win->ui_ops->new_window != NULL) + win->ui_ops->new_window(win); windows = g_list_append(windows, win); @@ -440,13 +440,13 @@ void gaim_window_destroy(struct gaim_window *win) { - struct gaim_window_ops *ops; + struct gaim_window_ui_ops *ops; GList *node; if (win == NULL) return; - ops = gaim_window_get_ops(win); + ops = gaim_window_get_ui_ops(win); for (node = g_list_first(gaim_window_get_conversations(win)); node != NULL; @@ -475,12 +475,12 @@ void gaim_window_show(struct gaim_window *win) { - struct gaim_window_ops *ops; + struct gaim_window_ui_ops *ops; if (win == NULL) return; - ops = gaim_window_get_ops(win); + ops = gaim_window_get_ui_ops(win); if (ops == NULL || ops->show == NULL) return; @@ -491,12 +491,12 @@ void gaim_window_hide(struct gaim_window *win) { - struct gaim_window_ops *ops; + struct gaim_window_ui_ops *ops; if (win == NULL) return; - ops = gaim_window_get_ops(win); + ops = gaim_window_get_ui_ops(win); if (ops == NULL || ops->hide == NULL) return; @@ -507,12 +507,12 @@ void gaim_window_raise(struct gaim_window *win) { - struct gaim_window_ops *ops; + struct gaim_window_ui_ops *ops; if (win == NULL) return; - ops = gaim_window_get_ops(win); + ops = gaim_window_get_ui_ops(win); if (ops == NULL || ops->raise == NULL) return; @@ -523,12 +523,12 @@ void gaim_window_flash(struct gaim_window *win) { - struct gaim_window_ops *ops; + struct gaim_window_ui_ops *ops; if (win == NULL) return; - ops = gaim_window_get_ops(win); + ops = gaim_window_get_ui_ops(win); if (ops == NULL || ops->flash == NULL) return; @@ -537,29 +537,29 @@ } void -gaim_window_set_ops(struct gaim_window *win, struct gaim_window_ops *ops) +gaim_window_set_ui_ops(struct gaim_window *win, struct gaim_window_ui_ops *ops) { - struct gaim_conversation_ops *convops = NULL; + struct gaim_conversation_ui_ops *conv_ops = NULL; GList *l; - if (win == NULL || win->ops == ops) + if (win == NULL || win->ui_ops == ops) return; if (ops != NULL) { - if (ops->get_conversation_ops != NULL) - convops = ops->get_conversation_ops(); + if (ops->get_conversation_ui_ops != NULL) + conv_ops = ops->get_conversation_ui_ops(); } - if (win->ops != NULL) { - if (win->ops->destroy_window != NULL) - win->ops->destroy_window(win); + if (win->ui_ops != NULL) { + if (win->ui_ops->destroy_window != NULL) + win->ui_ops->destroy_window(win); } - win->ops = ops; + win->ui_ops = ops; - if (win->ops != NULL) { - if (win->ops->new_window != NULL) - win->ops->new_window(win); + if (win->ui_ops != NULL) { + if (win->ui_ops->new_window != NULL) + win->ui_ops->new_window(win); } for (l = gaim_window_get_conversations(win); @@ -568,27 +568,27 @@ struct gaim_conversation *conv = (struct gaim_conversation *)l; - gaim_conversation_set_ops(conv, convops); + gaim_conversation_set_ui_ops(conv, conv_ops); - if (win->ops != NULL && win->ops->add_conversation != NULL) - win->ops->add_conversation(win, conv); + if (win->ui_ops != NULL && win->ui_ops->add_conversation != NULL) + win->ui_ops->add_conversation(win, conv); } } -struct gaim_window_ops * -gaim_window_get_ops(const struct gaim_window *win) +struct gaim_window_ui_ops * +gaim_window_get_ui_ops(const struct gaim_window *win) { if (win == NULL) return NULL; - return win->ops; + return win->ui_ops; } int gaim_window_add_conversation(struct gaim_window *win, struct gaim_conversation *conv) { - struct gaim_window_ops *ops; + struct gaim_window_ui_ops *ops; if (win == NULL || conv == NULL) return -1; @@ -599,7 +599,7 @@ gaim_conversation_get_index(conv)); } - ops = gaim_window_get_ops(win); + ops = gaim_window_get_ui_ops(win); win->conversations = g_list_append(win->conversations, conv); win->conversation_count++; @@ -609,8 +609,8 @@ if (ops != NULL) { conv->window = win; - if (ops->get_conversation_ops != NULL) - gaim_conversation_set_ops(conv, ops->get_conversation_ops()); + if (ops->get_conversation_ui_ops != NULL) + gaim_conversation_set_ui_ops(conv, ops->get_conversation_ui_ops()); if (ops->add_conversation != NULL) ops->add_conversation(win, conv); @@ -622,14 +622,14 @@ struct gaim_conversation * gaim_window_remove_conversation(struct gaim_window *win, unsigned int index) { - struct gaim_window_ops *ops; + struct gaim_window_ui_ops *ops; struct gaim_conversation *conv; GList *node; if (win == NULL || index >= gaim_window_get_conversation_count(win)) return NULL; - ops = gaim_window_get_ops(win); + ops = gaim_window_get_ui_ops(win); node = g_list_nth(gaim_window_get_conversations(win), index); conv = (struct gaim_conversation *)node->data; @@ -659,7 +659,7 @@ gaim_window_move_conversation(struct gaim_window *win, unsigned int index, unsigned int new_index) { - struct gaim_window_ops *ops; + struct gaim_window_ui_ops *ops; struct gaim_conversation *conv; GList *l; @@ -684,7 +684,7 @@ conv = (struct gaim_conversation *)l->data; /* Update the UI part of this. */ - ops = gaim_window_get_ops(win); + ops = gaim_window_get_ui_ops(win); if (ops != NULL && ops->move_conversation != NULL) ops->move_conversation(win, conv, new_index); @@ -724,13 +724,13 @@ void gaim_window_switch_conversation(struct gaim_window *win, unsigned int index) { - struct gaim_window_ops *ops; + struct gaim_window_ui_ops *ops; if (win == NULL || index < 0 || index >= gaim_window_get_conversation_count(win)) return; - ops = gaim_window_get_ops(win); + ops = gaim_window_get_ui_ops(win); if (ops != NULL && ops->switch_conversation != NULL) ops->switch_conversation(win, index); @@ -742,12 +742,12 @@ struct gaim_conversation * gaim_window_get_active_conversation(const struct gaim_window *win) { - struct gaim_window_ops *ops; + struct gaim_window_ui_ops *ops; if (win == NULL) return NULL; - ops = gaim_window_get_ops(win); + ops = gaim_window_get_ui_ops(win); if (ops != NULL && ops->get_active_index != NULL) return gaim_window_get_conversation_at(win, ops->get_active_index(win)); @@ -853,7 +853,7 @@ gaim_conversation_destroy(struct gaim_conversation *conv) { struct gaim_window *win; - struct gaim_conversation_ops *ops; + struct gaim_conversation_ui_ops *ops; struct gaim_connection *gc; const char *name; GList *node; @@ -862,7 +862,7 @@ return; win = gaim_conversation_get_window(conv); - ops = gaim_conversation_get_ops(conv); + ops = gaim_conversation_get_ui_ops(conv); gc = gaim_conversation_get_gc(conv); name = gaim_conversation_get_name(conv); @@ -963,27 +963,27 @@ } void -gaim_conversation_set_ops(struct gaim_conversation *conv, - struct gaim_conversation_ops *ops) +gaim_conversation_set_ui_ops(struct gaim_conversation *conv, + struct gaim_conversation_ui_ops *ops) { - if (conv == NULL || conv->ops == ops) + if (conv == NULL || conv->ui_ops == ops) return; - if (conv->ops != NULL && conv->ops->destroy_conversation != NULL) - conv->ops->destroy_conversation(conv); + if (conv->ui_ops != NULL && conv->ui_ops->destroy_conversation != NULL) + conv->ui_ops->destroy_conversation(conv); conv->ui_data = NULL; - conv->ops = ops; + conv->ui_ops = ops; } -struct gaim_conversation_ops * -gaim_conversation_get_ops(struct gaim_conversation *conv) +struct gaim_conversation_ui_ops * +gaim_conversation_get_ui_ops(struct gaim_conversation *conv) { if (conv == NULL) return NULL; - return conv->ops; + return conv->ui_ops; } void @@ -1026,7 +1026,7 @@ void gaim_conversation_set_title(struct gaim_conversation *conv, const char *title) { - struct gaim_conversation_ops *ops; + struct gaim_conversation_ui_ops *ops; if (conv == NULL || title == NULL) return; @@ -1036,7 +1036,7 @@ conv->title = g_strdup(title); - ops = gaim_conversation_get_ops(conv); + ops = gaim_conversation_get_ui_ops(conv); if (ops != NULL && ops->set_title != NULL) ops->set_title(conv, conv->title); @@ -1290,7 +1290,7 @@ time_t mtime) { struct gaim_connection *gc; - struct gaim_conversation_ops *ops; + struct gaim_conversation_ui_ops *ops; struct gaim_window *win; struct buddy *b; GaimUnseenState unseen; @@ -1299,7 +1299,7 @@ if (conv == NULL || message == NULL) return; - ops = gaim_conversation_get_ops(conv); + ops = gaim_conversation_get_ui_ops(conv); if (ops == NULL || ops->write_conv == NULL) return; @@ -1387,7 +1387,7 @@ gaim_conversation_update_progress(struct gaim_conversation *conv, float percent) { - struct gaim_conversation_ops *ops; + struct gaim_conversation_ui_ops *ops; if (conv == NULL) return; @@ -1399,7 +1399,7 @@ * NOTE: A percent >= 1 indicates that the progress bar should be * closed. */ - ops = gaim_conversation_get_ops(conv); + ops = gaim_conversation_get_ui_ops(conv); if (ops != NULL && ops->update_progress != NULL) ops->update_progress(conv, percent); @@ -1409,12 +1409,12 @@ gaim_conversation_update(struct gaim_conversation *conv, GaimConvUpdateType type) { - struct gaim_conversation_ops *ops; + struct gaim_conversation_ui_ops *ops; if (conv == NULL) return; - ops = gaim_conversation_get_ops(conv); + ops = gaim_conversation_get_ui_ops(conv); if (ops != NULL && ops->updated != NULL) ops->updated(conv, type); @@ -1566,8 +1566,8 @@ if (!(flags & WFLAG_NOLOG) & (im_options & OPT_IM_POPUP)) gaim_window_raise(gaim_conversation_get_window(c)); - if (c->ops != NULL && c->ops->write_im != NULL) - c->ops->write_im(c, who, message, len, flags, mtime); + if (c->ui_ops != NULL && c->ui_ops->write_im != NULL) + c->ui_ops->write_im(c, who, message, len, flags, mtime); else gaim_conversation_write(c, who, message, -1, flags, mtime); } @@ -1794,8 +1794,8 @@ } /* Pass this on to either the ops structure or the default write func. */ - if (conv->ops != NULL && conv->ops->write_chat != NULL) - conv->ops->write_chat(conv, who, message, flags, mtime); + if (conv->ui_ops != NULL && conv->ui_ops->write_chat != NULL) + conv->ui_ops->write_chat(conv, who, message, flags, mtime); else gaim_conversation_write(conv, who, message, -1, flags, mtime); } @@ -1814,14 +1814,14 @@ const char *extra_msg) { struct gaim_conversation *conv; - struct gaim_conversation_ops *ops; + struct gaim_conversation_ui_ops *ops; char tmp[BUF_LONG]; if (chat == NULL || user == NULL) return; conv = gaim_chat_get_conversation(chat); - ops = gaim_conversation_get_ops(conv); + ops = gaim_conversation_get_ui_ops(conv); gaim_chat_set_users(chat, g_list_insert_sorted(gaim_chat_get_users(chat), g_strdup(user), @@ -1851,14 +1851,14 @@ const char *new_user) { struct gaim_conversation *conv; - struct gaim_conversation_ops *ops; + struct gaim_conversation_ui_ops *ops; char tmp[BUF_LONG]; if (chat == NULL || old_user == NULL || new_user == NULL) return; conv = gaim_chat_get_conversation(chat); - ops = gaim_conversation_get_ops(conv); + ops = gaim_conversation_get_ui_ops(conv); gaim_chat_set_users(chat, g_list_insert_sorted(gaim_chat_get_users(chat), g_strdup(new_user), @@ -1890,7 +1890,7 @@ const char *reason) { struct gaim_conversation *conv; - struct gaim_conversation_ops *ops; + struct gaim_conversation_ui_ops *ops; char tmp[BUF_LONG]; GList *names; @@ -1898,7 +1898,7 @@ return; conv = gaim_chat_get_conversation(chat); - ops = gaim_conversation_get_ops(conv); + ops = gaim_conversation_get_ui_ops(conv); plugin_event(event_chat_buddy_leave, gaim_conversation_get_gc(conv), gaim_chat_get_id(chat), user);
--- a/src/conversation.h Wed Jan 29 23:34:04 2003 +0000 +++ b/src/conversation.h Thu Jan 30 01:43:35 2003 +0000 @@ -31,7 +31,7 @@ typedef enum _GaimConversationType GaimConversationType; typedef enum _GaimUnseenState GaimUnseenState; typedef enum _GaimConvUpdateType GaimConvUpdateType; -struct gaim_window_ops; +struct gaim_window_ui_ops; struct gaim_window; struct gaim_conversation; struct gaim_im; @@ -92,9 +92,9 @@ * Any UI representing a window must assign a filled-out gaim_window_ops * structure to the gaim_window. */ -struct gaim_window_ops +struct gaim_window_ui_ops { - struct gaim_conversation_ops *(*get_conversation_ops)(void); + struct gaim_conversation_ui_ops *(*get_conversation_ui_ops)(void); void (*new_window)(struct gaim_window *win); void (*destroy_window)(struct gaim_window *win); @@ -119,9 +119,9 @@ * Conversation operations and events. * * Any UI representing a conversation must assign a filled-out - * gaim_conversation_ops structure to the gaim_conversation. + * gaim_conversation_ui_ops structure to the gaim_conversation. */ -struct gaim_conversation_ops +struct gaim_conversation_ui_ops { void (*destroy_conversation)(struct gaim_conversation *conv); void (*write_chat)(struct gaim_conversation *conv, const char *who, @@ -151,12 +151,11 @@ */ struct gaim_window { - GList *conversations; /**< The conversations in the window. */ - size_t conversation_count; /**< The number of conversations. */ + GList *conversations; /**< The conversations in the window. */ + size_t conversation_count; /**< The number of conversations. */ - struct gaim_window_ops *ops; /**< UI-specific window operations. */ - - void *ui_data; /**< UI-specific data. */ + struct gaim_window_ui_ops *ui_ops; /**< UI-specific window operations. */ + void *ui_data; /**< UI-specific data. */ }; /** @@ -164,14 +163,14 @@ */ struct gaim_im { - struct gaim_conversation *conv; + struct gaim_conversation *conv; /**< The parent conversation. */ - int typing_state; - guint typing_timeout; - time_t type_again; - guint type_again_timeout; + int typing_state; /**< The current typing state. */ + guint typing_timeout; /**< The typing timer handle. */ + time_t type_again; /**< The type again time. */ + guint type_again_timeout; /**< The type again timer handle. */ - GSList *images; + GSList *images; /**< A list of images in the IM. */ }; /** @@ -179,13 +178,13 @@ */ struct gaim_chat { - struct gaim_conversation *conv; + struct gaim_conversation *conv; /**< The parent conversation. */ - GList *in_room; - GList *ignored; - char *who; - char *topic; - int id; + GList *in_room; /**< The users in the room. */ + GList *ignored; /**< Ignored users. */ + char *who; /**< The person who set the topic. */ + char *topic; /**< The topic. */ + int id; /**< The chat ID. */ }; /** @@ -201,9 +200,6 @@ struct aim_user *user; /**< The user using this conversation. */ struct gaim_window *window; /**< The parent window. */ - /** UI-specific conversation operations.*/ - struct gaim_conversation_ops *ops; - int conversation_pos; /**< The position in the window's list. */ char *name; /**< The name of the conversation. */ @@ -216,8 +212,6 @@ GaimUnseenState unseen; /**< The unseen tab state. */ - void *ui_data; /**< UI-specific data. */ - union { struct gaim_im *im; /**< IM-specific data. */ @@ -225,6 +219,9 @@ void *misc; /**< Misc. data. */ } u; + + struct gaim_conversation_ui_ops *ui_ops; /**< UI-specific operations. */ + void *ui_data; /**< UI-specific data. */ }; @@ -284,8 +281,8 @@ * @param win The window. * @param ops The UI window operations structure. */ -void gaim_window_set_ops(struct gaim_window *win, - struct gaim_window_ops *ops); +void gaim_window_set_ui_ops(struct gaim_window *win, + struct gaim_window_ui_ops *ops); /** * Returns the specified window's UI window operations structure. @@ -294,7 +291,8 @@ * * @return The UI window operations structure. */ -struct gaim_window_ops *gaim_window_get_ops(const struct gaim_window *win); +struct gaim_window_ui_ops *gaim_window_get_ui_ops( + const struct gaim_window *win); /** * Adds a conversation to this window. @@ -436,8 +434,8 @@ * @param conv The conversation. * @param ops The UI conversation operations structure. */ -void gaim_conversation_set_ops(struct gaim_conversation *conv, - struct gaim_conversation_ops *ops); +void gaim_conversation_set_ui_ops(struct gaim_conversation *conv, + struct gaim_conversation_ui_ops *ops); /** * Returns the specified conversation's UI operations structure. @@ -446,7 +444,7 @@ * * @return The operations structure. */ -struct gaim_conversation_ops *gaim_conversation_get_ops( +struct gaim_conversation_ui_ops *gaim_conversation_get_ui_ops( struct gaim_conversation *conv); /**
--- a/src/gtkconv.c Wed Jan 29 23:34:04 2003 +0000 +++ b/src/gtkconv.c Thu Jan 30 01:43:35 2003 +0000 @@ -3141,10 +3141,10 @@ /************************************************************************** * GTK+ window ops **************************************************************************/ -static struct gaim_conversation_ops * -gaim_gtk_get_conversation_ops(void) +static struct gaim_conversation_ui_ops * +gaim_gtk_get_conversation_ui_ops(void) { - return gaim_get_gtk_conversation_ops(); + return gaim_get_gtk_conversation_ui_ops(); } static void @@ -3490,9 +3490,9 @@ return gtk_notebook_get_current_page(GTK_NOTEBOOK(gtkwin->notebook)); } -static struct gaim_window_ops window_ops = +static struct gaim_window_ui_ops window_ui_ops = { - gaim_gtk_get_conversation_ops, + gaim_gtk_get_conversation_ui_ops, gaim_gtk_new_window, gaim_gtk_destroy_window, gaim_gtk_show, @@ -3549,14 +3549,14 @@ gtk_size_group_add_widget(gtkconv->sg, gtkconv->u.im->add); } -struct gaim_window_ops * -gaim_get_gtk_window_ops(void) +struct gaim_window_ui_ops * +gaim_get_gtk_window_ui_ops(void) { - return &window_ops; + return &window_ui_ops; } /************************************************************************** - * Conversation ops + * Conversation UI operations **************************************************************************/ static void gaim_gtkconv_destroy(struct gaim_conversation *conv) @@ -4166,7 +4166,7 @@ } } -static struct gaim_conversation_ops conversation_ops = +static struct gaim_conversation_ui_ops conversation_ui_ops = { gaim_gtkconv_destroy, /* destroy_conversation */ gaim_gtkconv_write_chat, /* write_chat */ @@ -4180,10 +4180,10 @@ gaim_gtkconv_updated /* updated */ }; -struct gaim_conversation_ops * -gaim_get_gtk_conversation_ops(void) +struct gaim_conversation_ui_ops * +gaim_get_gtk_conversation_ui_ops(void) { - return &conversation_ops;; + return &conversation_ui_ops; } /**************************************************************************
--- a/src/gtkconv.h Wed Jan 29 23:34:04 2003 +0000 +++ b/src/gtkconv.h Thu Jan 30 01:43:35 2003 +0000 @@ -175,10 +175,10 @@ ((struct gaim_gtk_conversation *)(conv)->ui_data) #define GAIM_IS_GTK_WINDOW(win) \ - (gaim_window_get_ops(win) == gaim_get_gtk_window_ops()) + (gaim_window_get_ui_ops(win) == gaim_get_gtk_window_ui_ops()) #define GAIM_IS_GTK_CONVERSATION(conv) \ - (gaim_conversation_get_ops(conv) == gaim_get_gtk_conversation_ops()) + (gaim_conversation_get_ui_ops(conv) == gaim_get_gtk_conversation_ui_ops()) /************************************************************************** * @name GTK+ Conversation API @@ -188,14 +188,14 @@ * * @return The GTK window operations structure. */ -struct gaim_window_ops *gaim_get_gtk_window_ops(void); +struct gaim_window_ui_ops *gaim_get_gtk_window_ui_ops(void); /** * Returns the UI operations structure for GTK conversations. * * @return The GTK conversation operations structure. */ -struct gaim_conversation_ops *gaim_get_gtk_conversation_ops(void); +struct gaim_conversation_ui_ops *gaim_get_gtk_conversation_ui_ops(void); /** * Sets a lock on the update state.