static gboolean
clipman_item_clicked (GtkWidget      *mi,
                      GdkEventButton *ev,
                      ClipmanAction  *action)
{
    if (ev->button == 1 && action->clipman->Behaviour == STRICTLY)
    {
        DBG("Clip copied to his own clipboard (STRICTLY)");
        
        if (action->clip->fromtype == DEFAULT)
            gtk_clipboard_set_text(defaultClip, action->clip->text, -1);
        
        if (action->clip->fromtype == PRIMARY)
            gtk_clipboard_set_text(primaryClip, action->clip->text, -1);
    }
    else if (ev->button == 1)
    {
        DBG("Clip copied to both clipboards");
        
        gtk_clipboard_set_text(defaultClip, action->clip->text, -1);
        gtk_clipboard_set_text(primaryClip, action->clip->text, -1);
    }
    else if (ev->button == 3)
    {
        if (xfce_confirm (_("Are you sure you want to remove this clip from the history?"), 
	              "gtk-yes", 
                      NULL))
        {
            DBG ("Removed the selected clip from the History");
        
            if (gtk_clipboard_wait_for_text (defaultClip) &&
                !strcmp(gtk_clipboard_wait_for_text (defaultClip), action->clip->text)
               )
                gtk_clipboard_set_text(defaultClip, "", -1);
        
            if (gtk_clipboard_wait_for_text (primaryClip) &&
                !strcmp(gtk_clipboard_wait_for_text (primaryClip), action->clip->text)
               )
                gtk_clipboard_set_text(primaryClip, "", -1);

            g_ptr_array_remove (action->clipman->clips, action->clip);
            clipman_free_clip (action->clip);
        }
    }
    
    return FALSE;
}
static gboolean
clipman_clear (GtkWidget      *mi,
               GdkEventButton *ev,
               ClipmanPlugin  *clipman)
{
    ClipmanClip *clip;

    if (xfce_confirm (_("Are you sure you want to clear the history?"), 
	              "gtk-yes", 
                      NULL))
    {
        gtk_clipboard_set_text(primaryClip, "", -1);
        gtk_clipboard_set_text(defaultClip, "", -1);
        
        while (clipman->clips->len > 0)
        {
            clip = g_ptr_array_index (clipman->clips, 0);
            g_ptr_array_remove (clipman->clips, clip);
            clipman_free_clip (clip);
        }
    }
    
    return FALSE;
}
示例#3
0
文件: utils.c 项目: morenko/sven
/* compat stub */
gboolean confirm (const char *text, const char *stock, const char *action)
{
    return xfce_confirm (text, stock, action);
}