pidgin: 371b9fc5: Add a 'Jump to markerline' option in the...

sadrul at pidgin.im sadrul at pidgin.im
Mon Apr 14 01:36:15 EDT 2008


-----------------------------------------------------------------
Revision: 371b9fc5e0540b1a7ad069de7fc76ab60f7f17b7
Ancestor: 9da7555026cd7b8456f95ae153a7852ddbcf6678
Author: sadrul at pidgin.im
Date: 2008-04-14T05:30:18
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/371b9fc5e0540b1a7ad069de7fc76ab60f7f17b7

Modified files:
        pidgin/plugins/markerline.c

ChangeLog: 

Add a 'Jump to markerline' option in the conversation window menu to
jump to the markerline. The menuitem can be assigned a hotkey using the
usual 'press key while hovering' GTK+ method. Closes #5355.

-------------- next part --------------
============================================================
--- pidgin/plugins/markerline.c	594a5b3d40cc7b12536ea9bd9b534c8914ec4b82
+++ pidgin/plugins/markerline.c	db46fcd6eafae8d68a446899a552f0196820ed27
@@ -216,6 +216,32 @@ conv_created(PurpleConversation *conv, g
 	attach_to_pidgin_window(win, NULL);
 }
 
+static void
+jump_to_markerline(PurpleConversation *conv, gpointer null)
+{
+	PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv);
+	int offset;
+	GtkTextIter iter;
+
+	if (!gtkconv)
+		return;
+
+	offset = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(gtkconv->imhtml), "markerline"));
+	gtk_text_buffer_get_iter_at_offset(GTK_IMHTML(gtkconv->imhtml)->text_buffer, &iter, offset);
+	gtk_text_view_scroll_to_iter(GTK_TEXT_VIEW(gtkconv->imhtml), &iter, 0, TRUE, 0, 0);
+}
+
+static void
+conv_menu_cb(PurpleConversation *conv, GList **list)
+{
+	PurpleConversationType type = purple_conversation_get_type(conv);
+	gboolean enabled = ((type == PURPLE_CONV_TYPE_IM && purple_prefs_get_bool(PREF_IMS)) ||
+		(type == PURPLE_CONV_TYPE_CHAT && purple_prefs_get_bool(PREF_CHATS)));
+	PurpleMenuAction *action = purple_menu_action_new(_("Jump to markerline"),
+			enabled ? PURPLE_CALLBACK(jump_to_markerline) : NULL, NULL, NULL);
+	*list = g_list_append(*list, action);
+}
+
 static gboolean
 plugin_load(PurplePlugin *plugin)
 {
@@ -224,6 +250,8 @@ plugin_load(PurplePlugin *plugin)
 	purple_signal_connect(purple_conversations_get_handle(), "conversation-created",
 						plugin, PURPLE_CALLBACK(conv_created), NULL);
 
+	purple_signal_connect(purple_conversations_get_handle(), "conversation-extended-menu",
+						plugin, PURPLE_CALLBACK(conv_menu_cb), NULL);
 	return TRUE;
 }
 


More information about the Commits mailing list