# HG changeset patch # User Yoshiki Yazawa # Date 1210855493 -32400 # Node ID d5f251b37f6b3e6a7864eab86923234723b364c2 # Parent 3e0d4fd75b0381de51030dfdc769ee3e53066cba - make sure that disabling markup widgets works even if counter is disabled. - a bit tidy up. diff -r 3e0d4fd75b03 -r d5f251b37f6b pidgin-twitter.c --- a/pidgin-twitter.c Wed May 14 23:45:26 2008 +0900 +++ b/pidgin-twitter.c Thu May 15 21:44:53 2008 +0900 @@ -573,6 +573,7 @@ PidginWindow *win = list->data; PurpleConversation *conv = pidgin_conv_window_get_active_conversation(win); + /* only attach to twitter conversation window */ if(is_twitter_conv(conv)) attach_to_gtkconv(PIDGIN_CONVERSATION(conv), NULL); } @@ -584,6 +585,29 @@ GtkWidget *box, *sep, *counter, *menus; box = gtkconv->toolbar; + + /* Disable widgets that decorate or add link to composing text + * because Twitter can't receive markuped strings. For lean-view + * and wide-view, see pidgin/gtkimhtmltoolbar.c. + */ + menus = g_object_get_data(G_OBJECT(box), "lean-view"); + if(menus) { + gtk_widget_set_sensitive(GTK_WIDGET(menus), FALSE); + } + menus = g_object_get_data(G_OBJECT(box), "wide-view"); + if(menus) { + gtk_widget_set_sensitive(GTK_WIDGET(menus), FALSE); + } + purple_conversation_set_features( + gtkconv->active_conv, + purple_conversation_get_features(gtkconv->active_conv) & + ~PURPLE_CONNECTION_HTML); + + /* check if the counter is enabled */ + if(!purple_prefs_get_bool(OPT_COUNTER)) + return; + + /* get counter object */ counter = g_object_get_data(G_OBJECT(box), PLUGIN_ID "-counter"); g_return_if_fail(counter == NULL); @@ -601,23 +625,7 @@ gtk_widget_show_all(sep); g_object_set_data(G_OBJECT(box), PLUGIN_ID "-sep", sep); - /* Disable widgets that decorate or link text - * because Twitter can't receive decorated them. - * About lean-view and wide-view, See pidgin/gtkimhtmltoolbar.c - */ - menus = g_object_get_data(G_OBJECT(box), "lean-view"); - if(menus) { - gtk_widget_set_sensitive(GTK_WIDGET(menus), FALSE); - } - menus = g_object_get_data(G_OBJECT(box), "wide-view"); - if(menus) { - gtk_widget_set_sensitive(GTK_WIDGET(menus), FALSE); - } - purple_conversation_set_features(gtkconv->active_conv, - purple_conversation_get_features( - gtkconv->active_conv) & (~PURPLE_CONNECTION_HTML)); - - /* connect signals, etc. */ + /* connect to signals */ g_signal_connect(G_OBJECT(gtkconv->entry_buffer), "insert_text", G_CALLBACK(insert_text_cb), gtkconv); g_signal_connect(G_OBJECT(gtkconv->entry_buffer), "delete_range", @@ -658,12 +666,8 @@ g_return_if_fail(gtkconv != NULL); /* only attach to twitter conversation window */ - if(is_twitter_conv(conv)) { - gboolean enabled = purple_prefs_get_bool(OPT_COUNTER); - if(enabled) { - attach_to_gtkconv(gtkconv, NULL); - } - } + if(is_twitter_conv(conv)) + attach_to_gtkconv(gtkconv, NULL); } static gboolean @@ -708,8 +712,7 @@ regp[PSEUDO] = g_regex_new(P_PSEUDO, G_REGEX_RAW, 0, NULL); /* attach counter to the existing twitter window */ - gboolean enabled = purple_prefs_get_bool(OPT_COUNTER); - if(enabled) { + if(purple_prefs_get_bool(OPT_COUNTER)) { attach_to_window(); }