Ejemplo n.º 1
0
static void qq_group_list_on_double_click(GtkTreeView *tree
                                    , GtkTreePath *path 
                                    , GtkTreeViewColumn  *col 
                                    , gpointer data)
{
    gchar *code;
    GtkTreeModel *model = gtk_tree_view_get_model(tree); 

    GtkTreeIter iter;
    gtk_tree_model_get_iter(model, &iter, path);
    gtk_tree_model_get(model, &iter, BDY_LIST_UIN, &code, -1);

    GtkWidget *cw = gqq_config_lookup_ht(cfg, "chat_window_map", code); 
    if(cw != NULL){
        // We have open a window for this group
        g_object_set(cw, "code", code, NULL);
        gtk_widget_show(cw);
        g_free(code);
        return;
    }
    
    g_debug("Create group chat window for %s(%s, %d)", code
                                        , __FILE__, __LINE__);
    cw = qq_group_chatwindow_new(code);
    gtk_widget_show(cw);
    gqq_config_insert_ht(cfg, "chat_window_map", code, cw);
    g_free(code);
}
Ejemplo n.º 2
0
static gboolean qq_tray_button_press(GtkStatusIcon *tray, GdkEvent *event
                                    , gpointer data)
{
    GdkEventButton *buttonevent = (GdkEventButton*)event;

	/* Only handle left clicked. */
	if(buttonevent -> button != 1 || buttonevent -> type != GDK_BUTTON_PRESS){
		return FALSE;
	}
    
    QQTrayPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE(tray, qq_tray_get_type()
                                                    , QQTrayPriv);
    gchar *uin = g_queue_pop_tail(priv -> blinking_queue);
    if(uin == NULL){
		/* If there is no new msg, show or hide the main window. */
		qq_mainwindow_show_hide(main_win);
        return FALSE;
    }
    GtkWidget *cw = gqq_config_lookup_ht(cfg, "chat_window_map", uin);
    if(cw != NULL){
        gtk_widget_show(cw);
    }
    g_free(uin);

    if(g_queue_is_empty(priv -> blinking_queue)){
        gtk_status_icon_set_blinking(tray, FALSE);
        GdkPixbuf *pb = gdk_pixbuf_new_from_file(IMGDIR"/webqq_icon.png"
                                                    , NULL);
        gtk_status_icon_set_from_pixbuf(GTK_STATUS_ICON(tray), pb);
        g_object_unref(pb);
        return FALSE;
    }
    qq_tray_blinking(QQ_TRAY(tray), g_queue_peek_tail(priv -> blinking_queue));
    return FALSE;
}