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

status.h File Reference

#include <gtk/gtk.h>
#include "account.h"

Include dependency graph for status.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Data Structures

struct  callback_item

Enumerations

enum  list_type { LIST_ONLINE, LIST_EDIT }

Functions

void add_contact_and_accounts (struct contact *c)
void add_contact_line (struct contact *ec)
void add_account_line (eb_account *ea)
void add_group_line (grouplist *eg)
void remove_account_line (eb_account *ea)
void remove_contact_line (struct contact *ec)
void remove_group_line (grouplist *eg)
void buddy_update_status_and_log (eb_account *ea)
void buddy_update_status (eb_account *ea)
void contact_update_status (struct contact *ec)
void buddy_login (eb_account *ea)
void buddy_logoff (eb_account *ea)
void eb_sign_on_all (GtkWidget *widget, gpointer foo)
void eb_import_window (GtkWidget *import_submenuitem)
void eb_profile_window (GtkWidget *profile_submenuitem)
void eb_set_status_window (GtkWidget *set_status_submenuitem)
void eb_status_window ()
GtkWidget * MakeStatusButton (eb_local_account *ela)
void update_contact_list ()
void update_user (eb_account *ea)
void update_contact_window_length ()
void focus_statuswindow (void)


Enumeration Type Documentation

enum list_type
 

Enumeration values:
LIST_ONLINE 
LIST_EDIT 

Definition at line 32 of file status.h.

00033 {
00034     LIST_ONLINE,
00035     LIST_EDIT
00036 };


Function Documentation

void add_account_line eb_account   ea
 

Definition at line 826 of file status.c.

References _, account_click(), account::account_contact, add_contact_line(), get_account_position(), account::handle, account::icon_handler, iconblank_bm, iconblank_pm, account::list_item, account::pix, RUN_SERVICE, account::status, status_tips, and contact::tree.

Referenced by add_contact_and_accounts(), buddy_login(), and update_contact_list().

00827 {
00828     GtkWidget * box, * label;
00829     
00830     if (ea->list_item)
00831         return;
00832     
00833     add_contact_line(ea->account_contact);
00834 
00835     ea->list_item = gtk_tree_item_new();
00836 
00837     box = gtk_hbox_new(FALSE, 1);
00838     ea->pix = gtk_pixmap_new(iconblank_pm, iconblank_bm);
00839     label = gtk_label_new(ea->handle);
00840     {
00841         char * c = g_strndup(RUN_SERVICE(ea)->get_status_string(ea), 20);
00842         if(strlen(c) == 20)
00843         {
00844             c[19] = c[18] = c[17] = '.';
00845             if(!status_tips)
00846             {
00847                 status_tips = gtk_tooltips_new();
00848             }
00849             /*
00850              * that 3rd parameter is not a bug, it really is a useless
00851              * parameter
00852              */
00853 
00854             gtk_tooltips_set_tip(GTK_TOOLTIPS(status_tips), ea->list_item,
00855                     RUN_SERVICE(ea)->get_status_string(ea),
00856                     _("status info here"));
00857         }
00858         ea->status = gtk_label_new(c);
00859         g_free(c);
00860     }
00861 
00862     gtk_box_pack_start(GTK_BOX(box), ea->pix, FALSE, FALSE, 1);
00863     gtk_widget_show(ea->pix);
00864     gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5);
00865     gtk_box_pack_start(GTK_BOX(box), label, TRUE, TRUE, 1);
00866     gtk_widget_show(label);
00867     gtk_box_pack_start(GTK_BOX(box), ea->status, FALSE, FALSE, 1);
00868     gtk_widget_show(ea->status);
00869 
00870     gtk_container_add(GTK_CONTAINER(ea->list_item), box);
00871     gtk_widget_show(box);
00872 
00873     ea->icon_handler = -1;
00874 
00875     gtk_object_set_user_data(GTK_OBJECT(ea->list_item), ea);
00876     gtk_tree_insert(GTK_TREE(ea->account_contact->tree), ea->list_item,
00877         get_account_position(ea));
00878 
00879     gtk_signal_connect(GTK_OBJECT(ea->list_item),  "button_press_event",
00880                   GTK_SIGNAL_FUNC(account_click),
00881                   (eb_account *)ea );
00882 
00883     gtk_widget_show(ea->list_item);
00884 
00885 }

void add_contact_and_accounts struct contact   c
 

Definition at line 716 of file status.c.

References contact::accounts, add_account_line(), buddy_update_status(), account::online, and status_show.

Referenced by move_account(), and move_contact().

00717 {
00718     GList *l;
00719     for (l = c->accounts; l; l = l->next) 
00720     {
00721         eb_account * ea = l->data;
00722         if ((status_show == 0) || (status_show == 1) || ea->online) 
00723         {
00724             add_account_line(ea);
00725             buddy_update_status(ea);
00726         }
00727     }
00728 }

void add_contact_line struct contact   ec
 

Definition at line 888 of file status.c.

References _, _grouplist::contacts_shown, contact::group, contact::icon_handler, iconblank_bm, iconblank_pm, contact::label, _grouplist::list_item, contact::list_item, _grouplist::name, contact::nick, contact::pix, contact::status, _grouplist::tree, and contact::tree.

Referenced by add_account_line(), and update_contact_list().

00889 {
00890     GtkWidget * box;
00891     
00892     if (ec->list_item)
00893         return;
00894     
00895     ec->list_item = gtk_tree_item_new();
00896     ec->tree = gtk_tree_new();
00897 
00898     box = gtk_hbox_new(FALSE, 1);
00899     ec->pix = gtk_pixmap_new(iconblank_pm, iconblank_bm);
00900     ec->label = gtk_label_new(ec->nick);
00901     ec->status = gtk_label_new("");
00902 
00903     gtk_box_pack_start(GTK_BOX(box), ec->pix, FALSE, FALSE, 1);
00904     gtk_widget_show(ec->pix);
00905     gtk_misc_set_alignment(GTK_MISC(ec->label), 0.0, 0.5);
00906     gtk_box_pack_start(GTK_BOX(box), ec->label, TRUE, TRUE, 1);
00907     gtk_widget_show(ec->label);
00908     gtk_box_pack_start(GTK_BOX(box), ec->status, FALSE, FALSE, 1);
00909     gtk_widget_show(ec->status);
00910 
00911     gtk_container_add(GTK_CONTAINER(ec->list_item), box);
00912     gtk_widget_show(box);
00913 
00914     ec->icon_handler = -1;
00915 
00916     gtk_object_set_user_data(GTK_OBJECT(ec->list_item), ec);
00917     
00918     if (!ec->group->contacts_shown) {
00919         ec->group->tree = gtk_tree_new();
00920         gtk_tree_item_set_subtree(GTK_TREE_ITEM(ec->group->list_item),
00921             ec->group->tree);
00922         if(strcmp(_("Unknown"),ec->group->name) !=0 &&
00923            strcmp(_("Ignore"),ec->group->name) !=0)
00924             gtk_tree_item_expand(GTK_TREE_ITEM(ec->group->list_item));
00925     }
00926     gtk_drag_source_set(ec->list_item,
00927         GDK_BUTTON1_MASK | GDK_BUTTON2_MASK,
00928                 drag_types, 1,
00929         GDK_ACTION_MOVE|GDK_ACTION_DEFAULT);
00930     gtk_signal_connect(GTK_OBJECT(ec->list_item), "drag_begin",
00931                GTK_SIGNAL_FUNC(start_drag), ec);
00932     gtk_signal_connect(GTK_OBJECT(ec->list_item), "drag_data_get",
00933                GTK_SIGNAL_FUNC(drag_data_get),
00934                ec);
00935     
00936     ec->group->contacts_shown++;
00937     gtk_tree_insert(GTK_TREE(ec->group->tree), ec->list_item,
00938         get_contact_position(ec));
00939 
00940     gtk_tree_item_set_subtree(GTK_TREE_ITEM(ec->list_item), ec->tree);
00941     if(ec->expanded)
00942         gtk_tree_item_expand(GTK_TREE_ITEM(ec->list_item));
00943     else
00944         gtk_tree_item_collapse(GTK_TREE_ITEM(ec->list_item));
00945 
00946     gtk_signal_connect(GTK_OBJECT(ec->list_item),  "button_press_event",
00947                   GTK_SIGNAL_FUNC(contact_click),
00948                   (struct contact*)ec );
00949     gtk_signal_connect(GTK_OBJECT(ec->list_item), "expand",
00950                   GTK_SIGNAL_FUNC(expand_contact), (struct contact*)ec);
00951     gtk_signal_connect(GTK_OBJECT(ec->list_item), "collapse",
00952                   GTK_SIGNAL_FUNC(collapse_contact), (struct contact*)ec );
00953         
00954     gtk_widget_show(ec->list_item); 
00955 }

void add_group_line grouplist   eg
 

Definition at line 783 of file status.c.

References contact_list, _grouplist::contacts_online, _grouplist::contacts_shown, drag_motion_cb(), drag_types, group_click(), _grouplist::label, _grouplist::list_item, _grouplist::name, and _grouplist::tree.

Referenced by add_group(), MakeContactList(), and move_contact().

00784 {
00785     GtkWidget * box;
00786 
00787     /* Might call add_group() - which calls add_group_line() 
00788        before contact_list exists - this is OK so just return */
00789     if (eg->list_item || !contact_list)
00790         return;
00791         
00792     eg->list_item = gtk_tree_item_new();
00793 
00794     box = gtk_hbox_new(FALSE, 1);
00795 
00796     eg->label = gtk_label_new(eg->name);
00797     gtk_label_set_justify(GTK_LABEL(eg->label), GTK_JUSTIFY_LEFT);
00798 
00799     gtk_box_pack_start(GTK_BOX(box), eg->label, FALSE, FALSE, 1);
00800     gtk_widget_show(eg->label);
00801 
00802     gtk_container_add(GTK_CONTAINER(eg->list_item), box);
00803     gtk_widget_show(box);
00804 
00805     gtk_object_set_user_data(GTK_OBJECT(eg->list_item), (gpointer)eg);
00806     eg->contacts_online = 0;
00807     eg->contacts_shown = 0;
00808     eg->tree = NULL;
00809     gtk_tree_append(GTK_TREE(contact_list), eg->list_item);
00810 
00811     gtk_signal_connect(GTK_OBJECT(eg->list_item),  "button_press_event",
00812                GTK_SIGNAL_FUNC(group_click),
00813                (grouplist *)eg );
00814     gtk_drag_dest_set(eg->list_item, GTK_DEST_DEFAULT_ALL &
00815               ~GTK_DEST_DEFAULT_HIGHLIGHT,
00816               drag_types, 1,
00817               GDK_ACTION_MOVE|GDK_ACTION_DEFAULT);
00818     gtk_signal_connect(GTK_OBJECT(eg->list_item), "drag_motion",
00819                GTK_SIGNAL_FUNC(drag_motion_cb), eg);
00820     
00821     gtk_widget_show(eg->list_item);
00822 }

void buddy_login eb_account   ea
 

Definition at line 1334 of file status.c.

References _, account::account_contact, add_account_line(), buddy_update_status(), contact_login(), contact::group, account::icon_handler, iconlogin_bm, iconlogin_pm, _grouplist::name, contact::online, account::online, account::pix, refresh_buddy_status(), set_account_icon(), and account::status_handler.

01335 {
01336     
01337     /* don't do anything if this has already been done */
01338     if (ea->online)
01339         return;
01340     
01341     ea->account_contact->online++;
01342     ea->online = TRUE;
01343     
01344     if (do_ignore_unknown && !strcmp(_("Unknown"), ea->account_contact->group->name))
01345         return;
01346     
01347     add_account_line(ea);
01348     
01349     /* sets the "open door" icon */
01350     gtk_pixmap_set(GTK_PIXMAP(ea->pix), iconlogin_pm, iconlogin_bm);
01351 
01352     /* set the timeout to remove the "open door" icon */
01353     if (ea->icon_handler != -1)
01354         gtk_timeout_remove(ea->icon_handler);
01355     ea->icon_handler = gtk_timeout_add(10000, (GtkFunction)set_account_icon,
01356         (gpointer) ea);
01357     
01358     /* if there is only one account (this one) logged in under the
01359        parent contact, we must login the contact also */
01360     if (ea->account_contact->online == 1)
01361         contact_login(ea->account_contact);
01362         
01363     buddy_update_status(ea);
01364     
01365     /* make sure the status gets updated often */
01366     ea->status_handler = gtk_timeout_add(30000,
01367         (GtkFunction)refresh_buddy_status, (gpointer) ea);
01368 }

void buddy_logoff eb_account   ea
 

Definition at line 1372 of file status.c.

References _, account::account_contact, contact_logoff(), contact::group, hide_account(), account::icon_handler, iconlogoff_bm, iconlogoff_pm, _grouplist::name, contact::online, account::online, account::pix, and account::status_handler.

Referenced by remove_account().

01373 {
01374     
01375     /* don't do anything if this has already been done */
01376     if (!ea || !ea->online)
01377         return;
01378     
01379     ea->account_contact->online--;
01380     ea->online = FALSE;
01381 
01382     if (do_ignore_unknown && !strcmp(_("Unknown"), ea->account_contact->group->name))
01383         return;
01384 
01385     /* sets the "closed door" icon */
01386     gtk_pixmap_set(GTK_PIXMAP(ea->pix), iconlogoff_pm, iconlogoff_bm);
01387 
01388     /* removes any previously set timeouts for the account */ 
01389     if (ea->icon_handler != -1)
01390         gtk_timeout_remove(ea->icon_handler);
01391     ea->icon_handler = -1;
01392     if (ea->status_handler != -1)
01393         gtk_timeout_remove(ea->status_handler);
01394     ea->status_handler = -1;
01395     
01396     /* if this is the last account of the parent contact to log off,
01397        we must log off the contact also */
01398     if (ea->account_contact->online == 0)
01399         contact_logoff(ea->account_contact);
01400 
01401     /* timeout to remove the "close door" icon */
01402     ea->icon_handler = gtk_timeout_add(10000, (GtkFunction)hide_account,
01403         (gpointer) ea);
01404 
01405 }

void buddy_update_status eb_account   ea
 

Definition at line 1173 of file status.c.

References _, account::account_contact, contact_update_status(), eb_update_status(), account::icon_handler, account::list_item, account::pix, RUN_SERVICE, account::status, and status_tips.

Referenced by add_contact_and_accounts(), buddy_login(), buddy_update_status_and_log(), hide_account(), hide_contact(), refresh_buddy_status(), set_account_icon(), and update_contact_list().

01174 {
01175     GdkPixmap * pm;
01176     GdkBitmap * bm;
01177     if (!ea || !ea->list_item)
01178         return;
01179     
01180     {
01181         char * c = g_strndup(RUN_SERVICE(ea)->get_status_string(ea), 20);
01182         if(strlen(c) == 20)
01183         {
01184             c[19] = c[18] = c[17] = '.';
01185             if(!status_tips)
01186             {
01187                 status_tips = gtk_tooltips_new();
01188             }
01189             /*
01190              * that 3rd parameter is not a bug, it really is a useless
01191              * parameter
01192              */
01193 
01194             gtk_tooltips_set_tip(GTK_TOOLTIPS(status_tips), ea->list_item,
01195                     RUN_SERVICE(ea)->get_status_string(ea),
01196                     _("status info here"));
01197         }
01198         eb_update_status(ea, c);
01199         gtk_label_set_text(GTK_LABEL(ea->status), c);
01200 
01201         g_free(c);
01202     }
01203 
01204     /* update the icon if another timeout isn't about to change it */
01205     if (ea->icon_handler == -1) {
01206         RUN_SERVICE(ea)->get_status_pixmap(ea, &pm, &bm);
01207         gtk_pixmap_set(GTK_PIXMAP(ea->pix), pm, bm);
01208     }
01209 
01210     /* since the contact's status info  might be a copy of this
01211        account's status info, we should refresh that also */    
01212     contact_update_status(ea->account_contact); 
01213 }

void buddy_update_status_and_log eb_account   ea
 

Definition at line 1165 of file status.c.

References buddy_update_status(), eb_log_status_changed(), and RUN_SERVICE.

01166 {
01167     eb_log_status_changed(ea, RUN_SERVICE(ea)->get_status_string(ea));
01168 
01169     buddy_update_status(ea);
01170 }

void contact_update_status struct contact   ec
 

Definition at line 1077 of file status.c.

References _, contact::accounts, contact_list, contact_window, contact::default_chatb, contact::icon_handler, contact::label, contact::list_item, contact::nick, account::online, contact::pix, RUN_SERVICE, account::service_id, contact::status, and status_tips.

Referenced by buddy_update_status(), set_contact_icon(), and update_contact_list().

01078 {
01079     GdkPixmap * pm;
01080     GdkBitmap * bm;
01081     eb_account * ea = NULL;
01082     GList * l;
01083     int width, height;
01084     int width2, height2;
01085     int width3, height3;
01086 
01087     /* find the account who's status information should be reflected in
01088        the contact line (preferably the default protocol account, but
01089        if that one is not logged on, use another) */
01090     for (l = ec->accounts; l; l = l->next) 
01091     {
01092         eb_account * account = l->data;
01093         if (!ea)
01094             ea = account;
01095         if (!ea->online && account->online)
01096             ea = account;
01097         if (ec->default_chatb != ea->service_id && account->online &&
01098                 ec->default_chatb == account->service_id)
01099             ea = account;
01100     }
01101 
01102     if (!ea)
01103         return;
01104 
01105     {
01106         char * c = g_strndup(RUN_SERVICE(ea)->get_status_string(ea), 20);
01107         if(strlen(c) == 20)
01108         {
01109             c[19] = c[18] = c[17] = '.';
01110             if(!status_tips)
01111             {
01112                 status_tips = gtk_tooltips_new();
01113             }
01114             /*
01115              * that 3rd parameter is not a bug, it really is a useless
01116              * parameter
01117              */
01118 
01119             gtk_tooltips_set_tip(GTK_TOOLTIPS(status_tips), ec->list_item,
01120                     RUN_SERVICE(ea)->get_status_string(ea),
01121                     _("status info here"));
01122         }
01123         gtk_label_set_text(GTK_LABEL(ec->status), c);
01124         g_free(c);
01125     }
01126     gtk_label_set_text(GTK_LABEL(ec->label), ec->nick);
01127 
01128     /* set the icon if there isn't another timeout about to alter the icon */
01129     if (ec->icon_handler == -1) 
01130     {
01131         RUN_SERVICE(ea)->get_status_pixmap(ea, &pm, &bm);
01132         gtk_pixmap_set(GTK_PIXMAP(ec->pix), pm, bm);
01133     }
01134 
01135     width = contact_list->allocation.width;
01136     height = contact_list->allocation.height;
01137 
01138     if(GTK_WIDGET_VISIBLE(GTK_SCROLLED_WINDOW(contact_window)->vscrollbar))
01139     {
01140         width3 = GTK_SCROLLED_WINDOW(contact_window)->vscrollbar->allocation.width;
01141         height3 = GTK_SCROLLED_WINDOW(contact_window)->vscrollbar->allocation.height;
01142     }
01143     else
01144     {
01145         width3 = 0, height3 = 0;
01146     }
01147 
01148         if (do_noautoresize == 0)
01149     {
01150         width2 = contact_window->allocation.width;
01151         height2 = contact_window->allocation.height;
01152 
01153         if(width+width3> width2)
01154         {
01155             gtk_widget_set_usize(contact_window,width+width3+2,height2);
01156         } 
01157     }
01158     
01159 }

void eb_import_window GtkWidget *    import_submenuitem
 

Definition at line 1588 of file status.c.

References menu_item_data::callback, menu_item_data::data, DBG_CORE, eb_debug, eb_import_function(), EB_IMPORT_MENU, GetPref(), menu_item_data::label, and menu_data::menu_items.

Referenced by eb_status_window(), and rebuild_import_menu().

01589 {
01590     GtkWidget *label;
01591     // import_items is a list of struct callback_items
01592     GList *list=NULL;
01593     GtkWidget * import_menu = gtk_menu_new();
01594     menu_data *md=NULL;
01595     menu_item_data *mid=NULL;
01596 
01597     label = gtk_tearoff_menu_item_new();
01598     gtk_menu_append(GTK_MENU(import_menu), label);
01599     gtk_widget_show(label);
01600 
01601     eb_debug(DBG_CORE, ">\n");
01602     /* import_items is a list that is maintained as a pref, modified by calls to eb_add_menu_item */
01603     md = GetPref(EB_IMPORT_MENU);
01604     if(md) {
01605         for(list = md->menu_items; list; list  = g_list_next(list) ) {
01606             mid=(menu_item_data *)list->data;
01607             eb_debug(DBG_CORE, "adding import item: %s\n", mid->label);
01608             label = gtk_menu_item_new_with_label(mid->label);
01609             gtk_menu_append(GTK_MENU(import_menu), label);
01610             gtk_signal_connect(GTK_OBJECT(label), "activate",
01611                     eb_import_function, mid->callback);
01612             gtk_widget_show(label);  
01613         }
01614     }
01615     gtk_menu_item_set_submenu(GTK_MENU_ITEM(import_submenuitem), import_menu);
01616     gtk_widget_show(import_menu);
01617     gtk_widget_show(import_submenuitem);
01618     eb_debug(DBG_CORE, "<\n");
01619 }

void eb_profile_window GtkWidget *    profile_submenuitem
 

Definition at line 1551 of file status.c.

References menu_item_data::data, DBG_CORE, eb_debug, eb_profile_function(), EB_PROFILE_MENU, GetPref(), menu_item_data::label, and menu_data::menu_items.

Referenced by eb_status_window(), and rebuild_profile_menu().

01552 {
01553     GtkWidget *label;
01554     // import_items is a list of struct callback_items
01555     GList *list=NULL;
01556     GtkWidget * profile_menu = gtk_menu_new();
01557     menu_data *md=NULL;
01558     menu_item_data *mid=NULL;
01559     gboolean added = FALSE;
01560 
01561     label = gtk_tearoff_menu_item_new();
01562     gtk_menu_append(GTK_MENU(profile_menu), label);
01563     gtk_widget_show(label);
01564 
01565     eb_debug(DBG_CORE, ">\n");
01566     /* import_items is a list that is maintained as a pref, modified by calls to eb_add_menu_item */
01567     md = GetPref(EB_PROFILE_MENU);
01568     if(md) {
01569         for(list = md->menu_items; list; list  = g_list_next(list) ) {
01570             mid=(menu_item_data *)list->data;
01571             eb_debug(DBG_CORE, "adding profile item: %s\n", mid->label);
01572             label = gtk_menu_item_new_with_label(mid->label);
01573             gtk_menu_append(GTK_MENU(profile_menu), label);
01574             gtk_signal_connect(GTK_OBJECT(label), "activate",
01575                     eb_profile_function, mid);
01576             gtk_widget_show(label);  
01577             added = TRUE;
01578         }
01579     }
01580     gtk_widget_set_sensitive(profile_submenuitem, added);
01581     
01582     gtk_menu_item_set_submenu(GTK_MENU_ITEM(profile_submenuitem), profile_menu);
01583     gtk_widget_show(profile_menu);
01584     gtk_widget_show(profile_submenuitem);
01585     eb_debug(DBG_CORE, "<\n");
01586 }

void eb_set_status_window GtkWidget *    set_status_submenuitem
 

Definition at line 1621 of file status.c.

References account_menu(), and MakeStatusMenu().

Referenced by eb_status_window(), and rebuild_set_status_menu().

01622 {
01623     GtkWidget *label;
01624     GtkWidget * account_menu = gtk_menu_new();
01625     GList *list=NULL;
01626 
01627     label = gtk_tearoff_menu_item_new();
01628     gtk_menu_append(GTK_MENU(account_menu), label); 
01629     gtk_widget_show(label);
01630     for(list = accounts; list; list  = g_list_next(list) )
01631     {
01632         label = MakeStatusMenu(list->data);
01633         ((eb_local_account*)(list->data))->status_button = label;
01634         gtk_menu_append(GTK_MENU(account_menu), label);
01635         gtk_widget_show(label);
01636     }
01637     gtk_menu_item_set_submenu(GTK_MENU_ITEM(set_status_submenuitem), account_menu);
01638     gtk_widget_show(account_menu);
01639     gtk_widget_show(set_status_submenuitem);
01640 }

void eb_sign_on_all GtkWidget *    widget,
gpointer    foo
 

Definition at line 553 of file status.c.

References local_account::connected, and RUN_SERVICE.

Referenced by start_login().

00553                                                      {
00554     GList *node = accounts ;
00555     while(node) {
00556         eb_local_account *ac = (eb_local_account*)(node->data);
00557         if (!ac->connected) {
00558             RUN_SERVICE(ac)->login(ac) ;
00559         }
00560         node = node->next ;
00561     }
00562 }

void eb_status_window  
 

Definition at line 1702 of file status.c.

References _, away_menu, build_away_menu(), contact_window, DBG_CORE, delete_event(), eb_debug, eb_icon(), eb_import_window(), eb_profile_window(), eb_save_size(), eb_set_status_window(), geometry, get_main_menu(), iconblank_bm, iconblank_pm, iconlogin_bm, iconlogin_pm, iconlogoff_bm, iconlogoff_pm, load_away_messages(), main_menu_factory, MakeContactList(), SetPref(), status_bar, status_message, status_show_callback(), statuswindow, and update_contact_list().

Referenced by ok_callback(), and start_login().

01703 {
01704     GtkWidget *statusbox;
01705     GtkWidget *vbox;
01706     GtkWidget *label;
01707     GtkWidget *menubox;
01708     GtkWidget *menu;
01709     GtkWidget *submenuitem;
01710     GtkWidget *hbox;
01711     GtkAccelGroup *accel = NULL;
01712     char * userrc = NULL;
01713     int win_x, win_y, win_w, win_h;
01714     int flags;
01715 
01716     statuswindow = gtk_window_new(GTK_WINDOW_TOPLEVEL);
01717     accel = gtk_accel_group_new();
01718     gtk_window_add_accel_group( GTK_WINDOW(statuswindow),accel );
01719     /* The next line allows you to make the window smaller than the orig. size */
01720     gtk_window_set_policy(GTK_WINDOW(statuswindow), TRUE, TRUE, TRUE);
01721     gtk_widget_realize(statuswindow);
01722 
01723     iconlogin_pm = gdk_pixmap_create_from_xpm_d(statuswindow->window, &iconlogin_bm,
01724         NULL, (gchar **) login_icon_xpm);
01725     iconblank_pm = gdk_pixmap_create_from_xpm_d(statuswindow->window, &iconblank_bm,
01726         NULL, (gchar **) blank_icon_xpm);
01727     iconlogoff_pm = gdk_pixmap_create_from_xpm_d(statuswindow->window, &iconlogoff_bm,
01728         NULL, (gchar **) logoff_icon_xpm);
01729 
01730     /* handle geometry - ivey */
01731 
01732 #ifndef __MINGW32__
01733     if (geometry[0] != 0) { 
01734         flags = XParseGeometry(geometry, &win_x, &win_y, &win_w, &win_h);
01735         /* proper negative handling comes later... 
01736         if ((flags & XValue) && (flags & XNegative))
01737             *win_x = DisplayWidth(display, screenNum) - *win_x;
01738         if ((flags & YValue) && (flags & YNegative))
01739             *win_y = DisplayHeight(display, screenNum) - *win_y;
01740         */
01741         gtk_window_set_position(GTK_WINDOW(statuswindow), GTK_WIN_POS_NONE); 
01742         gtk_widget_set_uposition(statuswindow, win_x, win_y);
01743         gtk_widget_set_usize(statuswindow, win_w, win_h);
01744     }
01745 #endif
01746     statusbox = gtk_vbox_new(FALSE, 0);
01747 
01748     menubox = gtk_handle_box_new();
01749     gtk_handle_box_set_handle_position(GTK_HANDLE_BOX(menubox), GTK_POS_LEFT);
01750     gtk_handle_box_set_snap_edge(GTK_HANDLE_BOX(menubox), GTK_POS_LEFT);
01751     gtk_handle_box_set_shadow_type(GTK_HANDLE_BOX(menubox), GTK_SHADOW_NONE);
01752 
01753     userrc = g_strconcat(config_dir, G_DIR_SEPARATOR_S, "menurc", NULL);
01754     gtk_item_factory_parse_rc(userrc);
01755     g_free(userrc);
01756 
01757     get_main_menu(statuswindow, &menu);
01758     
01759     /* fill in branches */
01760     
01761     submenuitem = gtk_item_factory_get_widget(main_menu_factory, "/File/Import");
01762     eb_import_window(submenuitem);
01763     SetPref("widget::import_submenuitem", submenuitem);
01764     
01765     submenuitem = gtk_item_factory_get_widget(main_menu_factory, "/File/Set profile");
01766     eb_profile_window(submenuitem);
01767     SetPref("widget::profile_submenuitem", submenuitem);
01768     
01769     submenuitem = gtk_item_factory_get_widget(main_menu_factory, "/File/Set status");
01770     eb_set_status_window(submenuitem);
01771     SetPref("widget::set_status_submenuitem", submenuitem);
01772     
01773     away_menu = gtk_menu_new();
01774     load_away_messages();
01775     build_away_menu();
01776 
01777     submenuitem = gtk_item_factory_get_widget(main_menu_factory, "/Tools/Set as away");
01778     gtk_menu_item_set_submenu(GTK_MENU_ITEM(submenuitem), away_menu);
01779     gtk_widget_show(away_menu);
01780         
01781     gtk_container_add(GTK_CONTAINER(menubox), menu );
01782     gtk_widget_show(menu);
01783     gtk_box_pack_start(GTK_BOX(statusbox), menubox, FALSE, FALSE, 0 );
01784     gtk_widget_show(menubox);
01785 
01786     /*
01787      * Do the main status window
01788      */
01789 
01790     vbox = gtk_vbox_new(FALSE, 0);
01791     hbox = gtk_hbox_new(FALSE, 0);
01792 
01793     label = gtk_radio_button_new_with_label
01794       (NULL, _("Online"));
01795     gtk_box_pack_start(GTK_BOX(hbox), label, TRUE, TRUE, 1);
01796     gtk_signal_connect(GTK_OBJECT(label), "clicked",
01797                GTK_SIGNAL_FUNC(status_show_callback),
01798                (gpointer) 2);
01799     gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(label),TRUE);
01800     gtk_widget_show(label);
01801 
01802 
01803     label = gtk_radio_button_new_with_label
01804       (gtk_radio_button_group(GTK_RADIO_BUTTON(label)),
01805        _("Contacts"));
01806     gtk_box_pack_start(GTK_BOX(hbox), label, TRUE, TRUE, 1);
01807     gtk_signal_connect(GTK_OBJECT(label), "clicked",
01808                GTK_SIGNAL_FUNC(status_show_callback),
01809                (gpointer) 1);
01810     gtk_widget_show(label);
01811 
01812 
01813     label = gtk_radio_button_new_with_label
01814       (gtk_radio_button_group(GTK_RADIO_BUTTON(label)),
01815        _("Accounts"));
01816     gtk_box_pack_start(GTK_BOX(hbox), label, TRUE, TRUE, 1);
01817     gtk_signal_connect(GTK_OBJECT(label), "clicked",
01818                GTK_SIGNAL_FUNC(status_show_callback),
01819                (gpointer) 0);
01820     gtk_widget_show(label);
01821 
01822     gtk_box_pack_start(GTK_BOX(vbox),hbox,FALSE,FALSE,0);
01823     gtk_widget_show(hbox);
01824 
01825     eb_debug(DBG_CORE, "%d\n", g_list_length(accounts));
01826     MakeContactList();
01827     gtk_widget_show(contact_window);
01828     gtk_box_pack_start(GTK_BOX(vbox),contact_window,TRUE,TRUE,0);
01829 
01830     gtk_widget_show(vbox);
01831 
01832     gtk_box_pack_start(GTK_BOX(statusbox), vbox, TRUE, TRUE,0);
01833 
01834     /*
01835      * Status Bar
01836      */
01837 
01838     hbox = gtk_handle_box_new();
01839     gtk_handle_box_set_handle_position(GTK_HANDLE_BOX(hbox), GTK_POS_LEFT);
01840     gtk_handle_box_set_snap_edge(GTK_HANDLE_BOX(hbox), GTK_POS_LEFT);
01841     status_message = gtk_label_new(_("Welcome To Yattm"));
01842     status_bar = gtk_frame_new(NULL);
01843     gtk_frame_set_shadow_type(GTK_FRAME(status_bar), GTK_SHADOW_IN );
01844     gtk_widget_show(status_message);
01845     gtk_container_add(GTK_CONTAINER(status_bar), status_message);
01846     gtk_widget_show(status_bar);
01847     gtk_container_add(GTK_CONTAINER(hbox), status_bar);
01848     gtk_widget_show(hbox);
01849         
01850         gtk_box_pack_start(GTK_BOX(statusbox), hbox ,FALSE, FALSE,0);
01851         gtk_window_set_title(GTK_WINDOW(statuswindow), _("Yattm "VERSION));
01852     eb_icon(statuswindow->window);
01853     gtk_widget_show(statusbox);
01854 
01855     gtk_container_add(GTK_CONTAINER(statuswindow), statusbox );
01856 
01857     gtk_signal_connect (GTK_OBJECT (statuswindow), "delete_event",
01858                 GTK_SIGNAL_FUNC (delete_event), NULL);
01859 
01860     gtk_widget_show( statuswindow);
01861 
01862     gtk_signal_connect(GTK_OBJECT(contact_window), "size_allocate",
01863             eb_save_size,NULL);
01864     update_contact_list ();
01865 }

void focus_statuswindow void   
 

Definition at line 96 of file status.c.

References statuswindow.

Referenced by console_session_get_command().

00097 {
00098     gdk_window_raise(statuswindow->window);
00099 }

GtkWidget* MakeStatusButton eb_local_account   ela
 

void remove_account_line eb_account   ea
 

Definition at line 1008 of file status.c.

References account::account_contact, DBG_CORE, eb_debug, account::icon_handler, account::list_item, account::pix, account::status, and contact::tree.

Referenced by hide_account(), move_account(), remove_account(), remove_contact_line(), and update_contact_list().

01009 {
01010 
01011     if (!ea || !ea->account_contact || !ea->list_item) {
01012         if(!ea->account_contact)
01013             eb_debug(DBG_CORE, "Not removing account_line, ea->account_contact is NULL !\n");
01014         return;
01015     }
01016 
01017     gtk_container_remove(GTK_CONTAINER(ea->account_contact->tree), ea->list_item);
01018     ea->list_item = NULL;
01019     ea->pix = NULL;
01020     ea->status = NULL;
01021     if (ea->icon_handler != -1)
01022         gtk_timeout_remove(ea->icon_handler);
01023     ea->icon_handler = -1;
01024 }

void remove_contact_line struct contact   ec
 

Definition at line 981 of file status.c.

References contact::accounts, _grouplist::contacts_shown, contact::group, contact::icon_handler, contact::label, account::list_item, contact::list_item, contact::pix, remove_account_line(), contact::status, contact::tree, and _grouplist::tree.

Referenced by hide_contact(), move_account(), move_contact(), remove_contact(), remove_group_line(), and update_contact_list().

00982 {
00983     GList * accounts;
00984     
00985     if (!ec->list_item)
00986         return;
00987         
00988     for (accounts = ec->accounts; accounts; accounts = accounts->next) {
00989         eb_account * ea = accounts->data;
00990         if (ea->list_item)
00991             remove_account_line(ea);
00992     }
00993     
00994     ec->group->contacts_shown--;
00995     gtk_container_remove(GTK_CONTAINER(ec->group->tree), ec->list_item);
00996     ec->list_item = NULL;
00997     ec->tree = NULL;
00998     ec->pix = NULL;
00999     ec->status = NULL;
01000     ec->label = NULL;
01001     if (ec->icon_handler != -1)
01002         gtk_timeout_remove(ec->icon_handler);
01003     ec->icon_handler = -1;
01004 }

void remove_group_line grouplist   eg
 

Definition at line 958 of file status.c.

References contact_list, _grouplist::label, contact::list_item, _grouplist::list_item, _grouplist::members, remove_contact_line(), and _grouplist::tree.

Referenced by remove_group().

00959 {
00960     GList * contacts;
00961     
00962     if (!eg->list_item)
00963         return;
00964         
00965     for (contacts = eg->members; contacts; contacts = contacts->next) {
00966         struct contact * ec = contacts->data;
00967         if (ec->list_item)
00968             remove_contact_line(ec);
00969     }
00970         
00971     gtk_container_remove(GTK_CONTAINER(contact_list), eg->list_item);
00972     eg->list_item = NULL;
00973     eg->tree = NULL;
00974     eg->label = NULL;
00975 }

void update_contact_list  
 

Definition at line 605 of file status.c.

References _, contact::accounts, add_account_line(), add_contact_line(), buddy_update_status(), contact_update_status(), contact::list_item, _grouplist::members, contact::online, remove_account_line(), remove_contact_line(), and status_show.

Referenced by add_button_callback(), drag_data_get(), eb_import_function(), eb_profile_function(), eb_status_window(), ignore_dialog_callback(), ok_callback(), remove_account_callback(), remove_contact_callback(), remove_group_callback(), and status_show_callback().

00606 {
00607   GList * grps;
00608   GList * contacts;
00609   GList * accounts;
00610 
00611   grouplist * grp;
00612   struct contact * con;
00613   eb_account * ea;
00614 
00615   /* Error Check */
00616   if ( (status_show < 0) || (status_show > 2) ) { status_show = 2; }
00617 
00618   for (grps = groups; grps; grps = grps->next)
00619     {
00620       grp = grps->data;
00621 
00622       /* Currently, groups are always visible so we never touch them :) */
00623 
00624       for (contacts = grp->members; contacts; contacts = contacts->next)
00625     {
00626       con = contacts->data;
00627 
00628       /* Visibility of contact */
00629 
00630       /* show_all_accounts presumes show_all_contacts */
00631       if ((status_show == 1) || (status_show == 0))
00632         {
00633           /* MUST show the contact */
00634           add_contact_line (con);
00635           contact_update_status (con);
00636         }
00637       else
00638         {
00639           /* defer to whether it's online or not */
00640 
00641           if (! con->online)
00642         {
00643           remove_contact_line (con);
00644         }
00645           else
00646         {
00647           contact_update_status (con);
00648         }
00649         }
00650 
00651       for (accounts = con->accounts; accounts; accounts = accounts->next)
00652         {
00653           ea = accounts->data;
00654 
00655           if ( (status_show == 0) || (status_show == 1) )
00656         {
00657           /* definitely visible */
00658 
00659           add_account_line(ea);
00660           buddy_update_status(ea);
00661 
00662           if (con->list_item == NULL)
00663             {
00664               /* Do nothing */
00665               fprintf (stderr,
00666             _("Account vanished after add_account_line.\n"));
00667             }
00668           else if (status_show == 0)
00669             {
00670               /* MAKE IT VISIBLE NOW */
00671 
00672             gtk_tree_item_expand (GTK_TREE_ITEM(con->list_item));
00673             }
00674           else
00675             {
00676             gtk_tree_item_collapse (GTK_TREE_ITEM(con->list_item));
00677             }
00678         }
00679           else
00680         {
00681           /* Close it up */
00682 
00683           if (ea->online)
00684             {
00685               buddy_update_status(ea);
00686 
00687               if (con->list_item != NULL)
00688                         {
00689                           gtk_tree_item_collapse
00690                 (GTK_TREE_ITEM(con->list_item));
00691                         }
00692                       else
00693                         {
00694                           fprintf (stderr, _("Account missing while online?\n"));
00695                         }
00696             }
00697           else
00698             {
00699               remove_account_line(ea);
00700             }
00701         }
00702         } /* End for loop for accounts */
00703 
00704     } /* End for loop for contacts */
00705 
00706     } /* End for loop for groups */
00707 
00708 } /* end update_contact_list */

void update_contact_window_length  
 

Definition at line 1407 of file status.c.

References contact_window, DBG_CORE, eb_debug, and iGetLocalPref().

01408 {
01409   int h,w;
01410   h = iGetLocalPref("length_contact_window");
01411   w = iGetLocalPref("width_contact_window");
01412   if (h == 0) 
01413       h = 256;
01414   if (w == 0)
01415       w = 150;
01416   eb_debug(DBG_CORE, "statuswindow size: %dx%d\n",h,w);
01417   gtk_widget_set_usize(contact_window, w, h);
01418 }

void update_user eb_account   ea
 


Contact: Andy Maloney     [Documentation generated by doxygen]