"Fossies" - the Fresh Open Source Software Archive

Member "procmeter3-3.6+svn387/gtk1/resources.c" (24 Dec 2010, 2520 Bytes) of package /linux/misc/procmeter3-3.6+svn387.tgz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "resources.c" see the Fossies "Dox" file reference documentation.

    1 /***************************************
    2   $Header: /home/amb/CVS/procmeter3/gtk1/resources.c,v 1.1 2000-12-16 16:35:43 amb Exp $
    3 
    4   ProcMeter - A system monitoring program for Linux - Version 3.3.
    5 
    6   X Window resource conversions.
    7   ******************/ /******************
    8   Written by Andrew M. Bishop
    9 
   10   This file Copyright 1998,99 Andrew M. Bishop
   11   It may be distributed under the GNU Public License, version 2, or
   12   any higher version.  See section COPYING of the GNU Public license
   13   for conditions under which this file may be redistributed.
   14   ***************************************/
   15 
   16 
   17 #include <stdlib.h>
   18 #include <stdio.h>
   19 #include <string.h>
   20 
   21 #include <gtk/gtk.h>
   22 
   23 #include "window.h"
   24 #include "procmeterp.h"
   25 
   26 
   27 /*++++++++++++++++++++++++++++++++++++++
   28   Convert a string to a font structure.
   29 
   30   GdkFont *StringToFont Returns a pointer to a font structure.
   31 
   32   char *string The string to convert.
   33   ++++++++++++++++++++++++++++++++++++++*/
   34 
   35 GdkFont *StringToFont(char *string)
   36 {
   37  return(gdk_font_load(string));
   38 }
   39 
   40 
   41 /*++++++++++++++++++++++++++++++++++++++
   42   Convert a string to a pixel.
   43 
   44   GdkColor StringToPixel Returns a GdkColor value.
   45 
   46   char *string The string to convert.
   47   ++++++++++++++++++++++++++++++++++++++*/
   48 
   49 GdkColor StringToPixel(char *string)
   50 {
   51  static GdkColor color;
   52 
   53  gdk_color_parse(string,&color);
   54  gdk_colormap_alloc_color(gdk_colormap_get_system(),&color,FALSE,TRUE);
   55 
   56  return(color);
   57 }
   58 
   59 
   60 /*++++++++++++++++++++++++++++++++++++++
   61   Convert a string to a Boolean.
   62 
   63   gboolean StringToBoolean Returns a Boolean value.
   64 
   65   char *string The string to convert.
   66   ++++++++++++++++++++++++++++++++++++++*/
   67 
   68 gboolean StringToBoolean(char *string)
   69 {
   70  gboolean b;
   71 
   72  if(!strcasecmp(string,"true") ||
   73     !strcasecmp(string,"yes") ||
   74     !strcasecmp(string,"1"))
   75     b=TRUE;
   76  else
   77     b=FALSE;
   78 
   79  return(b);
   80 }
   81 
   82 
   83 /*++++++++++++++++++++++++++++++++++++++
   84   Convert a string to an integer
   85 
   86   int StringToInt Returns an integer value.
   87 
   88   char *string The string to convert.
   89   ++++++++++++++++++++++++++++++++++++++*/
   90 
   91 int StringToInt(char *string)
   92 {
   93  int i;
   94 
   95  if(sscanf(string,"%d",&i)!=1)
   96     i=0;
   97 
   98  return(i);
   99 }
  100 
  101 
  102 /*++++++++++++++++++++++++++++++++++++++
  103   Convert a string to a label position.
  104 
  105   int StringToLabelPosition Returns an integer value.
  106 
  107   char *string The string to convert.
  108   ++++++++++++++++++++++++++++++++++++++*/
  109 
  110 int StringToLabelPosition(char *string)
  111 {
  112  int i;
  113 
  114  if(!strcasecmp(string,"top"))
  115     i=1;
  116  else if(!strcasecmp(string,"bottom"))
  117     i=-1;
  118  else
  119     i=0;
  120 
  121  return(i);
  122 }