Logo Search packages:      
Sourcecode: libgphoto2 version File versions  Download package

int gp_setting_set ( char *  id,
char *  key,
char *  value 
)

Set a specific gphoto setting.

Parameters:
id the frontend id of the caller
key the key the frontend queries
value retrieved value
Returns:
GPhoto error code
This function sets the setting key for a specific frontend id to the value.

Definition at line 102 of file gphoto2-setting.c.

References CHECK_NULL, gp_log(), GP_LOG_DEBUG, and GP_OK.

{
        int x;

      CHECK_NULL (id && key);

      if (!glob_setting_count)
            load_settings ();

      gp_log (GP_LOG_DEBUG, "gphoto2-setting",
            "Setting key '%s' to value '%s' (%s)", key, value, id);

        for (x=0; x<glob_setting_count; x++) {
                if ((strcmp(glob_setting[x].id, id)==0) &&
                (strcmp(glob_setting[x].key, key)==0)) {
                        strcpy(glob_setting[x].value, value);
                        save_settings ();
                        return (GP_OK);
                }
      }
        strcpy(glob_setting[glob_setting_count].id, id);
        strcpy(glob_setting[glob_setting_count].key, key);
        strcpy(glob_setting[glob_setting_count++].value, value);
        save_settings ();

        return (GP_OK);
}


Generated by  Doxygen 1.6.0   Back to index