/home/fernape/Projects/lkmonitor/src/support.h File Reference

#include <gnome.h>

Go to the source code of this file.

Defines

#define Q_(String)   g_strip_context ((String), (String))

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)


Define Documentation

#define Q_ ( String   )     g_strip_context ((String), (String))

Definition at line 37 of file support.h.


Function Documentation

GdkPixbuf* create_pixbuf ( const gchar *  filename  ) 

Definition at line 93 of file support.c.

Referenced by create_about(), create_window1(), create_window2(), and lkmonitor_create_tray_icon().

00094 {
00095   gchar *pathname = NULL;
00096   GdkPixbuf *pixbuf;
00097   GError *error = NULL;
00098 
00099   if (!filename || !filename[0])
00100       return NULL;
00101 
00102   pathname = gnome_program_locate_file (NULL, GNOME_FILE_DOMAIN_APP_PIXMAP,
00103                                         filename, TRUE, NULL);
00104 
00105   if (!pathname)
00106     {
00107       g_warning (_("Couldn't find pixmap file: %s"), filename);
00108       return NULL;
00109     }
00110 
00111   pixbuf = gdk_pixbuf_new_from_file (pathname, &error);
00112   if (!pixbuf)
00113     {
00114       fprintf (stderr, "Failed to load pixbuf file: %s: %s\n",
00115                pathname, error->message);
00116       g_error_free (error);
00117     }
00118   g_free (pathname);
00119   return pixbuf;
00120 }

GtkWidget* create_pixmap ( GtkWidget *  widget,
const gchar *  filename 
)

Definition at line 69 of file support.c.

Referenced by create_window1().

00071 {
00072   GtkWidget *pixmap;
00073   gchar *pathname;
00074 
00075   if (!filename || !filename[0])
00076       return gtk_image_new ();
00077 
00078   pathname = gnome_program_locate_file (NULL, GNOME_FILE_DOMAIN_APP_PIXMAP,
00079                                         filename, TRUE, NULL);
00080   if (!pathname)
00081     {
00082       g_warning (_("Couldn't find pixmap file: %s"), filename);
00083       return gtk_image_new ();
00084     }
00085 
00086   pixmap = gtk_image_new_from_file (pathname);
00087   g_free (pathname);
00088   return pixmap;
00089 }

void glade_set_atk_action_description ( AtkAction *  action,
const gchar *  action_name,
const gchar *  description 
)

Definition at line 124 of file support.c.

00127 {
00128   gint n_actions, i;
00129 
00130   n_actions = atk_action_get_n_actions (action);
00131   for (i = 0; i < n_actions; i++)
00132     {
00133       if (!strcmp (atk_action_get_name (action, i), action_name))
00134         atk_action_set_description (action, i, description);
00135     }
00136 }

GtkWidget* lookup_widget ( GtkWidget *  widget,
const gchar *  widget_name 
)

Definition at line 42 of file support.c.

Referenced by lkmonitor_init_widgets(), lkmonitor_load_net_dev(), lkmonitor_write_settings(), refresh(), update_channels(), update_cmd_ver(), update_cpu(), update_cpu_mhz(), update_devs(), update_fs_info(), update_mem(), update_misc(), update_mm_details(), update_modules_info(), update_net_info(), update_process(), update_process_window(), and update_settings().

00044 {
00045   GtkWidget *parent, *found_widget;
00046 
00047   for (;;)
00048     {
00049       if (GTK_IS_MENU (widget))
00050         parent = gtk_menu_get_attach_widget (GTK_MENU (widget));
00051       else
00052         parent = widget->parent;
00053       if (!parent)
00054         parent = (GtkWidget*) g_object_get_data (G_OBJECT (widget), "GladeParentKey");
00055       if (parent == NULL)
00056         break;
00057       widget = parent;
00058     }
00059 
00060   found_widget = (GtkWidget*) g_object_get_data (G_OBJECT (widget),
00061                                                  widget_name);
00062   if (!found_widget)
00063     g_warning ("Widget not found: %s", widget_name);
00064   return found_widget;
00065 }


Generated on Tue Apr 1 22:52:57 2008 for lkmonitor by  doxygen 1.5.1