2
* This file is no longer being generated by Glade and contains hand
11
#include <sys/types.h>
19
#include "tX_ui_support.h"
22
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 = gtk_widget_get_parent(widget);
34
parent = (GtkWidget *) g_object_get_data (G_OBJECT (widget), "tXUiParentKey");
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;
49
/* Use this function to set the directory containing installed pixmaps. */
51
add_pixmap_directory (const gchar *directory)
53
pixmaps_directories = g_list_prepend (pixmaps_directories,
54
g_strdup (directory));
57
/* This is an internally used function to find pixmap files. */
59
find_pixmap_file (const gchar *filename)
63
/* We step through each of the pixmaps directory to find it. */
64
elem = pixmaps_directories;
67
gchar *pathname = g_strdup_printf ("%s%s%s", (gchar*)elem->data,
68
G_DIR_SEPARATOR_S, filename);
69
if (g_file_test (pathname, G_FILE_TEST_EXISTS))
77
/* This is an internally used function to create pixmaps. */
79
create_pixmap (GtkWidget *widget,
80
const gchar *filename)
82
gchar *pathname = NULL;
85
if (!filename || !filename[0])
86
return gtk_image_new ();
88
pathname = find_pixmap_file (filename);
92
g_warning ("Couldn't find pixmap file: %s", filename);
93
return gtk_image_new ();
96
pixmap = gtk_image_new_from_file (pathname);
101
/* This is an internally used function to create pixmaps. */
103
create_pixbuf (const gchar *filename)
105
gchar *pathname = NULL;
107
GError *error = NULL;
109
if (!filename || !filename[0])
112
pathname = find_pixmap_file (filename);
116
g_warning ("Couldn't find pixmap file: %s", filename);
120
pixbuf = gdk_pixbuf_new_from_file (pathname, &error);
123
fprintf (stderr, "Failed to load pixbuf file: %s: %s\n",
124
pathname, error->message);
125
g_error_free (error);
131
/* This is used to set ATK action descriptions. */
133
ui_set_atk_action_description (AtkAction *action,
134
const gchar *action_name,
135
const gchar *description)
139
n_actions = atk_action_get_n_actions (action);
140
for (i = 0; i < n_actions; i++)
142
if (!strcmp (atk_action_get_name (action, i), action_name))
143
atk_action_set_description (action, i, description);