Mercurial > pidgin
changeset 7561:cdfdbabd3266
[gaim-migrate @ 8175]
Move conversation placement from a core pref to a UI pref.
committer: Tailor Script <tailor@pidgin.im>
author | Christian Hammond <chipx86@chipx86.com> |
---|---|
date | Tue, 18 Nov 2003 23:24:05 +0000 |
parents | af9968dbdc70 |
children | b859cfb5f31a |
files | src/conversation.c src/conversation.h src/gaimrc.c src/gtkconv.c src/gtkprefs.c src/prefs.c |
diffstat | 6 files changed, 58 insertions(+), 32 deletions(-) [+] |
line wrap: on
line diff
--- a/src/conversation.c Tue Nov 18 22:59:16 2003 +0000 +++ b/src/conversation.c Tue Nov 18 23:24:05 2003 +0000 @@ -851,9 +851,6 @@ gaim_conv_window_show(win); } else { - if (place_conv == NULL) - gaim_prefs_set_string("/core/conversations/placement", "last"); - if (!place_conv) gaim_debug(GAIM_DEBUG_ERROR, "conversation", "This is about to suck.\n"); @@ -2481,23 +2478,18 @@ return data->fnc; } -static void -conv_placement_pref_cb(const char *name, GaimPrefType type, - gpointer value, gpointer data) +void +gaim_conv_placement_set_current_func(GaimConvPlacementFunc func) { - GaimConvPlacementFunc fnc; - - if (strcmp(name, "/core/conversations/placement")) - return; - - ensure_default_funcs(); - - fnc = gaim_conv_placement_get_fnc(value); - - if (fnc == NULL) - return; - - place_conv = fnc; + g_return_if_fail(func != NULL); + + place_conv = func; +} + +GaimConvPlacementFunc +gaim_conv_placement_get_current_func(void) +{ + return place_conv; } static void @@ -2505,10 +2497,10 @@ gpointer value, gpointer data) { /* - * If the use_server_alias option was changed, and use_alias_for_title + * If the use_server_alias option was changed, and use_alias_for_title * is false, then we don't have to do anything here. */ - if (!strcmp(name, "/core/buddies/use_server_alias") && + if (!strcmp(name, "/core/buddies/use_server_alias") && !gaim_prefs_get_bool("/core/conversations/use_alias_for_title")) return; @@ -2550,7 +2542,6 @@ gaim_prefs_add_bool("/core/conversations/away_back_on_send", TRUE); gaim_prefs_add_bool("/core/conversations/use_alias_for_title", TRUE); gaim_prefs_add_bool("/core/conversations/combine_chat_im", FALSE); - gaim_prefs_add_string("/core/conversations/placement", "last"); /* Conversations -> Chat */ gaim_prefs_add_none("/core/conversations/chat"); @@ -2563,9 +2554,6 @@ gaim_prefs_add_bool("/core/conversations/im/show_login", TRUE); gaim_prefs_add_bool("/core/conversations/im/send_typing", TRUE); - gaim_prefs_connect_callback("/core/conversations/placement", - conv_placement_pref_cb, NULL); - gaim_prefs_trigger_callback("/core/conversations/placement"); gaim_prefs_connect_callback("/core/conversations/use_alias_for_title", update_titles_pref_cb, NULL); gaim_prefs_connect_callback("/core/buddies/use_server_alias",
--- a/src/conversation.h Tue Nov 18 22:59:16 2003 +0000 +++ b/src/conversation.h Tue Nov 18 23:24:05 2003 +0000 @@ -1241,6 +1241,20 @@ GaimConvPlacementFunc gaim_conv_placement_get_fnc(const char *id); /** + * Sets the current conversation placement function. + * + * @param func The new conversation placement function. + */ +void gaim_conv_placement_set_current_func(GaimConvPlacementFunc func); + +/** + * Returns the current conversation placement function. + * + * @return The current conversation placement function. + */ +GaimConvPlacementFunc gaim_conv_placement_get_current_func(void); + +/** * Returns the id of the specified conversation placement function. * * @param fnc A pointer to the registered function.
--- a/src/gaimrc.c Tue Nov 18 22:59:16 2003 +0000 +++ b/src/gaimrc.c Tue Nov 18 23:24:05 2003 +0000 @@ -1065,20 +1065,20 @@ } else if (!strcmp(p->option, "conv_placement")) { switch(atoi(p->value[0])) { case 1: - gaim_prefs_set_string("/core/conversations/placement", + gaim_prefs_set_string("/gaim/gtk/conversations/placement", "new"); break; case 2: - gaim_prefs_set_string("/core/conversations/placement", + gaim_prefs_set_string("/gaim/gtk/conversations/placement", "group"); break; case 3: - gaim_prefs_set_string("/core/conversations/placement", + gaim_prefs_set_string("/gaim/gtk/conversations/placement", "account"); break; case 0: default: - gaim_prefs_set_string("/core/conversations/placement", + gaim_prefs_set_string("/gaim/gtk/conversations/placement", "last"); break; }
--- a/src/gtkconv.c Tue Nov 18 22:59:16 2003 +0000 +++ b/src/gtkconv.c Tue Nov 18 23:24:05 2003 +0000 @@ -6084,6 +6084,23 @@ } } +static void +conv_placement_pref_cb(const char *name, GaimPrefType type, + gpointer value, gpointer data) +{ + GaimConvPlacementFunc func; + + if (strcmp(name, "/gaim/gtk/conversations/placement")) + return; + + func = gaim_conv_placement_get_fnc(value); + + if (func == NULL) + return; + + gaim_conv_placement_set_current_func(func); +} + void gaim_gtk_conversations_init(void) { @@ -6113,6 +6130,7 @@ gaim_prefs_add_bool("/gaim/gtk/conversations/smiley_shortcuts", FALSE); gaim_prefs_add_bool("/gaim/gtk/conversations/show_urls_as_links", TRUE); gaim_prefs_add_bool("/gaim/gtk/conversations/show_formatting_toolbar", TRUE); + gaim_prefs_add_string("/gaim/gtk/conversations/placement", "last"); gaim_prefs_add_string("/gaim/gtk/conversations/bgcolor", "#FFFFFF"); gaim_prefs_add_string("/gaim/gtk/conversations/fgcolor", "#000000"); gaim_prefs_add_string("/gaim/gtk/conversations/font_face", ""); @@ -6162,6 +6180,11 @@ gaim_prefs_connect_callback("/gaim/gtk/conversations/tab_side", tab_side_pref_cb, NULL); + gaim_prefs_connect_callback("/gaim/gtk/conversations/placement", + conv_placement_pref_cb, NULL); + gaim_prefs_trigger_callback("/gaim/gtk/conversations/placement"); + + /* IM callbacks */ gaim_prefs_connect_callback("/gaim/gtk/conversations/im/button_type",
--- a/src/gtkprefs.c Tue Nov 18 22:59:16 2003 +0000 +++ b/src/gtkprefs.c Tue Nov 18 23:24:05 2003 +0000 @@ -882,7 +882,7 @@ names = gaim_conv_placement_get_options(); label = prefs_dropdown_from_list(vbox, _("_Placement:"), - GAIM_PREF_STRING, "/core/conversations/placement", names); + GAIM_PREF_STRING, "/gaim/gtk/conversations/placement", names); g_list_free(names); gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
--- a/src/prefs.c Tue Nov 18 22:59:16 2003 +0000 +++ b/src/prefs.c Tue Nov 18 23:24:05 2003 +0000 @@ -615,6 +615,8 @@ void gaim_prefs_rename_old() { gaim_prefs_rename("/gaim/gtk/logging/log_ims", "/core/logging/log_ims"); gaim_prefs_rename("/gaim/gtk/logging/log_chats", "/core/logging/log_chats"); + gaim_prefs_rename("/core/conversations/placement", + "/gaim/gtk/conversations/placement"); } guint gaim_prefs_connect_callback(const char *name, GaimPrefCallback func, gpointer data) @@ -879,8 +881,7 @@ GMarkupParseContext *context; GError *error = NULL; - - if(!filename) { + if (!filename) { prefs_is_loaded = TRUE; return FALSE; }