Mercurial > pidgin.yaz
comparison 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 |
comparison
equal
deleted
inserted
replaced
27949:a4a2090fd976 | 27950:fb593c327870 |
---|---|
1614 static gboolean | 1614 static gboolean |
1615 gtk_blist_key_press_cb(GtkWidget *tv, GdkEventKey *event, gpointer data) | 1615 gtk_blist_key_press_cb(GtkWidget *tv, GdkEventKey *event, gpointer data) |
1616 { | 1616 { |
1617 PurpleBlistNode *node; | 1617 PurpleBlistNode *node; |
1618 GValue val; | 1618 GValue val; |
1619 GtkTreeIter iter; | 1619 GtkTreeIter iter, parent; |
1620 GtkTreeSelection *sel; | 1620 GtkTreeSelection *sel; |
1621 GtkTreePath *path; | |
1621 | 1622 |
1622 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(tv)); | 1623 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(tv)); |
1623 if(!gtk_tree_selection_get_selected(sel, NULL, &iter)) | 1624 if(!gtk_tree_selection_get_selected(sel, NULL, &iter)) |
1624 return FALSE; | 1625 return FALSE; |
1625 | 1626 |
1639 } else { | 1640 } else { |
1640 return FALSE; | 1641 return FALSE; |
1641 } | 1642 } |
1642 if(buddy) | 1643 if(buddy) |
1643 pidgin_retrieve_user_info(buddy->account->gc, buddy->name); | 1644 pidgin_retrieve_user_info(buddy->account->gc, buddy->name); |
1644 } else if (event->keyval == GDK_F2) { | 1645 } else { |
1645 gtk_blist_menu_alias_cb(tv, node); | 1646 switch (event->keyval) { |
1647 case GDK_F2: | |
1648 gtk_blist_menu_alias_cb(tv, node); | |
1649 break; | |
1650 | |
1651 case GDK_Left: | |
1652 path = gtk_tree_model_get_path(GTK_TREE_MODEL(gtkblist->treemodel), &iter); | |
1653 if (gtk_tree_view_row_expanded(GTK_TREE_VIEW(tv), path)) { | |
1654 /* Collapse the Group */ | |
1655 gtk_tree_view_collapse_row(GTK_TREE_VIEW(tv), path); | |
1656 gtk_tree_path_free(path); | |
1657 return TRUE; | |
1658 } else { | |
1659 /* Select the Parent */ | |
1660 if (gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel), &iter, path)) { | |
1661 if (gtk_tree_model_iter_parent(GTK_TREE_MODEL(gtkblist->treemodel), &parent, &iter)) { | |
1662 gtk_tree_path_free(path); | |
1663 path = gtk_tree_model_get_path(GTK_TREE_MODEL(gtkblist->treemodel), &parent); | |
1664 gtk_tree_view_set_cursor(GTK_TREE_VIEW(tv), path, NULL, FALSE); | |
1665 gtk_tree_path_free(path); | |
1666 return TRUE; | |
1667 } | |
1668 } | |
1669 } | |
1670 gtk_tree_path_free(path); | |
1671 break; | |
1672 | |
1673 case GDK_Right: | |
1674 path = gtk_tree_model_get_path(GTK_TREE_MODEL(gtkblist->treemodel), &iter); | |
1675 if (!gtk_tree_view_row_expanded(GTK_TREE_VIEW(tv), path)) { | |
1676 /* Expand the Group */ | |
1677 if (PURPLE_BLIST_NODE_IS_CONTACT(node)) { | |
1678 pidgin_blist_expand_contact_cb(NULL, node); | |
1679 gtk_tree_path_free(path); | |
1680 return TRUE; | |
1681 } else if (!PURPLE_BLIST_NODE_IS_BUDDY(node)) { | |
1682 gtk_tree_view_expand_row(GTK_TREE_VIEW(tv), path, FALSE); | |
1683 gtk_tree_path_free(path); | |
1684 return TRUE; | |
1685 } | |
1686 } else { | |
1687 /* Select the First Child */ | |
1688 if (gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel), &parent, path)) { | |
1689 if (gtk_tree_model_iter_nth_child(GTK_TREE_MODEL(gtkblist->treemodel), &iter, &parent, 0)) { | |
1690 gtk_tree_path_free(path); | |
1691 path = gtk_tree_model_get_path(GTK_TREE_MODEL(gtkblist->treemodel), &iter); | |
1692 gtk_tree_view_set_cursor(GTK_TREE_VIEW(tv), path, NULL, FALSE); | |
1693 gtk_tree_path_free(path); | |
1694 return TRUE; | |
1695 } | |
1696 } | |
1697 } | |
1698 gtk_tree_path_free(path); | |
1699 break; | |
1700 } | |
1646 } | 1701 } |
1647 | 1702 |
1648 return FALSE; | 1703 return FALSE; |
1649 } | 1704 } |
1650 | 1705 |
5560 } | 5615 } |
5561 | 5616 |
5562 gtkblist = PIDGIN_BLIST(list); | 5617 gtkblist = PIDGIN_BLIST(list); |
5563 priv = PIDGIN_BUDDY_LIST_GET_PRIVATE(gtkblist); | 5618 priv = PIDGIN_BUDDY_LIST_GET_PRIVATE(gtkblist); |
5564 | 5619 |
5620 if (priv->current_theme) | |
5621 g_object_unref(priv->current_theme); | |
5622 | |
5565 theme_name = purple_prefs_get_string(PIDGIN_PREFS_ROOT "/blist/theme"); | 5623 theme_name = purple_prefs_get_string(PIDGIN_PREFS_ROOT "/blist/theme"); |
5566 if (theme_name && *theme_name) | 5624 if (theme_name && *theme_name) |
5567 priv->current_theme = PIDGIN_BLIST_THEME(purple_theme_manager_find_theme(theme_name, "blist")); | 5625 priv->current_theme = g_object_ref(PIDGIN_BLIST_THEME(purple_theme_manager_find_theme(theme_name, "blist"))); |
5568 else | 5626 else |
5569 priv->current_theme = NULL; | 5627 priv->current_theme = NULL; |
5570 | 5628 |
5571 gtkblist->empty_avatar = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, 32, 32); | 5629 gtkblist->empty_avatar = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, 32, 32); |
5572 gdk_pixbuf_fill(gtkblist->empty_avatar, 0x00000000); | 5630 gdk_pixbuf_fill(gtkblist->empty_avatar, 0x00000000); |
6168 else | 6226 else |
6169 count = purple_blist_get_group_online_count(group); | 6227 count = purple_blist_get_group_online_count(group); |
6170 | 6228 |
6171 if (count > 0 || purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_empty_groups")) | 6229 if (count > 0 || purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_empty_groups")) |
6172 show = TRUE; | 6230 show = TRUE; |
6173 else if (PURPLE_BLIST_NODE_IS_BUDDY(node)) { /* Or chat? */ | 6231 else if (PURPLE_BLIST_NODE_IS_BUDDY(node) && buddy_is_displayable((PurpleBuddy*)node)) { /* Or chat? */ |
6174 if (buddy_is_displayable((PurpleBuddy*)node)) | 6232 show = TRUE; |
6175 show = TRUE; | 6233 } else if (!show_offline) { |
6176 } else if (!show_offline && PURPLE_BLIST_NODE_IS_GROUP(node)) { | |
6177 show = pidgin_blist_group_has_show_offline_buddy(group); | 6234 show = pidgin_blist_group_has_show_offline_buddy(group); |
6178 } | 6235 } |
6179 | 6236 |
6180 if (show) { | 6237 if (show) { |
6181 gchar *title; | 6238 gchar *title; |
6695 gdk_cursor_unref(gtkblist->arrow_cursor); | 6752 gdk_cursor_unref(gtkblist->arrow_cursor); |
6696 gtkblist->hand_cursor = NULL; | 6753 gtkblist->hand_cursor = NULL; |
6697 gtkblist->arrow_cursor = NULL; | 6754 gtkblist->arrow_cursor = NULL; |
6698 | 6755 |
6699 priv = PIDGIN_BUDDY_LIST_GET_PRIVATE(gtkblist); | 6756 priv = PIDGIN_BUDDY_LIST_GET_PRIVATE(gtkblist); |
6757 if (priv->current_theme) | |
6758 g_object_unref(priv->current_theme); | |
6700 g_free(priv); | 6759 g_free(priv); |
6701 | 6760 |
6702 g_free(gtkblist); | 6761 g_free(gtkblist); |
6703 accountmenu = NULL; | 6762 accountmenu = NULL; |
6704 gtkblist = NULL; | 6763 gtkblist = NULL; |
7265 purple_prefs_set_string(PIDGIN_PREFS_ROOT "/blist/theme", | 7324 purple_prefs_set_string(PIDGIN_PREFS_ROOT "/blist/theme", |
7266 purple_theme_get_name(PURPLE_THEME(theme))); | 7325 purple_theme_get_name(PURPLE_THEME(theme))); |
7267 else | 7326 else |
7268 purple_prefs_set_string(PIDGIN_PREFS_ROOT "/blist/theme", ""); | 7327 purple_prefs_set_string(PIDGIN_PREFS_ROOT "/blist/theme", ""); |
7269 | 7328 |
7270 priv->current_theme = theme; | 7329 if (priv->current_theme) |
7330 g_object_unref(priv->current_theme); | |
7331 | |
7332 priv->current_theme = theme ? g_object_ref(theme) : NULL; | |
7271 | 7333 |
7272 pidgin_blist_build_layout(list); | 7334 pidgin_blist_build_layout(list); |
7273 | 7335 |
7274 pidgin_blist_refresh(list); | 7336 pidgin_blist_refresh(list); |
7275 } | 7337 } |