示例#1
0
static void
get_gconf_options (MTClosure *mt)
{
    gdouble val;

    mt->threshold = gconf_client_get_int (mt->client, OPT_THRESHOLD, NULL);
    mt->delay_enabled = gconf_client_get_bool (mt->client, OPT_DELAY, NULL);
    mt->dwell_enabled = gconf_client_get_bool (mt->client, OPT_DWELL, NULL);
    mt->dwell_show_ctw = gconf_client_get_bool (mt->client, OPT_CTW, NULL);
    mt->dwell_mode = gconf_client_get_int (mt->client, OPT_MODE, NULL);
    mt->style = gconf_client_get_int (mt->client, OPT_STYLE, NULL);
    mt->animate_cursor = gconf_client_get_bool (mt->client, OPT_ANIMATE, NULL);

    val = gconf_client_get_float (mt->client, OPT_DELAY_T, NULL);
    mt_timer_set_target (mt->delay_timer, val);
    val = gconf_client_get_float (mt->client, OPT_DWELL_T, NULL);
    mt_timer_set_target (mt->dwell_timer, val);

    mt->dwell_dirs[DWELL_CLICK_TYPE_SINGLE] =
	gconf_client_get_int (mt->client, OPT_G_SINGLE, NULL);
    mt->dwell_dirs[DWELL_CLICK_TYPE_DOUBLE] =
	gconf_client_get_int (mt->client, OPT_G_DOUBLE, NULL);
    mt->dwell_dirs[DWELL_CLICK_TYPE_DRAG] =
	gconf_client_get_int (mt->client, OPT_G_DRAG, NULL);
    mt->dwell_dirs[DWELL_CLICK_TYPE_RIGHT] =
	gconf_client_get_int (mt->client, OPT_G_RIGHT, NULL);
}
示例#2
0
float
calendar_config_get_tag_vpane_pos	(void)
{
	calendar_config_init ();

	return  gconf_client_get_float (config, CALENDAR_CONFIG_TAG_VPANE_POS, NULL);
}
示例#3
0
gfloat gm_pref_store_get_float(GmPrefStore * store, const gchar * key)
{

    gfloat value = 0.0;

    if (store == NULL)
        return value;

#if HAVE_GSETTINGS
    value = g_settings_get_double(store->settings, key);
#else
#ifdef HAVE_GCONF
    gchar *full_key;

    full_key = g_strdup_printf("/apps/%s/preferences/%s", store->context, key);
    value = gconf_client_get_float(store->gconf, full_key, NULL);
    g_free(full_key);
#else

    if (g_key_file_has_key(store->keyfile, store->context, key, NULL))
        value = g_key_file_get_double(store->keyfile, store->context, key, NULL);

#endif
#endif
    return value;
}
示例#4
0
static void construct(Uptime_plug_data **p)
{
  *p = g_malloc(sizeof(Uptime_plug_data));
  Uptime_plug_data * data = *p;
  GConfValue *value;
  gchar * svalue;

  data->timer = 1000;
  data->forceupdate = FALSE;

  svalue = gconf_client_get_string(get_dashboard_gconf(), GCONF_UPTIME_NO_GTK_BG, NULL);

  if (!svalue)
  {
    gconf_client_set_string(get_dashboard_gconf(), GCONF_UPTIME_NO_GTK_BG, svalue = g_strdup("999999d6"), NULL);
  }

  awn_cairo_string_to_color(svalue, &data->bg);

  g_free(svalue);


  svalue = gconf_client_get_string(get_dashboard_gconf(), GCONF_UPTIME_NO_GTK_FG, NULL);

  if (!svalue)
  {
    gconf_client_set_string(get_dashboard_gconf(), GCONF_UPTIME_NO_GTK_FG, svalue = g_strdup("000000bb"), NULL);
  }

  awn_cairo_string_to_color(svalue, &data->fg);

  g_free(svalue);


  value = gconf_client_get(get_dashboard_gconf(), GCONF_UPTIME_SIZE_MULT, NULL);

  if (value)
  {
    data->size_mult = gconf_client_get_float(get_dashboard_gconf(), GCONF_UPTIME_SIZE_MULT, NULL);
  }
  else
  {
    data->size_mult = 2.0;
  }

  value = gconf_client_get(get_dashboard_gconf(), GCONF_UPTIME_SHOW_SECONDS, NULL);

  if (value)
  {
    data->show_seconds = gconf_client_get_bool(get_dashboard_gconf(), GCONF_UPTIME_SHOW_SECONDS, NULL);
  }
  else
  {
    data->show_seconds = FALSE;
  }
}
NS_IMETHODIMP
nsGConfService::GetFloat(const nsACString &aKey, float* aResult)
{
  GError* error = nsnull;
  *aResult = gconf_client_get_float(mClient, PromiseFlatCString(aKey).get(),
                                    &error);

  if (error) {
    g_error_free(error);
    return NS_ERROR_FAILURE;
  }

  return NS_OK;
}
/* Returns currently stored gain in gconf for band */
static gdouble get_band_value(gint band)
{
        gchar *key;
        gdouble value;

        g_return_val_if_fail(band >= 0 && band < NUM_BANDS, 0);

        if (!confclient) {
                confclient = gconf_client_get_default();
        }

        key = g_strdup_printf("%s%d", GCONF_MAFW_GST_EQ_RENDERER "/band", band);
        value =  gconf_client_get_float(confclient, key, NULL);
        g_free(key);

        return CLAMP(value, EQ_GAIN_MIN, EQ_GAIN_MAX);
}
示例#7
0
/**
 * Gets the border width
 */
gfloat cpumeter_gconf_get_border_width(GConfClient* client)
{
  gfloat width;
  GConfValue *value = gconf_client_get(client, GCONF_BORDER_WIDTH, NULL);

  if (value)
  {
    width = gconf_client_get_float(client, GCONF_BORDER_WIDTH, NULL);
  }
  else
  {
    width = GCONF_DEFAULT_BORDER_WIDTH;
    gconf_client_set_float(client, GCONF_BORDER_WIDTH, GCONF_DEFAULT_BORDER_WIDTH, NULL);
  }

  return width;
}
gfloat
eel_gconf_get_float (const char *key)
{
	gfloat result;
	GConfClient *client;
	GError *error = NULL;
	
	g_return_val_if_fail (key != NULL, 0);
	
	client = eel_gconf_client_get_global ();
	g_return_val_if_fail (client != NULL, 0);
	
	result = gconf_client_get_float (client, key, &error);

	if (eel_gconf_handle_error (&error)) {
		result = 0;
	}

	return result;
}
/**
 * panel_applet_gconf_get_float:
 * @applet: a #PanelApplet.
 * @key: a GConf key name.
 * @error: a #GError, or %NULL.
 *
 * Convenience wrapper around gconf_client_get_float() to get the value of @key
 * in the per-instance GConf directory of @applet.
 *
 * Returns: the value of @key.
 *
 * Deprecated: 3.0: Use #GSettings to store per-instance settings.
 **/
gdouble
panel_applet_gconf_get_float (PanelApplet  *applet,
			      const gchar  *key,
			      GError      **error)
{
	GConfClient  *client;
	gchar        *full_key;
	gdouble       retval;

	g_return_val_if_fail (PANEL_IS_APPLET (applet), 0.0);

	full_key = panel_applet_gconf_get_full_key (applet, key);

	client = panel_applet_gconf_get_client ();

	retval = gconf_client_get_float (client, full_key, error);

	g_free (full_key);

	return retval;
}
示例#10
0
gdouble
gnc_gconf_get_float (const gchar *section,
                     const gchar *name,
                     GError **caller_error)
{
    GError *error = NULL;
    gint value;
    gchar *key;

    if (our_client == NULL)
        our_client = gconf_client_get_default();

    key = gnc_gconf_make_key(section, name);
    value = gconf_client_get_float(our_client, key, &error);
    if (error)
    {
        gnc_gconf_load_error(key, caller_error, error);
    }
    g_free(key);
    return value;
}
示例#11
0
void DeclinationFilter::loadSettings()
{
    GConfClient *client = gconf_client_get_default();
    if (! client ) {
        sensordLogW() << "Failed to initialise GConf client.";
        return;
    }
    GError *error = NULL;
    int value = gconf_client_get_int(client, declinationKey, &error);
    if ( error != NULL) {
        GError *error2 = NULL;
        value = gconf_client_get_float(client, declinationKey, &error2);
        if ( error2 != NULL) {
            sensordLogW() << "Failed to read value for " << declinationKey << " from GConf: " << error2->message;
            g_error_free(error2);
            return;
        }
        g_error_free(error);
    }

    declinationCorrection_ = value;
    sensordLogD() << "Fetched declination correction from GConf: " << declinationCorrection_;
    g_object_unref(client);
}
static void
penge_everything_pane_init (PengeEverythingPane *self)
{
  PengeEverythingPanePrivate *priv = GET_PRIVATE_REAL (self);
  gfloat tile_width, tile_height;
  GError *error = NULL;

  self->priv = priv;

  /* pointer to pointer */
  priv->pointer_to_actor = g_hash_table_new (NULL, NULL);

  /* For storing sw items */
  priv->uuid_to_sw_items = g_hash_table_new_full (g_str_hash,
                                                  g_str_equal,
                                                  g_free,
                                                  (GDestroyNotify)sw_item_unref);

  priv->client = sw_client_new ();
  sw_client_get_services (priv->client,
                          (SwClientGetServicesCallback)_client_get_services_cb,
                          self);

  priv->recent_log = g_object_new (ZEITGEIST_TYPE_LOG, NULL);
  priv->recent_monitor = zeitgeist_monitor_new (
                                            zeitgeist_time_range_new_anytime (),
                                            _default_template_factory ());

  g_signal_connect (priv->recent_monitor,
                    "events-inserted",
                    (GCallback)_zeitgeist_monitor_events_inserted_signal,
                    self);

  g_signal_connect (priv->recent_monitor,
                    "events-deleted",
                    (GCallback)_zeitgeist_monitor_events_deleted_signal,
                    self);

  /* the log holds a weak ref to the monitor */
  zeitgeist_log_install_monitor (priv->recent_log, priv->recent_monitor);

  penge_block_container_set_spacing (PENGE_BLOCK_CONTAINER (self), 5);

  priv->gconf_client = gconf_client_get_default ();

  tile_width = gconf_client_get_float (priv->gconf_client,
                                       DAWATI_MYZONE_MIN_TILE_WIDTH,
                                       NULL);

  /* Returns 0.0 if unset */
  if (tile_width == 0.0)
  {
    tile_width = TILE_WIDTH;
  }

  tile_height = gconf_client_get_float (priv->gconf_client,
                                        DAWATI_MYZONE_MIN_TILE_HEIGHT,
                                        NULL);

  if (tile_height == 0.0)
  {
    tile_height = TILE_HEIGHT;
  }

  penge_block_container_set_min_tile_size (PENGE_BLOCK_CONTAINER (self),
                                           tile_width,
                                           tile_height);

  g_signal_connect (self,
                    "count-changed",
                    (GCallback)_layout_count_changed_cb,
                    self);

  priv->ratio_notify_id =
    gconf_client_notify_add (priv->gconf_client,
                             DAWATI_MYZONE_RATIO,
                             _gconf_ratio_notify_cb,
                             self,
                             NULL,
                             &error);

  if (error)
  {
    g_warning (G_STRLOC ": Error setting gconf key notification: %s",
               error->message);
    g_clear_error (&error);
  } else {
    gconf_client_notify (priv->gconf_client, DAWATI_MYZONE_RATIO);
  }

  priv->refresh_id = g_timeout_add_seconds (REFRESH_TIME, (GSourceFunc) _refresh_cb, self);
}
示例#13
0
static void construct(CPU_plug_data **p)
{
  GConfValue *value;
  *p = g_malloc(sizeof(CPU_plug_data));
  CPU_plug_data * data = *p;
  gchar * svalue;
  data->max_width_left = -1;
  data->max_width_right = -1;
  data->timer = 100;
  data->user = 0;
  data->sys = 0;
  data->idle = 100;
  data->iowait = 0;

  data->emotive_text = FALSE;

  svalue = gconf_client_get_string(get_dashboard_gconf(), GCONF_CPU_METER_NO_GTK_BG, NULL);

  if (!svalue)
  {
    gconf_client_set_string(get_dashboard_gconf(), GCONF_CPU_METER_NO_GTK_BG, svalue = g_strdup("999999ee"), NULL);
  }

  awn_cairo_string_to_color(svalue, &data->bg);

  g_free(svalue);

  svalue = gconf_client_get_string(get_dashboard_gconf(), GCONF_CPU_METER_NO_GTK_FG, NULL);

  if (!svalue)
  {
    gconf_client_set_string(get_dashboard_gconf(), GCONF_CPU_METER_NO_GTK_FG, svalue = g_strdup("000000ff"), NULL);
  }

  awn_cairo_string_to_color(svalue, &data->fg);

  g_free(svalue);

  value = gconf_client_get(get_dashboard_gconf(), GCONF_CPU_SIZE_MULT, NULL);

  if (value)
  {
    data->size_mult = gconf_client_get_float(get_dashboard_gconf(), GCONF_CPU_SIZE_MULT, NULL);
  }
  else
  {
    data->size_mult = 1.72;
    gconf_client_set_float(get_dashboard_gconf(), GCONF_CPU_SIZE_MULT, data->size_mult, NULL);
  }

  value = gconf_client_get(get_dashboard_gconf(), GCONF_CPU_REFRESH, NULL);

  if (value)
  {
    data->refresh = gconf_client_get_int(get_dashboard_gconf(), GCONF_CPU_REFRESH, NULL);
  }
  else
  {
    data->refresh = 500;
    set_refresh(*p, data->refresh);
  }

  value = gconf_client_get(get_dashboard_gconf(), GCONF_CPU_METER, NULL);

  if (value)
  {
    data->shiny_graphs = gconf_client_get_bool(get_dashboard_gconf(), GCONF_CPU_METER, NULL);
  }
  else
  {
    data->shiny_graphs = TRUE;
    gconf_client_set_bool(get_dashboard_gconf(), GCONF_CPU_METER,
                          data->shiny_graphs, NULL);
  }

  value = gconf_client_get(get_dashboard_gconf(), GCONF_CPU_METER_USE_2_COLOUR_GRADIENT    , NULL);

  if (value)
  {
    data->two_colour_gradient = gconf_client_get_bool(get_dashboard_gconf(), GCONF_CPU_METER_USE_2_COLOUR_GRADIENT    , NULL);
  }
  else
  {
    data->two_colour_gradient = FALSE;
    gconf_client_set_bool(get_dashboard_gconf(), GCONF_CPU_METER_USE_2_COLOUR_GRADIENT, data->two_colour_gradient, NULL);
  }

  svalue = gconf_client_get_string(get_dashboard_gconf(), GCONF_CPU_METER_START_COLOUR, NULL);

  if (!svalue)
  {
    gconf_client_set_string(get_dashboard_gconf(), GCONF_CPU_METER_START_COLOUR, svalue = g_strdup("00FF10bb"), NULL);
  }

  awn_cairo_string_to_color(svalue, &data->colour_meter_start);

  g_free(svalue);
  svalue = gconf_client_get_string(get_dashboard_gconf(), GCONF_CPU_METER_MIDDLE_COLOUR, NULL);

  if (!svalue)
  {
    gconf_client_set_string(get_dashboard_gconf(), GCONF_CPU_METER_MIDDLE_COLOUR, svalue = g_strdup("EEC83177"), NULL);
  }

  awn_cairo_string_to_color(svalue, &data->colour_meter_middle);

  g_free(svalue);
  svalue = gconf_client_get_string(get_dashboard_gconf(), GCONF_CPU_METER_STOP_COLOUR, NULL);

  if (!svalue)
  {
    gconf_client_set_string(get_dashboard_gconf(), GCONF_CPU_METER_STOP_COLOUR, svalue = g_strdup("FF0010ee"), NULL);
  }

  awn_cairo_string_to_color(svalue, &data->colour_meter_end);

  g_free(svalue);
  //data->pats[] is initialized once i render.. then needs to be free'd in constructor

}
示例#14
0
static void
cheese_gconf_get_property (GObject *object, guint prop_id, GValue *value,
                           GParamSpec *pspec)
{
  CheeseGConf *self;

  self = CHEESE_GCONF (object);
  CheeseGConfPrivate *priv = CHEESE_GCONF_GET_PRIVATE (self);

  char   *effects;
  GSList *list, *tmp;

  switch (prop_id)
  {
    case GCONF_PROP_COUNTDOWN:
      g_value_set_boolean (value, gconf_client_get_bool (priv->client,
                                                         CHEESE_GCONF_PREFIX "/countdown",
                                                         NULL));
      break;
    case GCONF_PROP_FLASH:
      g_value_set_boolean (value, gconf_client_get_bool (priv->client,
                                                         CHEESE_GCONF_PREFIX "/flash",
                                                         NULL));
      break;
    case GCONF_PROP_CAMERA:
      g_value_set_string (value, gconf_client_get_string (priv->client,
                                                          CHEESE_GCONF_PREFIX "/camera",
                                                          NULL));
      break;
    case GCONF_PROP_SELECTED_EFFECTS:
      effects = NULL;
      list    = gconf_client_get_list (priv->client,
                                       CHEESE_GCONF_PREFIX "/selected_effects",
                                       GCONF_VALUE_STRING,
                                       NULL);
      tmp = list;
      while (tmp != NULL)
      {
        char *str = tmp->data;
        int   j;
        str[0] = g_ascii_toupper (str[0]);
        for (j = 1; j < g_utf8_strlen (str, -1); j++)
        {
          if (str[j] == '-')
          {
            str[j]     = ' ';
            str[j + 1] = g_ascii_toupper (str[j + 1]);
          }
          else if (str[j] == '_')
          {
            str[j]     = '/';
            str[j + 1] = g_ascii_toupper (str[j + 1]);
          }
        }
        if (effects == NULL)
          effects = g_strdup (str);
        else
        {
          gchar *dummy = effects;
          effects = g_strjoin (",", effects, str, NULL);
          g_free (dummy);
        }

        g_free (tmp->data);
        tmp = g_slist_next (tmp);
      }
      g_value_set_string (value, effects);

      g_slist_free (list);
      g_slist_free (tmp);
      break;
    case GCONF_PROP_X_RESOLUTION:
      g_value_set_int (value, gconf_client_get_int (priv->client,
                                                    CHEESE_GCONF_PREFIX "/x_resolution",
                                                    NULL));
      break;
    case GCONF_PROP_Y_RESOLUTION:
      g_value_set_int (value, gconf_client_get_int (priv->client,
                                                    CHEESE_GCONF_PREFIX "/y_resolution",
                                                    NULL));
      break;
    case GCONF_PROP_BRIGHTNESS:
      if (!gconf_client_get (priv->client,
                             CHEESE_GCONF_PREFIX "/brightness",
                             NULL))
        g_value_set_double (value, G_PARAM_SPEC_DOUBLE (pspec)->default_value);
      else
        g_value_set_double (value, gconf_client_get_float (priv->client,
                                                           CHEESE_GCONF_PREFIX "/brightness",
                                                           NULL));
      break;
    case GCONF_PROP_CONTRAST:
      if (!gconf_client_get (priv->client,
                             CHEESE_GCONF_PREFIX "/contrast",
                             NULL))
        g_value_set_double (value, G_PARAM_SPEC_DOUBLE (pspec)->default_value);
      else
        g_value_set_double (value, gconf_client_get_float (priv->client,
                                                           CHEESE_GCONF_PREFIX "/contrast",
                                                           NULL));
      break;
    case GCONF_PROP_SATURATION:
      if (!gconf_client_get (priv->client,
                             CHEESE_GCONF_PREFIX "/saturation",
                             NULL))
        g_value_set_double (value, G_PARAM_SPEC_DOUBLE (pspec)->default_value);
      else
        g_value_set_double (value, gconf_client_get_float (priv->client,
                                                           CHEESE_GCONF_PREFIX "/saturation",
                                                           NULL));
      break;
    case GCONF_PROP_HUE:
      if (!gconf_client_get (priv->client,
                             CHEESE_GCONF_PREFIX "/hue",
                             NULL))
        g_value_set_double (value, G_PARAM_SPEC_DOUBLE (pspec)->default_value);
      else
        g_value_set_double (value, gconf_client_get_float (priv->client,
                                                           CHEESE_GCONF_PREFIX "/hue",
                                                           NULL));
      break;
    case GCONF_PROP_VIDEO_PATH:
      g_value_set_string (value, gconf_client_get_string (priv->client,
                                                          CHEESE_GCONF_PREFIX "/video_path",
                                                          NULL));
      break;
    case GCONF_PROP_PHOTO_PATH:
      g_value_set_string (value, gconf_client_get_string (priv->client,
                                                          CHEESE_GCONF_PREFIX "/photo_path",
                                                          NULL));
      break;
    case GCONF_PROP_ENABLE_DELETE:
      g_value_set_boolean (value, gconf_client_get_bool (priv->client,
                                                         CHEESE_GCONF_PREFIX "/enable_delete",
                                                         NULL));
      break;
    case GCONF_PROP_WIDE_MODE:
      g_value_set_boolean (value, gconf_client_get_bool (priv->client,
                                                         CHEESE_GCONF_PREFIX "/wide_mode",
                                                         NULL));
      break;
    case GCONF_PROP_BURST_DELAY:
      g_value_set_int (value, gconf_client_get_int (priv->client,
                                                    CHEESE_GCONF_PREFIX "/burst_delay",
                                                    NULL));
      break;
    case GCONF_PROP_BURST_REPEAT:
      g_value_set_int (value, gconf_client_get_int (priv->client,
                                                    CHEESE_GCONF_PREFIX "/burst_repeat",
                                                    NULL));
      break;
    default:
      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
      break;
  }
}
示例#15
0
gint loadOptions() {
	GSList *values;
	gint i;
	gint count;

	values = gconf_client_all_entries(gcfg, GCONF_BASE, NULL);
	count = g_slist_length(values);
	for(i=0; i<count; i++) {
		GConfEntry *item;
		GConfValue *typ;
		gchar *value;
		gchar **path = NULL;
		gint y = 0;

		item = g_slist_nth_data(values, i);
		typ = gconf_entry_get_value(item);
		if(typ == NULL) {
#ifdef _DEBUG_
			g_warning("Gconf item \"%s\" is unassigned!",
				gconf_entry_get_key(item));
#endif
			continue;
		}

		path = g_strsplit(gconf_entry_get_key(item), "/", 0);
		while(path[y] != NULL)
			y++;

		if(!g_ascii_strcasecmp(path[y-1], "hostnames")) {
			if(path != NULL)
				g_strfreev(path);
			continue;
		}

		switch(typ->type) {
		case GCONF_VALUE_STRING:
			value = g_strdup_printf("%s",
				gconf_client_get_string(gcfg, 
				gconf_entry_get_key(item), NULL));
			break;
		case GCONF_VALUE_INT:
			value = g_strdup_printf("%d",
				gconf_client_get_int(gcfg, 
				gconf_entry_get_key(item), NULL));
			break;
		case GCONF_VALUE_FLOAT:
			value = g_strdup_printf("%f",
				gconf_client_get_float(gcfg, 
				gconf_entry_get_key(item), NULL));
			break;
		case GCONF_VALUE_BOOL:
			value = g_strdup_printf("%d",
				gconf_client_get_bool(gcfg, 
				gconf_entry_get_key(item), NULL));
			break;
		default:
			g_warning("Unsupported gconf value type (%d)",
				typ->type);
			continue;
		}
		
#ifdef _DEBUG_
		g_warning("Option: %s->%s", path[y-1], value);
#endif

		g_hash_table_insert(config, g_strdup(path[y-1]),
			g_strdup(value));

		if(path != NULL)
			g_strfreev(path);
	}

	/* get the current username */
	if(SHASH("username") == NULL) {
		g_hash_table_insert(config, "username",
			g_utf8_strup((gchar*)g_get_user_name(), -1));
	}

	return(0);
}