annotate src/modplug/gui/support.cxx @ 1882:eed7c270e8dd

Fix MILLIONS of Makefiles.
author Jonathan Schleifer <js@h3c.de>
date Wed, 26 Sep 2007 14:53:37 +0200
parents 499656950801
children 4b53cd5812e2
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1 /*
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
2 * DO NOT EDIT THIS FILE - it is generated by Glade.
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
3 */
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
4
1781
499656950801 modplug: Mk2
William Pitcock <nenolod@atheme.org>
parents: 1603
diff changeset
5 #include <config.h>
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
6
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
7 #include <sys/types.h>
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
8 #include <sys/stat.h>
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
9 #include <unistd.h>
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
10 #include <string.h>
1603
3ba928b31aac Made the GUI dialogs (fileinfo & config) bit neater.
Matti Hamalainen <ccr@tnsp.org>
parents: 1044
diff changeset
11 #include <stdio.h>
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
12
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
13 #include <gtk/gtk.h>
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
14
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
15 #include "support.h"
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
16
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
17 GtkWidget*
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
18 lookup_widget (GtkWidget *widget,
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
19 const gchar *widget_name)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
20 {
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
21 GtkWidget *parent, *found_widget;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
22
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
23 for (;;)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
24 {
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
25 if (GTK_IS_MENU (widget))
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
26 parent = gtk_menu_get_attach_widget (GTK_MENU (widget));
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
27 else
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
28 parent = widget->parent;
1603
3ba928b31aac Made the GUI dialogs (fileinfo & config) bit neater.
Matti Hamalainen <ccr@tnsp.org>
parents: 1044
diff changeset
29 if (!parent)
3ba928b31aac Made the GUI dialogs (fileinfo & config) bit neater.
Matti Hamalainen <ccr@tnsp.org>
parents: 1044
diff changeset
30 parent = (GtkWidget*) g_object_get_data (G_OBJECT (widget), "GladeParentKey");
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
31 if (parent == NULL)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
32 break;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
33 widget = parent;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
34 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
35
1603
3ba928b31aac Made the GUI dialogs (fileinfo & config) bit neater.
Matti Hamalainen <ccr@tnsp.org>
parents: 1044
diff changeset
36 found_widget = (GtkWidget*) g_object_get_data (G_OBJECT (widget),
3ba928b31aac Made the GUI dialogs (fileinfo & config) bit neater.
Matti Hamalainen <ccr@tnsp.org>
parents: 1044
diff changeset
37 widget_name);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
38 if (!found_widget)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
39 g_warning ("Widget not found: %s", widget_name);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
40 return found_widget;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
41 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
42
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
43 static GList *pixmaps_directories = NULL;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
44
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
45 /* Use this function to set the directory containing installed pixmaps. */
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
46 void
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
47 add_pixmap_directory (const gchar *directory)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
48 {
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
49 pixmaps_directories = g_list_prepend (pixmaps_directories,
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
50 g_strdup (directory));
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
51 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
52
1603
3ba928b31aac Made the GUI dialogs (fileinfo & config) bit neater.
Matti Hamalainen <ccr@tnsp.org>
parents: 1044
diff changeset
53 /* This is an internally used function to find pixmap files. */
3ba928b31aac Made the GUI dialogs (fileinfo & config) bit neater.
Matti Hamalainen <ccr@tnsp.org>
parents: 1044
diff changeset
54 static gchar*
3ba928b31aac Made the GUI dialogs (fileinfo & config) bit neater.
Matti Hamalainen <ccr@tnsp.org>
parents: 1044
diff changeset
55 find_pixmap_file (const gchar *filename)
3ba928b31aac Made the GUI dialogs (fileinfo & config) bit neater.
Matti Hamalainen <ccr@tnsp.org>
parents: 1044
diff changeset
56 {
3ba928b31aac Made the GUI dialogs (fileinfo & config) bit neater.
Matti Hamalainen <ccr@tnsp.org>
parents: 1044
diff changeset
57 GList *elem;
3ba928b31aac Made the GUI dialogs (fileinfo & config) bit neater.
Matti Hamalainen <ccr@tnsp.org>
parents: 1044
diff changeset
58
3ba928b31aac Made the GUI dialogs (fileinfo & config) bit neater.
Matti Hamalainen <ccr@tnsp.org>
parents: 1044
diff changeset
59 /* We step through each of the pixmaps directory to find it. */
3ba928b31aac Made the GUI dialogs (fileinfo & config) bit neater.
Matti Hamalainen <ccr@tnsp.org>
parents: 1044
diff changeset
60 elem = pixmaps_directories;
3ba928b31aac Made the GUI dialogs (fileinfo & config) bit neater.
Matti Hamalainen <ccr@tnsp.org>
parents: 1044
diff changeset
61 while (elem)
3ba928b31aac Made the GUI dialogs (fileinfo & config) bit neater.
Matti Hamalainen <ccr@tnsp.org>
parents: 1044
diff changeset
62 {
3ba928b31aac Made the GUI dialogs (fileinfo & config) bit neater.
Matti Hamalainen <ccr@tnsp.org>
parents: 1044
diff changeset
63 gchar *pathname = g_strdup_printf ("%s%s%s", (gchar*)elem->data,
3ba928b31aac Made the GUI dialogs (fileinfo & config) bit neater.
Matti Hamalainen <ccr@tnsp.org>
parents: 1044
diff changeset
64 G_DIR_SEPARATOR_S, filename);
3ba928b31aac Made the GUI dialogs (fileinfo & config) bit neater.
Matti Hamalainen <ccr@tnsp.org>
parents: 1044
diff changeset
65 if (g_file_test (pathname, G_FILE_TEST_EXISTS))
3ba928b31aac Made the GUI dialogs (fileinfo & config) bit neater.
Matti Hamalainen <ccr@tnsp.org>
parents: 1044
diff changeset
66 return pathname;
3ba928b31aac Made the GUI dialogs (fileinfo & config) bit neater.
Matti Hamalainen <ccr@tnsp.org>
parents: 1044
diff changeset
67 g_free (pathname);
3ba928b31aac Made the GUI dialogs (fileinfo & config) bit neater.
Matti Hamalainen <ccr@tnsp.org>
parents: 1044
diff changeset
68 elem = elem->next;
3ba928b31aac Made the GUI dialogs (fileinfo & config) bit neater.
Matti Hamalainen <ccr@tnsp.org>
parents: 1044
diff changeset
69 }
3ba928b31aac Made the GUI dialogs (fileinfo & config) bit neater.
Matti Hamalainen <ccr@tnsp.org>
parents: 1044
diff changeset
70 return NULL;
3ba928b31aac Made the GUI dialogs (fileinfo & config) bit neater.
Matti Hamalainen <ccr@tnsp.org>
parents: 1044
diff changeset
71 }
3ba928b31aac Made the GUI dialogs (fileinfo & config) bit neater.
Matti Hamalainen <ccr@tnsp.org>
parents: 1044
diff changeset
72
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
73 /* This is an internally used function to create pixmaps. */
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
74 GtkWidget*
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
75 create_pixmap (GtkWidget *widget,
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
76 const gchar *filename)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
77 {
1603
3ba928b31aac Made the GUI dialogs (fileinfo & config) bit neater.
Matti Hamalainen <ccr@tnsp.org>
parents: 1044
diff changeset
78 gchar *pathname = NULL;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
79 GtkWidget *pixmap;
1603
3ba928b31aac Made the GUI dialogs (fileinfo & config) bit neater.
Matti Hamalainen <ccr@tnsp.org>
parents: 1044
diff changeset
80
3ba928b31aac Made the GUI dialogs (fileinfo & config) bit neater.
Matti Hamalainen <ccr@tnsp.org>
parents: 1044
diff changeset
81 if (!filename || !filename[0])
3ba928b31aac Made the GUI dialogs (fileinfo & config) bit neater.
Matti Hamalainen <ccr@tnsp.org>
parents: 1044
diff changeset
82 return gtk_image_new ();
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
83
1603
3ba928b31aac Made the GUI dialogs (fileinfo & config) bit neater.
Matti Hamalainen <ccr@tnsp.org>
parents: 1044
diff changeset
84 pathname = find_pixmap_file (filename);
3ba928b31aac Made the GUI dialogs (fileinfo & config) bit neater.
Matti Hamalainen <ccr@tnsp.org>
parents: 1044
diff changeset
85
3ba928b31aac Made the GUI dialogs (fileinfo & config) bit neater.
Matti Hamalainen <ccr@tnsp.org>
parents: 1044
diff changeset
86 if (!pathname)
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
87 {
1603
3ba928b31aac Made the GUI dialogs (fileinfo & config) bit neater.
Matti Hamalainen <ccr@tnsp.org>
parents: 1044
diff changeset
88 g_warning (_("Couldn't find pixmap file: %s"), filename);
3ba928b31aac Made the GUI dialogs (fileinfo & config) bit neater.
Matti Hamalainen <ccr@tnsp.org>
parents: 1044
diff changeset
89 return gtk_image_new ();
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
90 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
91
1603
3ba928b31aac Made the GUI dialogs (fileinfo & config) bit neater.
Matti Hamalainen <ccr@tnsp.org>
parents: 1044
diff changeset
92 pixmap = gtk_image_new_from_file (pathname);
3ba928b31aac Made the GUI dialogs (fileinfo & config) bit neater.
Matti Hamalainen <ccr@tnsp.org>
parents: 1044
diff changeset
93 g_free (pathname);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
94 return pixmap;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
95 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
96
1603
3ba928b31aac Made the GUI dialogs (fileinfo & config) bit neater.
Matti Hamalainen <ccr@tnsp.org>
parents: 1044
diff changeset
97 /* This is an internally used function to create pixmaps. */
3ba928b31aac Made the GUI dialogs (fileinfo & config) bit neater.
Matti Hamalainen <ccr@tnsp.org>
parents: 1044
diff changeset
98 GdkPixbuf*
3ba928b31aac Made the GUI dialogs (fileinfo & config) bit neater.
Matti Hamalainen <ccr@tnsp.org>
parents: 1044
diff changeset
99 create_pixbuf (const gchar *filename)
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
100 {
1603
3ba928b31aac Made the GUI dialogs (fileinfo & config) bit neater.
Matti Hamalainen <ccr@tnsp.org>
parents: 1044
diff changeset
101 gchar *pathname = NULL;
3ba928b31aac Made the GUI dialogs (fileinfo & config) bit neater.
Matti Hamalainen <ccr@tnsp.org>
parents: 1044
diff changeset
102 GdkPixbuf *pixbuf;
3ba928b31aac Made the GUI dialogs (fileinfo & config) bit neater.
Matti Hamalainen <ccr@tnsp.org>
parents: 1044
diff changeset
103 GError *error = NULL;
3ba928b31aac Made the GUI dialogs (fileinfo & config) bit neater.
Matti Hamalainen <ccr@tnsp.org>
parents: 1044
diff changeset
104
3ba928b31aac Made the GUI dialogs (fileinfo & config) bit neater.
Matti Hamalainen <ccr@tnsp.org>
parents: 1044
diff changeset
105 if (!filename || !filename[0])
3ba928b31aac Made the GUI dialogs (fileinfo & config) bit neater.
Matti Hamalainen <ccr@tnsp.org>
parents: 1044
diff changeset
106 return NULL;
3ba928b31aac Made the GUI dialogs (fileinfo & config) bit neater.
Matti Hamalainen <ccr@tnsp.org>
parents: 1044
diff changeset
107
3ba928b31aac Made the GUI dialogs (fileinfo & config) bit neater.
Matti Hamalainen <ccr@tnsp.org>
parents: 1044
diff changeset
108 pathname = find_pixmap_file (filename);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
109
1603
3ba928b31aac Made the GUI dialogs (fileinfo & config) bit neater.
Matti Hamalainen <ccr@tnsp.org>
parents: 1044
diff changeset
110 if (!pathname)
3ba928b31aac Made the GUI dialogs (fileinfo & config) bit neater.
Matti Hamalainen <ccr@tnsp.org>
parents: 1044
diff changeset
111 {
3ba928b31aac Made the GUI dialogs (fileinfo & config) bit neater.
Matti Hamalainen <ccr@tnsp.org>
parents: 1044
diff changeset
112 g_warning (_("Couldn't find pixmap file: %s"), filename);
3ba928b31aac Made the GUI dialogs (fileinfo & config) bit neater.
Matti Hamalainen <ccr@tnsp.org>
parents: 1044
diff changeset
113 return NULL;
3ba928b31aac Made the GUI dialogs (fileinfo & config) bit neater.
Matti Hamalainen <ccr@tnsp.org>
parents: 1044
diff changeset
114 }
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
115
1603
3ba928b31aac Made the GUI dialogs (fileinfo & config) bit neater.
Matti Hamalainen <ccr@tnsp.org>
parents: 1044
diff changeset
116 pixbuf = gdk_pixbuf_new_from_file (pathname, &error);
3ba928b31aac Made the GUI dialogs (fileinfo & config) bit neater.
Matti Hamalainen <ccr@tnsp.org>
parents: 1044
diff changeset
117 if (!pixbuf)
3ba928b31aac Made the GUI dialogs (fileinfo & config) bit neater.
Matti Hamalainen <ccr@tnsp.org>
parents: 1044
diff changeset
118 {
3ba928b31aac Made the GUI dialogs (fileinfo & config) bit neater.
Matti Hamalainen <ccr@tnsp.org>
parents: 1044
diff changeset
119 fprintf (stderr, "Failed to load pixbuf file: %s: %s\n",
3ba928b31aac Made the GUI dialogs (fileinfo & config) bit neater.
Matti Hamalainen <ccr@tnsp.org>
parents: 1044
diff changeset
120 pathname, error->message);
3ba928b31aac Made the GUI dialogs (fileinfo & config) bit neater.
Matti Hamalainen <ccr@tnsp.org>
parents: 1044
diff changeset
121 g_error_free (error);
3ba928b31aac Made the GUI dialogs (fileinfo & config) bit neater.
Matti Hamalainen <ccr@tnsp.org>
parents: 1044
diff changeset
122 }
3ba928b31aac Made the GUI dialogs (fileinfo & config) bit neater.
Matti Hamalainen <ccr@tnsp.org>
parents: 1044
diff changeset
123 g_free (pathname);
3ba928b31aac Made the GUI dialogs (fileinfo & config) bit neater.
Matti Hamalainen <ccr@tnsp.org>
parents: 1044
diff changeset
124 return pixbuf;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
125 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
126
1603
3ba928b31aac Made the GUI dialogs (fileinfo & config) bit neater.
Matti Hamalainen <ccr@tnsp.org>
parents: 1044
diff changeset
127 /* This is used to set ATK action descriptions. */
3ba928b31aac Made the GUI dialogs (fileinfo & config) bit neater.
Matti Hamalainen <ccr@tnsp.org>
parents: 1044
diff changeset
128 void
3ba928b31aac Made the GUI dialogs (fileinfo & config) bit neater.
Matti Hamalainen <ccr@tnsp.org>
parents: 1044
diff changeset
129 glade_set_atk_action_description (AtkAction *action,
3ba928b31aac Made the GUI dialogs (fileinfo & config) bit neater.
Matti Hamalainen <ccr@tnsp.org>
parents: 1044
diff changeset
130 const gchar *action_name,
3ba928b31aac Made the GUI dialogs (fileinfo & config) bit neater.
Matti Hamalainen <ccr@tnsp.org>
parents: 1044
diff changeset
131 const gchar *description)
3ba928b31aac Made the GUI dialogs (fileinfo & config) bit neater.
Matti Hamalainen <ccr@tnsp.org>
parents: 1044
diff changeset
132 {
3ba928b31aac Made the GUI dialogs (fileinfo & config) bit neater.
Matti Hamalainen <ccr@tnsp.org>
parents: 1044
diff changeset
133 gint n_actions, i;
3ba928b31aac Made the GUI dialogs (fileinfo & config) bit neater.
Matti Hamalainen <ccr@tnsp.org>
parents: 1044
diff changeset
134
3ba928b31aac Made the GUI dialogs (fileinfo & config) bit neater.
Matti Hamalainen <ccr@tnsp.org>
parents: 1044
diff changeset
135 n_actions = atk_action_get_n_actions (action);
3ba928b31aac Made the GUI dialogs (fileinfo & config) bit neater.
Matti Hamalainen <ccr@tnsp.org>
parents: 1044
diff changeset
136 for (i = 0; i < n_actions; i++)
3ba928b31aac Made the GUI dialogs (fileinfo & config) bit neater.
Matti Hamalainen <ccr@tnsp.org>
parents: 1044
diff changeset
137 {
3ba928b31aac Made the GUI dialogs (fileinfo & config) bit neater.
Matti Hamalainen <ccr@tnsp.org>
parents: 1044
diff changeset
138 if (!strcmp (atk_action_get_name (action, i), action_name))
3ba928b31aac Made the GUI dialogs (fileinfo & config) bit neater.
Matti Hamalainen <ccr@tnsp.org>
parents: 1044
diff changeset
139 atk_action_set_description (action, i, description);
3ba928b31aac Made the GUI dialogs (fileinfo & config) bit neater.
Matti Hamalainen <ccr@tnsp.org>
parents: 1044
diff changeset
140 }
3ba928b31aac Made the GUI dialogs (fileinfo & config) bit neater.
Matti Hamalainen <ccr@tnsp.org>
parents: 1044
diff changeset
141 }
3ba928b31aac Made the GUI dialogs (fileinfo & config) bit neater.
Matti Hamalainen <ccr@tnsp.org>
parents: 1044
diff changeset
142