pidgin/plugins/markerline.c

branch
soc.2013.gobjectification
changeset 34660
68c776e3436e
parent 32773
6700409ec3a3
child 35037
bcf94ea5b8e5
child 36757
2e04586cf6e8
equal deleted inserted replaced
34659:4fc616843cb2 34660:68c776e3436e
43 43
44 static void 44 static void
45 update_marker_for_gtkconv(PidginConversation *gtkconv) 45 update_marker_for_gtkconv(PidginConversation *gtkconv)
46 { 46 {
47 PurpleConversation *conv; 47 PurpleConversation *conv;
48 PurpleConversationType type;
49 48
50 g_return_if_fail(gtkconv != NULL); 49 g_return_if_fail(gtkconv != NULL);
51 50
52 conv = gtkconv->active_conv; 51 conv = gtkconv->active_conv;
53 type = purple_conversation_get_type(conv); 52
54 53 if ((PURPLE_IS_CHAT_CONVERSATION(conv) && !purple_prefs_get_bool(PREF_CHATS)) ||
55 if ((type == PURPLE_CONV_TYPE_CHAT && !purple_prefs_get_bool(PREF_CHATS)) || 54 (PURPLE_IS_IM_CONVERSATION(conv) && !purple_prefs_get_bool(PREF_IMS)))
56 (type == PURPLE_CONV_TYPE_IM && !purple_prefs_get_bool(PREF_IMS)))
57 return; 55 return;
58 56
59 gtk_webview_safe_execute_script(GTK_WEBVIEW(gtkconv->webview), 57 gtk_webview_safe_execute_script(GTK_WEBVIEW(gtkconv->webview),
60 "var mhr = document.getElementById(\"markerhr\");" 58 "var mhr = document.getElementById(\"markerhr\");"
61 "if (!mhr) {" 59 "if (!mhr) {"
164 } 162 }
165 163
166 static void 164 static void
167 conv_menu_cb(PurpleConversation *conv, GList **list) 165 conv_menu_cb(PurpleConversation *conv, GList **list)
168 { 166 {
169 PurpleConversationType type = purple_conversation_get_type(conv); 167 gboolean enabled = ((PURPLE_IS_IM_CONVERSATION(conv) && purple_prefs_get_bool(PREF_IMS)) ||
170 gboolean enabled = ((type == PURPLE_CONV_TYPE_IM && purple_prefs_get_bool(PREF_IMS)) || 168 (PURPLE_IS_CHAT_CONVERSATION(conv) && purple_prefs_get_bool(PREF_CHATS)));
171 (type == PURPLE_CONV_TYPE_CHAT && purple_prefs_get_bool(PREF_CHATS)));
172 PurpleMenuAction *action = purple_menu_action_new(_("Jump to markerline"), 169 PurpleMenuAction *action = purple_menu_action_new(_("Jump to markerline"),
173 enabled ? PURPLE_CALLBACK(jump_to_markerline) : NULL, NULL, NULL); 170 enabled ? PURPLE_CALLBACK(jump_to_markerline) : NULL, NULL, NULL);
174 *list = g_list_append(*list, action); 171 *list = g_list_append(*list, action);
175 } 172 }
176 173

mercurial