# HG changeset patch # User Christian Hammond # Date 1054066221 0 # Node ID de09863bd4b59c9fb759b636b24611844b7aaf85 # Parent f7dc3f656f03c81ab95cc8576fc47a07d4970c1b [gaim-migrate @ 5939] Split Show URLs as Links into Show URLs as Links and Send URLs as Links, and converted them to the new prefs system. Also, added a function in gtkprefs.c called prefs_checkbox(), which works with the new prefs. committer: Tailor Script diff -r f7dc3f656f03 -r de09863bd4b5 src/conversation.c --- a/src/conversation.c Tue May 27 08:09:10 2003 +0000 +++ b/src/conversation.c Tue May 27 20:10:21 2003 +0000 @@ -32,6 +32,7 @@ #include "gaim.h" #include "prpl.h" #include "notify.h" +#include "prefs.h" #ifdef _WIN32 #include "win32dep.h" @@ -213,8 +214,11 @@ buf2 = g_malloc(limit); - if (gc->flags & OPT_CONN_HTML && convo_options & OPT_CONVO_SEND_LINKS) - buffy =linkify_text(buf); + if ((gc->flags & OPT_CONN_HTML) && + gaim_prefs_get_bool("/core/conversations/send_urls_as_links")) { + + buffy = linkify_text(buf); + } else buffy = g_strdup(buf); diff -r f7dc3f656f03 -r de09863bd4b5 src/gtkprefs.c --- a/src/gtkprefs.c Tue May 27 08:09:10 2003 +0000 +++ b/src/gtkprefs.c Tue May 27 20:10:21 2003 +0000 @@ -68,7 +68,7 @@ static GtkWidget *away_text = NULL; static GtkListStore *smiley_theme_store = NULL; GtkWidget *prefs_proxy_frame = NULL; -GtkWidget *gaim_button(const char *, guint *, int, GtkWidget *); +static GtkWidget *gaim_button(const char *, guint *, int, GtkWidget *); GtkWidget *gaim_labeled_spin_button(GtkWidget *, const gchar *, int*, int, int, GtkSizeGroup *); static GtkWidget *gaim_dropdown(GtkWidget *, const gchar *, int *, int, ...); static GtkWidget *gaim_dropdown_from_list(GtkWidget *, const gchar *, int *, int, GList *); @@ -461,6 +461,33 @@ g_object_unref(style); } +static void +set_bool_pref(GtkWidget *w, const char *key) +{ + gaim_prefs_set_bool(key, + gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w))); +} + +static GtkWidget * +pref_checkbox(const char *text, char *key, GtkWidget *page) +{ + GtkWidget *button; + + button = gtk_check_button_new_with_mnemonic(text); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), + gaim_prefs_get_bool(key)); + + gtk_box_pack_start(GTK_BOX(page), button, FALSE, FALSE, 0); + + g_signal_connect(G_OBJECT(button), "clicked", + G_CALLBACK(set_bool_pref), key); + + gtk_widget_show(button); + + return button; +} + + GtkWidget *font_page() { GtkWidget *ret; GtkWidget *button; @@ -553,7 +580,9 @@ vbox = gaim_gtk_make_frame (ret, _("Display")); gaim_button(_("Show graphical _smileys"), &convo_options, OPT_CONVO_SHOW_SMILEY, vbox); gaim_button(_("Show _timestamp on messages"), &convo_options, OPT_CONVO_SHOW_TIME, vbox); - gaim_button(_("Show _URLs as links"), &convo_options, OPT_CONVO_SEND_LINKS, vbox); + pref_checkbox(_("Show _URLs as links"), + "/gaim/gtk/conversations/show_urls_as_links", vbox); + #ifdef USE_GTKSPELL gaim_button(_("_Highlight misspelled words"), &convo_options, OPT_CONVO_CHECK_SPELLING, vbox); #endif @@ -674,8 +703,10 @@ gtk_misc_set_alignment(GTK_MISC(label), 0, 0); gtk_size_group_add_widget(sg, label); - gaim_button(_("Show IMs and chats in _same tabbed window."), + gaim_button(_("Show IMs and chats in _same tabbed window"), &convo_options, OPT_CONVO_COMBINE, vbox); + pref_checkbox(_("Send _URLs as Links"), + "/core/conversations/send_urls_as_links", vbox); gtk_widget_show_all(ret); @@ -2099,7 +2130,7 @@ toggle_away_queue(); } -GtkWidget *gaim_button(const char *text, guint *options, int option, GtkWidget *page) +static GtkWidget *gaim_button(const char *text, guint *options, int option, GtkWidget *page) { GtkWidget *button; button = gtk_check_button_new_with_mnemonic(text); @@ -2497,5 +2528,13 @@ gaim_prefs_add_bool("/gaim/gtk/debug/enabled", FALSE); gaim_prefs_add_int("/gaim/gtk/debug/width", 400); gaim_prefs_add_int("/gaim/gtk/debug/height", 150); + + /* Conversations */ + gaim_prefs_add_none("/gaim/gtk/conversations"); + gaim_prefs_add_bool("/gaim/gtk/conversations/show_urls_as_links", TRUE); + + /* Smiley Themes */ + gaim_prefs_add_none("/gaim/gtk/smilies"); + gaim_prefs_add_string("/gaim/gtk/smilies/theme", ""); } diff -r f7dc3f656f03 -r de09863bd4b5 src/prefs.c --- a/src/prefs.c Tue May 27 08:09:10 2003 +0000 +++ b/src/prefs.c Tue May 27 20:10:21 2003 +0000 @@ -97,6 +97,8 @@ gaim_prefs_add_none("/core"); /* XXX: this is where you would want to put prefs declarations */ + gaim_prefs_add_none("/core/conversations"); + gaim_prefs_add_bool("/core/conversations/send_urls_as_links", TRUE); } static char *pref_full_name(struct gaim_pref *pref) { diff -r f7dc3f656f03 -r de09863bd4b5 src/server.c --- a/src/server.c Tue May 27 08:09:10 2003 +0000 +++ b/src/server.c Tue May 27 20:10:21 2003 +0000 @@ -38,6 +38,7 @@ #include "sound.h" #include "pounce.h" #include "notify.h" +#include "prefs.h" void serv_login(struct gaim_account *account) { @@ -813,7 +814,9 @@ * If you can't figure this out, stop reading right now. * "We're not worthy! We're not worthy!" */ - if ((len < 0) && (convo_options & OPT_CONVO_SEND_LINKS)) { + if (len < 0 && + gaim_prefs_get_bool("/gaim/gtk/conversations/show_urls_as_links")) { + buffy = linkify_text(message); g_free(message); message = buffy; @@ -1369,7 +1372,7 @@ - if (convo_options & OPT_CONVO_SEND_LINKS) + if (gaim_prefs_get_bool("/gaim/gtk/conversations/urls_as_links")) buf = linkify_text(message); else buf = g_strdup(message);