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

edit_contact_window.c File Reference

#include "intl.h"
#include <string.h>
#include "status.h"
#include "dialog.h"
#include "util.h"
#include "add_contact_window.h"
#include "pixmaps/tb_edit.xpm"
#include "pixmaps/cancel.xpm"

Include dependency graph for edit_contact_window.c:

Include dependency graph

Go to the source code of this file.

Functions

void destroy (GtkWidget *widget, gpointer data)
void ok_callback (GtkWidget *widget, gpointer data)
void edit_contact_window_new (struct contact *c)

Variables

gint window_open = 0
contactmy_contact
GtkWidget * edit_contact_window
GtkWidget * nick
GtkWidget * service_list
GtkWidget * group_list


Function Documentation

void destroy GtkWidget *    widget,
gpointer    data
[static]
 

Definition at line 45 of file edit_contact_window.c.

References window_open.

Referenced by edit_contact_window_new().

00046 {
00047     window_open = 0;
00048 }

void edit_contact_window_new struct contact   c
 

Definition at line 69 of file edit_contact_window.c.

References _, contact::default_chatb, destroy(), eb_icon(), edit_contact_window, get_groups(), get_service_list(), contact::group, group_list, _grouplist::name, contact::nick, nick, ok_callback(), service_list, and window_open.

Referenced by edit_contact_callback().

00070 {
00071     gchar buff[1024];
00072     if( !window_open )
00073     {
00074         GtkWidget * vbox = gtk_vbox_new( FALSE, 5 );
00075         GtkWidget * hbox = gtk_hbox_new( FALSE, 0 );
00076         GtkWidget * hbox2;
00077         GtkWidget * button;
00078         GtkWidget * label;
00079         GtkWidget * iconwid;
00080         GtkWidget * frame;
00081         GtkWidget * table;
00082         GtkWidget * separator;
00083         GdkPixmap *icon;
00084       GdkBitmap *mask;
00085         GList * list;
00086         edit_contact_window = gtk_window_new(GTK_WINDOW_DIALOG);
00087         gtk_widget_realize(edit_contact_window);
00088         gtk_container_set_border_width(GTK_CONTAINER(edit_contact_window), 5);
00089         
00090         table = gtk_table_new(2, 4, FALSE);
00091         gtk_table_set_row_spacings(GTK_TABLE(table), 5);
00092         gtk_table_set_row_spacings(GTK_TABLE(table), 5);
00093         gtk_container_set_border_width(GTK_CONTAINER(table), 5);
00094         
00095         label = gtk_label_new(_("Contact Name:"));
00096         gtk_box_pack_end(GTK_BOX(hbox), label, FALSE, FALSE, 5);
00097         gtk_widget_show(label);
00098         gtk_table_attach(GTK_TABLE(table), hbox, 0, 1, 0, 1, GTK_EXPAND,
00099                 GTK_EXPAND, 0, 0);
00100         gtk_widget_show(hbox);
00101         
00102         nick = gtk_entry_new();
00103         gtk_table_attach(GTK_TABLE(table), nick, 1, 2, 0, 1, 
00104                 GTK_FILL, GTK_FILL, 0, 0);
00105         
00106         gtk_entry_set_text(GTK_ENTRY(nick), c->nick );
00107         gtk_widget_show(nick);
00108         
00109         hbox = gtk_hbox_new(FALSE, 0);
00110         label = gtk_label_new(_("Default Protocol:"));
00111         gtk_box_pack_end(GTK_BOX(hbox),label, FALSE, FALSE, 5);
00112         gtk_widget_show(label);
00113         gtk_table_attach(GTK_TABLE(table), hbox, 2, 3, 0, 1, GTK_EXPAND, GTK_EXPAND,
00114                 0, 0);
00115         gtk_widget_show(hbox);
00116 
00117         
00118         service_list = gtk_combo_new();
00119         list = get_service_list();
00120         gtk_combo_set_popdown_strings(GTK_COMBO(service_list), list );
00121         gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(service_list)->entry), 
00122                 eb_services[c->default_chatb].name);
00123         g_list_free(list);
00124         gtk_table_attach(GTK_TABLE(table), service_list, 3, 4, 0, 1,
00125                 GTK_EXPAND, GTK_EXPAND, 0, 0);
00126         gtk_widget_show(service_list);
00127         
00128         hbox = gtk_hbox_new( FALSE, 0 );
00129 
00130         label = gtk_label_new(_("Group Name:"));
00131         gtk_box_pack_end(GTK_BOX(hbox),label, FALSE, FALSE, 5);
00132         gtk_widget_show(label);
00133 
00134         gtk_table_attach(GTK_TABLE(table), hbox, 0, 1, 1, 2,
00135                 GTK_EXPAND, GTK_EXPAND, 0, 0);
00136         gtk_widget_show(hbox);
00137         
00138         group_list = gtk_combo_new();
00139         list = get_groups();
00140         gtk_combo_set_popdown_strings(GTK_COMBO(group_list), list );
00141         g_list_free(list);
00142         gtk_table_attach(GTK_TABLE(table), group_list, 1, 2, 1, 2,
00143                 GTK_EXPAND, GTK_EXPAND, 0, 0);
00144 
00145         gtk_widget_show(group_list);
00146         gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(group_list)->entry), 
00147                 c->group->name);
00148 
00149         frame = gtk_frame_new(NULL);
00150 
00151         g_snprintf(buff,1024,_("Edit Properties for %s"), c->nick);
00152         gtk_frame_set_label(GTK_FRAME(frame), buff);
00153 
00154         gtk_container_add(GTK_CONTAINER(frame), table);
00155         gtk_widget_show(table);
00156 
00157         gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 0);
00158         gtk_widget_show(frame);
00159 
00160         separator = gtk_hseparator_new();
00161         gtk_box_pack_start(GTK_BOX(vbox), separator, FALSE, FALSE, 5);
00162         gtk_widget_show(separator);
00163 
00164         hbox = gtk_hbox_new(FALSE, 5);
00165         hbox2 = gtk_hbox_new(TRUE, 5);
00166         gtk_widget_set_usize(hbox2, 200,25 );
00167         
00168         /*Ok Button*/
00169    
00170     icon = gdk_pixmap_create_from_xpm_d( edit_contact_window->window, &mask, NULL, tb_edit_xpm);
00171     iconwid = gtk_pixmap_new( icon, mask );
00172     label = gtk_label_new(_("Apply"));
00173    
00174     gtk_box_pack_start(GTK_BOX(hbox), iconwid, FALSE, FALSE, 2);
00175     gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 2);
00176    
00177     gtk_widget_show(iconwid);
00178     gtk_widget_show(label);
00179    
00180     button = gtk_button_new();
00181    
00182     gtk_signal_connect(GTK_OBJECT(button), "clicked", 
00183                        GTK_SIGNAL_FUNC(ok_callback), NULL );
00184    
00185     gtk_container_add (GTK_CONTAINER (button), hbox);
00186     gtk_widget_show(hbox);
00187    
00188     gtk_box_pack_start(GTK_BOX(hbox2), button, TRUE, TRUE, 0);
00189     gtk_widget_show(button);
00190         
00191         /*Cancel Button*/
00192       
00193       hbox = gtk_hbox_new(FALSE, 5);
00194       icon = gdk_pixmap_create_from_xpm_d( edit_contact_window->window, &mask, NULL, cancel_xpm);
00195       iconwid = gtk_pixmap_new( icon, mask );
00196       label = gtk_label_new(_("Cancel"));
00197       
00198       gtk_box_pack_start(GTK_BOX(hbox), iconwid, FALSE, FALSE, 2);
00199       gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 2);
00200       
00201       gtk_widget_show(iconwid);
00202       gtk_widget_show(label);
00203       
00204       button = gtk_button_new();
00205       
00206       gtk_signal_connect_object(GTK_OBJECT(button), "clicked",
00207                                   GTK_SIGNAL_FUNC(gtk_widget_destroy),
00208                                   GTK_OBJECT(edit_contact_window));
00209       gtk_container_add (GTK_CONTAINER (button), hbox);     
00210       gtk_widget_show(hbox);     
00211       
00212       gtk_box_pack_start(GTK_BOX(hbox2), button, TRUE, TRUE, 0);
00213       gtk_widget_show(button);
00214         
00215         /*Buttons End*/
00216         
00217         hbox = gtk_hbox_new(FALSE, 5);
00218         
00219         gtk_box_pack_end(GTK_BOX(hbox), hbox2, FALSE, FALSE, 0 );
00220         gtk_widget_show(hbox2);
00221         
00222         gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
00223         gtk_widget_show(hbox);
00224         
00225         table = gtk_table_new(1, 1, FALSE);
00226         gtk_table_attach(GTK_TABLE(table), vbox, 0, 1, 0, 1,
00227                 GTK_EXPAND, GTK_EXPAND, 0, 0);
00228         gtk_widget_show(vbox);
00229         
00230         gtk_container_add(GTK_CONTAINER(edit_contact_window), table);
00231         gtk_widget_show(table);
00232         
00233         gtk_signal_connect( GTK_OBJECT(edit_contact_window), "destroy",
00234                         GTK_SIGNAL_FUNC(destroy), NULL );
00235         gtk_widget_show(edit_contact_window);
00236     }
00237     
00238     //gtk_entry_set_text(GTK_ENTRY(nick), c->nick );
00239     //gtk_combo_set_value_in_list(GTK_COMBO(service_list), c-> default_chatb, 0 );
00240     g_snprintf(buff,1024,_("Edit Properties for %s"), c->nick);
00241     gtk_window_set_title(GTK_WINDOW(edit_contact_window), buff ); 
00242     eb_icon(edit_contact_window->window);
00243     gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(service_list)->entry),
00244                        eb_services[c->default_chatb].name );
00245 
00246     gtk_signal_connect( GTK_OBJECT(edit_contact_window), "destroy",
00247                         GTK_SIGNAL_FUNC(destroy), NULL );
00248     my_contact = c;
00249     window_open = 1;
00250 }

void ok_callback GtkWidget *    widget,
gpointer    data
[static]
 

Definition at line 50 of file edit_contact_window.c.

References contact::default_chatb, contact::default_filetransb, edit_contact_window, get_service_id(), group_list, contact::label, move_contact(), nick, contact::nick, rename_nick_log(), service_list, update_contact_list(), and write_contact_list().

Referenced by edit_contact_window_new().

00051 {
00052     gint service_id = get_service_id(gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(service_list)->entry)));
00053         /* Rename log if logging is enabled */
00054         rename_nick_log(my_contact->nick, gtk_entry_get_text(GTK_ENTRY(nick)));
00055         strncpy(my_contact->nick, gtk_entry_get_text(GTK_ENTRY(nick)), 254);
00056         my_contact->nick[254] = '\0';
00057     my_contact->default_chatb = service_id;
00058     my_contact->default_filetransb = service_id;
00059     
00060     if (my_contact->label)
00061         gtk_label_set_text(GTK_LABEL(my_contact->label), my_contact->nick);
00062     move_contact(gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(group_list)->entry)),
00063             my_contact);
00064     update_contact_list ();
00065     write_contact_list();
00066     gtk_widget_destroy(edit_contact_window);
00067 }


Variable Documentation

GtkWidget* edit_contact_window [static]
 

Definition at line 40 of file edit_contact_window.c.

Referenced by edit_contact_window_new(), and ok_callback().

GtkWidget* group_list [static]
 

Definition at line 43 of file edit_contact_window.c.

Referenced by edit_contact_window_new(), and ok_callback().

struct contact* my_contact [static]
 

Definition at line 39 of file edit_contact_window.c.

GtkWidget* nick [static]
 

Definition at line 41 of file edit_contact_window.c.

Referenced by edit_contact_window_new(), and ok_callback().

GtkWidget* service_list [static]
 

Definition at line 42 of file edit_contact_window.c.

Referenced by edit_contact_window_new(), and ok_callback().

gint window_open = 0 [static]
 

Definition at line 38 of file edit_contact_window.c.

Referenced by destroy(), and edit_contact_window_new().


Contact: Andy Maloney     [Documentation generated by doxygen]