Exemplo n.º 1
0
static void close_offline_tabs_cb(GtkWidget *w, GObject *menu)
{
    GList *iter;
    PidginConversation *gtkconv, *gconv;
    PidginWindow *win;
    PurpleConversation *purpconv;
    PurpleAccount *account;
    PurpleBuddy *buddy;

    gtkconv = g_object_get_data(menu, "clicked_tab");

    if (!gtkconv)
        return;

    win = pidgin_conv_get_window(gtkconv);

    for (iter = pidgin_conv_window_get_gtkconvs(win); iter; )
    {
        gconv = iter->data;
        iter = iter->next;

        purpconv = gconv->active_conv;
        account = purpconv->account;
        buddy = purple_find_buddy(account, purpconv->name);

        if(!PURPLE_BUDDY_IS_ONLINE(buddy)){
            close_conv_cb(NULL, gconv);
        }
    }
}
Exemplo n.º 2
0
static void
detach_from_pidgin_window(PidginWindow *win, gpointer null)
{
	g_list_foreach(pidgin_conv_window_get_gtkconvs(win), (GFunc)detach_from_gtkconv, NULL);
	g_signal_handlers_disconnect_by_func(G_OBJECT(win->notebook), page_switched, win);
	g_signal_handlers_disconnect_by_func(G_OBJECT(win->window), focus_removed, win);

	gtk_widget_queue_draw(win->window);
}
Exemplo n.º 3
0
static void insert_icon_at_mark(GtkTextMark * requested_mark, gpointer user_data)
{
    GList          *win_list;
    GtkIMHtml      *target_imhtml = NULL;
    GtkTextBuffer  *target_buffer = NULL;
    GtkTextIter     insertion_point;
    TwitterConvIcon *conv_icon = user_data;

    /* find the conversation that contains the mark  */
    for (win_list = pidgin_conv_windows_get_list(); win_list; win_list = win_list->next) {
        PidginWindow   *win = win_list->data;
        GList          *conv_list;

        for (conv_list = pidgin_conv_window_get_gtkconvs(win); conv_list; conv_list = conv_list->next) {
            PidginConversation *conv = conv_list->data;

            GtkIMHtml      *current_imhtml = GTK_IMHTML(conv->imhtml);
            GtkTextBuffer  *current_buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(current_imhtml));

            if (current_buffer == gtk_text_mark_get_buffer(requested_mark)) {
                target_imhtml = current_imhtml;
                target_buffer = current_buffer;
                break;
            }
        }
    }

    if (!(target_imhtml && target_buffer)) {
        purple_debug_warning(PLUGIN_ID, "No target imhtml/target buffer\n");
        return;
    }

    /* insert icon to the mark */
    gtk_text_buffer_get_iter_at_mark(target_buffer, &insertion_point, requested_mark);

    /* in this function, we put an icon for pending marks. we should
     * not invalidate the icon here, otherwise it may result in
     * thrashing. --yaz */

    if (!conv_icon || !conv_icon->pixbuf) {
        purple_debug_warning(PLUGIN_ID, "No pixbuf\n");
        return;
    }

/* We only want to add the icon if the mark is still on screen. If the user cleared the screen with a ctrl-L, this won't be true. TODO -- can we get a callback at the clear and just delete the mark there? */
    if (TRUE == gtk_text_iter_is_end(&insertion_point)) {
        purple_debug_warning(PLUGIN_ID, "Not adding the icon, since the insertion point is no longer in the buffer\n");
    } else {
        /* insert icon actually */
        gtk_text_buffer_insert_pixbuf(target_buffer, &insertion_point, conv_icon->pixbuf);
    }

    gtk_text_buffer_delete_mark(target_buffer, requested_mark);
    requested_mark = NULL;
    purple_debug_info(PLUGIN_ID, "inserted icon into conv\n");
}
Exemplo n.º 4
0
static gboolean
window_resized(GtkWidget *w, GdkEventConfigure *event, PidginWindow *win)
{
	GList *list;

	list = pidgin_conv_window_get_gtkconvs(win);
	
	for (; list; list = list->next)
		update_marker_for_gtkconv(list->data);

	return FALSE;
}
Exemplo n.º 5
0
static void
attach_to_pidgin_window(PidginWindow *win, gpointer null)
{
	g_list_foreach(pidgin_conv_window_get_gtkconvs(win), (GFunc)attach_to_gtkconv, NULL);

	g_signal_connect(G_OBJECT(win->window), "focus_out_event",
					 G_CALLBACK(focus_removed), win);

	g_signal_connect(G_OBJECT(win->notebook), "switch_page",
					G_CALLBACK(page_switched), win);

	gtk_widget_queue_draw(win->window);
}