Mercurial > pidgin
changeset 8170:9d1a984681fe
[gaim-migrate @ 8883]
Gary Kramlich is probably getting sick of the prefs system, but at least
he made a nice interface for protocol prefs. Thanks Gary!
committer: Tailor Script <tailor@pidgin.im>
author | Nathan Walp <nwalp@pidgin.im> |
---|---|
date | Sun, 25 Jan 2004 22:15:42 +0000 |
parents | a64774143a42 |
children | d0ba2f7b40e7 |
files | src/gtkconv.c src/gtkprefs.c src/multi.h src/protocols/gg/gg.c src/protocols/irc/irc.c src/protocols/jabber/jabber.c src/protocols/msn/msn.c src/protocols/napster/napster.c src/protocols/oscar/oscar.c src/protocols/toc/toc.c src/protocols/trepia/trepia.c src/protocols/yahoo/yahoo.c src/protocols/zephyr/zephyr.c src/prpl.h |
diffstat | 14 files changed, 139 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/gtkconv.c Sun Jan 25 22:01:34 2004 +0000 +++ b/src/gtkconv.c Sun Jan 25 22:15:42 2004 +0000 @@ -1168,7 +1168,7 @@ gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); gtk_widget_show(button); - if (gc && prpl_info->get_info) { + if (gc && (prpl_info->get_info || prpl_info->get_cb_info)) { button = gtk_menu_item_new_with_label(_("Info")); g_signal_connect(G_OBJECT(button), "activate", G_CALLBACK(menu_chat_info_cb), conv); @@ -1186,6 +1186,7 @@ gtk_widget_show(button); } + /* XXX: jabber can only add buddies from here in certain circumstances */ /* Added by Jonas <jonas@birme.se> */ if (gc) { if (gaim_find_buddy(gc->account, who))
--- a/src/gtkprefs.c Sun Jan 25 22:01:34 2004 +0000 +++ b/src/gtkprefs.c Sun Jan 25 22:15:42 2004 +0000 @@ -32,6 +32,7 @@ #include "prpl.h" #include "sound.h" #include "util.h" +#include "multi.h" #include "gtkblist.h" #include "gtkconv.h" @@ -1545,6 +1546,96 @@ return ret; } +static GtkWidget * +protocol_page() { + GtkWidget *ret; + + ret = gtk_label_new(NULL); + gtk_widget_show(ret); + + return ret; +} + +static gboolean +protocol_pref_entry_cb(GtkWidget *entry, GdkEventFocus *event, gpointer data) { + char *pref = data; + + gaim_prefs_set_string(pref, gtk_entry_get_text(GTK_ENTRY(entry))); + + return FALSE; +} + +static GtkWidget * +protocol_pref_page(GaimPluginProtocolInfo *prpl_info) { + GtkWidget *ret, *parent, *frame, *hbox, *label, *misc; + GtkSizeGroup *sg; + GList *pp = NULL; + + sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); + + ret = gtk_vbox_new(FALSE, 18); + gtk_container_set_border_width (GTK_CONTAINER (ret), 12); + gtk_widget_show(ret); + + parent = ret; + + for(pp = prpl_info->protocol_prefs; pp != NULL; pp = pp->next) { + struct proto_pref *pref = pp->data; + + if(pref->key != NULL) { + switch(gaim_prefs_get_type(pref->key)) { + case GAIM_PREF_BOOLEAN: + misc = gaim_gtk_prefs_checkbox(pref->label, + pref->key, + parent); + break; + case GAIM_PREF_INT: + misc = gaim_gtk_prefs_labeled_spin_button(parent, + pref->label, + pref->key, + pref->min, + pref->max, + sg); + break; + case GAIM_PREF_STRING: + hbox = gtk_hbox_new(FALSE, 6); + gtk_widget_show(hbox); + gtk_box_pack_start(GTK_BOX(parent), hbox, FALSE, FALSE, 0); + + label = gtk_label_new_with_mnemonic(pref->label); + gtk_misc_set_alignment(GTK_MISC(label), 0, 0); + gtk_size_group_add_widget(sg, label); + gtk_widget_show(label); + gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); + + misc = gtk_entry_new(); + gtk_entry_set_text(GTK_ENTRY(misc), + gaim_prefs_get_string(pref->key)); + g_signal_connect(G_OBJECT(misc), "focus-out-event", + G_CALLBACK(protocol_pref_entry_cb), + (gpointer)pref->key); + gtk_label_set_mnemonic_widget(GTK_LABEL(label), misc); + gtk_widget_show(misc); + gtk_box_pack_start(GTK_BOX(hbox), misc, FALSE, FALSE, 0); + + break; + case GAIM_PREF_NONE: /* XXX No use for this, if you want a + frame, set key to NULL */ + case GAIM_PREF_STRING_LIST: /*XXX No one should need this */ + default: + break; + } + } else { + frame = gaim_gtk_make_frame(ret, pref->label); + gtk_widget_show(frame); + + parent = frame; + } + } + + return ret; +} + static GtkWidget *plugin_description=NULL, *plugin_details=NULL; static void prefs_plugin_sel (GtkTreeSelection *sel, GtkTreeModel *model) @@ -2291,6 +2382,21 @@ prefs_notebook_add_page(_("Away / Idle"), NULL, away_page(), &p, NULL, notebook_page++); prefs_notebook_add_page(_("Away Messages"), NULL, away_message_page(), &c, &p, notebook_page++); + prefs_notebook_add_page(_("Protocols"), NULL, protocol_page(), &p, NULL, notebook_page++); + for (l = gaim_plugins_get_protocols(); l != NULL; l = l->next) { + plug = l->data; + + if (GAIM_IS_PROTOCOL_PLUGIN(plug)) { + GaimPluginProtocolInfo *prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(plug); + + if (prpl_info->protocol_prefs != NULL) { + prefs_notebook_add_page(_(plug->info->name), NULL, + protocol_pref_page(prpl_info), &c, + &p, notebook_page++); + } + } + } + if (gaim_plugins_enabled()) { prefs_notebook_add_page(_("Plugins"), NULL, plugin_page(), &plugin_iter, NULL, notebook_page++);
--- a/src/multi.h Sun Jan 25 22:01:34 2004 +0000 +++ b/src/multi.h Sun Jan 25 22:15:42 2004 +0000 @@ -49,8 +49,14 @@ gboolean secret; }; +struct proto_pref { + char *key; + char *label; + int min; + int max; +}; + #endif /* _MULTI_H_ */ /* A big line. */ /* -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- */ -
--- a/src/protocols/gg/gg.c Sun Jan 25 22:01:34 2004 +0000 +++ b/src/protocols/gg/gg.c Sun Jan 25 22:15:42 2004 +0000 @@ -1,6 +1,6 @@ /* * gaim - Gadu-Gadu Protocol Plugin - * $Id: gg.c 8756 2004-01-10 18:13:52Z thekingant $ + * $Id: gg.c 8883 2004-01-25 22:15:42Z faceprint $ * * Copyright (C) 2001 Arkadiusz Mi¶kiewicz <misiek@pld.ORG.PL> * @@ -1305,6 +1305,7 @@ 0, NULL, NULL, + NULL, agg_list_icon, agg_list_emblems, NULL,
--- a/src/protocols/irc/irc.c Sun Jan 25 22:01:34 2004 +0000 +++ b/src/protocols/irc/irc.c Sun Jan 25 22:15:42 2004 +0000 @@ -525,6 +525,7 @@ OPT_PROTO_CHAT_TOPIC | OPT_PROTO_PASSWORD_OPTIONAL, NULL, NULL, + NULL, irc_blist_icon, irc_blist_emblems, NULL,
--- a/src/protocols/jabber/jabber.c Sun Jan 25 22:01:34 2004 +0000 +++ b/src/protocols/jabber/jabber.c Sun Jan 25 22:15:42 2004 +0000 @@ -1120,6 +1120,7 @@ OPT_PROTO_CHAT_TOPIC | OPT_PROTO_UNIQUE_CHATNAME, NULL, NULL, + NULL, jabber_list_icon, jabber_list_emblems, jabber_status_text, @@ -1208,6 +1209,7 @@ { GaimAccountUserSplit *split; GaimAccountOption *option; + struct proto_pref *ppref; split = gaim_account_user_split_new(_("Server"), "jabber.org", '@'); prpl_info.user_splits = g_list_append(prpl_info.user_splits, split); @@ -1243,6 +1245,16 @@ gaim_prefs_add_none("/plugins/prpl/jabber"); gaim_prefs_add_bool("/plugins/prpl/jabber/hide_os", FALSE); + + ppref = g_new0(struct proto_pref, 1); + ppref->key = NULL; + ppref->label = _("Privacy"); + prpl_info.protocol_prefs = g_list_append(prpl_info.protocol_prefs, ppref); + + ppref = g_new0(struct proto_pref, 1); + ppref->key = "/plugins/prpl/jabber/hide_os"; + ppref->label = _("Hide Operating System"); /* XXX: come up with a better name for this */ + prpl_info.protocol_prefs = g_list_append(prpl_info.protocol_prefs, ppref); } GAIM_INIT_PLUGIN(jabber, init_plugin, info);
--- a/src/protocols/msn/msn.c Sun Jan 25 22:01:34 2004 +0000 +++ b/src/protocols/msn/msn.c Sun Jan 25 22:15:42 2004 +0000 @@ -1571,6 +1571,7 @@ OPT_PROTO_MAIL_CHECK /* | OPT_PROTO_BUDDY_ICON */, NULL, NULL, + NULL, msn_list_icon, msn_list_emblems, msn_status_text,
--- a/src/protocols/napster/napster.c Sun Jan 25 22:01:34 2004 +0000 +++ b/src/protocols/napster/napster.c Sun Jan 25 22:15:42 2004 +0000 @@ -554,6 +554,7 @@ OPT_PROTO_CHAT_TOPIC, NULL, NULL, + NULL, nap_list_icon, nap_list_emblems, NULL,
--- a/src/protocols/oscar/oscar.c Sun Jan 25 22:01:34 2004 +0000 +++ b/src/protocols/oscar/oscar.c Sun Jan 25 22:15:42 2004 +0000 @@ -6624,6 +6624,7 @@ OPT_PROTO_MAIL_CHECK | OPT_PROTO_BUDDY_ICON | OPT_PROTO_IM_IMAGE, NULL, NULL, + NULL, oscar_list_icon, oscar_list_emblems, oscar_status_text,
--- a/src/protocols/toc/toc.c Sun Jan 25 22:01:34 2004 +0000 +++ b/src/protocols/toc/toc.c Sun Jan 25 22:15:42 2004 +0000 @@ -2094,6 +2094,7 @@ OPT_PROTO_CORRECT_TIME, NULL, NULL, + NULL, toc_list_icon, toc_list_emblems, NULL,
--- a/src/protocols/trepia/trepia.c Sun Jan 25 22:01:34 2004 +0000 +++ b/src/protocols/trepia/trepia.c Sun Jan 25 22:15:42 2004 +0000 @@ -1255,6 +1255,7 @@ OPT_PROTO_BUDDY_ICON, NULL, NULL, + NULL, trepia_list_icon, trepia_list_emblems, trepia_status_text,
--- a/src/protocols/yahoo/yahoo.c Sun Jan 25 22:01:34 2004 +0000 +++ b/src/protocols/yahoo/yahoo.c Sun Jan 25 22:15:42 2004 +0000 @@ -3113,6 +3113,7 @@ OPT_PROTO_MAIL_CHECK | OPT_PROTO_CHAT_TOPIC, NULL, /* user_splits */ NULL, /* protocol_options */ + NULL, /* protocol_prefs */ yahoo_list_icon, yahoo_list_emblems, yahoo_status_text,
--- a/src/protocols/zephyr/zephyr.c Sun Jan 25 22:01:34 2004 +0000 +++ b/src/protocols/zephyr/zephyr.c Sun Jan 25 22:15:42 2004 +0000 @@ -985,6 +985,7 @@ OPT_PROTO_NO_PASSWORD, NULL, NULL, + NULL, zephyr_list_icon, NULL, NULL,
--- a/src/prpl.h Sun Jan 25 22:01:34 2004 +0000 +++ b/src/prpl.h Sun Jan 25 22:15:42 2004 +0000 @@ -204,6 +204,7 @@ GList *user_splits; /* A GList of GaimAccountUserSplit */ GList *protocol_options; /* A GList of GaimAccountOption */ + GList *protocol_prefs; /* protocol specific options */ /** * Returns the base icon name for the given buddy and account. @@ -327,6 +328,7 @@ struct _GaimRoomlist *(*roomlist_get_list)(GaimConnection *gc); void (*roomlist_cancel)(struct _GaimRoomlist *list); void (*roomlist_expand_catagory)(struct _GaimRoomlist *list, struct _GaimRoomlistRoom *catagory); + }; #define GAIM_IS_PROTOCOL_PLUGIN(plugin) \