2 * DO NOT EDIT THIS FILE - it is generated by Glade.
17 #include "VisSupport.h"
20 lookup_widget (GtkWidget *widget,
21 const gchar *widget_name)
23 GtkWidget *parent, *found_widget;
27 if (GTK_IS_MENU (widget))
28 parent = gtk_menu_get_attach_widget (GTK_MENU (widget));
30 parent = widget->parent;
32 parent = (GtkWidget*) g_object_get_data (G_OBJECT (widget), "GladeParentKey");
38 found_widget = (GtkWidget*) g_object_get_data (G_OBJECT (widget),
41 g_warning ("Widget not found: %s", widget_name);
45 static GList *pixmaps_directories = NULL;
47 /* Use this function to set the directory containing installed pixmaps. */
49 add_pixmap_directory (const gchar *directory)
51 pixmaps_directories = g_list_prepend (pixmaps_directories,
52 g_strdup (directory));
55 /* This is an internally used function to find pixmap files. */
57 find_pixmap_file (const gchar *filename)
61 /* We step through each of the pixmaps directory to find it. */
62 elem = pixmaps_directories;
65 gchar *pathname = g_strdup_printf ("%s%s%s", (gchar*)elem->data,
66 G_DIR_SEPARATOR_S, filename);
67 if (g_file_test (pathname, G_FILE_TEST_EXISTS))
75 /* This is an internally used function to create pixmaps. */
77 create_pixmap (GtkWidget *widget,
78 const gchar *filename)
80 gchar *pathname = NULL;
83 if (!filename || !filename[0])
84 return gtk_image_new ();
86 pathname = find_pixmap_file (filename);
90 g_warning ("Couldn't find pixmap file: %s", filename);
91 return gtk_image_new ();
94 pixmap = gtk_image_new_from_file (pathname);
99 /* This is an internally used function to create pixmaps. */
101 create_pixbuf (const gchar *filename)
103 gchar *pathname = NULL;
105 GError *error = NULL;
107 if (!filename || !filename[0])
110 pathname = find_pixmap_file (filename);
114 g_warning ("Couldn't find pixmap file: %s", filename);
118 pixbuf = gdk_pixbuf_new_from_file (pathname, &error);
121 fprintf (stderr, "Failed to load pixbuf file: %s: %s\n",
122 pathname, error->message);
123 g_error_free (error);
129 /* This is used to set ATK action descriptions. */
131 glade_set_atk_action_description (AtkAction *action,
132 const gchar *action_name,
133 const gchar *description)
137 n_actions = atk_action_get_n_actions (action);
138 for (i = 0; i < n_actions; i++)
140 if (!strcmp (atk_action_get_name (action, i), action_name))
141 atk_action_set_description (action, i, description);