~ubuntu-branches/ubuntu/edgy/tilp/edgy

« back to all changes in this revision

Viewing changes to gtk/manpage_cb.c

  • Committer: Bazaar Package Importer
  • Author(s): Julien BLACHE
  • Date: 2004-05-22 21:12:03 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20040522211203-awg2cuw03guyvyz9
Tags: 6.72-2
* debian/control
  + Build-Depends: libticables3 (>= 3.8.4-1).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#ifdef HAVE_CONFIG_H
2
 
#  include <config.h>
3
 
#endif
4
 
 
5
 
#include <gtk/gtk.h>
6
 
 
7
 
#include "manpage_cb.h"
8
 
#include "manpage_dbox.h"
9
 
#include "support.h"
10
 
 
11
 
#include "tilibs.h"
12
 
#include "struct.h"
13
 
 
14
 
gint display_manpage_dbox()
15
 
{
16
 
  gtk_widget_show_all(create_manpage_dbox());
17
 
  return 0;
18
 
}
19
 
 
20
 
void
21
 
on_manpage_dbox_show                        (GtkWidget       *widget,
22
 
                                        gpointer         user_data)
23
 
{
24
 
  FILE *fd;
25
 
  gchar *buffer;
26
 
  GdkFont *fixed_font;
27
 
  GtkWidget *text;
28
 
 
29
 
  text = GTK_WIDGET(user_data);
30
 
  gtk_text_freeze(GTK_TEXT (text));
31
 
  gtk_editable_delete_text(GTK_EDITABLE(text), 0, -1);
32
 
 
33
 
  /* Create the base filename */
34
 
  //fprintf(stderr, "before: <%s>\n", inst_paths.manpage_dir); 
35
 
  buffer = g_strconcat(inst_paths.manpage_dir, "manpage.txt", NULL);
36
 
 
37
 
  /* Try to access the file */
38
 
  if(access(buffer, F_OK) == 0 )
39
 
    {
40
 
#if defined(__LINUX__)
41
 
      fixed_font = gdk_font_load ("-misc-clean-medium-r-*-*-*-140-*-*-*-*-*-*");
42
 
#elif defined(__WIN32__)
43
 
          fixed_font = gdk_font_load ("-adobe-courier-medium-r-normal--12-120-75-75-p-70-iso8859-1");
44
 
#endif
45
 
      if( (fd=fopen (buffer, "r")) != NULL)
46
 
        {
47
 
          memset (buffer, 0, sizeof(buffer));
48
 
          while(fread (buffer, 1, sizeof(buffer)-1, fd))
49
 
            {
50
 
              gtk_text_insert (GTK_TEXT (text), fixed_font, NULL, NULL, buffer, strlen (buffer));
51
 
              memset (buffer, 0, sizeof(buffer));
52
 
            }
53
 
          fclose (fd);
54
 
        }
55
 
    }
56
 
  gtk_text_thaw(GTK_TEXT (text));
57
 
}
58
 
 
59
 
void
60
 
manpage_ok_button_clicked                     (GtkButton       *button,
61
 
                                        gpointer         user_data)
62
 
{
63
 
  gtk_widget_destroy(GTK_WIDGET(user_data));
64
 
}