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_group_window.c File Reference

#include "intl.h"
#include <string.h>
#include "status.h"
#include "dialog.h"
#include "util.h"

Include dependency graph for edit_group_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 cancel_callback (GtkWidget *widget, gpointer data)
void edit_group_window_new (grouplist *g)

Variables

gint window_open = 0
GtkWidget * edit_group_window
GtkWidget * group_name
grouplistcurrent_group


Function Documentation

void cancel_callback GtkWidget *    widget,
gpointer    data
[static]
 

Definition at line 62 of file edit_group_window.c.

References edit_group_window.

Referenced by edit_group_window_new().

00063 {
00064     gtk_widget_destroy(edit_group_window);
00065 }

void destroy GtkWidget *    widget,
gpointer    data
[static]
 

Definition at line 39 of file edit_group_window.c.

References window_open.

Referenced by edit_group_window_new().

00040 {
00041     window_open = 0;
00042 }

void edit_group_window_new grouplist   g
 

Definition at line 67 of file edit_group_window.c.

References _, cancel_callback(), destroy(), eb_icon(), edit_group_window, group_name, _grouplist::name, ok_callback(), and window_open.

Referenced by edit_group_callback(), and show_add_group_window().

00068 {
00069     gchar buff[1024];
00070     gchar *name;
00071     if (g)
00072         name = g->name;
00073     else
00074         name = "";
00075     if ( !window_open )
00076     {
00077         GtkWidget * vbox = gtk_vbox_new( FALSE, 5 );
00078         GtkWidget * hbox = gtk_hbox_new( FALSE, 5 );
00079         GtkWidget * label;
00080 
00081         edit_group_window = gtk_window_new(GTK_WINDOW_DIALOG);
00082         gtk_window_set_position(GTK_WINDOW(edit_group_window), GTK_WIN_POS_MOUSE);
00083         gtk_widget_realize(edit_group_window);
00084 
00085         label = gtk_label_new(_("Group Name"));
00086         gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5);
00087         gtk_widget_show(label);
00088 
00089         group_name = gtk_entry_new();
00090         gtk_box_pack_start(GTK_BOX(hbox), group_name, TRUE, TRUE, 5);
00091         gtk_entry_set_text(GTK_ENTRY(group_name), name);
00092         gtk_widget_show(group_name);
00093 
00094         gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5);
00095         gtk_widget_show(hbox);
00096 
00097         hbox = gtk_hbox_new(TRUE, 5);
00098 
00099         label = gtk_button_new_with_label(_("OK"));
00100         gtk_box_pack_start(GTK_BOX(hbox), label, TRUE, TRUE, 5);
00101         gtk_signal_connect(GTK_OBJECT(label), "clicked",
00102                 GTK_SIGNAL_FUNC(ok_callback), NULL);
00103         gtk_widget_show(label);
00104 
00105         label = gtk_button_new_with_label(_("Cancel"));
00106         gtk_box_pack_start(GTK_BOX(hbox), label, TRUE, TRUE, 5);
00107         gtk_signal_connect(GTK_OBJECT(label), "clicked",
00108                 GTK_SIGNAL_FUNC(cancel_callback), NULL);
00109 
00110         gtk_widget_show(label);     
00111 
00112         gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5);
00113         gtk_widget_show(hbox);
00114 
00115         gtk_container_add(GTK_CONTAINER(edit_group_window), vbox);
00116         gtk_widget_show(vbox);
00117         
00118         gtk_signal_connect( GTK_OBJECT(edit_group_window), "destroy",
00119                 GTK_SIGNAL_FUNC(destroy), NULL);
00120         gtk_widget_show(edit_group_window);
00121     }
00122 
00123     gtk_entry_set_text(GTK_ENTRY(group_name), name);
00124     if (g)
00125         g_snprintf(buff, 1024, _("Edit Properties for %s"), name);
00126     else
00127         g_snprintf(buff, 1024, _("Add group"));
00128     gtk_window_set_title(GTK_WINDOW(edit_group_window), buff);
00129     eb_icon(edit_group_window->window);
00130     gtk_signal_connect(GTK_OBJECT(edit_group_window), "destroy",
00131                 GTK_SIGNAL_FUNC(destroy), NULL);
00132 
00133     current_group = g;
00134     window_open = 1;
00135 }

void ok_callback GtkWidget *    widget,
gpointer    data
[static]
 

Definition at line 44 of file edit_group_window.c.

References add_group(), edit_group_window, group_name, _grouplist::label, _grouplist::name, update_contact_list(), and write_contact_list().

Referenced by edit_group_window_new().

00045 {
00046     if (group_name == NULL || gtk_entry_get_text(GTK_ENTRY(group_name)) == NULL
00047     ||  strlen(gtk_entry_get_text(GTK_ENTRY(group_name))) == 0)
00048         return;
00049     if (current_group) { /*edit*/
00050         strcpy(current_group->name, gtk_entry_get_text(GTK_ENTRY(group_name)));
00051 
00052         gtk_label_set_text(GTK_LABEL(current_group->label),
00053                    current_group->name);
00054     } else { /*add*/
00055         add_group(gtk_entry_get_text(GTK_ENTRY(group_name)));
00056     }
00057     update_contact_list ();
00058     write_contact_list();
00059     gtk_widget_destroy(edit_group_window);
00060 }


Variable Documentation

grouplist* current_group [static]
 

Definition at line 37 of file edit_group_window.c.

GtkWidget* edit_group_window [static]
 

Definition at line 35 of file edit_group_window.c.

Referenced by cancel_callback(), edit_group_window_new(), and ok_callback().

GtkWidget* group_name [static]
 

Definition at line 36 of file edit_group_window.c.

Referenced by edit_group_window_new(), and ok_callback().

gint window_open = 0 [static]
 

Definition at line 34 of file edit_group_window.c.

Referenced by destroy(), and edit_group_window_new().


Contact: Andy Maloney     [Documentation generated by doxygen]