#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <string.h>
#include <stdio.h>
#include <gnome.h>
#include "support.h"
Go to the source code of this file.
Functions | |
GtkWidget * | lookup_widget (GtkWidget *widget, const gchar *widget_name) |
GtkWidget * | create_pixmap (GtkWidget *widget, const gchar *filename) |
GdkPixbuf * | create_pixbuf (const gchar *filename) |
void | glade_set_atk_action_description (AtkAction *action, const gchar *action_name, const gchar *description) |
GdkPixbuf* create_pixbuf | ( | const gchar * | filename | ) |
Definition at line 88 of file support.c.
Referenced by create_about(), create_window1(), and lkmonitor_create_tray_icon().
00089 { 00090 gchar *pathname = NULL; 00091 GdkPixbuf *pixbuf; 00092 GError *error = NULL; 00093 00094 if (!filename || !filename[0]) 00095 return NULL; 00096 00097 pathname = gnome_program_locate_file (NULL, GNOME_FILE_DOMAIN_APP_PIXMAP, 00098 filename, TRUE, NULL); 00099 00100 if (!pathname) 00101 { 00102 g_warning (_("Couldn't find pixmap file: %s"), filename); 00103 return NULL; 00104 } 00105 00106 pixbuf = gdk_pixbuf_new_from_file (pathname, &error); 00107 if (!pixbuf) 00108 { 00109 fprintf (stderr, "Failed to load pixbuf file: %s: %s\n", 00110 pathname, error->message); 00111 g_error_free (error); 00112 } 00113 g_free (pathname); 00114 return pixbuf; 00115 }
GtkWidget* create_pixmap | ( | GtkWidget * | widget, | |
const gchar * | filename | |||
) |
Definition at line 64 of file support.c.
Referenced by create_window1().
00066 { 00067 GtkWidget *pixmap; 00068 gchar *pathname; 00069 00070 if (!filename || !filename[0]) 00071 return gtk_image_new (); 00072 00073 pathname = gnome_program_locate_file (NULL, GNOME_FILE_DOMAIN_APP_PIXMAP, 00074 filename, TRUE, NULL); 00075 if (!pathname) 00076 { 00077 g_warning (_("Couldn't find pixmap file: %s"), filename); 00078 return gtk_image_new (); 00079 } 00080 00081 pixmap = gtk_image_new_from_file (pathname); 00082 g_free (pathname); 00083 return pixmap; 00084 }
void glade_set_atk_action_description | ( | AtkAction * | action, | |
const gchar * | action_name, | |||
const gchar * | description | |||
) |
Definition at line 119 of file support.c.
00122 { 00123 gint n_actions, i; 00124 00125 n_actions = atk_action_get_n_actions (action); 00126 for (i = 0; i < n_actions; i++) 00127 { 00128 if (!strcmp (atk_action_get_name (action, i), action_name)) 00129 atk_action_set_description (action, i, description); 00130 } 00131 }
GtkWidget* lookup_widget | ( | GtkWidget * | widget, | |
const gchar * | widget_name | |||
) |
Definition at line 37 of file support.c.
Referenced by lkmonitor_init_widgets(), lkmonitor_write_settings(), refresh(), update_cpu(), update_cpu_mhz(), update_devs(), update_mem(), update_misc(), and update_settings().
00039 { 00040 GtkWidget *parent, *found_widget; 00041 00042 for (;;) 00043 { 00044 if (GTK_IS_MENU (widget)) 00045 parent = gtk_menu_get_attach_widget (GTK_MENU (widget)); 00046 else 00047 parent = widget->parent; 00048 if (!parent) 00049 parent = (GtkWidget*) g_object_get_data (G_OBJECT (widget), "GladeParentKey"); 00050 if (parent == NULL) 00051 break; 00052 widget = parent; 00053 } 00054 00055 found_widget = (GtkWidget*) g_object_get_data (G_OBJECT (widget), 00056 widget_name); 00057 if (!found_widget) 00058 g_warning ("Widget not found: %s", widget_name); 00059 return found_widget; 00060 }