Mercurial > pidgin.yaz
diff pidgin/gtkblist.c @ 27950:fb593c327870
propagate from branch 'im.pidgin.pidgin' (head e155acab29d005538351633111052f094e5f5f98)
to branch 'im.pidgin.pidgin.yaz' (head 9a2679f1f093d6f68ab515aa5278606fb451449a)
author | Yoshiki Yazawa <yaz@honeyplanet.jp> |
---|---|
date | Fri, 12 Jun 2009 05:27:34 +0000 |
parents | c2ac87c5a035 005d20d58ac7 |
children | f058edca3d66 |
line wrap: on
line diff
--- a/pidgin/gtkblist.c Fri May 22 02:02:16 2009 +0000 +++ b/pidgin/gtkblist.c Fri Jun 12 05:27:34 2009 +0000 @@ -1616,8 +1616,9 @@ { PurpleBlistNode *node; GValue val; - GtkTreeIter iter; + GtkTreeIter iter, parent; GtkTreeSelection *sel; + GtkTreePath *path; sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(tv)); if(!gtk_tree_selection_get_selected(sel, NULL, &iter)) @@ -1641,8 +1642,62 @@ } if(buddy) pidgin_retrieve_user_info(buddy->account->gc, buddy->name); - } else if (event->keyval == GDK_F2) { - gtk_blist_menu_alias_cb(tv, node); + } else { + switch (event->keyval) { + case GDK_F2: + gtk_blist_menu_alias_cb(tv, node); + break; + + case GDK_Left: + path = gtk_tree_model_get_path(GTK_TREE_MODEL(gtkblist->treemodel), &iter); + if (gtk_tree_view_row_expanded(GTK_TREE_VIEW(tv), path)) { + /* Collapse the Group */ + gtk_tree_view_collapse_row(GTK_TREE_VIEW(tv), path); + gtk_tree_path_free(path); + return TRUE; + } else { + /* Select the Parent */ + if (gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel), &iter, path)) { + if (gtk_tree_model_iter_parent(GTK_TREE_MODEL(gtkblist->treemodel), &parent, &iter)) { + gtk_tree_path_free(path); + path = gtk_tree_model_get_path(GTK_TREE_MODEL(gtkblist->treemodel), &parent); + gtk_tree_view_set_cursor(GTK_TREE_VIEW(tv), path, NULL, FALSE); + gtk_tree_path_free(path); + return TRUE; + } + } + } + gtk_tree_path_free(path); + break; + + case GDK_Right: + path = gtk_tree_model_get_path(GTK_TREE_MODEL(gtkblist->treemodel), &iter); + if (!gtk_tree_view_row_expanded(GTK_TREE_VIEW(tv), path)) { + /* Expand the Group */ + if (PURPLE_BLIST_NODE_IS_CONTACT(node)) { + pidgin_blist_expand_contact_cb(NULL, node); + gtk_tree_path_free(path); + return TRUE; + } else if (!PURPLE_BLIST_NODE_IS_BUDDY(node)) { + gtk_tree_view_expand_row(GTK_TREE_VIEW(tv), path, FALSE); + gtk_tree_path_free(path); + return TRUE; + } + } else { + /* Select the First Child */ + if (gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel), &parent, path)) { + if (gtk_tree_model_iter_nth_child(GTK_TREE_MODEL(gtkblist->treemodel), &iter, &parent, 0)) { + gtk_tree_path_free(path); + path = gtk_tree_model_get_path(GTK_TREE_MODEL(gtkblist->treemodel), &iter); + gtk_tree_view_set_cursor(GTK_TREE_VIEW(tv), path, NULL, FALSE); + gtk_tree_path_free(path); + return TRUE; + } + } + } + gtk_tree_path_free(path); + break; + } } return FALSE; @@ -5562,9 +5617,12 @@ gtkblist = PIDGIN_BLIST(list); priv = PIDGIN_BUDDY_LIST_GET_PRIVATE(gtkblist); + if (priv->current_theme) + g_object_unref(priv->current_theme); + theme_name = purple_prefs_get_string(PIDGIN_PREFS_ROOT "/blist/theme"); if (theme_name && *theme_name) - priv->current_theme = PIDGIN_BLIST_THEME(purple_theme_manager_find_theme(theme_name, "blist")); + priv->current_theme = g_object_ref(PIDGIN_BLIST_THEME(purple_theme_manager_find_theme(theme_name, "blist"))); else priv->current_theme = NULL; @@ -6170,10 +6228,9 @@ if (count > 0 || purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_empty_groups")) show = TRUE; - else if (PURPLE_BLIST_NODE_IS_BUDDY(node)) { /* Or chat? */ - if (buddy_is_displayable((PurpleBuddy*)node)) - show = TRUE; - } else if (!show_offline && PURPLE_BLIST_NODE_IS_GROUP(node)) { + else if (PURPLE_BLIST_NODE_IS_BUDDY(node) && buddy_is_displayable((PurpleBuddy*)node)) { /* Or chat? */ + show = TRUE; + } else if (!show_offline) { show = pidgin_blist_group_has_show_offline_buddy(group); } @@ -6697,6 +6754,8 @@ gtkblist->arrow_cursor = NULL; priv = PIDGIN_BUDDY_LIST_GET_PRIVATE(gtkblist); + if (priv->current_theme) + g_object_unref(priv->current_theme); g_free(priv); g_free(gtkblist); @@ -7267,7 +7326,10 @@ else purple_prefs_set_string(PIDGIN_PREFS_ROOT "/blist/theme", ""); - priv->current_theme = theme; + if (priv->current_theme) + g_object_unref(priv->current_theme); + + priv->current_theme = theme ? g_object_ref(theme) : NULL; pidgin_blist_build_layout(list);