wmshutdown: Destroy dialog window before shutting down. This is especially useful...
[dockapps.git] / yawmppp / src / about.c
blobe065427c0748d2af536d67c3ed16f8f24677f170
1 /*
3 YAWMPPP - PPP dock app/helper for WindowMaker
4 Copyright (C) 2000, 2001:
6 Author: Felipe Bergo (bergo@seul.org)
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 $Id: about.c,v 1.1.1.1 2001/02/22 06:15:21 bergo Exp $
25 #include <stdio.h>
26 #include <stdlib.h>
27 #include <string.h>
28 #include <gtk/gtk.h>
29 #include "about.h"
31 #include "stepphone.xpm"
33 GtkWidget *about;
35 /* data must be a pointer to parent widget (GtkWindow) */
36 void applet_about (GtkWidget * widget, gpointer data)
38 GtkStyle *style;
39 GdkPixmap *phone;
40 GtkWidget *pi,*v,*h,*text,*h2,*b,*p,*v2;
41 char tabout[1024];
42 GdkBitmap *mask;
43 int i;
45 about=gtk_window_new(GTK_WINDOW_DIALOG);
46 gtk_window_set_transient_for(GTK_WINDOW(about),GTK_WINDOW(data));
47 gtk_window_set_wmclass(GTK_WINDOW(about),"yawmppp","about");
48 gtk_widget_realize(about);
49 gtk_window_set_policy(GTK_WINDOW(about),TRUE,TRUE,TRUE);
50 gtk_window_set_title (GTK_WINDOW (about), "About YAWMPPP");
52 style=gtk_widget_get_style(about);
53 phone=gdk_pixmap_create_from_xpm_d(about->window,&mask,
54 &style->bg[GTK_STATE_NORMAL],
55 (gchar **)stepphone_xpm);
56 pi=gtk_pixmap_new(phone,mask);
57 gdk_pixmap_unref(phone);
59 v=gtk_vbox_new(FALSE,2);
60 gtk_container_add(GTK_CONTAINER(about),v);
62 h=gtk_hbox_new(FALSE,2);
63 gtk_box_pack_start(GTK_BOX(v),h,FALSE,TRUE,2);
65 v2=gtk_vbox_new(FALSE,4);
66 gtk_box_pack_start(GTK_BOX(h),v2,FALSE,FALSE,2);
67 gtk_box_pack_start(GTK_BOX(v2),pi,FALSE,FALSE,6);
69 strcpy(tabout,"YAWMPPP\nYet Another PPP Dock Applet for Window Maker\n");
70 strcat(tabout,"Version ");
71 strcat(tabout,VERSION);
72 strcat(tabout,"\nCopyright (C) 2000, 2001 Felipe Bergo\n");
73 strcat(tabout,"email: bergo@seul.org\n\n");
75 strcat(tabout,"YAWMPPP is distributed under the terms of the GNU\n");
76 strcat(tabout,"General Public License, version 2 or later.\n");
77 strcat(tabout,"YAWMPPP comes with ABSOLUTELY NO WARRANTY;\n");
78 strcat(tabout,"This is free software, and you are welcome to\n");
79 strcat(tabout,"redistribute it under certain conditions.\n");
80 strcat(tabout,"Read the file COPYING for details.\n\n");
81 strcat(tabout,"To learn more about free software visit\n");
82 strcat(tabout,"http://www.gnu.org\n");
84 text=gtk_label_new(tabout);
85 gtk_box_pack_start(GTK_BOX(h),text,FALSE,TRUE,2);
86 gtk_label_set_justify(GTK_LABEL(text),GTK_JUSTIFY_LEFT);
88 h2=gtk_hbox_new(TRUE,2);
89 gtk_box_pack_start(GTK_BOX(v),h2,FALSE,TRUE,2);
91 for(i=0;i<3;i++) {
92 p=gtk_label_new(" ");
93 gtk_box_pack_start(GTK_BOX(h2),p,FALSE,FALSE,2);
94 gtk_widget_show(p);
97 b=gtk_button_new_with_label("Dismiss");
98 gtk_box_pack_start(GTK_BOX(h2),b,FALSE,TRUE,4);
100 gtk_container_set_border_width(GTK_CONTAINER(about),6);
102 gtk_widget_show(b);
103 gtk_widget_show(text);
104 gtk_widget_show(pi);
105 gtk_widget_show(h2);
106 gtk_widget_show(h);
107 gtk_widget_show(v2);
108 gtk_widget_show(v);
109 gtk_widget_show(about);
110 gtk_signal_connect(GTK_OBJECT(b),"clicked",
111 GTK_SIGNAL_FUNC(about_dismiss),NULL);
112 gtk_grab_add(about);
115 void
116 about_dismiss(GtkWidget *wid,gpointer data)
118 gtk_grab_remove(about);
119 gtk_widget_destroy(about);