File: changelog.c

package info (click to toggle)
gtimer 2.0.0-1.1
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 1,204 kB
  • sloc: ansic: 8,122; sh: 821; perl: 651; makefile: 86
file content (160 lines) | stat: -rw-r--r-- 4,746 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
/*
 * GTimer
 *
 * Copyright:
 *	(C) 1999 Craig Knudsen, cknudsen@cknudsen.com
 *	See accompanying file "COPYING".
 * 
 *	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
 *
 * Description:
 *	Display the ChangeLog
 *
 * Author:
 *	Craig Knudsen, cknudsen@cknudsen.com, http://www.cknudsen.com/
 *
 * Home Page:
 *	http://www.cknudsen.com/gtimer/
 *
 * History:
 *	13-May-1999	Created
 *
 ****************************************************************************/


#include <stdio.h>
#include <stdlib.h>
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <time.h>
#include <memory.h>
#include <ctype.h>

#include <gtk/gtk.h>

#ifdef HAVE_LIBINTL_H
#include <libintl.h>
#else
#define gettext(a)      a
#endif

#include "project.h"
#include "task.h"
#include "gtimer.h"
#include "changelog.h"

#ifdef GTIMER_MEMDEBUG
#include "memdebug/memdebug.h"
#endif

extern GdkPixmap *appicon2;
extern GdkPixmap *appicon2_mask;

static GtkWidget *changelog_window = NULL;

static void changelog_ok_callback ( GtkWidget *widget, gpointer data )
{
  gtk_widget_hide ( changelog_window );
}

static gboolean changelog_X_callback ( GtkWidget *widget, gpointer data )
{
  changelog_ok_callback( widget, data );
  return (TRUE);    // do NOT continue destroying window
}



/*
** Create the window.
*/
static void create_changelog_window ()
{
  /*GtkTooltips *tooltips;*/
  GtkWidget *hbox, *textarea, *vscrollbar, *button;
  GtkWidget *vbox, *textview, *swindow, *ok_button;    // PV: +
  GtkTextBuffer *txbuf;                                // PV: +
  int txlen;                                           // PV: +
  GtkStyle *style;
  char msg[100];

  changelog_window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  gtk_window_set_wmclass ( GTK_WINDOW ( changelog_window ), "GTimer", "gtimer" );
  sprintf ( msg, "GTimer: %s", gettext ("Change Log") );
  gtk_window_set_title (GTK_WINDOW (changelog_window), msg );
  gtk_window_set_position ( GTK_WINDOW(changelog_window), GTK_WIN_POS_MOUSE );
  gtk_widget_realize ( changelog_window );
  gdk_window_set_icon ( GTK_WIDGET ( changelog_window )->window,
    NULL, appicon2, appicon2_mask );

  vbox = gtk_vbox_new ( FALSE, 2 );
  gtk_container_add ( GTK_CONTAINER (changelog_window), vbox);

  hbox = gtk_hbox_new ( FALSE, 2 );
  gtk_box_pack_start ( GTK_BOX ( vbox ), hbox, FALSE, FALSE, 2 );

  swindow = gtk_scrolled_window_new(NULL, NULL);
  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW(swindow),
                                  GTK_POLICY_AUTOMATIC,
                                  GTK_POLICY_AUTOMATIC);
  gtk_box_pack_start ( GTK_BOX(vbox), swindow, TRUE, TRUE, 0);

//  style = gtk_style_new ();
// PV: -
/*
  gdk_font_unref ( style->font );
  style->font = gdk_font_load (
    "-adobe-courier-medium-r-*-*-12-*-*-*-*-*-*-*" );
  if ( style->font == NULL )
    style->font = gdk_font_load ( "fixed" );
*/
//  gtk_widget_push_style ( style );

  txbuf = gtk_text_buffer_new(NULL);
  txlen = strlen(changelog_text);
  gtk_text_buffer_set_text (GTK_TEXT_BUFFER(txbuf), changelog_text, txlen);
  textview = gtk_text_view_new_with_buffer(txbuf);
  gtk_text_view_set_editable(GTK_TEXT_VIEW(textview),0);                   
  gtk_container_add (GTK_CONTAINER (swindow), textview);
  ok_button = gtk_button_new_with_label(gettext("Ok"));
  gtk_box_pack_start(GTK_BOX(vbox), ok_button, FALSE, FALSE, 0);
  g_signal_connect(G_OBJECT(ok_button), "clicked",
                   G_CALLBACK (changelog_ok_callback), NULL);
  g_signal_connect(G_OBJECT(changelog_window), "delete-event",
                   G_CALLBACK (changelog_X_callback), NULL);


//  gtk_widget_show (button);
  gtk_window_set_default_size ( changelog_window, 600, 600 );
  /*gdk_window_resize ( GTK_WIDGET ( changelog_window )->window, 600, 400 );*/
  gtk_widget_show (changelog_window);
  gtk_widget_show_all(changelog_window);

  GTK_WIDGET_SET_FLAGS (ok_button, GTK_CAN_DEFAULT);
  gtk_widget_grab_default (ok_button);

}



void display_changelog () {
  if ( changelog_window == NULL )
    create_changelog_window ();
  else
    gtk_widget_show (changelog_window);
}