~ubuntu-branches/ubuntu/breezy/tiemu/breezy

« back to all changes in this revision

Viewing changes to src/gui/gtk/gxpm.c

  • Committer: Bazaar Package Importer
  • Author(s): Julien BLACHE
  • Date: 2005-06-02 16:50:15 UTC
  • mfrom: (1.2.1 upstream) (2.1.1 sarge)
  • Revision ID: james.westby@ubuntu.com-20050602165015-59ab24414tl2wzol
Tags: 1.99+svn1460-1
* New snapshot.
* debian/control:
  + Updated build-depends.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*  tilp - link program for TI calculators
2
 
 *  Copyright (C) 1999-2001  Romain Lievin
3
 
 *
4
 
 *  This program is free software; you can redistribute it and/or modify
5
 
 *  it under the terms of the GNU General Public License as published by
6
 
 *  the Free Software Foundation; either version 2 of the License, or
7
 
 *  (at your option) any later version.
8
 
 *
9
 
 *  This program is distributed in the hope that it will be useful,
10
 
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
 
 *  GNU General Public License for more details.
13
 
 *
14
 
 *  You should have received a copy of the GNU General Public License
15
 
 *  along with this program; if not, write to the Free Software
16
 
 *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17
 
 */
18
 
 
19
 
#include <stdio.h>
20
 
#include <stdlib.h>
21
 
#include <string.h>
22
 
#include <gtk/gtk.h>
23
 
 
24
 
#include "platform.h"
25
 
#include "struct.h"
26
 
#include "paths.h"
27
 
 
28
 
/* Open the pixmap stored on the file 'filename' and put it in the 'pixmap' 
29
 
variable according to the 'mask' variable */
30
 
void open_xpm (char *filename, GtkWidget *parent, 
31
 
               GdkPixmap **pixmap, GdkBitmap **mask)
32
 
{
33
 
  gchar *s;
34
 
  GtkStyle *style;
35
 
 
36
 
  style = gtk_widget_get_style (parent);
37
 
#if defined(__LINUX__)
38
 
  s = g_strconcat(inst_paths.base_dir, SHARE_DIR "/pixmaps/", filename, NULL);
39
 
#elif defined(__WIN32__)
40
 
  s = g_strconcat(inst_paths.base_dir, SHARE_DIR "\\pixmaps\\", filename, NULL);
41
 
#endif
42
 
  
43
 
  if (access (s, F_OK) != 0) 
44
 
    {
45
 
      g_error("Error: unable to access this file: '%s'\n", s);
46
 
      g_free(s);
47
 
      exit (1);
48
 
    }
49
 
  *pixmap = gdk_pixmap_create_from_xpm (parent->window, mask, 
50
 
                                        &style->bg[GTK_STATE_NORMAL], s);
51
 
  if (*pixmap == NULL) 
52
 
    {
53
 
      fprintf(stderr, "Error: unable to load this file into a pixmap: '%s'\n", s);
54
 
      g_free(s);
55
 
      exit (1);
56
 
    }
57
 
  g_free(s);
58
 
}
59
 
 
60
 
 
61