Search
lxdream.org :: lxdream/src/gui/support.c :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/gui/support.c
changeset 1:eea311cfd33e
author nkeynes
date Sat Mar 13 00:03:32 2004 +0000 (18 years ago)
permissions -rw-r--r--
last change This commit was generated by cvs2svn to compensate for changes in r2,
which included commits to RCS files with non-trunk default branches.
file annotate diff log raw
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/src/gui/support.c Sat Mar 13 00:03:32 2004 +0000
1.3 @@ -0,0 +1,115 @@
1.4 +/*
1.5 + * DO NOT EDIT THIS FILE - it is generated by Glade.
1.6 + */
1.7 +
1.8 +#ifdef HAVE_CONFIG_H
1.9 +# include <config.h>
1.10 +#endif
1.11 +
1.12 +#include <sys/types.h>
1.13 +#include <sys/stat.h>
1.14 +#include <unistd.h>
1.15 +#include <string.h>
1.16 +#include <stdio.h>
1.17 +
1.18 +#include <gnome.h>
1.19 +
1.20 +#include "support.h"
1.21 +
1.22 +GtkWidget*
1.23 +lookup_widget (GtkWidget *widget,
1.24 + const gchar *widget_name)
1.25 +{
1.26 + GtkWidget *parent, *found_widget;
1.27 +
1.28 + for (;;)
1.29 + {
1.30 + if (GTK_IS_MENU (widget))
1.31 + parent = gtk_menu_get_attach_widget (GTK_MENU (widget));
1.32 + else
1.33 + parent = widget->parent;
1.34 + if (!parent)
1.35 + parent = (GtkWidget*) g_object_get_data (G_OBJECT (widget), "GladeParentKey");
1.36 + if (parent == NULL)
1.37 + break;
1.38 + widget = parent;
1.39 + }
1.40 +
1.41 + found_widget = (GtkWidget*) g_object_get_data (G_OBJECT (widget),
1.42 + widget_name);
1.43 + if (!found_widget)
1.44 + g_warning ("Widget not found: %s", widget_name);
1.45 + return found_widget;
1.46 +}
1.47 +
1.48 +/* This is an internally used function to create pixmaps. */
1.49 +GtkWidget*
1.50 +create_pixmap (GtkWidget *widget,
1.51 + const gchar *filename)
1.52 +{
1.53 + GtkWidget *pixmap;
1.54 + gchar *pathname;
1.55 +
1.56 + if (!filename || !filename[0])
1.57 + return gtk_image_new ();
1.58 +
1.59 + pathname = gnome_program_locate_file (NULL, GNOME_FILE_DOMAIN_APP_PIXMAP,
1.60 + filename, TRUE, NULL);
1.61 + if (!pathname)
1.62 + {
1.63 + g_warning (_("Couldn't find pixmap file: %s"), filename);
1.64 + return gtk_image_new ();
1.65 + }
1.66 +
1.67 + pixmap = gtk_image_new_from_file (pathname);
1.68 + g_free (pathname);
1.69 + return pixmap;
1.70 +}
1.71 +
1.72 +/* This is an internally used function to create pixmaps. */
1.73 +GdkPixbuf*
1.74 +create_pixbuf (const gchar *filename)
1.75 +{
1.76 + gchar *pathname = NULL;
1.77 + GdkPixbuf *pixbuf;
1.78 + GError *error = NULL;
1.79 +
1.80 + if (!filename || !filename[0])
1.81 + return NULL;
1.82 +
1.83 + pathname = gnome_program_locate_file (NULL, GNOME_FILE_DOMAIN_APP_PIXMAP,
1.84 + filename, TRUE, NULL);
1.85 +
1.86 + if (!pathname)
1.87 + {
1.88 + g_warning (_("Couldn't find pixmap file: %s"), filename);
1.89 + return NULL;
1.90 + }
1.91 +
1.92 + pixbuf = gdk_pixbuf_new_from_file (pathname, &error);
1.93 + if (!pixbuf)
1.94 + {
1.95 + fprintf (stderr, "Failed to load pixbuf file: %s: %s\n",
1.96 + pathname, error->message);
1.97 + g_error_free (error);
1.98 + }
1.99 + g_free (pathname);
1.100 + return pixbuf;
1.101 +}
1.102 +
1.103 +/* This is used to set ATK action descriptions. */
1.104 +void
1.105 +glade_set_atk_action_description (AtkAction *action,
1.106 + const gchar *action_name,
1.107 + const gchar *description)
1.108 +{
1.109 + gint n_actions, i;
1.110 +
1.111 + n_actions = atk_action_get_n_actions (action);
1.112 + for (i = 0; i < n_actions; i++)
1.113 + {
1.114 + if (!strcmp (atk_action_get_name (action, i), action_name))
1.115 + atk_action_set_description (action, i, description);
1.116 + }
1.117 +}
1.118 +
.