12 #include <sys/types.h>
22 GtkWidget* lookup_widget(GtkWidget *widget,
23 const gchar *widget_name)
25 GtkWidget *parent, *found_widget;
29 if (GTK_IS_MENU (widget))
30 parent = gtk_menu_get_attach_widget (GTK_MENU (widget));
32 parent = widget->parent;
34 parent = (GtkWidget*) g_object_get_data (G_OBJECT (widget),
"GladeParentKey");
40 found_widget = (GtkWidget*) g_object_get_data (G_OBJECT (widget),
43 g_warning (
"Widget not found: %s", widget_name);
47 static GList *pixmaps_directories = NULL;
50 void add_pixmap_directory (
const gchar *directory)
52 pixmaps_directories = g_list_prepend (pixmaps_directories,
53 g_strdup (directory));
57 static gchar* find_pixmap_file (
const gchar *filename)
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))
76 GtkWidget* create_pixmap (GtkWidget *widget,
const gchar *filename)
78 gchar *pathname = NULL;
81 if (!filename || !filename[0])
82 return gtk_image_new ();
84 pathname = find_pixmap_file (filename);
88 g_warning (_(
"Couldn't find pixmap file: %s"), filename);
89 return gtk_image_new ();
92 pixmap = gtk_image_new_from_file (pathname);
98 GdkPixbuf* create_pixbuf(
const gchar *filename)
100 gchar *pathname = NULL;
102 GError *error = NULL;
104 if (!filename || !filename[0])
107 pathname = find_pixmap_file (filename);
111 g_warning (_(
"Couldn't find pixmap file: %s"), filename);
115 pixbuf = gdk_pixbuf_new_from_file (pathname, &error);
118 fprintf (stderr,
"Failed to load pixbuf file: %s: %s\n",
119 pathname, error->message);
120 g_error_free (error);
127 void glade_set_atk_action_description(AtkAction *action,
128 const gchar *action_name,
129 const gchar *description)
133 n_actions = atk_action_get_n_actions (action);
134 for (i = 0; i < n_actions; i++)
136 if (!strcmp (atk_action_get_name (action, i), action_name))
137 atk_action_set_description (action, i, description);
Headers of the GTK support functions for cuikplay.
Follow us!