示例#1
0
static void
gedit_dict_panel_gconf_notify_cb (GConfClient *client,
			      guint        cnxn_id,
			      GConfEntry  *entry,
			      gpointer     user_data)
{
	GeditDictPanel *panel = GEDIT_DICT_PANEL (user_data);
	GeditDictPanelPrivate *priv = panel->priv;

	if (strcmp (entry->key, GDICT_GCONF_SOURCE_KEY) == 0)
	{
		if (entry->value && (entry->value->type == GCONF_VALUE_STRING))
			gedit_dict_panel_set_source_name (panel, gconf_value_get_string (entry->value));
		else
			gedit_dict_panel_set_source_name (panel, GDICT_DEFAULT_SOURCE_NAME);
	}
	else if (strcmp (entry->key, GDICT_GCONF_DATABASE_KEY) == 0)
	{
		if (entry->value && (entry->value->type == GCONF_VALUE_STRING))
			gedit_dict_panel_set_database (panel, gconf_value_get_string (entry->value));
		else
			gedit_dict_panel_set_database (panel, GDICT_DEFAULT_DATABASE);
	}
	else if (strcmp (entry->key, GDICT_GCONF_STRATEGY_KEY) == 0)
	{
		if (entry->value && (entry->value->type == GCONF_VALUE_STRING))
			gedit_dict_panel_set_strategy (panel, gconf_value_get_string (entry->value));
		else
			gedit_dict_panel_set_strategy (panel, GDICT_DEFAULT_STRATEGY);
	}
}
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
文件: gconf.c 项目: Pidbip/egtkwave
static void
open_callback(GConfClient* gclient,
                     guint cnxn_id,
                     GConfEntry *entry,
                     gpointer user_data)
{
  if (gconf_entry_get_value (entry) == NULL)
    {
      /* value is unset */
    }
  else
    {
      if (gconf_entry_get_value (entry)->type == GCONF_VALUE_STRING)
        {
	  fprintf(stderr, "GTKWAVE | RPC Open: '%s'\n", gconf_value_get_string (gconf_entry_get_value (entry)) );

	  deal_with_rpc_open(gconf_value_get_string (gconf_entry_get_value (entry)), NULL);
	  gconf_entry_set_value(entry, NULL);
        }
      else
        {
          /* value is of wrong type */
        }
    }
}
示例#4
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;
}
示例#5
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 */
}
示例#6
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;
}
示例#7
0
static void
update_entry(GtkWidget* dialog, GConfChangeSet* cs, const gchar* config_key)
{
    GConfValue* value = NULL;
    GConfClient* client;

    client = g_object_get_data(dialog, "client");

    if (gconf_change_set_check_value(cs, config_key,
                                     &value))
    {
        GtkWidget* entry;

        entry = g_object_get_data(dialog, config_key);

        g_assert(entry != NULL);

        if (value == NULL)
        {
            /* We need to check for a default value,
               since the revert set will unset the user setting */
            GConfValue* def;

            def = gconf_client_get_default_from_schema(client,
                    config_key,
                    NULL);

            if (def)
            {
                if (def->type == GCONF_VALUE_STRING)
                {
                    gtk_entry_set_text(GTK_ENTRY(entry), gconf_value_get_string(def));
                }
                else
                    g_warning("Wrong type for default value of %s", config_key);

                gconf_value_free(def);
            }
            else
                gtk_entry_set_text(GTK_ENTRY(entry), "");
        }
        else if (value->type == GCONF_VALUE_STRING)
        {
            gtk_entry_set_text(GTK_ENTRY(entry), gconf_value_get_string(value));
        }
        else
        {
            /* error, wrong type value in the config database */
            g_warning("GConfChangeSet had wrong value type %d for key %s",
                      value->type, config_key);
            gtk_entry_set_text(GTK_ENTRY(entry), "");
        }
    }
}
示例#8
0
static GSList *
mc_load_macros (MCData *mc)
{
    GConfValue *macro_patterns;
    GConfValue *macro_commands;
    GSList     *macros_list = NULL;
    GConfClient *client;
    
    client = gconf_client_get_default ();
    macro_patterns = gconf_client_get (client,
		    "/apps/mini-commander/macro_patterns", NULL);
    macro_commands = gconf_client_get (client,
		    "/apps/mini-commander/macro_commands", NULL);
    
    if (macro_patterns && macro_commands) {
    	GSList *patterns;
	GSList *commands;

        patterns = gconf_value_get_list (macro_patterns);
        commands = gconf_value_get_list (macro_commands);

	for (; patterns && commands; patterns = patterns->next, commands = commands->next) {
            GConfValue *v1 = patterns->data;
            GConfValue *v2 = commands->data;
	    MCMacro    *macro;
            const char *pattern, *command;
            
            pattern = gconf_value_get_string (v1);
            command = gconf_value_get_string (v2);

	    if (!(macro = mc_macro_new (pattern, command)))
		continue;

	    macros_list = g_slist_prepend (macros_list, macro);
        }
    } else {    
	int i;

	for (i = 0; i < G_N_ELEMENTS (mc_default_macros); i++)
	    macros_list = g_slist_prepend (macros_list,
					   mc_macro_new (mc_default_macros [i].pattern,
							 mc_default_macros [i].command));
    }

    macros_list = g_slist_reverse (macros_list);

    if (macro_commands)
	gconf_value_free (macro_commands);

    if (macro_patterns)
	gconf_value_free (macro_patterns);

    return macros_list;
}
示例#9
0
GSList *
eel_gconf_value_get_string_list (const GConfValue *value)
{
    GSList *result;
    const GSList *slist;
    const GSList *node;
    const char *string;
    const GConfValue *next_value;

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

    g_return_val_if_fail (value->type == GCONF_VALUE_LIST, NULL);
    g_return_val_if_fail (gconf_value_get_list_type (value) == GCONF_VALUE_STRING, NULL);

    slist = gconf_value_get_list (value);
    result = NULL;
    for (node = slist; node != NULL; node = node->next) {
        next_value = node->data;
        g_return_val_if_fail (next_value != NULL, NULL);
        g_return_val_if_fail (next_value->type == GCONF_VALUE_STRING, NULL);
        string = gconf_value_get_string (next_value);
        result = g_slist_prepend (result, g_strdup (string));
    }
    return g_slist_reverse (result);
}
示例#10
0
/* Fills a GtkListStore with the string list from @value */
static void
list_store_binding_sync_pref_to_store (ListStoreBinding *binding,
                                       GConfValue       *value)
{
        GSList *list, *l;
        GtkTreeIter iter;

        /* Make sure we don't enter an infinite synchronizing loop */
        g_signal_handler_block (binding->list_store,
                                binding->row_inserted_id);
        g_signal_handler_block (binding->list_store,
                                binding->row_deleted_id);
        
        gtk_list_store_clear (binding->list_store);

        list = gconf_value_get_list (value);
        for (l = list; l; l = l->next) {
                GConfValue *l_value;
                const char *string;

                l_value = (GConfValue *) l->data;
                string = gconf_value_get_string (l_value);

                gtk_list_store_insert_with_values (binding->list_store,
                                                   &iter, -1,
                                                   0, string,
                                                   -1);
        }

        g_signal_handler_unblock (binding->list_store,
                                  binding->row_inserted_id);
        g_signal_handler_unblock (binding->list_store,
                                  binding->row_deleted_id);
}
示例#11
0
static void
contacts_gconf_search_cb (GConfClient *client, guint cnxn_id, GConfEntry *entry,
	gpointer user_data)
{
	const gchar *search;
	GConfValue *value;
	GtkWidget *widget;
	ContactsData *contacts_data = user_data;
		
	value = gconf_entry_get_value (entry);
	search = gconf_value_get_string (value);
	if (strcmp (search, "entry") == 0) {
		widget = contacts_data->ui->search_entry_hbox;
		gtk_widget_show (widget);
		widget = contacts_data->ui->search_tab_hbox;
		gtk_widget_hide (widget);
	} else if (strcmp (search, "alphatab") == 0) {
		widget = contacts_data->ui->search_entry_hbox;
		gtk_widget_hide (widget);
		widget = contacts_data->ui->search_tab_hbox;
		gtk_widget_show (widget);
	} else {
		g_warning ("Unknown search UI type \"%s\"", search);
	}
}
示例#12
0
/* Notification callback for our label widgets that
 * monitor the current value of a gconf key. i.e.
 * we are conceptually "configuring" the label widgets
 */
static void
configurable_widget_config_notify (GConfClient *client,
                                   guint        cnxn_id,
                                   GConfEntry  *entry,
                                   gpointer     user_data)
{
  GtkWidget *label = user_data;

  g_return_if_fail (GTK_IS_LABEL (label));

  /* Note that value can be NULL (unset) or it can have
   * the wrong type! Need to check that to survive
   * gconftool --break-key
   */
  
  if (gconf_entry_get_value (entry) == NULL)
    {
      gtk_label_set_text (GTK_LABEL (label), "");
    }
  else if (gconf_entry_get_value (entry)->type == GCONF_VALUE_STRING)
    {
      gtk_label_set_text (GTK_LABEL (label),
                          gconf_value_get_string (gconf_entry_get_value (entry)));
    }
  else
    {
      /* A real app would probably fall back to a reasonable default
       * in this case, instead of putting funky stuff in the GUI.
       */
      gtk_label_set_text (GTK_LABEL (label), "!type error!");
    }
}
static WnckTasklistGroupingType
get_grouping_type (GConfValue *value)
{
	WnckTasklistGroupingType type = -1;
	const char *str;

	g_assert (value != NULL);

	/* Backwards compat for old type: */
	if (value->type == GCONF_VALUE_BOOL) {
		type = (gconf_value_get_bool (value)) ? WNCK_TASKLIST_AUTO_GROUP:WNCK_TASKLIST_NEVER_GROUP;

	} else if (value->type == GCONF_VALUE_STRING) {
		str = gconf_value_get_string (value);
		if (g_ascii_strcasecmp (str, "never") == 0) {
			type = WNCK_TASKLIST_NEVER_GROUP;
		} else if (g_ascii_strcasecmp (str, "auto") == 0) {
			type = WNCK_TASKLIST_AUTO_GROUP;
		} else if (g_ascii_strcasecmp (str, "always") == 0) {
			type = WNCK_TASKLIST_ALWAYS_GROUP;
		}
	}

	return type;
}
示例#14
0
文件: confsection.C 项目: ggcov/ggcov
char *
confsection_t::get_string(const char *name, const char *deflt)
{
    char *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 == 0 ? 0 : g_strdup(deflt));
    }
    else
    {
	val = g_strdup(gconf_value_get_string(gcv));
	gconf_value_free(gcv);
    }
#else
    gboolean defaulted = FALSE;
    val = gnome_config_get_string_with_default(key.data(), &defaulted);
    if (defaulted)
	val = (deflt == 0 ? 0 : g_strdup(deflt));
#endif

    return val;
}
static void
panel_binding_changed (GConfClient  *client,
		       guint         cnxn_id,
		       GConfEntry   *entry,
		       PanelBinding *binding)
{
	GConfValue *value;

	if (binding->keyval)
		panel_binding_clear_entry (binding, NULL);

	binding->keyval    = 0;
	binding->modifiers = 0;

	value = gconf_entry_get_value (entry);

	if (!value || value->type != GCONF_VALUE_STRING)
		return;

	panel_binding_set_from_string (binding, gconf_value_get_string (value));

	if (!binding->keyval)
		return;

	panel_binding_set_entry (binding, NULL);
}
示例#16
0
bool Conf::GetStringList(const gchar *key,
			 std::list < std::string > &list)
{
    GConfValue *value = NULL;
    GSList *slist = NULL;

    if (!gconf_client)
	return false;

    value = gconf_client_get(gconf_client, key, NULL);
    if (value) {
	slist = gconf_value_get_list(value);

	if (slist) {
	    GSList *entry = slist;

	    list.clear();
	    while (entry) {
		list.push_back(std::string(gconf_value_get_string((GConfValue *)entry->data)));
		entry = entry->next;
	    }
	}
	gconf_value_free(value);
    } else {
	return false;
    }
    return true;
}
static void
bg_filename_changed_cb (GConfClient *client,
                        guint        cnxn_id,
                        GConfEntry  *entry,
                        gpointer     userdata)
{
  PengeViewBackground *pvb = PENGE_VIEW_BACKGROUND (userdata);
  const gchar *filename;
  GConfValue *value;
  GError *error = NULL;

  value = gconf_entry_get_value (entry);

  if (value)
  {
    filename = gconf_value_get_string (value);
    if (!clutter_texture_set_from_file (CLUTTER_TEXTURE (pvb),
                                        filename,
                                        &error))
    {
      g_warning (G_STRLOC ": Error setting magic texture contents: %s",
                 error->message);
      g_clear_error (&error);
    } else {
      clutter_actor_set_opacity ((ClutterActor *)pvb, 0xff);
    }
  } else {
    /* If the key is unset let's just make ourselves invisible */
    clutter_actor_set_opacity ((ClutterActor *)pvb, 0x0);
  }
}
示例#18
0
static void
calendar_sources_selected_sources_notify (GConfClient        *client,
					  guint               cnx_id,
					  GConfEntry         *entry,
					  CalendarSourceData *source_data)
{
  GSList *l;

  if (!entry->value ||
      entry->value->type != GCONF_VALUE_LIST ||
      gconf_value_get_list_type (entry->value) != GCONF_VALUE_STRING)
    return;

  dprintf ("Selected sources key (%s) changed, reloading\n", entry->key);

  for (l = source_data->selected_sources; l; l = l->next)
    g_free (l->data);
  source_data->selected_sources = NULL;

  for (l = gconf_value_get_list (entry->value); l; l = l->next)
    {
      const char *source = gconf_value_get_string (l->data);

      source_data->selected_sources = 
	g_slist_prepend (source_data->selected_sources,
			 g_strdup (source));
    }
  source_data->selected_sources =
    g_slist_reverse (source_data->selected_sources);

  calendar_sources_load_esource_list (source_data);
}
示例#19
0
static void
configurable_widget_config_notify(GConfClient* client,
                                  guint cnxn_id,
                                  GConfEntry *entry,
                                  gpointer user_data)
{
    GtkWidget* label = user_data;

    g_return_if_fail(label != NULL);
    g_return_if_fail(GTK_IS_LABEL(label));

    /* Note that value can be NULL (unset) or it can have
       the wrong type! */

    if (entry->value == NULL)
    {
        gtk_label_set_text(GTK_LABEL(label), "");
    }
    else if (entry->value->type == GCONF_VALUE_STRING)
    {
        gtk_label_set_text(GTK_LABEL(label),
                           gconf_value_get_string(entry->value));
    }
    else
    {
        /* A real app would probably fall back to a reasonable default in this case.  */
        gtk_label_set_text(GTK_LABEL(label), "!type error!");
    }
}
示例#20
0
文件: gconf.c 项目: Pidbip/egtkwave
static void
quit_callback(GConfClient* gclient,
                     guint cnxn_id,
                     GConfEntry *entry,
                     gpointer user_data)
{
  if (gconf_entry_get_value (entry) == NULL)
    {
      /* value is unset */
    }
  else
    {
      if (gconf_entry_get_value (entry)->type == GCONF_VALUE_STRING)
        {
	  const char *rc = gconf_value_get_string (gconf_entry_get_value (entry));
	  int rcv = atoi(rc);
	  fprintf(stderr, "GTKWAVE | RPC Quit: exit return code %d\n", rcv);
	  gconf_entry_set_value(entry, NULL);
	  exit(rcv);
        }
      else
        {
          /* value is of wrong type */
        }
    }
}
示例#21
0
static void
notify_func (GConfClient *client, guint cnxn_id, GConfEntry *entry,
	     gpointer user_data)
{
	GnocamApplet *a = GNOCAM_APPLET (user_data);
	GnocamAppletCam *c;
	const gchar *b = g_basename (entry->key);
	gchar *id;

	if (!strcmp (entry->key, "/desktop/gnome/cameras")) return;

	g_message ("Key: '%s'", entry->key);
	if (!entry->value) {
		c = g_hash_table_lookup (a->priv->cameras, entry->key);
		if (c) {
			gtk_object_destroy (GTK_OBJECT (c));
			g_hash_table_remove (a->priv->cameras, entry->key);
		}
	} else {
		if (strcmp (b, "name") && strcmp (b, "manufacturer") &&
		    strcmp (b, "model") && strcmp (b, "port")) return;
		
		id = g_path_get_dirname (entry->key);
		c = g_hash_table_lookup (a->priv->cameras, id);
		if (!c) c = gnocam_applet_add_cam (a, id);
		g_object_set (c, b, gconf_value_get_string (entry->value),
			      NULL);
		g_free (id);
	}
}
static void
disabled_applets_notify (GConfClient   *client,
                         guint          cnxn_id,
                         GConfEntry    *entry,
                         PanelLockdown *lockdown)
{
        GSList *l;

        if (!entry->value || entry->value->type != GCONF_VALUE_LIST ||
            gconf_value_get_list_type (entry->value) != GCONF_VALUE_STRING)
                return;

        for (l = lockdown->disabled_applets; l; l = l->next)
                g_free (l->data);
        g_slist_free (lockdown->disabled_applets);
        lockdown->disabled_applets = NULL;

        for (l = gconf_value_get_list (entry->value); l; l = l->next) {
                const char *iid = gconf_value_get_string (l->data);

                lockdown->disabled_applets =
                        g_slist_prepend (lockdown->disabled_applets,
                                         g_strdup (iid));
        }

        panel_lockdown_invoke_closures (lockdown);
}
示例#23
0
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;
}
示例#24
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);
	}
}
示例#25
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);
}
static void
panel_properties_dialog_update_background_type (PanelPropertiesDialog *dialog,
						GConfValue            *value)
{
	PanelBackgroundType  background_type;
	GtkWidget           *active_radio;

	if (!value || value->type != GCONF_VALUE_STRING)
		return;

	if (!panel_profile_map_background_type_string (gconf_value_get_string (value),
						       &background_type))
		return;

	switch (background_type) {
	case PANEL_BACK_NONE:
		active_radio = dialog->default_radio;
		break;
	case PANEL_BACK_COLOR:
		active_radio = dialog->color_radio;
		break;
	case PANEL_BACK_IMAGE:
		active_radio = dialog->image_radio;
		break;
	default:
		active_radio = NULL;
		g_assert_not_reached ();
		break;
	}

	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (active_radio), TRUE);
}
static void
toolbar_style_cb (GConfPropertyEditor *peditor,
		  gchar               *key,
		  GConfValue          *value,
		  AppearanceData      *data)
{
  set_toolbar_style (data, gconf_value_get_string (value));
}
示例#28
0
文件: notify.c 项目: xianjimli/misc
static void on_notify(GConfClient* client,
                                      guint cnxn_id,
                                      GConfEntry *entry,
                                      gpointer user_data)
{
	g_debug("%s: %s=%s", __func__, entry->key, gconf_value_get_string(entry->value));

	return;
}
static void
default_mixer_device_notify (GConfClient *client, guint cnxn_id, GConfEntry *entry, GladeXML *dialog)
{
	const gchar *mixer_device;

	mixer_device = gconf_value_get_string (gconf_entry_get_value (entry));

	update_mixer_device_combobox (mixer_device, dialog);
}
示例#30
0
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;  
}