コード例 #1
0
ファイル: merge.c プロジェクト: LQYMGT/window_merge
/**
 * Create a conversation window and merge it with the given Buddy List window
 *
 * This is the real core of the plugin right here.  It initializes the Buddy
 * List with a conversation window just like the project advertises.  See the
 * function pwm_split_conversation() to reverse this effect.
 *
 * @param[in] gtkblist   The Buddy List that will be able to show conversations
**/
void pwm_merge_conversation(PidginBuddyList *gtkblist)
{
	PidginWindow *
	    gtkconvwin; /*< The mutilated conversations for gtkblist */
	GtkBindingSet *binding_set; /*< The binding set of GtkIMHtml widgets */

	/* Sanity check: If the Buddy List is already merged, don't mess with
	 * it. */
	if (pwm_blist_get_convs(gtkblist) != NULL)
		return;

	binding_set =
	    gtk_binding_set_by_class(g_type_class_ref(GTK_TYPE_IMHTML));
	gtkconvwin = pidgin_conv_window_new();

	/* Tie the Buddy List and conversation window instances together. */
	g_object_set_data(G_OBJECT(gtkblist->notebook), "pwm_convs",
			  gtkconvwin);
	g_object_set_data(G_OBJECT(gtkconvwin->notebook), "pwm_blist",
			  gtkblist);

	/* Backup the Buddy List window title for restoring it later. */
	pwm_store(gtkblist, "title",
		  g_strdup(gtk_window_get_title(GTK_WINDOW(gtkblist->window))));

	/* Move the conversation notebook into the Buddy List window. */
	pwm_create_paned_layout(gtkblist, purple_prefs_get_string(PREF_SIDE));

	/* Display the instructions tab for new users. */
	pwm_init_dummy_conversation(gtkblist);
	pwm_show_dummy_conversation(gtkblist);

	/* Pass focus events from Buddy List to conversation window. */
	g_object_connect(G_OBJECT(gtkblist->window), "signal::focus-in-event",
			 G_CALLBACK(focus_in_event_cb), gtkconvwin->window,
			 NULL);

	/* Point the conversation window structure at the Buddy List's window.
	 */
	pwm_store(gtkblist, "conv_window", gtkconvwin->window);
	gtkconvwin->window = gtkblist->window;

	/* Block these "move-cursor" bindings for conversation event handlers.
	 */
	/* XXX: These are skipped in any GtkIMHtml, not just the conversations.
	 */
	/* XXX: Furthermore, there is no event to undo this effect. */
	gtk_binding_entry_skip(binding_set, GDK_Up, GDK_CONTROL_MASK);
	gtk_binding_entry_skip(binding_set, GDK_Down, GDK_CONTROL_MASK);
	gtk_binding_entry_skip(binding_set, GDK_Page_Up, GDK_CONTROL_MASK);
	gtk_binding_entry_skip(binding_set, GDK_Page_Down, GDK_CONTROL_MASK);
	gtk_binding_entry_skip(binding_set, GDK_KP_Page_Up, GDK_CONTROL_MASK);
	gtk_binding_entry_skip(binding_set, GDK_KP_Page_Down, GDK_CONTROL_MASK);
	gtk_binding_entry_skip(binding_set, GDK_Tab, GDK_CONTROL_MASK);
	gtk_binding_entry_skip(binding_set, GDK_KP_Tab, GDK_CONTROL_MASK);
	gtk_binding_entry_skip(binding_set, GDK_ISO_Left_Tab, GDK_CONTROL_MASK);
}
コード例 #2
0
ファイル: rbgtkbindingset.c プロジェクト: benolee/ruby-gnome2
static VALUE
binding_entry_skip(VALUE self, VALUE keyval, VALUE modifiers)
{
    gtk_binding_entry_skip(_SELF(self), NUM2UINT(keyval), RVAL2MOD(modifiers));
    return self;
}