/* X-Chat * Copyright (C) 1998 Peter Zelezny. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #include #include #include #include #include #include "fe-gtk.h" #include #include #include #include #include #include #include #include #include #include #include #include #include "../common/xchat.h" #include "../common/notify.h" #include "../common/cfgfiles.h" #include "../common/fe.h" #include "../common/server.h" #include "../common/util.h" #include "../common/userlist.h" #include "../common/outbound.h" #include "gtkutil.h" #include "maingui.h" #include "palette.h" #include "notifygui.h" /* model for the notify treeview */ enum { USER_COLUMN, STATUS_COLUMN, SERVER_COLUMN, SEEN_COLUMN, COLOUR_COLUMN, NPS_COLUMN, /* struct notify_per_server * */ N_COLUMNS }; static GtkWidget *notify_window = 0; static GtkWidget *notify_button_opendialog; static GtkWidget *notify_button_remove; static void notify_closegui (void) { notify_window = 0; } /* Need this to be able to set the foreground colour property of a row * from a GdkColor * in the model -Vince */ static void notify_treecell_property_mapper (GtkTreeViewColumn *col, GtkCellRenderer *cell, GtkTreeModel *model, GtkTreeIter *iter, gpointer data) { gchar *text; GdkColor *colour; int model_column = GPOINTER_TO_INT (data); gtk_tree_model_get (GTK_TREE_MODEL (model), iter, COLOUR_COLUMN, &colour, model_column, &text, -1); g_object_set (G_OBJECT (cell), "text", text, NULL); g_object_set (G_OBJECT (cell), "foreground-gdk", colour, NULL); g_free (text); } static void notify_row_cb (GtkTreeSelection *sel, GtkTreeView *view) { GtkTreeIter iter; struct notify_per_server *servnot; if (gtkutil_treeview_get_selected (view, &iter, NPS_COLUMN, &servnot, -1)) { gtk_widget_set_sensitive (notify_button_opendialog, servnot ? servnot->ison : 0); gtk_widget_set_sensitive (notify_button_remove, TRUE); return; } gtk_widget_set_sensitive (notify_button_opendialog, FALSE); gtk_widget_set_sensitive (notify_button_remove, FALSE); } static GtkWidget * notify_treeview_new (GtkWidget *box) { GtkListStore *store; GtkWidget *view; GtkTreeViewColumn *col; int col_id; store = gtk_list_store_new (N_COLUMNS, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_POINTER, /* can't specify colour! */ G_TYPE_POINTER ); g_return_val_if_fail (store != NULL, NULL); view = gtkutil_treeview_new (box, GTK_TREE_MODEL (store), notify_treecell_property_mapper, USER_COLUMN, _("Name"), STATUS_COLUMN, _("Status"), SERVER_COLUMN, _("Network"), SEEN_COLUMN, _("Last Seen"), -1); gtk_tree_view_column_set_expand (gtk_tree_view_get_column (GTK_TREE_VIEW (view), 0), TRUE); for (col_id=0; (col = gtk_tree_view_get_column (GTK_TREE_VIEW (view), col_id)); col_id++) gtk_tree_view_column_set_alignment (col, 0.5); g_signal_connect (G_OBJECT (gtk_tree_view_get_selection (GTK_TREE_VIEW (view))), "changed", G_CALLBACK (notify_row_cb), view); gtk_widget_show (view); return view; } void notify_gui_update (void) { struct notify *notify; struct notify_per_server *servnot; GSList *list = notify_list; GSList *slist; gchar *name, *status, *server, *seen; int online, servcount; time_t lastseen; char agobuf[128]; GtkListStore *store; GtkTreeView *view; GtkTreeIter iter; gboolean valid; /* true if we don't need to append a new tree row */ if (!notify_window) return; view = g_object_get_data (G_OBJECT (notify_window), "view"); store = GTK_LIST_STORE (gtk_tree_view_get_model (view)); valid = gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store), &iter); while (list) { notify = (struct notify *) list->data; name = notify->name; status = _("Offline"); server = ""; online = FALSE; lastseen = 0; /* First see if they're online on any servers */ slist = notify->server_list; while (slist) { servnot = (struct notify_per_server *) slist->data; if (servnot->ison) online = TRUE; if (servnot->lastseen > lastseen) lastseen = servnot->lastseen; slist = slist->next; } if (!online) /* Offline on all servers */ { if (!lastseen) seen = _("Never"); else { snprintf (agobuf, sizeof (agobuf), _("%d minutes ago"), (int)(time (0) - lastseen) / 60); seen = agobuf; } if (!valid) /* create new tree row if required */ gtk_list_store_append (store, &iter); gtk_list_store_set (store, &iter, 0, name, 1, status, 2, server, 3, seen, 4, &colors[4], 5, NULL, -1); if (valid) va
========================================================================
       MICROSOFT FOUNDATION CLASS LIBRARY : wmpa
========================================================================


AppWizard has created this wmpa DLL for you.  This DLL not only
demonstrates the basics of using the Microsoft Foundation classes but
is also a starting point for writing your DLL.

This file contains a summary of what you will find in each of the files that
make up your wmpa DLL.

wmpa.dsp
    This file (the project file) contains information at the project level and
    is used to build a single project or subproject. Other users can share the
    project (.dsp) file, but they should export the makefiles locally.

wmpa.h
	This is the main header file for the DLL.  It declares the
	CWmpaApp class.

wmpa.cpp
	This is the main DLL source file.  It contains the class CWmpaApp.
	It also contains the OLE entry points required of inproc servers.

wmpa.odl
    This file contains the Object Description Language source code for the
    type library of your DLL.

wmpa.rc
    This is a listing of all of