1 /*----------------------------------------------------------------------
3 gpiv - Graphic program for Particle Image Velocimetry, based on gtk/gnome
6 Copyright (C) 2002 Gerber van der Graaf
8 This file is part of gpiv.
10 Gpiv is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 2, or (at your option)
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software Foundation,
22 Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24 ----------------------------------------------------------------------*/
28 * Revision 1.3 2007-06-06 17:00:48 gerber
29 * Retreives images/data from URI using Gnome Virtual File System.
31 * Revision 1.2 2006/01/31 14:28:13 gerber
34 * Revision 1.1.1.1 2003/06/17 17:10:52 gerber
43 #include <sys/types.h>
55 lookup_widget (GtkWidget
*widget
,
56 const gchar
*widget_name
)
58 GtkWidget
*parent
, *found_widget
;
62 if (GTK_IS_MENU (widget
))
63 parent
= gtk_menu_get_attach_widget (GTK_MENU (widget
));
65 parent
= widget
->parent
;
67 parent
= (GtkWidget
*) g_object_get_data (G_OBJECT (widget
), "GladeParentKey");
73 found_widget
= (GtkWidget
*) g_object_get_data (G_OBJECT (widget
),
76 g_warning ("Widget not found: %s", widget_name
);
80 /* This is an internally used function to create pixmaps. */
82 create_pixmap (GtkWidget
*widget
,
83 const gchar
*filename
)
88 if (!filename
|| !filename
[0])
89 return gtk_image_new ();
91 pathname
= gnome_program_locate_file (NULL
, GNOME_FILE_DOMAIN_APP_PIXMAP
,
92 filename
, TRUE
, NULL
);
95 g_warning (_("Couldn't find pixmap file: %s"), filename
);
96 return gtk_image_new ();
99 pixmap
= gtk_image_new_from_file (pathname
);
104 /* This is an internally used function to create pixmaps. */
106 create_pixbuf (const gchar
*filename
)
108 gchar
*pathname
= NULL
;
110 GError
*error
= NULL
;
112 if (!filename
|| !filename
[0])
115 pathname
= gnome_program_locate_file (NULL
, GNOME_FILE_DOMAIN_APP_PIXMAP
,
116 filename
, TRUE
, NULL
);
120 g_warning (_("Couldn't find pixmap file: %s"), filename
);
124 pixbuf
= gdk_pixbuf_new_from_file (pathname
, &error
);
127 fprintf (stderr
, "Failed to load pixbuf file: %s: %s\n",
128 pathname
, error
->message
);
129 g_error_free (error
);
135 /* This is used to set ATK action descriptions. */
137 glade_set_atk_action_description (AtkAction
*action
,
138 const gchar
*action_name
,
139 const gchar
*description
)
143 n_actions
= atk_action_get_n_actions (action
);
144 for (i
= 0; i
< n_actions
; i
++)
146 if (!strcmp (atk_action_get_name (action
, i
), action_name
))
147 atk_action_set_description (action
, i
, description
);