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

info_window.c

Go to the documentation of this file.
00001 /*
00002  * Yattm
00003  *
00004  * Copyright (C) 1999, Torrey Searle <tsearle@uci.edu>
00005  *
00006  * This program is free software; you can redistribute it and/or modify
00007  * it under the terms of the GNU General Public License as published by
00008  * the Free Software Foundation; either version 2 of the License, or
00009  * (at your option) any later version.
00010  *
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program; if not, write to the Free Software
00018  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019  *
00020  */
00021  
00022 /*
00023  * info_window.c
00024  * implementation for the info window
00025  *
00026  */
00027  
00028 #ifdef HAVE_CONFIG_H
00029 #  include <config.h>
00030 #endif
00031 
00032 #include "intl.h"
00033 #include <string.h>
00034 #include <time.h>
00035 #include <stdio.h>
00036 #include <stdlib.h>
00037 #include <gtk/gtk.h>
00038 #include <gdk/gdkkeysyms.h>
00039 #include <ctype.h>
00040 #include "util.h"
00041 #include "gtk_eb_html.h"
00042 #include "pixmaps/cancel.xpm"
00043 #include "info_window.h"
00044 #include "dialog.h"
00045 
00046 static void iw_destroy_event(GtkWidget *widget, gpointer data)
00047 {
00048         info_window * iw = (info_window *)data;
00049       
00050         if(iw->info_data != NULL) {
00051           iw->cleanup(iw);
00052           free(iw->info_data);
00053           iw->info_data = NULL;
00054         }
00055         iw->remote_account->infowindow = NULL;
00056         gtk_widget_destroy(iw->window);
00057         iw->window=NULL;
00058         iw->info = NULL;
00059         g_free(iw);
00060 }
00061 
00062 static void iw_close_win(GtkWidget *widget, gpointer data)
00063 {
00064         info_window * iw = (info_window *)data;
00065         gtk_widget_destroy(iw->window);
00066 }
00067 
00068 
00069 
00070 info_window * eb_info_window_new(eb_local_account * local, struct account * remote)
00071 {
00072     GtkWidget *vbox;
00073         GtkWidget *hbox;
00074         GtkWidget *buttonbox;
00075         GtkWidget *label;
00076     GtkWidget *ok_button;
00077         GtkWidget *iconwid;
00078     GdkPixmap *icon;
00079         GdkBitmap *mask;
00080     info_window * iw;
00081 
00082         vbox = gtk_vbox_new(FALSE,0);
00083         hbox = gtk_hbox_new(FALSE,0);
00084         buttonbox = gtk_hbox_new(FALSE,0);
00085 
00086     iw = malloc(sizeof(info_window));
00087         iw->info_type = -1;
00088         iw->info_data = NULL;
00089     iw->remote_account = remote;
00090     iw->local_user = local;
00091 
00092     iw->window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
00093     gtk_window_set_position(GTK_WINDOW(iw->window), GTK_WIN_POS_MOUSE);
00094         gtk_window_set_policy(GTK_WINDOW(iw->window), TRUE, TRUE, TRUE);
00095         gtk_widget_realize(iw->window);
00096 
00097     iw->info = ext_gtk_text_new(NULL,NULL);
00098     gtk_eb_html_init(EXT_GTK_TEXT(iw->info));
00099         iw->scrollwindow = gtk_scrolled_window_new(NULL,NULL);
00100 
00101         gtk_widget_realize(iw->window); 
00102     gtk_window_set_title(GTK_WINDOW(iw->window), remote->handle);
00103     eb_icon(iw->window->window);
00104 
00105         gtk_widget_set_usize(iw->scrollwindow, 375, 150);
00106     gtk_container_add(GTK_CONTAINER(iw->scrollwindow),iw->info);
00107     gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(iw->scrollwindow),GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
00108 
00109     gtk_box_pack_start(GTK_BOX(vbox), iw->scrollwindow, TRUE,TRUE, 5);
00110     gtk_widget_show(iw->scrollwindow);
00111 
00112         gtk_container_set_border_width(GTK_CONTAINER(iw->window), 5);
00113 
00114         gtk_signal_connect (GTK_OBJECT (iw->window), "destroy", GTK_SIGNAL_FUNC (iw_destroy_event), iw);
00115 
00116         icon = gdk_pixmap_create_from_xpm_d(iw->window->window, &mask, NULL, cancel_xpm);
00117     iconwid = gtk_pixmap_new(icon, mask);
00118     gtk_widget_show(iconwid);
00119 
00120         ok_button = gtk_button_new ();
00121         gtk_signal_connect (GTK_OBJECT (ok_button), "clicked", GTK_SIGNAL_FUNC (iw_close_win), iw);
00122 
00123         gtk_box_pack_start (GTK_BOX (buttonbox), iconwid,TRUE,TRUE,0);
00124         label = gtk_label_new(_("Close"));
00125         gtk_box_pack_start (GTK_BOX (buttonbox), label,TRUE,TRUE,5);
00126         gtk_widget_show(buttonbox);
00127         gtk_container_add(GTK_CONTAINER(ok_button), buttonbox);
00128  
00129         gtk_box_pack_start(GTK_BOX(hbox), ok_button, TRUE,FALSE, 0);
00130         gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE,FALSE, 5);
00131 
00132     gtk_container_add(GTK_CONTAINER(iw->window), vbox);
00133         gtk_widget_show(iw->info);
00134         gtk_widget_show(label);
00135         gtk_widget_show(ok_button);
00136         gtk_widget_show(hbox);
00137  
00138         gtk_widget_show(vbox);
00139         gtk_widget_show(iw->window);
00140 
00141         return iw;
00142 }
00143 
00144 
00145 void clear_info_window(info_window *iw) 
00146 {
00147     gtk_editable_delete_text(GTK_EDITABLE(iw->info), 0, -1);
00148 }
00149 
00150 
00151 void eb_info_window_add_info( eb_account * remote_account, gchar* text, gint ignore_bg, gint ignore_fg, gint ignore_font ) {
00152 //        struct contact * remote_contact = remote_account->account_contact;
00153     
00154     if(remote_account->infowindow)
00155     {
00156     gtk_eb_html_add(EXT_GTK_TEXT(remote_account->infowindow->info), text,ignore_bg,ignore_fg,ignore_font);
00157   }
00158 }
00159 

Contact: Andy Maloney     [Documentation generated by doxygen]