Mercurial > pidgin.yaz
changeset 9422:d4e3356e7bbc
[gaim-migrate @ 10240]
[03:07] <marv> commit message?
[03:07] <grim> 'Thought others mind find this useful' i guess..
committer: Tailor Script <tailor@pidgin.im>
author | Tim Ringenbach <marv@pidgin.im> |
---|---|
date | Tue, 29 Jun 2004 08:10:26 +0000 |
parents | da603f6c5482 |
children | 2c6af2767fcf |
files | src/gtkprefs.c src/gtkprefs.h |
diffstat | 2 files changed, 59 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/gtkprefs.c Mon Jun 28 21:20:36 2004 +0000 +++ b/src/gtkprefs.c Tue Jun 29 08:10:26 2004 +0000 @@ -153,6 +153,50 @@ } static void +entry_set(GtkEntry *entry, gpointer data) { + char *key = (char*)data; + + gaim_prefs_set_string(key, gtk_entry_get_text(entry)); +} + +GtkWidget * +gaim_gtk_prefs_labeled_entry(GtkWidget *page, const gchar *title, char *key, + GtkSizeGroup *sg) +{ + GtkWidget *hbox, *label, *entry; + const gchar *value; + + value = gaim_prefs_get_string(key); + + hbox = gtk_hbox_new(FALSE, 5); + gtk_box_pack_start(GTK_BOX(page), hbox, FALSE, FALSE, 5); + gtk_widget_show(hbox); + + label = gtk_label_new_with_mnemonic(title); + gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); + gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); + gtk_widget_show(label); + + entry = gtk_entry_new(); + gtk_entry_set_text(GTK_ENTRY(entry), value); + gtk_box_pack_start(GTK_BOX(hbox), entry, FALSE, FALSE, 0); + g_signal_connect(G_OBJECT(entry), "changed", + G_CALLBACK(entry_set), (char*)key); + gtk_widget_show(entry); + + gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry); + + if(sg) { + gtk_size_group_add_widget(sg, label); + gtk_misc_set_alignment(GTK_MISC(label), 0, 0); + } + + gaim_set_accessible_label(entry, label); + + return hbox; +} + +static void dropdown_set(GObject *w, const char *key) { const char *str_value;
--- a/src/gtkprefs.h Mon Jun 28 21:20:36 2004 +0000 +++ b/src/gtkprefs.h Tue Jun 29 08:10:26 2004 +0000 @@ -81,6 +81,21 @@ const gchar *title, char *key, int min, int max, GtkSizeGroup *sg); /** + * Add a new entry representing a string preference + * + * @param page The page to which the entry will be added + * @param title The text to be displayed as the entry label + * @param key The key of the string pref that will be represented by the entry + * @param sg If not NULL, the size group to which the entry will be added + * + * @return An hbox containing both the label and the entry. Can be used to set + * the widgets to sensitive or insensitive based on the value of a + * checkbox. + */ +GtkWidget *gaim_gtk_prefs_labeled_entry(GtkWidget *page, const gchar *title, + char *key, GtkSizeGroup *sg); + +/** * Add a new dropdown representing a preference of the specified type * * @param page The page to which the dropdown will be added