/**
 * anjuta_plugin_description_get_raw:
 * @df: an #AnjutaPluginDescription object.
 * @section_name: Name of the section.
 * @keyname: Name of the key.
 * @locale: The locale for which the value is to be retrieved.
 * @val: (out) (transfer full) (allow-none): Pointer to the variable to store the string value.
 *
 * Retrieves the value of a key (in the given section) for the given locale.
 * The value returned in @val must be freed after use.
 *
 * Return value: %TRUE if sucessful, otherwise %FALSE.
 */
gboolean
anjuta_plugin_description_get_raw (AnjutaPluginDescription *df,
			    const char    *section_name,
			    const char    *keyname,
			    const char    *locale,
			    char         **val)
{
  AnjutaPluginDescriptionSection *section;
  AnjutaPluginDescriptionLine *line;

  *val = NULL;

  section = lookup_section (df, section_name);
  if (!section)
    return FALSE;

  line = lookup_line (df,
		      section,
		      keyname,
		      locale);

  if (!line)
    return FALSE;
  
  *val = g_strdup (line->value);
  
  return TRUE;
}
dbus_bool_t
bus_desktop_file_get_raw (BusDesktopFile  *desktop_file,
			  const char      *section_name,
			  const char      *keyname,
			  const char     **val)
{
  BusDesktopFileSection *section;
  BusDesktopFileLine *line;

  *val = NULL;

  section = lookup_section (desktop_file, section_name);
  
  if (!section)
    return FALSE;

  line = lookup_line (desktop_file,
		      section,
		      keyname);

  if (!line)
    return FALSE;
  
  *val = line->value;
  
  return TRUE;
}
Exemplo n.º 3
0
/**
 * gnome_theme_file_get_raw:
 * @df: A #GnomeThemeFile. 
 * @section: the string representing the section name
 * @keyname: the string representing the key name.
 * @locale: the string representing the locale. 
 * @val: a char**. 
 *
 * Searches section name and line in the #GnomeThemeFile data structure.
 * If found, sets the @val to value field in GnomeThemeFileLine and returns a boolean value.
 * 
 * Returns: TRUE if section and line were found in the #GnomeThemeFile, FALSE otherwise.
 * 
 * Since: 2.2
 **/ 
gboolean
gnome_theme_file_get_raw (GnomeThemeFile	*df,
			    const char		*section_name,
			    const char    	*keyname,
			    const char    	*locale,
			    char         	**val)
{
  GnomeThemeFileSection *section;
  GnomeThemeFileLine *line;

  *val = NULL;

  section = lookup_section (df, section_name);
  if (!section)
    return FALSE;

  line = lookup_line (df,
		      section,
		      keyname,
		      locale);

  if (!line)
    return FALSE;
  
  *val = g_strdup (line->value);
  
  return TRUE;
}
/**
 * anjuta_plugin_description_foreach_key:
 * @df: an #AnjutaPluginDescription object.
 * @section_name: Name of the section.
 * @include_localized: Whether each localized key should be called separately.
 * @func: The callback function.
 * @user_data: User data to pass to @func.
 *
 * Calls @func for each of the keys in the given section. @include_localized,
 * if set to %TRUE will make it call @func for the localized keys also,
 * otherwise only one call is made for the key in current locale.
 */
void
anjuta_plugin_description_foreach_key (AnjutaPluginDescription *df,
			      const char                  *section_name,
			      gboolean                     include_localized,
			      AnjutaPluginDescriptionLineFunc     func,
			      gpointer                     user_data)
{
  AnjutaPluginDescriptionSection *section;
  AnjutaPluginDescriptionLine *line;
  int i;

  section = lookup_section (df, section_name);
  if (!section)
    return;
  
  for (i = 0; i < section->n_lines; i++)
    {
      line = &section->lines[i];

      (*func) (df, g_quark_to_string (line->key), line->locale, line->value, user_data);
    }
  
  return;
}
Exemplo n.º 5
0
/**
 * gnome_theme_file_foreach_key:
 * @df: a #GnomeThemeFile.
 * @section: name of the section
 * @include_localized: a boolean value
 * @func: a #GnomeThemeFileLineFunc.
 * @user_data: a pointer to user_data.
 * 
 * Looks for the section @section_name. If found, this function calls @func for each line 
 * in the section with fields of line and @user_data.
 * 
 * Since: 2.2
 */ 
void
gnome_theme_file_foreach_key (GnomeThemeFile            *df,
			      const char		*section_name,
			      gboolean			include_localized,
			      GnomeThemeFileLineFunc	func,
			      gpointer			user_data)
{
  GnomeThemeFileSection *section;
  GnomeThemeFileLine *line;
  int i;

  section = lookup_section (df, section_name);
  if (!section)
    return;
  
  for (i = 0; i < section->n_lines; i++)
    {
      line = &section->lines[i];

      (*func) (df, g_quark_to_string (line->key), line->locale, line->value, user_data);
    }
  
  return;
}