# HG changeset patch # User Mark Doliner # Date 1093298779 0 # Node ID 1ae82c0c24ee9cf4b4b42604170245dd7f89a467 # Parent e8caffe42e38025419faa794be25c16aea626ca3 [gaim-migrate @ 10718] "adds a masked string type to plugin prefs" from Gary Kramlich committer: Tailor Script diff -r e8caffe42e38 -r 1ae82c0c24ee plugins/pluginpref_example.c --- a/plugins/pluginpref_example.c Mon Aug 23 21:59:27 2004 +0000 +++ b/plugins/pluginpref_example.c Mon Aug 23 22:06:19 2004 +0000 @@ -80,6 +80,12 @@ gaim_plugin_pref_frame_add(frame, ppref); ppref = gaim_plugin_pref_new_with_name_and_label( + "/plugins/core/pluginpref_example/masked_string", + "masked string"); + gaim_plugin_pref_set_masked(ppref, TRUE); + gaim_plugin_pref_frame_add(frame, ppref); + + ppref = gaim_plugin_pref_new_with_name_and_label( "/plugins/core/pluginpref_example/max_string", "string pref\n(max length of 16)"); gaim_plugin_pref_set_max_length(ppref, 16); @@ -144,6 +150,7 @@ "string"); gaim_prefs_add_string("/plugins/core/pluginpref_example/max_string", "max length string"); + gaim_prefs_add_string("/plugins/core/pluginpref_example/masked_string", "masked"); gaim_prefs_add_string("/plugins/core/pluginpref_example/string_choice", "red"); } diff -r e8caffe42e38 -r 1ae82c0c24ee src/gtkpluginpref.c --- a/src/gtkpluginpref.c Mon Aug 23 21:59:27 2004 +0000 +++ b/src/gtkpluginpref.c Mon Aug 23 22:06:19 2004 +0000 @@ -78,6 +78,8 @@ gtk_entry_set_text(GTK_ENTRY(entry), gaim_prefs_get_string(pref_name)); gtk_entry_set_max_length(GTK_ENTRY(entry), gaim_plugin_pref_get_max_length(pref)); + gtk_entry_set_visibility(GTK_ENTRY(entry), + !gaim_plugin_pref_get_masked(pref)); g_signal_connect(G_OBJECT(entry), "changed", G_CALLBACK(entry_cb), (gpointer)pref_name); diff -r e8caffe42e38 -r 1ae82c0c24ee src/pluginpref.c --- a/src/pluginpref.c Mon Aug 23 21:59:27 2004 +0000 +++ b/src/pluginpref.c Mon Aug 23 22:06:19 2004 +0000 @@ -44,6 +44,7 @@ int max; GList *choices; unsigned int max_length; + gboolean masked; }; GaimPluginPrefFrame * @@ -278,3 +279,17 @@ return pref->max_length; } + +void +gaim_plugin_pref_set_masked(GaimPluginPref *pref, gboolean masked) { + g_return_if_fail(pref); + + pref->masked = masked; +} + +gboolean +gaim_plugin_pref_get_masked(GaimPluginPref *pref) { + g_return_val_if_fail(pref, FALSE); + + return pref->masked; +} diff -r e8caffe42e38 -r 1ae82c0c24ee src/pluginpref.h --- a/src/pluginpref.h Mon Aug 23 21:59:27 2004 +0000 +++ b/src/pluginpref.h Mon Aug 23 22:06:19 2004 +0000 @@ -215,6 +215,22 @@ */ unsigned int gaim_plugin_pref_get_max_length(GaimPluginPref *pref); +/** + * Sets the masking of a string plugin pref + * + * @param pref The plugin pref + * @param masked The value to set + */ +void gaim_plugin_pref_set_masked(GaimPluginPref *pref, gboolean mask); + +/** + * Gets the masking of a string plugin pref + * + * @param pref The plugin pref + * @return The masking + */ +gboolean gaim_plugin_pref_get_masked(GaimPluginPref *pref); + /*@}*/ #ifdef __cplusplus