Search
lxdream.org :: lxdream/src/gui/support.c
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 (15 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.
view annotate diff log raw
     1 /*
     2  * DO NOT EDIT THIS FILE - it is generated by Glade.
     3  */
     5 #ifdef HAVE_CONFIG_H
     6 #  include <config.h>
     7 #endif
     9 #include <sys/types.h>
    10 #include <sys/stat.h>
    11 #include <unistd.h>
    12 #include <string.h>
    13 #include <stdio.h>
    15 #include <gnome.h>
    17 #include "support.h"
    19 GtkWidget*
    20 lookup_widget                          (GtkWidget       *widget,
    21                                         const gchar     *widget_name)
    22 {
    23   GtkWidget *parent, *found_widget;
    25   for (;;)
    26     {
    27       if (GTK_IS_MENU (widget))
    28         parent = gtk_menu_get_attach_widget (GTK_MENU (widget));
    29       else
    30         parent = widget->parent;
    31       if (!parent)
    32         parent = (GtkWidget*) g_object_get_data (G_OBJECT (widget), "GladeParentKey");
    33       if (parent == NULL)
    34         break;
    35       widget = parent;
    36     }
    38   found_widget = (GtkWidget*) g_object_get_data (G_OBJECT (widget),
    39                                                  widget_name);
    40   if (!found_widget)
    41     g_warning ("Widget not found: %s", widget_name);
    42   return found_widget;
    43 }
    45 /* This is an internally used function to create pixmaps. */
    46 GtkWidget*
    47 create_pixmap                          (GtkWidget       *widget,
    48                                         const gchar     *filename)
    49 {
    50   GtkWidget *pixmap;
    51   gchar *pathname;
    53   if (!filename || !filename[0])
    54       return gtk_image_new ();
    56   pathname = gnome_program_locate_file (NULL, GNOME_FILE_DOMAIN_APP_PIXMAP,
    57                                         filename, TRUE, NULL);
    58   if (!pathname)
    59     {
    60       g_warning (_("Couldn't find pixmap file: %s"), filename);
    61       return gtk_image_new ();
    62     }
    64   pixmap = gtk_image_new_from_file (pathname);
    65   g_free (pathname);
    66   return pixmap;
    67 }
    69 /* This is an internally used function to create pixmaps. */
    70 GdkPixbuf*
    71 create_pixbuf                          (const gchar     *filename)
    72 {
    73   gchar *pathname = NULL;
    74   GdkPixbuf *pixbuf;
    75   GError *error = NULL;
    77   if (!filename || !filename[0])
    78       return NULL;
    80   pathname = gnome_program_locate_file (NULL, GNOME_FILE_DOMAIN_APP_PIXMAP,
    81                                         filename, TRUE, NULL);
    83   if (!pathname)
    84     {
    85       g_warning (_("Couldn't find pixmap file: %s"), filename);
    86       return NULL;
    87     }
    89   pixbuf = gdk_pixbuf_new_from_file (pathname, &error);
    90   if (!pixbuf)
    91     {
    92       fprintf (stderr, "Failed to load pixbuf file: %s: %s\n",
    93                pathname, error->message);
    94       g_error_free (error);
    95     }
    96   g_free (pathname);
    97   return pixbuf;
    98 }
   100 /* This is used to set ATK action descriptions. */
   101 void
   102 glade_set_atk_action_description       (AtkAction       *action,
   103                                         const gchar     *action_name,
   104                                         const gchar     *description)
   105 {
   106   gint n_actions, i;
   108   n_actions = atk_action_get_n_actions (action);
   109   for (i = 0; i < n_actions; i++)
   110     {
   111       if (!strcmp (atk_action_get_name (action, i), action_name))
   112         atk_action_set_description (action, i, description);
   113     }
   114 }
.