Yattm - unified GTK instant-messaging client logo
   [Generated for version 0.2-17 - Mon Jan 6 19:01:23 GMT+1 2003]

Home - Main Page - Data Structures - File List - Data Fields - Globals

plugin_api.c File Reference

#include "intl.h"
#include "globals.h"
#include "plugin.h"
#include "dialog.h"
#include "prefs.h"

Include dependency graph for plugin_api.c:

Include dependency graph

Go to the source code of this file.

Functions

void eb_gtk_dialog_callback (GtkWidget *widget, gpointer data)
ebmImportDataebmImportData_new ()
ebmCallbackDataebmProfileData_new (eb_local_account *ela)
ebmContactDataebmContactData_new ()
void * eb_add_menu_item (char *label, char *menu_name, eb_menu_callback callback, ebmType type, void *data)
int eb_remove_menu_item (char *menu_name, void *tag)
void eb_do_dialog (char *message, char *title, eb_callback_action action, void *data)
void eb_set_active_menu_status (GSList *status_menu, int status)
int eb_input_add (int fd, eb_input_condition condition, eb_input_function function, void *callback_data)
void eb_input_remove (int tag)
int EB_DEBUG (const char *func, char *file, int line, char *fmt, va_alist) char *fmt


Function Documentation

void* eb_add_menu_item char *    label,
char *    menu_name,
eb_menu_callback    callback,
ebmType    type,
void *    data
 

Definition at line 64 of file plugin_api.c.

References menu_item_data::callback, DBG_CORE, eb_debug, eb_menu_callback, ebmType, GetPref(), menu_item_data::label, menu_data::menu_items, menu_data::redraw_menu, menu_data::type, and menu_item_data::user_data.

00065 {
00066     menu_item_data *mid=NULL;
00067     menu_data *md=NULL;
00068 
00069     eb_debug(DBG_CORE, ">Adding %s to menu %s\n", label, menu_name);
00070     md = GetPref(menu_name);
00071     if(!md)  {
00072         eb_debug("Unknown menu requested: %s\n", menu_name);
00073         return(NULL);
00074     }
00075     /* Make sure they're expecting the right kind of structure to be passed back */
00076     if(type!=md->type) {
00077         eb_debug("Incorrect ebmType passed, not adding menu item: %s\n", label);
00078         return(NULL);
00079     }
00080     mid=g_new0(menu_item_data, 1);
00081     mid->user_data=data;
00082     mid->label=label;
00083     mid->callback=callback;
00084     md->menu_items = g_list_append(md->menu_items, mid);
00085     if(md->redraw_menu) {
00086         eb_debug(DBG_CORE, "Calling redraw_menu for %s\n", menu_name);
00087         md->redraw_menu();
00088     }
00089     eb_debug(DBG_CORE, "<Successfully added menu item\n");
00090     /* Return the menu_item_data pointer, so that g_list_remove can be used */
00091     return((void *)mid);
00092 }

int EB_DEBUG const char *    func,
char *    file,
int    line,
char *    fmt,
va_alist   
 

void eb_do_dialog char *    message,
char *    title,
eb_callback_action    action,
void *    data
 

Definition at line 120 of file plugin_api.c.

References callback_data::action, callback_data::data, do_dialog(), eb_callback_action, eb_gtk_dialog_callback(), and title.

00121 {
00122     callback_data *cd=g_new0(callback_data,1);
00123     cd->action=action;
00124     cd->data=data;
00125     do_dialog(message, title, eb_gtk_dialog_callback, cd);
00126 }

void eb_gtk_dialog_callback GtkWidget *    widget,
gpointer    data
[static]
 

Definition at line 28 of file plugin_api.c.

References callback_data::action, and callback_data::data.

Referenced by eb_do_dialog().

00029 {
00030     callback_data *cd= (callback_data *)data;
00031     int result=0;
00032 
00033     result=(int)gtk_object_get_user_data(GTK_OBJECT(widget));
00034     cd->action(cd->data, result);
00035     //g_free(cd);
00036 }

int eb_input_add int    fd,
eb_input_condition    condition,
eb_input_function    function,
void *    callback_data
 

Definition at line 139 of file plugin_api.c.

References eb_input_condition, and eb_input_function.

00141 {
00142     return(gdk_input_add(fd, condition, function, callback_data));
00143 }

void eb_input_remove int    tag
 

Definition at line 145 of file plugin_api.c.

00146 {
00147     gdk_input_remove(tag);
00148 }

int eb_remove_menu_item char *    menu_name,
void *    tag
 

Definition at line 94 of file plugin_api.c.

References DBG_CORE, eb_debug, GetPref(), menu_item_data::label, menu_data::menu_items, and menu_data::redraw_menu.

00095 {
00096     menu_data *md=NULL;
00097     menu_item_data *mid=(menu_item_data *)tag;
00098 
00099     if(mid) {
00100         eb_debug(DBG_CORE, ">Request to remove %s from menu %s\n", mid->label, menu_name);
00101     }
00102     if(!tag) {
00103         eb_debug(DBG_CORE, "<Received request to delete from menu %s, with empty tag\n", menu_name);
00104         return(-1);
00105     }
00106     md=GetPref(menu_name);
00107     if(!md) {
00108         eb_debug(DBG_CORE, "<Requested menu %s does not exist, returning failure\n", menu_name);
00109         return(-1);
00110     }
00111     md->menu_items=g_list_remove(md->menu_items, tag);
00112     if(md->redraw_menu) {
00113         eb_debug(DBG_CORE, "Calling redraw_menu\n");
00114         md->redraw_menu();
00115     }
00116     eb_debug(DBG_CORE, "<Returning success\n");
00117     return(0);
00118 }

void eb_set_active_menu_status GSList *    status_menu,
int    status
 

Definition at line 128 of file plugin_api.c.

Referenced by eb_status().

00129 {
00130     gtk_check_menu_item_set_active
00131         (GTK_CHECK_MENU_ITEM
00132             (
00133              g_slist_nth(status_menu, status)->data
00134              ), TRUE
00135         );
00136 }

ebmContactData* ebmContactData_new  
 

Definition at line 57 of file plugin_api.c.

References ebmCONTACTDATA.

Referenced by contact_menu(), and handle_click().

00058 {
00059     ebmContactData *ecd=g_new0(ebmContactData, 1);
00060     ((ebmCallbackData *)ecd)->CDType=ebmCONTACTDATA;
00061     return(ecd);
00062 }

ebmImportData* ebmImportData_new  
 

Definition at line 41 of file plugin_api.c.

References ebmIMPORTDATA.

00042 {
00043     ebmImportData *eid=g_new0(ebmImportData, 1);
00044     ((ebmCallbackData *)eid)->CDType=ebmIMPORTDATA;
00045     return(eid);
00046 }

ebmCallbackData* ebmProfileData_new eb_local_account   ela
 

Definition at line 48 of file plugin_api.c.

References ebmPROFILEDATA, and ebmCallbackData::user_data.

00049 {
00050     ebmCallbackData *eid=g_new0(ebmCallbackData, 1);
00051     ((ebmCallbackData *)eid)->CDType=ebmPROFILEDATA;
00052     eid->user_data = ela;
00053     return(eid);
00054 }


Contact: Andy Maloney     [Documentation generated by doxygen]