Mercurial > audlegacy
annotate Plugins/Input/modplug/gui/support.cxx @ 1713:a4d7227231e3 trunk
[svn] More .cpp -> .cxx. Noticed by Chainsaw. Shame on me that I forgot some ;).
author | js |
---|---|
date | Sat, 16 Sep 2006 07:33:28 -0700 |
parents | Plugins/Input/modplug/gui/support.cpp@37316876ef6e |
children |
rev | line source |
---|---|
278
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
1 /* |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
2 * DO NOT EDIT THIS FILE - it is generated by Glade. |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
3 */ |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
4 |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
5 #ifdef HAVE_CONFIG_H |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
6 # include <config.h> |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
7 #endif |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
8 |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
9 #include <sys/types.h> |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
10 #include <sys/stat.h> |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
11 #include <unistd.h> |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
12 #include <string.h> |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
13 |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
14 #include <gtk/gtk.h> |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
15 |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
16 #include "support.h" |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
17 |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
18 /* This is an internally used function to check if a pixmap file exists. */ |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
19 static gchar* check_file_exists (const gchar *directory, |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
20 const gchar *filename); |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
21 |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
22 /* This is an internally used function to create pixmaps. */ |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
23 static GtkWidget* create_dummy_pixmap (GtkWidget *widget); |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
24 |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
25 GtkWidget* |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
26 lookup_widget (GtkWidget *widget, |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
27 const gchar *widget_name) |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
28 { |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
29 GtkWidget *parent, *found_widget; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
30 |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
31 for (;;) |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
32 { |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
33 if (GTK_IS_MENU (widget)) |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
34 parent = gtk_menu_get_attach_widget (GTK_MENU (widget)); |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
35 else |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
36 parent = widget->parent; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
37 if (parent == NULL) |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
38 break; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
39 widget = parent; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
40 } |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
41 |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
42 found_widget = (GtkWidget*) gtk_object_get_data (GTK_OBJECT (widget), |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
43 widget_name); |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
44 if (!found_widget) |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
45 g_warning ("Widget not found: %s", widget_name); |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
46 return found_widget; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
47 } |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
48 |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
49 /* This is a dummy pixmap we use when a pixmap can't be found. */ |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
50 static char *dummy_pixmap_xpm[] = { |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
51 /* columns rows colors chars-per-pixel */ |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
52 "1 1 1 1", |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
53 " c None", |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
54 /* pixels */ |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
55 " " |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
56 }; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
57 |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
58 /* This is an internally used function to create pixmaps. */ |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
59 static GtkWidget* |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
60 create_dummy_pixmap (GtkWidget *widget) |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
61 { |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
62 GdkColormap *colormap; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
63 GdkPixmap *gdkpixmap; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
64 GdkBitmap *mask; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
65 GtkWidget *pixmap; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
66 |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
67 colormap = gtk_widget_get_colormap (widget); |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
68 gdkpixmap = gdk_pixmap_colormap_create_from_xpm_d (NULL, colormap, &mask, |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
69 NULL, dummy_pixmap_xpm); |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
70 if (gdkpixmap == NULL) |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
71 g_error ("Couldn't create replacement pixmap."); |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
72 pixmap = gtk_pixmap_new (gdkpixmap, mask); |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
73 gdk_pixmap_unref (gdkpixmap); |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
74 gdk_bitmap_unref (mask); |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
75 return pixmap; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
76 } |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
77 |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
78 static GList *pixmaps_directories = NULL; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
79 |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
80 /* Use this function to set the directory containing installed pixmaps. */ |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
81 void |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
82 add_pixmap_directory (const gchar *directory) |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
83 { |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
84 pixmaps_directories = g_list_prepend (pixmaps_directories, |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
85 g_strdup (directory)); |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
86 } |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
87 |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
88 /* This is an internally used function to create pixmaps. */ |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
89 GtkWidget* |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
90 create_pixmap (GtkWidget *widget, |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
91 const gchar *filename) |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
92 { |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
93 gchar *found_filename = NULL; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
94 GdkColormap *colormap; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
95 GdkPixmap *gdkpixmap; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
96 GdkBitmap *mask; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
97 GtkWidget *pixmap; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
98 GList *elem; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
99 |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
100 /* We first try any pixmaps directories set by the application. */ |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
101 elem = pixmaps_directories; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
102 while (elem) |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
103 { |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
104 found_filename = check_file_exists ((gchar*)elem->data, filename); |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
105 if (found_filename) |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
106 break; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
107 elem = elem->next; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
108 } |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
109 |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
110 /* If we haven't found the pixmap, try the source directory. */ |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
111 if (!found_filename) |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
112 { |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
113 found_filename = check_file_exists ("../pixmaps", filename); |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
114 } |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
115 |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
116 if (!found_filename) |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
117 { |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
118 g_warning (_("Couldn't find pixmap file: %s"), filename); |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
119 return create_dummy_pixmap (widget); |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
120 } |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
121 |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
122 colormap = gtk_widget_get_colormap (widget); |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
123 gdkpixmap = gdk_pixmap_colormap_create_from_xpm (NULL, colormap, &mask, |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
124 NULL, found_filename); |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
125 if (gdkpixmap == NULL) |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
126 { |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
127 g_warning (_("Error loading pixmap file: %s"), found_filename); |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
128 g_free (found_filename); |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
129 return create_dummy_pixmap (widget); |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
130 } |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
131 g_free (found_filename); |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
132 pixmap = gtk_pixmap_new (gdkpixmap, mask); |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
133 gdk_pixmap_unref (gdkpixmap); |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
134 gdk_bitmap_unref (mask); |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
135 return pixmap; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
136 } |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
137 |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
138 /* This is an internally used function to check if a pixmap file exists. */ |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
139 gchar* |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
140 check_file_exists (const gchar *directory, |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
141 const gchar *filename) |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
142 { |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
143 gchar *full_filename; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
144 struct stat s; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
145 gint status; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
146 |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
147 full_filename = (gchar*) g_malloc (strlen (directory) + 1 |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
148 + strlen (filename) + 1); |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
149 strcpy (full_filename, directory); |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
150 strcat (full_filename, G_DIR_SEPARATOR_S); |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
151 strcat (full_filename, filename); |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
152 |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
153 status = stat (full_filename, &s); |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
154 if (status == 0 && S_ISREG (s.st_mode)) |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
155 return full_filename; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
156 g_free (full_filename); |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
157 return NULL; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
158 } |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
159 |