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 */ } } }
/* 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 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 */ } } }
static void writesave_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 *fni = gconf_value_get_string (gconf_entry_get_value (entry)); if(fni && !in_main_iteration()) { int use_arg = strcmp(fni, "+"); /* plus filename uses default */ const char *fn = use_arg ? fni : GLOBALS->filesel_writesave; if(fn) { FILE *wave; if(!(wave=fopen(fn, "wb"))) { fprintf(stderr, "GTKWAVE | RPC Writesave: error opening save file '%s' for writing.\n", fn); perror("Why"); errno=0; } else { write_save_helper(fn, wave); if(use_arg) { if(GLOBALS->filesel_writesave) { free_2(GLOBALS->filesel_writesave); } GLOBALS->filesel_writesave = strdup_2(fn); } wave_gconf_client_set_string("/current/savefile", fn); fclose(wave); fprintf(stderr, "GTKWAVE | RPC Writesave: wrote save file '%s'.\n", GLOBALS->filesel_writesave); } } } gconf_entry_set_value(entry, NULL); } else { /* value is of wrong type */ } } }
/* Append the list of entries as an array. */ void gconf_dbus_utils_append_entries (DBusMessageIter *iter, GSList *entries) { DBusMessageIter array_iter; GSList *l; dbus_message_iter_open_container (iter, DBUS_TYPE_ARRAY, DBUS_STRUCT_BEGIN_CHAR_AS_STRING DBUS_TYPE_STRING_AS_STRING DBUS_TYPE_STRING_AS_STRING DBUS_TYPE_BOOLEAN_AS_STRING DBUS_TYPE_STRING_AS_STRING DBUS_TYPE_BOOLEAN_AS_STRING DBUS_TYPE_BOOLEAN_AS_STRING DBUS_STRUCT_END_CHAR_AS_STRING, &array_iter); for (l = entries; l; l = l->next) { GConfEntry *entry = l->data; utils_append_entry_values_stringified (&array_iter, entry->key, gconf_entry_get_value (entry), gconf_entry_get_is_default (entry), gconf_entry_get_is_writable (entry), gconf_entry_get_schema_name (entry)); } dbus_message_iter_close_container (iter, &array_iter); }
/** * 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; }
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); }
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 */ }
/* Pref changed: sync */ static void list_store_binding_pref_changed (GConfClient *client, guint cnxn_id, GConfEntry *entry, gpointer user_data) { GConfValue *gconf_value; ListStoreBinding *binding; GSList *l; gconf_value = gconf_entry_get_value (entry); if (!gconf_value) return; /* NULL means that the value has been unset */ binding = (ListStoreBinding *) user_data; /* Check that this notification is not caused by * sync_store_to_pref() */ l = g_slist_find_custom (binding->val_changes, gconf_value, (GCompareFunc) gconf_value_compare); if (l) { gconf_value_free (l->data); binding->val_changes = g_slist_delete_link (binding->val_changes, l); return; } list_store_binding_sync_pref_to_store (binding, gconf_value); }
void SmoothRefresh::status_changed(GConfClient *client, guint cnxn_id, GConfEntry *entry, gpointer user_data) { static_cast<SmoothRefresh*>(user_data)->load_gconf_value(gconf_entry_get_value(entry)); }
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); } }
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_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) }
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); } }
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); } }
/** * 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; }
static void crawler_state_changed (GConfClient *client, guint conn_id, GConfEntry *entry, gpointer user_data) { const GConfValue *value; gchar *str_value; MafwPlaylist *playlist; /* Reload current playlist when crawler is done indexing local content */ value = gconf_entry_get_value(entry); str_value = gconf_value_to_string(value); if (str_value && g_ascii_strcasecmp (str_value, "IDLE") == 0) { g_print ("Crawler is done indexing." \ "Reloading current playlist\n"); playlist = MAFW_PLAYLIST(get_current_playlist()); if (playlist != NULL) { display_playlist_contents(playlist); } } }
/** 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; }
/** 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; }
static void use_default_clipboard_key_changed_callback(GConfClient *client, guint cnxn_id, GConfEntry *entry, gpointer user_data) { GConfValue *value = gconf_entry_get_value(entry); gtk_toggle_button_set_active((GtkToggleButton*)defaultCheck, gconf_value_get_bool(value)); }
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); }
static void max_item_length_key_changed_callback(GConfClient *client, guint cnxn_id, GConfEntry *entry, gpointer user_data) { hasChanged = 1; GConfValue *value = gconf_entry_get_value (entry); gtk_spin_button_set_value((GtkSpinButton*)itemLength, gconf_value_get_int(value)); }
static void __set_entry_from_gconf (GConfClient *client, guint cxn_id, GConfEntry *entry, gpointer user_data) { GtkWidget *tentry = user_data; if (gconf_entry_get_value (entry) == NULL) { gtk_entry_set_text (GTK_ENTRY (tentry), ""); } else if (gconf_entry_get_value (entry)->type == GCONF_VALUE_STRING) { const gchar *tmp = gconf_value_get_string (gconf_entry_get_value (entry)); gtk_entry_set_text (GTK_ENTRY (tentry), tmp); } }
/** * Called by gconf when the accelerator key has changed. * @param client * @param id * @param entry * @param userdata the GtkButton */ static void accel_button_update_cb(GConfClient *client, guint id, GConfEntry *entry, gpointer userdata) { GtkButton *button; const char *accelerator; g_return_if_fail(GTK_IS_BUTTON(userdata)); button = GTK_BUTTON(userdata); accelerator = gconf_value_get_string(gconf_entry_get_value(entry)); gtk_button_set_label(GTK_BUTTON(button), accelerator); }
static void gconf_key_changed (GConfClient *client, guint cnxn_id, GConfEntry *entry, gpointer data) { DeviceChooser *device_chooser = (DeviceChooser *) data; gchar *description; description = get_gconf_description_for_profile (device_chooser->profile, device_chooser->type); add_device (device_chooser->type, gconf_value_get_string (gconf_entry_get_value (entry)), description, device_chooser->profile); g_free (description); }
/*! * "detachable toolbars" value changed in gconf */ static void detachable_changed_cb(GConfClient *client, guint cnxn_id, GConfEntry *entry, gpointer data) { EV_GnomeToolbar *self = reinterpret_cast<EV_GnomeToolbar*>(data); GConfValue *value; gboolean detachable; value = gconf_entry_get_value (entry); detachable = gconf_value_get_bool (value); self->setDetachable(detachable); }
void spell_language_changed_cb (GConfClient *client, guint id, GConfEntry *entry, gpointer user_data) { #ifdef HAVE_GTKSPELL Ebook *ebook; GConfValue *value; GtkSpell *spell; const gchar *gconf_lang; gchar *lang; GtkWidget * window, * G_GNUC_UNUSED spell_check; GtkTextView * text_view; gboolean spellcheck_wanted; g_return_if_fail (user_data); ebook = (Ebook *) user_data; value = gconf_entry_get_value (entry); gconf_lang = gconf_value_get_string (value); window = GTK_WIDGET(gtk_builder_get_object (ebook->builder, "gpdfwindow")); spell_check = GTK_WIDGET(gtk_builder_get_object (ebook->builder, "spellcheckmenuitem")); text_view = GTK_TEXT_VIEW(gtk_builder_get_object (ebook->builder, "textview")); if (*gconf_lang == '\0' || gconf_lang == NULL) lang = NULL; else lang = g_strdup (gconf_lang); if (window) { spellcheck_wanted = gconf_client_get_bool (ebook->client, ebook->spell_check.key, NULL); spell = gtkspell_get_from_text_view (text_view); if (spellcheck_wanted) { if (spell && lang) /* Only if we have both spell and lang non-null we can use _set_language() */ gtkspell_set_language (spell, lang, NULL); else { /* We need to create a new spell widget if we want to use lang == NULL (use default lang) * or if the spell isn't initialized */ if (spell) gtkspell_detach (spell); spell = gtkspell_new_attach (text_view, lang, NULL); } gtkspell_recheck_all (spell); } } spell_language_select_menuitem (ebook, lang); g_free (lang); #endif /* HAVE_GTKSPELL */ }
static void reconfigure_keygrab(GConfClient *caller, guint id, GConfEntry *entry, gpointer userdata) { const char *accelerator; struct keygrab_data *data = (struct keygrab_data *)userdata; uninstall_keygrab(); accelerator = gconf_value_get_string(gconf_entry_get_value(entry)); if(!install_keygrab(accelerator, data)) { launch_get_new_key_ui(data); } else { launch_get_new_key_ui_accept(); } }
static void key_combination_key_changed_callback(GConfClient *client, guint cnxn_id, GConfEntry *entry, gpointer user_data) { hasChanged = 1; keybinder_unbind(popupKey, keyhandler); GConfValue *value = gconf_entry_get_value(entry); popupKey = g_strdup(gconf_value_get_string(value)); keybinder_bind(popupKey, keyhandler, NULL); gtk_tooltips_set_tip(toolTip, GTK_WIDGET(user_data), g_strdup_printf(_("Glipper (%s)\nClipboardmanager"), popupKey), "Glipper"); gtk_entry_set_text((GtkEntry*)keyCombEntry, popupKey); }
static void reload_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) { if(in_main_iteration()) return; reload_into_new_context(); gconf_entry_set_value(entry, NULL); } else { /* value is of wrong type */ } } }