1 /*----------------------------------------------------------------------
3 gpiv - Graphic program for Particle Image Velocimetry, based on gtk/gnome
6 Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008
9 This file is part of gpiv.
11 Gpiv is free software; you can redistribute it and/or modify
12 it under the terms of the GNU General Public License as published by
13 the Free Software Foundation; either version 2, or (at your option)
16 This program is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 GNU General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with this program; if not, write to the Free Software Foundation,
23 Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
25 ----------------------------------------------------------------------*/
29 * Revision 1.3 2007-06-06 17:00:48 gerber
30 * Retreives images/data from URI using Gnome Virtual File System.
32 * Revision 1.2 2006/01/31 14:28:13 gerber
35 * Revision 1.1.1.1 2003/06/17 17:10:52 gerber
44 #include <sys/types.h>
56 lookup_widget (GtkWidget
*widget
,
57 const gchar
*widget_name
)
59 GtkWidget
*parent
, *found_widget
;
63 if (GTK_IS_MENU (widget
))
64 parent
= gtk_menu_get_attach_widget (GTK_MENU (widget
));
66 parent
= widget
->parent
;
68 parent
= (GtkWidget
*) g_object_get_data (G_OBJECT (widget
), "GladeParentKey");
74 found_widget
= (GtkWidget
*) g_object_get_data (G_OBJECT (widget
),
77 g_warning ("Widget not found: %s", widget_name
);
81 /* This is an internally used function to create pixmaps. */
83 create_pixmap (GtkWidget
*widget
,
84 const gchar
*filename
)
89 if (!filename
|| !filename
[0])
90 return gtk_image_new ();
92 pathname
= gnome_program_locate_file (NULL
, GNOME_FILE_DOMAIN_APP_PIXMAP
,
93 filename
, TRUE
, NULL
);
96 g_warning (_("Couldn't find pixmap file: %s"), filename
);
97 return gtk_image_new ();
100 pixmap
= gtk_image_new_from_file (pathname
);
105 /* This is an internally used function to create pixmaps. */
107 create_pixbuf (const gchar
*filename
)
109 gchar
*pathname
= NULL
;
111 GError
*error
= NULL
;
113 if (!filename
|| !filename
[0])
116 pathname
= gnome_program_locate_file (NULL
, GNOME_FILE_DOMAIN_APP_PIXMAP
,
117 filename
, TRUE
, NULL
);
121 g_warning (_("Couldn't find pixmap file: %s"), filename
);
125 pixbuf
= gdk_pixbuf_new_from_file (pathname
, &error
);
128 fprintf (stderr
, "Failed to load pixbuf file: %s: %s\n",
129 pathname
, error
->message
);
130 g_error_free (error
);
136 /* This is used to set ATK action descriptions. */
138 glade_set_atk_action_description (AtkAction
*action
,
139 const gchar
*action_name
,
140 const gchar
*description
)
144 n_actions
= atk_action_get_n_actions (action
);
145 for (i
= 0; i
< n_actions
; i
++)
147 if (!strcmp (atk_action_get_name (action
, i
), action_name
))
148 atk_action_set_description (action
, i
, description
);