static GConfSchema* gconf_dialog_safely_get_schema (GConfDialog* self, GConfEntry* entry) {
	GConfSchema* result = NULL;
	GError * _inner_error_;
	const char* schema_name;
	GConfSchema* rt;
	GConfSchema* _tmp3_;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (entry != NULL, NULL);
	_inner_error_ = NULL;
	schema_name = gconf_entry_get_schema_name (entry);
	rt = NULL;
	if (schema_name != NULL) {
		{
			GConfSchema* _tmp0_;
			GConfSchema* _tmp2_;
			GConfSchema* _tmp1_;
			_tmp0_ = gconf_client_get_schema (self->priv->_default_client, schema_name, &_inner_error_);
			if (_inner_error_ != NULL) {
				goto __catch24_g_error;
			}
			rt = (_tmp2_ = gconf_schema_copy (_tmp1_ = _tmp0_), _gconf_schema_free0 (rt), _tmp2_);
			_gconf_schema_free0 (_tmp1_);
			result = rt;
			return result;
		}
		goto __finally24;
		__catch24_g_error:
		{
			GError * e;
			e = _inner_error_;
			_inner_error_ = NULL;
			{
				_g_error_free0 (e);
			}
		}
		__finally24:
		if (_inner_error_ != NULL) {
			_gconf_schema_free0 (rt);
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
			g_clear_error (&_inner_error_);
			return NULL;
		}
	}
	g_critical ("gtkextra-gconfdialog.vala:161: schema not found for entry %s", gconf_entry_get_key (entry));
	rt = (_tmp3_ = gconf_schema_new (), _gconf_schema_free0 (rt), _tmp3_);
	gconf_schema_set_short_desc (rt, gconf_entry_get_key (entry));
	gconf_schema_set_long_desc (rt, "This key lacks a schema");
	gconf_schema_set_type (rt, GCONF_VALUE_STRING);
	result = rt;
	return result;
}
static void
panel_menu_button_gconf_notify (GConfClient     *client,
				guint            cnxn_id,
				GConfEntry      *entry,
				PanelMenuButton *button)
{
	GConfValue *value;
	const char *key;

	key = panel_gconf_basename (gconf_entry_get_key (entry));

	value = entry->value;

	if (!strcmp (key, "menu_path")) {
		if (value && value->type == GCONF_VALUE_STRING)
			panel_menu_button_set_menu_path (button,
							 gconf_value_get_string (value));
	} else if (!strcmp (key, "custom_icon")) {
		if (value && value->type == GCONF_VALUE_STRING)
			panel_menu_button_set_custom_icon (button,
							   gconf_value_get_string (value));
	} else if (!strcmp (key, "tooltip")) {
		if (value && value->type == GCONF_VALUE_STRING)
			panel_menu_button_set_tooltip (button,
						       gconf_value_get_string (value));
	} else if (!strcmp (key, "use_menu_path")) {
		if (value && value->type == GCONF_VALUE_BOOL)
			panel_menu_button_set_use_menu_path (button,
							     gconf_value_get_bool (value));
	} else if (!strcmp (key, "use_custom_icon")) {
		if (value && value->type == GCONF_VALUE_BOOL)
			panel_menu_button_set_use_custom_icon (button,
							       gconf_value_get_bool (value));
	}
}
예제 #3
0
static void
em_junk_sa_setting_notify(GConfClient *gconf, guint cnxn_id, GConfEntry *entry, void *data)
{
	GConfValue *value;
	char *tkey;

	g_return_if_fail (gconf_entry_get_key (entry) != NULL);

	if (!(value = gconf_entry_get_value (entry)))
		return;

	tkey = strrchr(entry->key, '/');
	g_return_if_fail (tkey != NULL);

	if (!strcmp(tkey, "local_only"))
		em_junk_sa_local_only = gconf_value_get_bool(value);
	else if (!strcmp(tkey, "use_daemon"))
		em_junk_sa_use_daemon = gconf_value_get_bool(value);
	else if (!strcmp(tkey, "socket_path")) {
		pthread_mutex_lock (&em_junk_sa_preferred_socket_path_lock);
		g_free (em_junk_sa_preferred_socket_path);
		em_junk_sa_preferred_socket_path = g_strdup (gconf_value_get_string(value));
		pthread_mutex_unlock (&em_junk_sa_preferred_socket_path_lock);
	}
}
예제 #4
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;
}
예제 #5
0
static void
gnc_gconf_general_changed (GConfClient *client,
                           guint cnxn_id,
                           GConfEntry *entry,
                           gpointer data)
{
    const gchar *key, *key_tail;
    GHookList *hook_list;

    g_once(&gcb_init_once, gcb_init, NULL);

    key = gconf_entry_get_key(entry);
    key_tail = strrchr(key, '/');
    if (key_tail != NULL)
    {
        key_tail++;
    }
    if (key_tail == NULL)
    {
        /* Should never happen. */
        g_warning("Malformed key %s:", key);
        return;
    }

    hook_list = g_hash_table_lookup(gcb_callback_hash, key_tail);
    if (hook_list != NULL)
        g_hook_list_marshal(hook_list, TRUE, gcb_call_hook, entry);
    g_hook_list_invoke(gcb_final_hook_list, TRUE);
}
예제 #6
0
static void
something_changed_gconfCB (GConfClient *client,
                           guint cnxn_id,
                           GConfEntry *entry,
                           gpointer user_data)
{
  GConfValue *v = gconf_entry_get_value (entry);
  const char *key = gconf_entry_get_key (entry);

  if (!v || v->type != GCONF_VALUE_STRING || ! key) return;
  if (strcmp (key, GCONF_TOOL_BAR_STYLE) == 0)
    {
      const char *value = gconf_value_get_string (v);
      store_tool_bar_style_changed (value, first_dpyinfo);
    }
#ifdef HAVE_XFT
  else if (strcmp (key, GCONF_MONO_FONT) == 0)
    {
      const char *value = gconf_value_get_string (v);
      store_monospaced_changed (value);
    }
  else if (strcmp (key, GCONF_FONT_NAME) == 0)
    {
      const char *value = gconf_value_get_string (v);
      store_font_name_changed (value);
    }
#endif /* HAVE_XFT */
}
static void
panel_properties_dialog_toplevel_notify (GConfClient           *client,
					 guint                  cnxn_id,
					 GConfEntry            *entry,
					 PanelPropertiesDialog *dialog)
{
	GConfValue *value;
	const char *key;

	key = panel_gconf_basename (gconf_entry_get_key (entry));
	if (!key)
		return;

	value = gconf_entry_get_value (entry);

#define UPDATE_TOGGLE(p, n)                                                                        \
	if (!strcmp (key, p)) {                                                                    \
		if (value && value->type == GCONF_VALUE_BOOL) {                                    \
			gboolean val = gconf_value_get_bool (value);                               \
			if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->n)) != val)   \
				gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->n), val); \
		}                                                                                  \
	}

	if (!strcmp (key, "orientation"))
		panel_properties_dialog_update_orientation (dialog, value);
	else if (!strcmp (key, "size"))
		panel_properties_dialog_update_size (dialog, value);
	else UPDATE_TOGGLE ("expand",         expand_toggle)
	else UPDATE_TOGGLE ("auto_hide",      autohide_toggle)
	else UPDATE_TOGGLE ("enable_buttons", hidebuttons_toggle)
	else UPDATE_TOGGLE ("enable_arrows",  arrows_toggle)
}
예제 #8
0
static void
gconf_key_changed (GConfClient *client,
		   guint cnxn_id,
		   GConfEntry *entry,
		   gpointer user_data)
{
	const char *key, *value;
	GConfValue *v;

	key = gconf_entry_get_key (entry);
	v = gconf_entry_get_value (entry);
	if (v->type != GCONF_VALUE_STRING)
		return;
	value = gconf_value_get_string (v);

	g_message ("gconf key changed %s", key);

	/* Don't add empty strings in the hashtable */
	if (value != NULL && value[0] == '\0')
		value = NULL;

	g_hash_table_insert (options, g_path_get_basename (key),
			     g_strdup (value));

	g_signal_emit_by_name (G_OBJECT (master), "options-changed", options);
}
예제 #9
0
/**
 * GConf callback for ALS settings
 *
 * @param gcc Unused
 * @param id Connection ID from gconf_client_notify_add()
 * @param entry The modified GConf entry
 * @param data Unused
 */
static void use_als_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 == use_als_gconf_id) {
		use_als_flag = gconf_value_get_bool(gcv);
		rethink_als_status();
	} else {
		mce_log(LL_WARN,
			"Spurious GConf value received; confused!");
	}

EXIT:
	return;
}
예제 #10
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;
}
예제 #11
0
/** 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;
}
예제 #12
0
const gchar *
gm_conf_entry_get_key (GmConfEntry *entry)
{
    GConfEntry *gconf_entry = NULL;

    g_return_val_if_fail (entry != NULL, NULL);

    gconf_entry = (GConfEntry *)entry;
    return gconf_entry_get_key (gconf_entry);
}
예제 #13
0
void
gnc_gconf_unset_dir (const gchar *section,
                     GError **caller_error)
{
    GError *error = NULL;
    GSList *entries, *tmp;
    const gchar *key;
    gchar *dir_key;

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

    dir_key = gnc_gconf_make_key(section, NULL);
    entries = gconf_client_all_entries(our_client, dir_key, &error);
    g_free(dir_key);
    if (error)
    {
        if (caller_error)
        {
            g_propagate_error(caller_error, error);
        }
        else
        {
            printf("Failed to get directory entries for key %s: %s",
                   dir_key, error->message);
            g_error_free(error);
        }
        return;
    }

    for (tmp = entries; tmp; tmp = g_slist_next(tmp))
    {
        key = gconf_entry_get_key(tmp->data);
        if (!gconf_client_unset(our_client, key, &error))
        {
            if (caller_error)
            {
                g_propagate_error(caller_error, error);
            }
            else
            {
                printf("Failed to unset key %s: %s", key, error->message);
                g_error_free(error);
            }
            break;
        }
    }

    g_slist_foreach(entries, (GFunc)gconf_entry_free, NULL);
    g_slist_free(entries);
}
예제 #14
0
/**
* client: ignored
* id: ignored
* entry: used for validation only
* sctx: The context to work with
*
* Refreshes the sources generated from the keyservers
*
**/
static void
refresh_keyservers (GConfClient *client, guint id, GConfEntry *entry, 
                    SeahorseContext *sctx)
{
#ifdef WITH_KEYSERVER
#ifdef WITH_PGP
    SeahorseServerSource *ssrc;
    GSList *keyservers, *l;
    GHashTable *check;
    const gchar *uri;
    
    if (!sctx->pv->auto_sources)
        return;
    
    if (entry && !g_str_equal (KEYSERVER_KEY, gconf_entry_get_key (entry)))
        return;

    /* Make a light copy of the auto_source table */    
    check = g_hash_table_new (g_str_hash, g_str_equal);
    g_hash_table_foreach (sctx->pv->auto_sources, (GHFunc)auto_source_to_hash, check);

    
    /* Load and strip names from keyserver list */
    keyservers = seahorse_servers_get_uris ();
    
    for (l = keyservers; l; l = g_slist_next (l)) {
        uri = (const gchar*)(l->data);
        
        /* If we don't have a keysource then add it */
        if (!g_hash_table_lookup (sctx->pv->auto_sources, uri)) {
            ssrc = seahorse_server_source_new (uri);
            if (ssrc != NULL) {
                seahorse_context_take_source (sctx, SEAHORSE_SOURCE (ssrc));
                g_hash_table_replace (sctx->pv->auto_sources, g_strdup (uri), ssrc);
            }
        }
        
        /* Mark this one as present */
        g_hash_table_remove (check, uri);
    }
    
    /* Now remove any extras */
    g_hash_table_foreach (check, (GHFunc)auto_source_remove, sctx);
    
    g_hash_table_destroy (check);
    seahorse_util_string_slist_free (keyservers);
#endif /* WITH_PGP */
#endif /* WITH_KEYSERVER */
}
예제 #15
0
static GHashTable *
load_options (void)
{
        GHashTable *ht = NULL;
        GConfClient *client = gconf_client_get_default ();
        GSList *entries, *e;
        GError *error = NULL;

        gconf_client_add_dir (client, GEOCLUE_GCONF_TOP,
        		      GCONF_CLIENT_PRELOAD_RECURSIVE, NULL);

        entries = gconf_client_all_entries (client, GEOCLUE_GCONF_TOP, &error);
        if (error != NULL) {
                g_warning ("Error loading master options: %s", error->message);
                g_error_free (error);
                return NULL;
        }

        /* Setup keys monitoring */
	gconf_client_notify_add (client, GEOCLUE_GCONF_TOP,
				 (GConfClientNotifyFunc) gconf_key_changed,
				 NULL, NULL, NULL);

        ht = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
        g_print ("Master options:\n");
        for (e = entries; e; e = e->next) {
                GConfEntry *entry = e->data;
                const char *key, *value;
                GConfValue *v;

                key = gconf_entry_get_key (entry);
                v = gconf_entry_get_value (entry);
                if (v->type != GCONF_VALUE_STRING)
                	continue;
                value = gconf_value_get_string (v);

                if (value != NULL && value[0] == '\0')
                	value = NULL;

                g_print ("  %s = %s\n", key, value);
                g_hash_table_insert (ht, g_path_get_basename (key),
                                     g_strdup (value));
                 gconf_entry_free (entry);
         }
         g_slist_free (entries);

         return ht;
 }
예제 #16
0
static void
lockdown_changed (GConfClient *client,
                  guint        cnxd_id,
                  GConfEntry  *entry,
                  gpointer     user_data)
{
	GConfValue  *value = gconf_entry_get_value (entry);
	const gchar *key   = gconf_entry_get_key (entry);

	if (value == NULL || key == NULL) {
		return;
	}

	if (g_strcmp0 (key, LOCKDOWN_KEY_USER) == 0 || g_strcmp0 (key, LOCKDOWN_KEY_SCREENSAVER) == 0) {
		rebuild_items(root_menuitem, dbus_interface);
	}

	return;
}
예제 #17
0
static void
connections_changed_cb (GConfClient *conf_client,
                        guint cnxn_id,
                        GConfEntry *entry,
                        gpointer user_data)
{
	BMAGConfSettings *self = BMA_GCONF_SETTINGS (user_data);
	BMAGConfSettingsPrivate *priv = BMA_GCONF_SETTINGS_GET_PRIVATE (self);
	char **dirs = NULL;
	guint len;
	char *path = NULL;

	dirs = g_strsplit (gconf_entry_get_key (entry), "/", -1);
	len = g_strv_length (dirs);
	if (len < 5)
		goto out;

	if (   strcmp (dirs[0], "")
	    || strcmp (dirs[1], "system")
	    || strcmp (dirs[2], "networking")
	    || strcmp (dirs[3], "connections"))
		goto out;

	path = g_strconcat ("/", dirs[1], "/", dirs[2], "/", dirs[3], "/", dirs[4], NULL);

	if (!g_hash_table_lookup (priv->pending_changes, path)) {
		ConnectionChangedInfo *info;
		guint id;

		info = g_new (ConnectionChangedInfo, 1);
		info->settings = self;
		info->path = path;
		path = NULL;

		id = g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, connection_changes_done, 
						  info, connection_changed_info_destroy);
		g_hash_table_insert (priv->pending_changes, info->path, GUINT_TO_POINTER (id));
	}

out:
	g_free (path);
	g_strfreev (dirs);
}
static
gboolean
is_default_value (
  GConfClient* client,
  const GConfEntry* entry
) {
  // This doesn't work:
  // return gconf_entry_get_is_default(entry);

  GError* error = NULL;
  const GConfValue* def = gconf_client_get_default_from_schema(
    client,
    gconf_entry_get_key(entry),
    &error
  );
  if (error || !def)
      return FALSE;
  return gconf_value_compare(def, entry->value) == 0;
}
예제 #19
0
/* Callback invoked when equalizer values change in gconf. Updates sliders
 * accordingly */
static void update_slider_cb(GConfClient *client,
                             guint cnxn_id,
                             GConfEntry *entry,
                             GtkWidget *slider_band[NUM_BANDS])
{
        const gchar *key;
        GConfValue *value;
        gdouble gain;
        gint band_number;

        key = gconf_entry_get_key(entry);
        value = gconf_entry_get_value(entry);

        /* Get band number */
        sscanf (key, GCONF_MAFW_GST_EQ_RENDERER "/band%d", &band_number);
        if (band_number < NUM_BANDS) {
                gain = value?
                        CLAMP(gconf_value_get_float(value), -24.0, +12.0): 0.0;
                gtk_range_set_value(GTK_RANGE(slider_band[band_number]), gain);
        }
}
예제 #20
0
static gboolean
read_done_item_is_writable( const NAIFactoryProvider *provider, NAObjectItem *item, ReaderData *data, GSList **messages )
{
	GSList *ie;
	gboolean writable;
	GConfEntry *gconf_entry;
	const gchar *key;

	/* check for writability of this item
	 * item is writable if and only if all entries are themselves writable
	 */
	writable = TRUE;
	for( ie = data->entries ; ie && writable ; ie = ie->next ){
		gconf_entry = ( GConfEntry * ) ie->data;
		key = gconf_entry_get_key( gconf_entry );
		writable = is_key_writable( NAGP_GCONF_PROVIDER( provider ), key );
	}

	g_debug( "nagp_reader_read_done_item: writable=%s", writable ? "True":"False" );
	return( writable );
}
예제 #21
0
/**
 * sig_gconf_value_changed 
 * GGconf notify function for when HTTP proxy GConf key has changed.
 */
static void
notify_gconf_value_changed(GConfClient * client,
			   guint cnxn_id, GConfEntry * entry,
			   gpointer data)
{
    const char *key;

    key = gconf_entry_get_key(entry);

    if (strcmp(key, KEY_GCONF_USE_HTTP_PROXY) == 0
	|| strcmp(key, KEY_GCONF_HTTP_PROXY_IGNORE_HOSTS) == 0
	|| strcmp(key, KEY_GCONF_HTTP_PROXY_HOST) == 0
	|| strcmp(key, KEY_GCONF_HTTP_PROXY_PORT) == 0) {
	gboolean use_proxy_value;

	g_mutex_lock(gl_mutex);

	/* Check and see if we are using the proxy */
	use_proxy_value =
	    gconf_client_get_bool(gl_client,
				  KEY_GCONF_USE_HTTP_PROXY, NULL);
	construct_gl_http_proxy(use_proxy_value);

	g_mutex_unlock(gl_mutex);
    } else if (strcmp(key, KEY_GCONF_HTTP_AUTH_USER) == 0
	       || strcmp(key, KEY_GCONF_HTTP_AUTH_PW) == 0
	       || strcmp(key, KEY_GCONF_HTTP_USE_AUTH) == 0) {
	gboolean use_proxy_auth;

	g_mutex_lock(gl_mutex);

	use_proxy_auth =
	    gconf_client_get_bool(gl_client,
				  KEY_GCONF_HTTP_USE_AUTH, NULL);
	set_proxy_auth(use_proxy_auth);

	g_mutex_unlock(gl_mutex);
    }
}
예제 #22
0
static void
keybinding_changed (GConfClient *client,
                    guint        cnxd_id,
                    GConfEntry  *entry,
                    gpointer     user_data)
{
	GConfValue  *value = gconf_entry_get_value (entry);
	const gchar *key   = gconf_entry_get_key (entry);

	if (value == NULL || key == NULL) {
		return;
	}

	if (g_strcmp0 (key, KEY_LOCK_SCREEN) == 0) {
		g_debug("Keybinding changed to: %s", gconf_value_get_string(value));
		if (lock_menuitem != NULL) {
			dbusmenu_menuitem_property_set_shortcut_string(lock_menuitem, gconf_value_get_string(value));
		}
	}

	return;
}
예제 #23
0
/**
 * GConf callback for CPA setting
 *
 * @param gcc Unused
 * @param id Connection ID from gconf_client_notify_add()
 * @param entry The modified GConf entry
 * @param data Unused
 */
static void color_profile_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;

	/* FIXME: we are changing the setting from setting changed
	 *        callback - make sure this does not backfire in
	 *        some nasty way ...
	 */

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

	if (id == color_profile_gconf_id) {
		const gchar *profile = gconf_value_get_string(gcv);

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

EXIT:
	return;
}
static void
panel_properties_dialog_background_notify (GConfClient           *client,
					   guint                  cnxn_id,
					   GConfEntry            *entry,
					   PanelPropertiesDialog *dialog)
{
	GConfValue *value;
	const char *key;

	key = panel_gconf_basename (gconf_entry_get_key (entry));
	if (!key)
		return;

	value = gconf_entry_get_value (entry);

	if (!strcmp (key, "type"))
		panel_properties_dialog_update_background_type (dialog, value);
	else if (!strcmp (key, "color"))
		panel_properties_dialog_update_background_color (dialog, value);
	else if (!strcmp (key, "opacity"))
		panel_properties_dialog_update_background_opacity (dialog, value);
	else if (!strcmp (key, "image"))
		panel_properties_dialog_update_background_image (dialog, value);
}
static void
_gconf_client_notify (GsdPointingDeviceManager *manager,
                      GConfClient *client,
                      guint cnxn_id,
                      GConfEntry *entry)
{
    GConfValue *value;
    const gchar *key;
    GpdsXInput *xinput;

    xinput = gsd_pointing_device_manager_get_xinput(manager);
    if (!xinput)
        return;

    gpds_touchpad_xinput_setup_property_entries(xinput);

    value = gconf_entry_get_value(entry);
    key = gpds_gconf_get_key_from_path(gconf_entry_get_key(entry));

    switch (value->type) {
    case GCONF_VALUE_BOOL:
        if (!strcmp(key, GPDS_TOUCHPAD_DISABLE_WHILE_OTHER_DEVICE_EXISTS_KEY)) {
            set_disable_while_other_device_exists(manager, xinput, client);
        } else if (!strcmp(key, GPDS_TOUCHPAD_PALM_DETECTION_KEY)) {
            set_palm_detection(manager, xinput, client);
        } else if (!strcmp(key, GPDS_TOUCHPAD_GUEST_MOUSE_OFF_KEY)) {
            set_guest_mouse_off(manager, xinput, client);
        } else if (!strcmp(key, GPDS_TOUCHPAD_LOCKED_DRAGS_KEY)) {
            set_locked_drags(manager, xinput, client);
        } else if (!strcmp(key, GPDS_TOUCHPAD_TAP_FAST_TAP_KEY)) {
            set_tap_fast_tap(manager, xinput, client);
        } else if (!strcmp(key, GPDS_TOUCHPAD_CIRCULAR_SCROLLING_KEY)) {
            set_circular_scrolling(manager, xinput, client);
        } else if (!strcmp(key, GPDS_TOUCHPAD_VERTICAL_SCROLLING_KEY) ||
                   !strcmp(key, GPDS_TOUCHPAD_HORIZONTAL_SCROLLING_KEY) ||
                   !strcmp(key, GPDS_TOUCHPAD_CONTINUOUS_EDGE_SCROLLING_KEY)) {
            set_edge_scrolling(manager, xinput, client);
        } else if (!strcmp(key, GPDS_TOUCHPAD_TWO_FINGER_VERTICAL_SCROLLING_KEY) ||
                   !strcmp(key, GPDS_TOUCHPAD_TWO_FINGER_HORIZONTAL_SCROLLING_KEY)) {
            set_two_finger_scrolling(manager, xinput, client);
        }
        break;
    case GCONF_VALUE_INT:
        if (!strcmp(key, GPDS_TOUCHPAD_OFF_KEY)) {
            set_touchpad_off(manager, xinput, client);
        } else if (!strcmp(key, GPDS_TOUCHPAD_LOCKED_DRAGS_TIMEOUT_KEY)) {
            set_locked_drags_timeout(manager, xinput, client);
        } else if (!strcmp(key, GPDS_TOUCHPAD_TAP_TIME_KEY)) {
            set_tap_time(manager, xinput, client);
        } else if (!strcmp(key, GPDS_TOUCHPAD_TAP_MOVE_KEY)) {
            set_tap_move(manager, xinput, client);
        } else if (!strcmp(key, GPDS_TOUCHPAD_VERTICAL_SCROLLING_DISTANCE_KEY) ||
                   !strcmp(key, GPDS_TOUCHPAD_HORIZONTAL_SCROLLING_DISTANCE_KEY)) {
            set_scrolling_distance(manager, xinput, client);
        } else if (!strcmp(key, GPDS_TOUCHPAD_PALM_DETECTION_WIDTH_KEY) ||
                   !strcmp(key, GPDS_TOUCHPAD_PALM_DETECTION_DEPTH_KEY)) {
            set_palm_dimensions(manager, xinput, client);
        } else if (!strcmp(key, GPDS_TOUCHPAD_CLICK_ACTION_FINGER1_KEY) ||
                   !strcmp(key, GPDS_TOUCHPAD_CLICK_ACTION_FINGER2_KEY) ||
                   !strcmp(key, GPDS_TOUCHPAD_CLICK_ACTION_FINGER3_KEY)) {
            set_click_action(manager, xinput, client);
        }
        break;
    case GCONF_VALUE_FLOAT:
        if (!strcmp(key, GPDS_TOUCHPAD_MINIMUM_SPEED_KEY) ||
            !strcmp(key, GPDS_TOUCHPAD_MAXIMUM_SPEED_KEY) ||
            !strcmp(key, GPDS_TOUCHPAD_ACCELERATION_FACTOR_KEY) ||
            !strcmp(key, GPDS_TOUCHPAD_TRACKSTICK_SPEED_KEY)) {
            set_move_speed(manager, xinput, client);
        }
        break;
    default:
        break;
    }

    g_object_unref(xinput);
}
예제 #26
0
파일: options.c 프로젝트: AKMergl/gRDesktop
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);
}
예제 #27
0
/*
 * Class:     gnu_java_util_prefs_gconf_GConfNativePeer
 * Method:    gconf_client_gconf_client_all_keys
 * Signature: (Ljava/lang/String;)Ljava/util/List;
 */
JNIEXPORT jobject JNICALL
Java_gnu_java_util_prefs_gconf_GConfNativePeer_gconf_1client_1gconf_1client_1all_1keys
  (JNIEnv *env, jclass clazz __attribute__ ((unused)), jstring node)
{
  /* TODO: check all the calls to gdk_threads_enter/leave */
  
  const char *dir = NULL;
  GError *err = NULL;
  GSList *entries = NULL;
  GSList *tmp;

  /* java.util.ArrayList */
  jobject jlist = NULL;

  dir = JCL_jstring_to_cstring (env, node);
  if (dir == NULL)
    {
      return NULL;
    }

  gdk_threads_enter ();
  entries = gconf_client_all_entries (client, dir, &err);
  gdk_threads_leave ();
  if (err != NULL)
    {
      throw_exception_by_name (env, "java/util/prefs/BackingStoreException",
                               err->message);
      g_error_free (err);
      err = NULL;

      JCL_free_cstring (env, node, dir);
      return NULL;
    }

  jlist = get_jlist_reference (env, jlist_class);
  if (jlist == NULL)
    {
      throw_exception_by_name (env, "java/util/prefs/BackingStoreException",
			       "Unable to get java.util.List reference in native code\n");
      JCL_free_cstring (env, node, dir);
      g_slist_foreach (entries, (GFunc) gconf_entry_free, NULL);
      g_slist_free (entries);
      return NULL;
    }

  tmp = entries;
  while (tmp != NULL)
    {
      const char *_val = gconf_entry_get_key (tmp->data);
      _val = strrchr (_val, '/');
      ++_val;
      (*env)->CallBooleanMethod (env, jlist, jlist_add_id,
				 (*env)->NewStringUTF (env, _val));
      tmp = g_slist_next (tmp);
    }

  /* clean up things */
  JCL_free_cstring (env, node, dir);
  g_slist_foreach (entries, (GFunc) gconf_entry_free, NULL);
  g_slist_free (entries);
  
  return jlist;
}