Mercurial > pidgin.yaz
changeset 7098:770233dad86c
[gaim-migrate @ 7663]
Renamed a few of the buddy list structs to be compliant with the rest of
gaim.
committer: Tailor Script <tailor@pidgin.im>
author | Christian Hammond <chipx86@chipx86.com> |
---|---|
date | Wed, 01 Oct 2003 04:05:46 +0000 |
parents | 2c331b10161e |
children | 8130adad8b7a |
files | src/blist.c src/blist.h src/dialogs.c src/gtkblist.h src/gtkconn.c src/gtkpounce.c src/protocols/oscar/oscar.c |
diffstat | 7 files changed, 92 insertions(+), 83 deletions(-) [+] |
line wrap: on
line diff
--- a/src/blist.c Wed Oct 01 03:46:16 2003 +0000 +++ b/src/blist.c Wed Oct 01 04:05:46 2003 +0000 @@ -34,8 +34,8 @@ #define PATHSIZE 1024 -struct gaim_buddy_list *gaimbuddylist = NULL; -static struct gaim_blist_ui_ops *blist_ui_ops = NULL; +GaimBuddyList *gaimbuddylist = NULL; +static GaimBlistUiOps *blist_ui_ops = NULL; /***************************************************************************** @@ -82,7 +82,7 @@ static void blist_pref_cb(const char *name, GaimPrefType typ, gpointer value, gpointer data) { - struct gaim_blist_ui_ops *ops = gaimbuddylist->ui_ops; + GaimBlistUiOps *ops = gaimbuddylist->ui_ops; GaimBlistNode *gnode, *cnode, *bnode; if (!ops) @@ -147,9 +147,9 @@ * Public API functions * *****************************************************************************/ -struct gaim_buddy_list *gaim_blist_new() +GaimBuddyList *gaim_blist_new() { - struct gaim_buddy_list *gbl = g_new0(struct gaim_buddy_list, 1); + GaimBuddyList *gbl = g_new0(GaimBuddyList, 1); gbl->ui_ops = gaim_blist_get_ui_ops(); @@ -168,12 +168,12 @@ } void -gaim_set_blist(struct gaim_buddy_list *list) +gaim_set_blist(GaimBuddyList *list) { gaimbuddylist = list; } -struct gaim_buddy_list * +GaimBuddyList * gaim_get_blist(void) { return gaimbuddylist; @@ -181,28 +181,28 @@ void gaim_blist_show () { - struct gaim_blist_ui_ops *ops = gaimbuddylist->ui_ops; + GaimBlistUiOps *ops = gaimbuddylist->ui_ops; if (ops) ops->show(gaimbuddylist); } void gaim_blist_destroy() { - struct gaim_blist_ui_ops *ops = gaimbuddylist->ui_ops; + GaimBlistUiOps *ops = gaimbuddylist->ui_ops; if (ops) ops->destroy(gaimbuddylist); } void gaim_blist_set_visible (gboolean show) { - struct gaim_blist_ui_ops *ops = gaimbuddylist->ui_ops; + GaimBlistUiOps *ops = gaimbuddylist->ui_ops; if (ops) ops->set_visible(gaimbuddylist, show); } void gaim_blist_update_buddy_status (GaimBuddy *buddy, int status) { - struct gaim_blist_ui_ops *ops; + GaimBlistUiOps *ops; if (buddy->uc == status) return; @@ -223,7 +223,7 @@ } static gboolean presence_update_timeout_cb(GaimBuddy *buddy) { - struct gaim_blist_ui_ops *ops = gaimbuddylist->ui_ops; + GaimBlistUiOps *ops = gaimbuddylist->ui_ops; GaimConversation *conv; conv = gaim_find_conversation_with_account(buddy->name, buddy->account); @@ -253,7 +253,7 @@ } void gaim_blist_update_buddy_presence(GaimBuddy *buddy, int presence) { - struct gaim_blist_ui_ops *ops = gaimbuddylist->ui_ops; + GaimBlistUiOps *ops = gaimbuddylist->ui_ops; gboolean do_something = FALSE; if (!GAIM_BUDDY_IS_ONLINE(buddy) && presence) { @@ -287,7 +287,7 @@ void gaim_blist_update_buddy_idle (GaimBuddy *buddy, int idle) { - struct gaim_blist_ui_ops *ops = gaimbuddylist->ui_ops; + GaimBlistUiOps *ops = gaimbuddylist->ui_ops; if(buddy->idle == idle) return; @@ -299,7 +299,7 @@ void gaim_blist_update_buddy_evil (GaimBuddy *buddy, int warning) { - struct gaim_blist_ui_ops *ops = gaimbuddylist->ui_ops; + GaimBlistUiOps *ops = gaimbuddylist->ui_ops; if(buddy->evil == warning) return; @@ -309,14 +309,14 @@ } void gaim_blist_update_buddy_icon(GaimBuddy *buddy) { - struct gaim_blist_ui_ops *ops = gaimbuddylist->ui_ops; + GaimBlistUiOps *ops = gaimbuddylist->ui_ops; if(ops) ops->update(gaimbuddylist, (GaimBlistNode*)buddy); } void gaim_blist_rename_buddy (GaimBuddy *buddy, const char *name) { - struct gaim_blist_ui_ops *ops = gaimbuddylist->ui_ops; + GaimBlistUiOps *ops = gaimbuddylist->ui_ops; g_free(buddy->name); buddy->name = g_strdup(name); if (ops) @@ -325,7 +325,7 @@ void gaim_blist_alias_chat(GaimBlistChat *chat, const char *alias) { - struct gaim_blist_ui_ops *ops = gaimbuddylist->ui_ops; + GaimBlistUiOps *ops = gaimbuddylist->ui_ops; g_free(chat->alias); @@ -340,7 +340,7 @@ void gaim_blist_alias_buddy (GaimBuddy *buddy, const char *alias) { - struct gaim_blist_ui_ops *ops = gaimbuddylist->ui_ops; + GaimBlistUiOps *ops = gaimbuddylist->ui_ops; GaimConversation *conv; g_free(buddy->alias); @@ -361,7 +361,7 @@ void gaim_blist_server_alias_buddy (GaimBuddy *buddy, const char *alias) { - struct gaim_blist_ui_ops *ops = gaimbuddylist->ui_ops; + GaimBlistUiOps *ops = gaimbuddylist->ui_ops; GaimConversation *conv; g_free(buddy->server_alias); @@ -382,7 +382,7 @@ void gaim_blist_rename_group(GaimGroup *group, const char *name) { - struct gaim_blist_ui_ops *ops = gaimbuddylist->ui_ops; + GaimBlistUiOps *ops = gaimbuddylist->ui_ops; GaimGroup *dest_group; GaimBlistNode *prev, *child, *next; GSList *accts; @@ -435,7 +435,7 @@ GaimBlistChat *gaim_blist_chat_new(GaimAccount *account, const char *alias, GHashTable *components) { GaimBlistChat *chat; - struct gaim_blist_ui_ops *ops; + GaimBlistUiOps *ops; if(!components) return NULL; @@ -488,7 +488,7 @@ GaimBuddy *gaim_buddy_new(GaimAccount *account, const char *screenname, const char *alias) { GaimBuddy *b; - struct gaim_blist_ui_ops *ops; + GaimBlistUiOps *ops; b = g_new0(GaimBuddy, 1); b->account = account; @@ -535,7 +535,7 @@ { GaimBlistNode *n = node, *cnode = (GaimBlistNode*)chat; GaimGroup *g = group; - struct gaim_blist_ui_ops *ops = gaimbuddylist->ui_ops; + GaimBlistUiOps *ops = gaimbuddylist->ui_ops; gboolean save = FALSE; @@ -614,7 +614,7 @@ GaimBlistNode *cnode, *bnode; GaimGroup *g; GaimContact *c; - struct gaim_blist_ui_ops *ops = gaimbuddylist->ui_ops; + GaimBlistUiOps *ops = gaimbuddylist->ui_ops; gboolean save = FALSE; struct _gaim_hbuddy *hb; @@ -740,7 +740,7 @@ GaimContact *gaim_contact_new() { - struct gaim_blist_ui_ops *ops; + GaimBlistUiOps *ops; GaimContact *c = g_new0(GaimContact, 1); ((GaimBlistNode*)c)->type = GAIM_BLIST_CONTACT_NODE; @@ -773,7 +773,7 @@ GaimGroup *g = gaim_find_group(name); if (!g) { - struct gaim_blist_ui_ops *ops; + GaimBlistUiOps *ops; g= g_new0(GaimGroup, 1); g->name = g_strdup(name); g->totalsize = 0; @@ -794,7 +794,7 @@ void gaim_blist_add_contact(GaimContact *contact, GaimGroup *group, GaimBlistNode *node) { - struct gaim_blist_ui_ops *ops = gaimbuddylist->ui_ops; + GaimBlistUiOps *ops = gaimbuddylist->ui_ops; GaimGroup *g; GaimBlistNode *gnode, *cnode, *bnode; gboolean save = FALSE; @@ -914,7 +914,7 @@ void gaim_blist_add_group (GaimGroup *group, GaimBlistNode *node) { - struct gaim_blist_ui_ops *ops; + GaimBlistUiOps *ops; GaimBlistNode *gnode = (GaimBlistNode*)group; gboolean save = FALSE; @@ -975,7 +975,7 @@ void gaim_blist_remove_contact(GaimContact* contact) { - struct gaim_blist_ui_ops *ops = gaimbuddylist->ui_ops; + GaimBlistUiOps *ops = gaimbuddylist->ui_ops; GaimBlistNode *gnode, *cnode = (GaimBlistNode*)contact; @@ -1002,7 +1002,7 @@ void gaim_blist_remove_buddy (GaimBuddy *buddy) { - struct gaim_blist_ui_ops *ops = gaimbuddylist->ui_ops; + GaimBlistUiOps *ops = gaimbuddylist->ui_ops; GaimBlistNode *cnode, *node = (GaimBlistNode*)buddy; GaimGroup *group; @@ -1055,7 +1055,7 @@ void gaim_blist_remove_chat (GaimBlistChat *chat) { - struct gaim_blist_ui_ops *ops = gaimbuddylist->ui_ops; + GaimBlistUiOps *ops = gaimbuddylist->ui_ops; GaimBlistNode *gnode, *node = (GaimBlistNode*)chat; GaimGroup *group; @@ -1083,7 +1083,7 @@ void gaim_blist_remove_group (GaimGroup *group) { - struct gaim_blist_ui_ops *ops = gaimbuddylist->ui_ops; + GaimBlistUiOps *ops = gaimbuddylist->ui_ops; GaimBlistNode *node = (GaimBlistNode*)group; GList *l; @@ -1357,7 +1357,7 @@ void gaim_blist_add_account(GaimAccount *account) { - struct gaim_blist_ui_ops *ops = gaimbuddylist->ui_ops; + GaimBlistUiOps *ops = gaimbuddylist->ui_ops; GaimBlistNode *gnode, *cnode, *bnode; if(!gaimbuddylist) @@ -1404,7 +1404,7 @@ void gaim_blist_remove_account(GaimAccount *account) { - struct gaim_blist_ui_ops *ops = gaimbuddylist->ui_ops; + GaimBlistUiOps *ops = gaimbuddylist->ui_ops; GaimBlistNode *gnode, *cnode, *bnode; if (!gaimbuddylist) @@ -2278,7 +2278,7 @@ gaim_blist_request_add_buddy(GaimAccount *account, const char *username, const char *group, const char *alias) { - struct gaim_blist_ui_ops *ui_ops; + GaimBlistUiOps *ui_ops; ui_ops = gaim_blist_get_ui_ops(); @@ -2289,7 +2289,7 @@ void gaim_blist_request_add_chat(GaimAccount *account, GaimGroup *group) { - struct gaim_blist_ui_ops *ui_ops; + GaimBlistUiOps *ui_ops; ui_ops = gaim_blist_get_ui_ops(); @@ -2300,7 +2300,7 @@ void gaim_blist_request_add_group(void) { - struct gaim_blist_ui_ops *ui_ops; + GaimBlistUiOps *ui_ops; ui_ops = gaim_blist_get_ui_ops(); @@ -2597,12 +2597,12 @@ } void -gaim_blist_set_ui_ops(struct gaim_blist_ui_ops *ops) +gaim_blist_set_ui_ops(GaimBlistUiOps *ops) { blist_ui_ops = ops; } -struct gaim_blist_ui_ops * +GaimBlistUiOps * gaim_blist_get_ui_ops(void) { return blist_ui_ops;
--- a/src/blist.h Wed Oct 01 03:46:16 2003 +0000 +++ b/src/blist.h Wed Oct 01 04:05:46 2003 +0000 @@ -28,6 +28,8 @@ #include <glib.h> +typedef struct _GaimBuddyList GaimBuddyList; +typedef struct _GaimBlistUiOps GaimBlistUiOps; typedef struct _GaimBlistNode GaimBlistNode; typedef struct _GaimBlistChat GaimBlistChat; @@ -41,25 +43,29 @@ /**************************************************************************/ /* Enumerations */ /**************************************************************************/ -enum gaim_blist_node_type { +typedef enum +{ GAIM_BLIST_GROUP_NODE, GAIM_BLIST_CONTACT_NODE, GAIM_BLIST_BUDDY_NODE, GAIM_BLIST_CHAT_NODE, GAIM_BLIST_OTHER_NODE -}; + +} GaimBlistNodeType; #define GAIM_BLIST_NODE_IS_CHAT(n) ((n)->type == GAIM_BLIST_CHAT_NODE) #define GAIM_BLIST_NODE_IS_BUDDY(n) ((n)->type == GAIM_BLIST_BUDDY_NODE) #define GAIM_BLIST_NODE_IS_CONTACT(n) ((n)->type == GAIM_BLIST_CONTACT_NODE) #define GAIM_BLIST_NODE_IS_GROUP(n) ((n)->type == GAIM_BLIST_GROUP_NODE) -enum gaim_buddy_presence_state { +typedef enum +{ GAIM_BUDDY_SIGNING_OFF = -1, GAIM_BUDDY_OFFLINE = 0, GAIM_BUDDY_ONLINE, GAIM_BUDDY_SIGNING_ON -}; + +} GaimBuddyPresenceState; #define GAIM_BUDDY_IS_ONLINE(b) ((b)->account->gc && \ ((b)->present == GAIM_BUDDY_ONLINE || \ @@ -74,12 +80,12 @@ * A Buddy list node. This can represent a group, a buddy, or anything else. This is a base class for struct buddy and * struct group and for anything else that wants to put itself in the buddy list. */ struct _GaimBlistNode { - enum gaim_blist_node_type type; /**< The type of node this is */ - GaimBlistNode *prev; /**< The sibling before this buddy. */ - GaimBlistNode *next; /**< The sibling after this buddy. */ - GaimBlistNode *parent; /**< The parent of this node */ - GaimBlistNode *child; /**< The child of this node */ - void *ui_data; /**< The UI can put data here. */ + GaimBlistNodeType type; /**< The type of node this is */ + GaimBlistNode *prev; /**< The sibling before this buddy. */ + GaimBlistNode *next; /**< The sibling after this buddy. */ + GaimBlistNode *parent; /**< The parent of this node */ + GaimBlistNode *child; /**< The child of this node */ + void *ui_data; /**< The UI can put data here. */ }; /** @@ -90,7 +96,7 @@ char *name; /**< The screenname of the buddy. */ char *alias; /**< The user-set alias of the buddy */ char *server_alias; /**< The server-specified alias of the buddy. (i.e. MSN "Friendly Names") */ - enum gaim_buddy_presence_state present; /**< This is 0 if the buddy appears offline, 1 if he appears online, and 2 if + GaimBuddyPresenceState present; /**< This is 0 if the buddy appears offline, 1 if he appears online, and 2 if he has recently signed on */ int evil; /**< The warning level */ time_t signon; /**< The time the buddy signed on. */ @@ -144,12 +150,12 @@ /** * The Buddy List */ -struct gaim_buddy_list { - GaimBlistNode *root; /**< The first node in the buddy list */ - GHashTable *buddies; /**< Every buddy in this list */ - struct gaim_blist_ui_ops *ui_ops; /**< The UI operations for the buddy list */ +struct _GaimBuddyList { + GaimBlistNode *root; /**< The first node in the buddy list */ + GHashTable *buddies; /**< Every buddy in this list */ + GaimBlistUiOps *ui_ops; /**< The UI operations for the buddy list */ - void *ui_data; /**< UI-specific data. */ + void *ui_data; /**< UI-specific data. */ }; /** @@ -158,17 +164,17 @@ * Any UI representing a buddy list must assign a filled-out gaim_window_ops * structure to the buddy list core. */ -struct gaim_blist_ui_ops +struct _GaimBlistUiOps { - void (*new_list)(struct gaim_buddy_list *list); /**< Sets UI-specific data on a buddy list. */ + void (*new_list)(GaimBuddyList *list); /**< Sets UI-specific data on a buddy list. */ void (*new_node)(GaimBlistNode *node); /**< Sets UI-specific data on a node. */ - void (*show)(struct gaim_buddy_list *list); /**< The core will call this when its finished doing it's core stuff */ - void (*update)(struct gaim_buddy_list *list, + void (*show)(GaimBuddyList *list); /**< The core will call this when its finished doing it's core stuff */ + void (*update)(GaimBuddyList *list, GaimBlistNode *node); /**< This will update a node in the buddy list. */ - void (*remove)(struct gaim_buddy_list *list, + void (*remove)(GaimBuddyList *list, GaimBlistNode *node); /**< This removes a node from the list */ - void (*destroy)(struct gaim_buddy_list *list); /**< When the list gets destroyed, this gets called to destroy the UI. */ - void (*set_visible)(struct gaim_buddy_list *list, + void (*destroy)(GaimBuddyList *list); /**< When the list gets destroyed, this gets called to destroy the UI. */ + void (*set_visible)(GaimBuddyList *list, gboolean show); /**< Hides or unhides the buddy list */ void (*request_add_buddy)(GaimAccount *account, const char *username, const char *group, const char *alias); @@ -188,21 +194,21 @@ /** * Creates a new buddy list */ -struct gaim_buddy_list *gaim_blist_new(); +GaimBuddyList *gaim_blist_new(); /** * Sets the main buddy list. * * @return The main buddy list. */ -void gaim_set_blist(struct gaim_buddy_list *blist); +void gaim_set_blist(GaimBuddyList *blist); /** * Returns the main buddy list. * * @return The main buddy list. */ -struct gaim_buddy_list *gaim_get_blist(void); +GaimBuddyList *gaim_get_blist(void); /** * Shows the buddy list, creating a new one if necessary. @@ -765,14 +771,14 @@ * * @param ops The ops struct. */ -void gaim_blist_set_ui_ops(struct gaim_blist_ui_ops *ops); +void gaim_blist_set_ui_ops(GaimBlistUiOps *ops); /** * Returns the UI operations structure to be used for the buddy list. * * @return The UI operations structure. */ -struct gaim_blist_ui_ops *gaim_blist_get_ui_ops(void); +GaimBlistUiOps *gaim_blist_get_ui_ops(void); /*@}*/
--- a/src/dialogs.c Wed Oct 01 03:46:16 2003 +0000 +++ b/src/dialogs.c Wed Oct 01 04:05:46 2003 +0000 @@ -574,7 +574,7 @@ GtkWidget *window; GtkWidget *hbox; GtkWidget *label; - struct gaim_gtk_buddy_list *gtkblist; + GaimGtkBuddyList *gtkblist; GtkWidget *img = gtk_image_new_from_stock(GAIM_STOCK_DIALOG_COOL, GTK_ICON_SIZE_DIALOG); gtkblist = GAIM_GTK_BLIST(gaim_get_blist()); @@ -647,7 +647,7 @@ GtkWidget *hbox, *vbox; GtkWidget *label; GtkWidget *table; - struct gaim_gtk_buddy_list *gtkblist; + GaimGtkBuddyList *gtkblist; GtkWidget *img = gtk_image_new_from_stock(GAIM_STOCK_DIALOG_QUESTION, GTK_ICON_SIZE_DIALOG); struct getuserinfo *info = NULL; @@ -730,7 +730,7 @@ GtkWidget *img = gtk_image_new_from_stock(GAIM_STOCK_DIALOG_QUESTION, GTK_ICON_SIZE_DIALOG); GtkWidget *table; struct getuserinfo *info = g_new0(struct getuserinfo, 1); - struct gaim_gtk_buddy_list *gtkblist; + GaimGtkBuddyList *gtkblist; gtkblist = GAIM_GTK_BLIST(gaim_get_blist());
--- a/src/gtkblist.h Wed Oct 01 03:46:16 2003 +0000 +++ b/src/gtkblist.h Wed Oct 01 04:05:46 2003 +0000 @@ -40,14 +40,16 @@ typedef enum { GAIM_STATUS_ICON_LARGE, GAIM_STATUS_ICON_SMALL + } GaimStatusIconSize; + /************************************************************************** * @name Structures **************************************************************************/ /** * Like, everything you need to know about the gtk buddy list */ -struct gaim_gtk_buddy_list { +typedef struct { GtkWidget *window; GtkWidget *vbox; /**< This is the vbox that everything gets packed into. Your plugin might want to pack something in it itself. Go, plugins! */ @@ -73,9 +75,10 @@ GtkWidget *tipwindow; /**< The window used by the tooltip */ GaimBlistNode *selected_node; /**< The currently selected node */ -}; -#define GAIM_GTK_BLIST(list) ((struct gaim_gtk_buddy_list *)(list)->ui_data) +} GaimGtkBuddyList; + +#define GAIM_GTK_BLIST(list) ((GaimGtkBuddyList *)(list)->ui_data) #define GAIM_IS_GTK_BLIST(list) \ ((list)->ui_ops == gaim_gtk_blist_get_ui_ops()) @@ -93,7 +96,7 @@ * * @return The GTK list operations structure. */ -struct gaim_blist_ui_ops *gaim_gtk_blist_get_ui_ops(void); +GaimBlistUiOps *gaim_gtk_blist_get_ui_ops(void); /** * Returns the base image to represent the account, based on the currently selected theme @@ -110,7 +113,7 @@ * * @param list This is the core list that gets updated from */ -void gaim_gtk_blist_refresh(struct gaim_buddy_list *list); +void gaim_gtk_blist_refresh(GaimBuddyList *list); /** * Tells the buddy list to update its toolbar based on the preferences @@ -139,7 +142,7 @@ * @name GTK+ Buddy List sorting functions **************************************************************************/ -typedef GtkTreeIter (*gaim_gtk_blist_sort_function)(GaimBlistNode *new, struct gaim_buddy_list *blist, GtkTreeIter group, GtkTreeIter *cur); +typedef GtkTreeIter (*gaim_gtk_blist_sort_function)(GaimBlistNode *new, GaimBuddyList *blist, GtkTreeIter group, GtkTreeIter *cur); extern GSList *gaim_gtk_blist_sort_methods;
--- a/src/gtkconn.c Wed Oct 01 03:46:16 2003 +0000 +++ b/src/gtkconn.c Wed Oct 01 04:05:46 2003 +0000 @@ -299,7 +299,7 @@ { GSList *awy = away_messages; struct away_message *a, *message = NULL; - struct gaim_gtk_buddy_list *gtkblist; + GaimGtkBuddyList *gtkblist; gtkblist = GAIM_GTK_BLIST(gaim_get_blist());
--- a/src/gtkpounce.c Wed Oct 01 03:46:16 2003 +0000 +++ b/src/gtkpounce.c Wed Oct 01 04:05:46 2003 +0000 @@ -178,8 +178,8 @@ { const char *name; const char *message, *command, *sound; - struct gaim_buddy_list *blist; - struct gaim_gtk_buddy_list *gtkblist; + GaimBuddyList *blist; + GaimGtkBuddyList *gtkblist; GaimPounceEvent events = GAIM_POUNCE_NONE; name = gtk_entry_get_text(GTK_ENTRY(dialog->buddy_entry)); @@ -918,8 +918,8 @@ static void free_pounce(GaimPounce *pounce) { - struct gaim_buddy_list *blist; - struct gaim_gtk_buddy_list *gtkblist; + GaimBuddyList *blist; + GaimGtkBuddyList *gtkblist; /* Rebuild the pounce menu */ blist = gaim_get_blist();
--- a/src/protocols/oscar/oscar.c Wed Oct 01 03:46:16 2003 +0000 +++ b/src/protocols/oscar/oscar.c Wed Oct 01 04:05:46 2003 +0000 @@ -4879,7 +4879,7 @@ GaimBlistNode *gnode, *cnode, *bnode; GaimGroup *group; GaimBuddy *buddy; - struct gaim_buddy_list *blist; + GaimBuddyList *blist; GSList *cur; /* Buddies */