コード例 #1
0
static gboolean
simple_value_is_equal (const GConfValue *a,
                       const GConfValue *b)
{
    g_assert (a != NULL);
    g_assert (b != NULL);

    switch (a->type) {
    case GCONF_VALUE_STRING:
        return eel_str_is_equal (gconf_value_get_string (a),
                                 gconf_value_get_string (b));

    case GCONF_VALUE_INT:
        return gconf_value_get_int (a) ==
               gconf_value_get_int (b);

    case GCONF_VALUE_FLOAT:
        return gconf_value_get_float (a) ==
               gconf_value_get_float (b);

    case GCONF_VALUE_BOOL:
        return gconf_value_get_bool (a) ==
               gconf_value_get_bool (b);
    default:
        g_assert_not_reached ();
    }

    return FALSE;
}
コード例 #2
0
ファイル: memnotify.c プロジェクト: kimmoli/mce
/** GConf callback for memnotify related settings
 *
 * @param gcc    (not used)
 * @param id     Connection ID from gconf_client_notify_add()
 * @param entry  The modified GConf entry
 * @param data   (not used)
 */
static void
memnotify_gconf_cb(GConfClient *const gcc, const guint id,
                   GConfEntry *const entry, gpointer const data)
{
    const GConfValue *gcv = gconf_entry_get_value(entry);

    (void)gcc;
    (void)data;

    /* Key is unset */
    if (gcv == NULL) {
        mce_log(LL_DEBUG, "GConf Key `%s' has been unset",
                gconf_entry_get_key(entry));
        goto EXIT;
    }

    if( id == memnotify_gconf_warning_used_id ) {
        gint old = memnotify_limit[MEMNOTIFY_LEVEL_WARNING].mnl_used;
        gint val = gconf_value_get_int(gcv);
        if( old != val ) {
            mce_log(LL_DEBUG, "memnotify.warning.used: %d -> %d", old, val);
            memnotify_limit[MEMNOTIFY_LEVEL_WARNING].mnl_used = val;
            memnotify_status_update_triggers();
        }
    }
    else if( id == memnotify_gconf_warning_active_id ) {
        gint old = memnotify_limit[MEMNOTIFY_LEVEL_WARNING].mnl_active;
        gint val = gconf_value_get_int(gcv);
        if( old != val ) {
            mce_log(LL_DEBUG, "memnotify.warning.active: %d -> %d", old, val);
            memnotify_limit[MEMNOTIFY_LEVEL_WARNING].mnl_active = val;
            memnotify_status_update_triggers();
        }
    }
    else if( id == memnotify_gconf_critical_used_id ) {
        gint old = memnotify_limit[MEMNOTIFY_LEVEL_CRITICAL].mnl_used;
        gint val = gconf_value_get_int(gcv);
        if( old != val ) {
            mce_log(LL_DEBUG, "memnotify.critical.used: %d -> %d", old, val);
            memnotify_limit[MEMNOTIFY_LEVEL_CRITICAL].mnl_used = val;
            memnotify_status_update_triggers();
        }
    }
    else if( id == memnotify_gconf_critical_active_id ) {
        gint old = memnotify_limit[MEMNOTIFY_LEVEL_CRITICAL].mnl_active;
        gint val = gconf_value_get_int(gcv);
        if( old != val ) {
            mce_log(LL_DEBUG, "memnotify.critical.active: %d -> %d", old, val);
            memnotify_limit[MEMNOTIFY_LEVEL_CRITICAL].mnl_active = val;
            memnotify_status_update_triggers();
        }
    }
    else {
        mce_log(LL_WARN, "Spurious GConf value received; confused!");
    }

EXIT:

    return;
}
コード例 #3
0
ファイル: GConf2Backend.c プロジェクト: definite/ibus-chewing
static GValue *gconf_value_to_g_value(GConfValue * confValue, GValue * value)
{
    GType gType = G_VALUE_TYPE(value);

    switch (confValue->type) {
    case GCONF_VALUE_BOOL:
        if (gType != G_TYPE_BOOLEAN) {
            return NULL;
        }
        g_value_set_boolean(value, gconf_value_get_bool(confValue));
        break;
    case GCONF_VALUE_INT:
        if (gType != G_TYPE_INT && gType != G_TYPE_UINT) {
            return NULL;
        } else if (gType == G_TYPE_INT) {
            g_value_set_int(value, gconf_value_get_int(confValue));
        } else {
            g_value_set_uint(value, gconf_value_get_int(confValue));
        }
        break;
    case GCONF_VALUE_STRING:
        if (gType != G_TYPE_STRING) {
            return NULL;
        }
        g_value_set_string(value, gconf_value_get_string(confValue));
        break;
    default:
        return NULL;
    }
    return value;
}
コード例 #4
0
ファイル: preferences.c プロジェクト: johnhk/glipper-lite
static void
max_elements_key_changed_callback(GConfClient *client,
		    guint        cnxn_id,
		    GConfEntry  *entry,
		    gpointer     user_data)
{
	hasChanged = 1;
	GConfValue *value = gconf_entry_get_value (entry);
	deleteOldElement(gconf_value_get_int(value));
	gtk_spin_button_set_value((GtkSpinButton*)historyLength, gconf_value_get_int(value));
}
コード例 #5
0
ファイル: marina-prefs.c プロジェクト: chergert/marina
static gint
gconf_client_get_int_with_default (GConfClient* client, const gchar* key,
                                   gint def, GError** err)
{
  GError* error = NULL;
  GConfValue* val;

  g_return_val_if_fail (err == NULL || *err == NULL, def);

  val = gconf_client_get (client, key, &error);

  if (val != NULL)
    {
      gint retval = def;

      g_return_val_if_fail (error == NULL, def);
      
      if (check_type (key, val, GCONF_VALUE_INT, &error))
        retval = gconf_value_get_int(val);
      else
        handle_error (client, error, err);

      gconf_value_free (val);

      return retval;
    }
  else
    {
      if (error != NULL)
        handle_error (client, error, err);
      return def;
    }
}
コード例 #6
0
ファイル: powersavemode.c プロジェクト: guhl/mce
/**
 * GConf callback for power saving related settings
 *
 * @param gcc Unused
 * @param id Connection ID from gconf_client_notify_add()
 * @param entry The modified GConf entry
 * @param data Unused
 */
static void psm_gconf_cb(GConfClient *const gcc, const guint id,
			 GConfEntry *const entry, gpointer const data)
{
	const GConfValue *gcv = gconf_entry_get_value(entry);

	(void)gcc;
	(void)data;

	/* Key is unset */
	if (gcv == NULL) {
		mce_log(LL_DEBUG,
			"GConf Key `%s' has been unset",
			gconf_entry_get_key(entry));
		goto EXIT;
	}

	if (id == psm_gconf_cb_id) {
		power_saving_mode = gconf_value_get_bool(gcv);
		update_power_saving_mode();
	} else if (id == force_psm_gconf_cb_id) {
		force_psm = gconf_value_get_bool(gcv);
		update_power_saving_mode();
	} else if (id == psm_threshold_gconf_cb_id) {
		psm_threshold = gconf_value_get_int(gcv);
		update_power_saving_mode();
	} else {
		mce_log(LL_WARN,
			"Spurious GConf value received; confused!");
	}

EXIT:
	return;
}
コード例 #7
0
ファイル: confsection.C プロジェクト: ggcov/ggcov
int
confsection_t::get_int(const char *name, int deflt)
{
    int val;
    string_var key = make_key(name);

#if HAVE_LIBGCONF
    GError *e = 0;
    GConfValue *gcv = gconf_client_get(gconf_client_get_default(), key, &e);
    handle_error(secname_, e);
    if (gcv == 0)
    {
	val = deflt;
    }
    else
    {
	val = gconf_value_get_int(gcv);
	gconf_value_free(gcv);
    }
#else
    gboolean defaulted = FALSE;
    val = gnome_config_get_int_with_default(key.data(), &defaulted);
    if (defaulted)
	val = deflt;
#endif
    return val;
}
コード例 #8
0
gboolean dasher_app_settings_get_free_long(DasherAppSettings *pSelf, const gchar *szName, gint &iValue) {
#ifdef WITH_GCONF
  DasherAppSettingsPrivate *pPrivate = (DasherAppSettingsPrivate *)(pSelf->private_data);

  gchar szFullName[256];
      
  strncpy(szFullName, "/apps/dasher4/", 256);
  strncat(szFullName, szName, 255 - strlen(szFullName));

  GConfValue *pGConfValue;
  GError *pGConfError = NULL;

  pGConfValue = gconf_client_get_without_default(pPrivate->pGConfClient, szFullName, &pGConfError);
      
  if(pGConfValue) {
    iValue = gconf_value_get_int(pGConfValue);
    gconf_value_free(pGConfValue);
    return true;
  }
  else {
    return false;
  }
#else
  return false;
#endif
}
コード例 #9
0
ファイル: mce-dbus.c プロジェクト: Vesuri/mce
/** Helper for appending gconf int list to dbus message
 *
 * @param conf GConfValue of int list type
 * @param pcount number of items in the returned array is stored here
 * @return array of integers that can be easily added to DBusMessage
 */
static dbus_int32_t *int_array_from_gconf_value(GConfValue *conf, int *pcount)
{
	dbus_int32_t *array = 0;
	int           count = 0;

	GSList *list, *item;

	if( conf->type != GCONF_VALUE_LIST )
		goto EXIT;

	if( gconf_value_get_list_type(conf) != GCONF_VALUE_INT )
		goto EXIT;

	list = gconf_value_get_list(conf);

	for( item = list; item; item = item->next )
		++count;

	array = g_malloc_n(count, sizeof *array);
	count = 0;

	for( item = list; item; item = item->next )
		array[count++] = gconf_value_get_int(item->data);

EXIT:
	return *pcount = count, array;
}
コード例 #10
0
ファイル: filter-brightness-als.c プロジェクト: oleid/mce
/** GConf callback for powerkey related settings
 *
 * @param gcc    (not used)
 * @param id     Connection ID from gconf_client_notify_add()
 * @param entry  The modified GConf entry
 * @param data   (not used)
 */
static void
fba_gconf_cb(GConfClient *const gcc, const guint id,
			    GConfEntry *const entry, gpointer const data)
{
	(void)gcc;
	(void)data;
	(void)id;

	const GConfValue *gcv = gconf_entry_get_value(entry);

	if( !gcv ) {
		mce_log(LL_DEBUG, "GConf Key `%s' has been unset",
			gconf_entry_get_key(entry));
		goto EXIT;
	}

	if( id == use_als_gconf_id ) {
		gboolean old = use_als_flag;
		use_als_flag = gconf_value_get_bool(gcv);

		if( use_als_flag != old ) {
			rethink_als_status();
		}
	}
	else if( id == als_input_filter_gconf_id ) {
		const char *val = gconf_value_get_string(gcv);

		if( !eq(als_input_filter, val) ) {
			g_free(als_input_filter);
			als_input_filter = g_strdup(val);
			inputflt_select(als_input_filter);
		}
	}
	else if( id == als_sample_time_gconf_id ) {
		gint old = als_sample_time;
		als_sample_time = gconf_value_get_int(gcv);

		if( als_sample_time != old ) {
			mce_log(LL_NOTICE, "als_sample_time: %d -> %d",
				old, als_sample_time);
			// NB: takes effect on the next sample timer restart
		}
	}
	else if (id == color_profile_gconf_id) {
		const gchar *val = gconf_value_get_string(gcv);

		if( !eq(color_profile_name, val) ) {
			if( !set_color_profile(val) )
				save_color_profile(color_profile_name);
		}
	}
	else {
		mce_log(LL_WARN, "Spurious GConf value received; confused!");
	}

EXIT:

	return;
}
コード例 #11
0
static GConfValue *
corner_flip_from_widget (GConfPropertyEditor *peditor, GConfValue *value)
{
	GConfValue *new_value;

	new_value = gconf_value_new (GCONF_VALUE_BOOL);
	gconf_value_set_bool (new_value, (gconf_value_get_int (value) == 1));
	return new_value;
}
/* All of our scales but double_click are on the range 1->10 as a result, we
 * have a few routines to convert from whatever the gconf key is to our range.
 */
static GConfValue *
double_click_from_gconf (GConfPropertyEditor *peditor, const GConfValue *value)
{
	GConfValue *new_value;

	new_value = gconf_value_new (GCONF_VALUE_INT);
	gconf_value_set_int (new_value, CLAMP ((int) floor ((gconf_value_get_int (value) + 50) / 100.0) * 100, 100, 1000));
	return new_value;
}
コード例 #13
0
static void
gnc_reset_warnings_gconf_changed (GConfClient *client,
                                  guint cnxn_id,
                                  GConfEntry *entry,
                                  gpointer user_data)
{
    GtkWidget *dialog, *box;
    GList *list;

    g_return_if_fail(GTK_IS_DIALOG(user_data));

    ENTER("entry %p, data %p", entry, user_data);
    dialog = GTK_WIDGET(user_data);
    DEBUG("entry key '%s', value as %p, value as int %d", entry->key, entry->value, gconf_value_get_int(entry->value));

    /* Which box is affected */
    if (strstr(entry->key, "permanent") != 0)
    {
        box = gnc_glade_lookup_widget(GTK_WIDGET(dialog), "perm_vbox");
    }
    else
    {
        box = gnc_glade_lookup_widget(GTK_WIDGET(dialog), "temp_vbox");
    }

    if (gconf_value_get_int(entry->value) != 0)
    {
        gnc_reset_warnings_add_one (entry, box);
        DEBUG("added checkbox for %s", entry->key);
    }
    else
    {
        /* Don't know if we were invoked by the dialog removing the
         * warning, or if the remove happened somewhere else like
         * gconf-editor.  Can't hurt to run the widgets and try to remove
         * it.  Worst case we can't find it because its already been
         * deleted. */
        list = gtk_container_get_children(GTK_CONTAINER(box));
        g_list_foreach(list, (GFunc)gnc_reset_warnings_find_remove, entry->key);
        g_list_free(list);
    }
    gnc_reset_warnings_update_widgets(dialog);
    LEAVE(" ");
}
コード例 #14
0
static void
panel_properties_dialog_update_size (PanelPropertiesDialog *dialog,
				     GConfValue            *value)
{
	if (!value || value->type != GCONF_VALUE_INT)
		return;

	gtk_spin_button_set_value (GTK_SPIN_BUTTON (dialog->size_spin),
				   gconf_value_get_int (value));
}
コード例 #15
0
ファイル: rw_config.c プロジェクト: alip2890/Rippix
gpointer
config_read (const char *key)
{
  /* Create the connection to GConf database if it doesn't exist yet. */
  config_open_close (CONFIG_OP_OPEN);

  if (key)
    {
      GError *read_error = NULL;
      GConfValue *value = gconf_client_get (conf_client, key, &read_error);

      if (read_error)
	{
	  error (0, 0, _("Could not read GConf key: %s"), read_error->message);
	  g_clear_error (&read_error);
	  return NULL;
	}
      else
	{
	  if (value)
	    {
	      switch (value->type)
		{
		case GCONF_VALUE_STRING:
		  return (gpointer) gconf_value_get_string (value);
		  break;
		case GCONF_VALUE_BOOL:
		  return (gpointer) gconf_value_get_bool (value);
		  break;
		case GCONF_VALUE_INT:
		  return (gpointer) gconf_value_get_int (value);
		  break;
		  /* gdouble cannot be casted to gpointer somehow...

		     case GCONF_VALUE_FLOAT:
		     data = (gpointer) gconf_value_get_float (value);
		     break;*/
		case GCONF_VALUE_FLOAT:
		case GCONF_VALUE_SCHEMA:
		case GCONF_VALUE_LIST:
		case GCONF_VALUE_PAIR: 
		case GCONF_VALUE_INVALID:
		  error (0, 0, _("Error reading GConf database: Key type is not supported"));
		  break;
		}
	    }
	  else
	    {
	      error (0, 0, _("Key could not be read: key unset or no default exists"));

	    }
	}
    }
    return NULL;  
}
static GConfValue *
threshold_from_gconf (GConfPropertyEditor *peditor,
		      const GConfValue *value)
{
	GConfValue *new_value;

	new_value = gconf_value_new (GCONF_VALUE_FLOAT);

	if (gconf_value_get_int (value) == -1) {
		int threshold;

		get_default_mouse_info (NULL, NULL, &threshold);
		gconf_value_set_float (new_value, CLAMP (threshold, 1, 10));
	}
	else {
		gconf_value_set_float (new_value, CLAMP (gconf_value_get_int (value), 1, 10));
	}

	return new_value;
}
static GConfValue *
bell_flash_from_widget (GConfPropertyEditor *peditor, const GConfValue *value)
{
	GConfValue *new_value;

	new_value = gconf_value_new (GCONF_VALUE_STRING);
	gconf_value_set_string (new_value,
				gconf_enum_to_string (bell_flash_enums, gconf_value_get_int (value)));

	return new_value;
}
コード例 #18
0
static GConfValue *
action_from_widget (GConfPropertyEditor *peditor, GConfValue *value)
{
	GConfValue *new_value;

	new_value = gconf_value_new (GCONF_VALUE_STRING);
	gconf_value_set_string (new_value, 
			gconf_enum_to_string (actions_lookup_table, 
				gconf_value_get_int (value)));
	return new_value;
}
static GConfValue *
left_handed_to_gconf (GConfPropertyEditor *peditor,
		      const GConfValue *value)
{
	GConfValue *new_value;

	new_value = gconf_value_new (GCONF_VALUE_BOOL);

	gconf_value_set_bool (new_value, gconf_value_get_int (value) == 1);

	return new_value;
}
コード例 #20
0
static GConfValue *
toolbar_from_widget (GConfPropertyEditor *peditor, GConfValue *value)
{
  GConfValue *new_value;

  new_value = gconf_value_new (GCONF_VALUE_STRING);
  gconf_value_set_string (new_value,
      gconf_enum_to_string (toolbar_style_enums,
			    gconf_value_get_int (value)));

  return new_value;
}
コード例 #21
0
ファイル: mce-gconf.c プロジェクト: ClementFan/mce
/**
 * Return an integer list from the specified GConf key
 *
 * @param key The GConf key to get the values from
 * @param[out] values Will contain an GSList with the values on return
 * @return TRUE on success, FALSE on failure
 */
gboolean mce_gconf_get_int_list(const gchar *const key, GSList **values)
{
	gboolean status = FALSE;
	GError *error = NULL;
	GConfValue *gcv, *gcv2;
	GSList *list;
	gint i;

	if( gconf_disabled ) {
		mce_log(LL_DEBUG, "blocked %s query", key);
		goto EXIT;
	}

	gcv = gconf_client_get(gconf_client, key, &error);

	if (gcv == NULL) {
		mce_log((error != NULL) ? LL_WARN : LL_INFO,
			"Could not retrieve %s from GConf; %s",
			key, (error != NULL) ? error->message : "Key not set");
		goto EXIT;
	}

	if ((gcv->type != GCONF_VALUE_LIST) ||
	    (gconf_value_get_list_type(gcv) != GCONF_VALUE_INT)) {
		mce_log(LL_ERR,
			"GConf key %s should have type: %d<%d>, but has type: %d<%d>",
			key, GCONF_VALUE_LIST, GCONF_VALUE_INT,
			gcv->type, gconf_value_get_list_type(gcv));
		goto EXIT;
	}

	list = gconf_value_get_list(gcv);

	for (i = 0; (gcv2 = g_slist_nth_data(list, i)) != NULL; i++) {
		gint data;

		data = gconf_value_get_int(gcv2);

		/* Prepend is more efficient than append */
		*values = g_slist_prepend(*values, GINT_TO_POINTER(data));
	}

	/* Reverse the list, since we want the entries in the right order */
	*values = g_slist_reverse(*values);
	gconf_value_free(gcv);

	status = TRUE;

EXIT:
	g_clear_error(&error);

	return status;
}
static GConfValue *
drag_threshold_from_gconf (GConfPropertyEditor *peditor,
			   const GConfValue *value)
{
	GConfValue *new_value;

	new_value = gconf_value_new (GCONF_VALUE_FLOAT);

	gconf_value_set_float (new_value, CLAMP (gconf_value_get_int (value), 1, 10));

	return new_value;
}
コード例 #23
0
ファイル: main.c プロジェクト: jdelarosa36/webview
void
load_settings()
{
	  GConfClient* gcClient = NULL;
	  GConfValue* val = NULL;
	  gdouble sport;

	  gcClient = gconf_client_get_default();
	  g_assert(GCONF_IS_CLIENT(gcClient));

	  gchar *port_path = g_strconcat(config->GC_ROOT, "port", NULL);
	  val = gconf_client_get_without_default(gcClient, port_path, NULL);
	  if (val == NULL) {
		  g_warning("Unable to read server port value\n");
	  } else {
		  if (val->type == GCONF_VALUE_STRING) {
			  settings->server_port = g_strndup(gconf_value_get_string(val),STRING_MAX_SIZE - 1);

			  sport = g_ascii_strtod(settings->server_port, NULL);
			  if( (sport < 1024) || (sport > 32766) )
			  {
					GtkWidget *failDialog = gtk_message_dialog_new(NULL,
				     		GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR,
				     		GTK_BUTTONS_OK,
				     		"Bad server port value.\nServer port must be between 1024 and 32766.\nDefaulting to 8080.");
					gtk_dialog_run (GTK_DIALOG (failDialog));
					gtk_widget_destroy (failDialog);
					settings->server_port = "8080";
			  }

		  } else {
			  g_warning("Bad server port value set\n");
		  }
	  }

	  gchar *update_path = g_strconcat(config->GC_ROOT, "update", NULL);
	  val = gconf_client_get_without_default(gcClient, update_path, NULL);
	  if (val == NULL) {
		  g_warning("Unable to read update interval value\n");
	  } else {
		  if (val->type == GCONF_VALUE_INT) {
			  settings->update_interval = gconf_value_get_int(val);
		  } else {
			  g_warning("Bad update interval set\n");
		  }
	  }

	  /*
	  gconf_value_free(val);
	  val = NULL;
	*/
}
コード例 #24
0
ファイル: preferences.c プロジェクト: Metamorf/mini-commander
static void
normal_size_x_changed (GConfClient  *client,
		       guint         cnxn_id,
		       GConfEntry   *entry,
		       MCData       *mc)
{
    if (!entry->value || entry->value->type != GCONF_VALUE_INT)
	return;

    mc->preferences.normal_size_x = gconf_value_get_int (entry->value);

    mc_command_update_entry_size (mc);
}
コード例 #25
0
ファイル: gsm-manager.c プロジェクト: Cordia/dawati-shell
static void
on_idle_delay_changed (GConfClient *client,
                       guint        cnxn_id,
                       GConfEntry  *entry,
                       gpointer     user_data)
{
    GsmManager *manager = GSM_MANAGER (user_data);

    if (entry->value && entry->value->type == GCONF_VALUE_INT) {
        gsm_presence_set_idle_timeout (manager->priv->presence,
                                       gconf_value_get_int (entry->value) * 60000);
    }
}
コード例 #26
0
ファイル: preferences.c プロジェクト: Metamorf/mini-commander
static void
normal_size_y_changed (GConfClient  *client,
		       guint         cnxn_id,
		       GConfEntry   *entry,
		       MCData       *mc)
{
    if (!entry->value || entry->value->type != GCONF_VALUE_INT)
	return;

    mc->preferences.normal_size_y = gconf_value_get_int (entry->value);

    mc_applet_draw (mc); /* FIXME: we shouldn't have to redraw the whole applet */
}
コード例 #27
0
ファイル: preferences.c プロジェクト: Metamorf/mini-commander
static void
cmd_line_color_bg_b_changed (GConfClient  *client,
			     guint         cnxn_id,
			     GConfEntry   *entry,
			     MCData       *mc)
{
    if (!entry->value || entry->value->type != GCONF_VALUE_INT)
	return;

    mc->preferences.cmd_line_color_bg_b = gconf_value_get_int (entry->value);

    mc_command_update_entry_color (mc);
}
コード例 #28
0
ファイル: gmconf-gconf.c プロジェクト: brownsys/pane-ekiga
gint
gm_conf_entry_get_int (GmConfEntry *entry)
{
    GConfEntry *gconf_entry = NULL;

    g_return_val_if_fail (entry != NULL, 0);

    gconf_entry = (GConfEntry *)entry;
    if (gconf_entry->value)
        return gconf_value_get_int (gconf_entry->value);

    return 0;
}
コード例 #29
0
static void
gconf_notify_cb (GConfClient *client,
		 guint        cnxn_id,
		 GConfEntry  *entry,
		 gpointer     user_data)
{
	DrWright  *dr = user_data;
	GtkWidget *item;

	if (!strcmp (entry->key, GCONF_PATH "/type_time")) {
		if (entry->value->type == GCONF_VALUE_INT) {
			dr->type_time = 60 * gconf_value_get_int (entry->value);
			dr->warn_time = MIN (dr->type_time / 10, 5*60);

			dr->state = STATE_START;
		}
	}
	else if (!strcmp (entry->key, GCONF_PATH "/break_time")) {
		if (entry->value->type == GCONF_VALUE_INT) {
			dr->break_time = 60 * gconf_value_get_int (entry->value);
			dr->state = STATE_START;
		}
	}
	else if (!strcmp (entry->key, GCONF_PATH "/enabled")) {
		if (entry->value->type == GCONF_VALUE_BOOL) {
			dr->enabled = gconf_value_get_bool (entry->value);
			dr->state = STATE_START;

			item = gtk_item_factory_get_widget_by_action (dr->popup_factory,
								      POPUP_ITEM_BREAK);
			gtk_widget_set_sensitive (item, dr->enabled);

			update_tooltip (dr);
		}
	}

	maybe_change_state (dr);
}
コード例 #30
0
ファイル: mt-main.c プロジェクト: Kristishka/mousetweaks
static void
gconf_value_changed (GConfClient *client,
		     const gchar *key,
		     GConfValue  *value,
		     gpointer     data)
{
    MTClosure *mt = data;

    if (g_str_equal (key, OPT_THRESHOLD) && value->type == GCONF_VALUE_INT)
	mt->threshold = gconf_value_get_int (value);
    else if (g_str_equal (key, OPT_DELAY) && value->type == GCONF_VALUE_BOOL)
	mt->delay_enabled = gconf_value_get_bool (value);
    else if (g_str_equal (key, OPT_DELAY_T) && value->type == GCONF_VALUE_FLOAT)
	mt_timer_set_target (mt->delay_timer, gconf_value_get_float (value));
    else if (g_str_equal (key, OPT_DWELL) && value->type == GCONF_VALUE_BOOL) {
	mt->dwell_enabled = gconf_value_get_bool (value);
	mt_ctw_update_sensitivity (mt);
	mt_ctw_update_visibility (mt);
    }
    else if (g_str_equal (key, OPT_DWELL_T) && value->type == GCONF_VALUE_FLOAT)
	mt_timer_set_target (mt->dwell_timer, gconf_value_get_float (value));
    else if (g_str_equal (key, OPT_CTW) && value->type == GCONF_VALUE_BOOL) {
	mt->dwell_show_ctw = gconf_value_get_bool (value);
	mt_ctw_update_visibility (mt);
    }
    else if (g_str_equal (key, OPT_MODE) && value->type == GCONF_VALUE_INT) {
	mt->dwell_mode = gconf_value_get_int (value);
	mt_ctw_update_sensitivity (mt);
    }
    else if (g_str_equal (key, OPT_STYLE) && value->type == GCONF_VALUE_INT) {
	mt->style = gconf_value_get_int (value);
	mt_ctw_update_style (mt, mt->style);
    }
    else if (g_str_equal (key, OPT_G_SINGLE) && value->type == GCONF_VALUE_INT)
	mt->dwell_dirs[DWELL_CLICK_TYPE_SINGLE] = gconf_value_get_int (value);
    else if (g_str_equal (key, OPT_G_DOUBLE) && value->type == GCONF_VALUE_INT)
	mt->dwell_dirs[DWELL_CLICK_TYPE_DOUBLE] = gconf_value_get_int (value);
    else if (g_str_equal (key, OPT_G_DRAG) && value->type == GCONF_VALUE_INT)
	mt->dwell_dirs[DWELL_CLICK_TYPE_DRAG] = gconf_value_get_int (value);
    else if (g_str_equal (key, OPT_G_RIGHT) && value->type == GCONF_VALUE_INT)
	mt->dwell_dirs[DWELL_CLICK_TYPE_RIGHT] = gconf_value_get_int (value);
    else if (g_str_equal (key, OPT_ANIMATE) && value->type == GCONF_VALUE_BOOL) {
	MtCursorManager *manager;

	manager = mt_cursor_manager_get_default ();
	mt->animate_cursor = gconf_value_get_bool (value);

	if (mt->animate_cursor)
	    mt->cursor = mt_cursor_manager_current_cursor (manager);
	else
	    mt_cursor_manager_restore_all (manager);
    }
}