Mercurial > pidgin
comparison src/gtkblist.c @ 12600:e856f985a0b9
[gaim-migrate @ 14934]
Enable the extra warnings regardless of --enable-debug.
Enable FORTIFY_SOURCE regardless of --enable-debug, adding a --disable-fortify flag to configure.
Enable (well, stop disabling) the missing initializer warnings.
This leads to warnings with: GValue v = {0,}; that must be worked around.
Basically, instead of:
GValue v = {0,};
...
g_value_init(&v, G_TYPE_FOO); /* or other use of the GValue */
We'd need to do:
GValue v;
...
v.g_type = 0;
g_value_init(&v, G_TYPE_FOO); /* or other use of the GValue */
Fix several cases of missing initializers. I don't think any of these are bugs, but having this warning seems like a good idea. It might prevent us from making a mistake in the future.
While I was fixing missing initializers, I optimized substitute_simple_word in plugins/spellchk.c, in the same way as I did substitute_word before. Yes, I'm bad for committing these together.
Added a --enable-fatal-asserts flag to configure. As the name implies, this makes g_return_... guards fatal. This is a useful flag to run on a debug copy of Gaim. It will make it very clear if your changes have triggered one of these guards. It's also useful in detecting g_return_... abuse, which helps prevent crashes if Gaim is compiled with G_DISABLE_ASSERT defined.
committer: Tailor Script <tailor@pidgin.im>
author | Richard Laager <rlaager@wiktel.com> |
---|---|
date | Wed, 21 Dec 2005 18:36:19 +0000 |
parents | 37160dd563fa |
children | e63fb8e9f4ac |
comparison
equal
deleted
inserted
replaced
12599:e94c33909aa6 | 12600:e856f985a0b9 |
---|---|
292 static void gtk_blist_renderer_edited_cb(GtkCellRendererText *text_rend, char *arg1, | 292 static void gtk_blist_renderer_edited_cb(GtkCellRendererText *text_rend, char *arg1, |
293 char *arg2, gpointer nada) | 293 char *arg2, gpointer nada) |
294 { | 294 { |
295 GtkTreeIter iter; | 295 GtkTreeIter iter; |
296 GtkTreePath *path; | 296 GtkTreePath *path; |
297 GValue val = {0,}; | 297 GValue val; |
298 GaimBlistNode *node; | 298 GaimBlistNode *node; |
299 | 299 |
300 path = gtk_tree_path_new_from_string (arg1); | 300 path = gtk_tree_path_new_from_string (arg1); |
301 gtk_tree_model_get_iter (GTK_TREE_MODEL(gtkblist->treemodel), &iter, path); | 301 gtk_tree_model_get_iter (GTK_TREE_MODEL(gtkblist->treemodel), &iter, path); |
302 gtk_tree_path_free (path); | 302 gtk_tree_path_free (path); |
303 val.g_type = 0; | |
303 gtk_tree_model_get_value (GTK_TREE_MODEL(gtkblist->treemodel), &iter, NODE_COLUMN, &val); | 304 gtk_tree_model_get_value (GTK_TREE_MODEL(gtkblist->treemodel), &iter, NODE_COLUMN, &val); |
304 node = g_value_get_pointer(&val); | 305 node = g_value_get_pointer(&val); |
305 gtk_tree_view_set_enable_search (GTK_TREE_VIEW(gtkblist->treeview), TRUE); | 306 gtk_tree_view_set_enable_search (GTK_TREE_VIEW(gtkblist->treeview), TRUE); |
306 g_object_set(G_OBJECT(gtkblist->text_rend), "editable", FALSE, NULL); | 307 g_object_set(G_OBJECT(gtkblist->text_rend), "editable", FALSE, NULL); |
307 | 308 |
735 gtk_widget_show_all(data->window); | 736 gtk_widget_show_all(data->window); |
736 } | 737 } |
737 | 738 |
738 static void gtk_blist_row_expanded_cb(GtkTreeView *tv, GtkTreeIter *iter, GtkTreePath *path, gpointer user_data) { | 739 static void gtk_blist_row_expanded_cb(GtkTreeView *tv, GtkTreeIter *iter, GtkTreePath *path, gpointer user_data) { |
739 GaimBlistNode *node; | 740 GaimBlistNode *node; |
740 GValue val = {0,}; | 741 GValue val; |
741 | 742 |
743 val.g_type = 0; | |
742 gtk_tree_model_get_value(GTK_TREE_MODEL(gtkblist->treemodel), iter, NODE_COLUMN, &val); | 744 gtk_tree_model_get_value(GTK_TREE_MODEL(gtkblist->treemodel), iter, NODE_COLUMN, &val); |
743 | 745 |
744 node = g_value_get_pointer(&val); | 746 node = g_value_get_pointer(&val); |
745 | 747 |
746 if (GAIM_BLIST_NODE_IS_GROUP(node)) { | 748 if (GAIM_BLIST_NODE_IS_GROUP(node)) { |
748 } | 750 } |
749 } | 751 } |
750 | 752 |
751 static void gtk_blist_row_collapsed_cb(GtkTreeView *tv, GtkTreeIter *iter, GtkTreePath *path, gpointer user_data) { | 753 static void gtk_blist_row_collapsed_cb(GtkTreeView *tv, GtkTreeIter *iter, GtkTreePath *path, gpointer user_data) { |
752 GaimBlistNode *node; | 754 GaimBlistNode *node; |
753 GValue val = {0,}; | 755 GValue val; |
754 | 756 |
757 val.g_type = 0; | |
755 gtk_tree_model_get_value(GTK_TREE_MODEL(gtkblist->treemodel), iter, NODE_COLUMN, &val); | 758 gtk_tree_model_get_value(GTK_TREE_MODEL(gtkblist->treemodel), iter, NODE_COLUMN, &val); |
756 | 759 |
757 node = g_value_get_pointer(&val); | 760 node = g_value_get_pointer(&val); |
758 | 761 |
759 if (GAIM_BLIST_NODE_IS_GROUP(node)) { | 762 if (GAIM_BLIST_NODE_IS_GROUP(node)) { |
764 } | 767 } |
765 | 768 |
766 static void gtk_blist_row_activated_cb(GtkTreeView *tv, GtkTreePath *path, GtkTreeViewColumn *col, gpointer data) { | 769 static void gtk_blist_row_activated_cb(GtkTreeView *tv, GtkTreePath *path, GtkTreeViewColumn *col, gpointer data) { |
767 GaimBlistNode *node; | 770 GaimBlistNode *node; |
768 GtkTreeIter iter; | 771 GtkTreeIter iter; |
769 GValue val = { 0, }; | 772 GValue val; |
770 | 773 |
771 gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel), &iter, path); | 774 gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel), &iter, path); |
772 | 775 |
776 val.g_type = 0; | |
773 gtk_tree_model_get_value (GTK_TREE_MODEL(gtkblist->treemodel), &iter, NODE_COLUMN, &val); | 777 gtk_tree_model_get_value (GTK_TREE_MODEL(gtkblist->treemodel), &iter, NODE_COLUMN, &val); |
774 node = g_value_get_pointer(&val); | 778 node = g_value_get_pointer(&val); |
775 | 779 |
776 if(GAIM_BLIST_NODE_IS_CONTACT(node) || GAIM_BLIST_NODE_IS_BUDDY(node)) { | 780 if(GAIM_BLIST_NODE_IS_CONTACT(node) || GAIM_BLIST_NODE_IS_BUDDY(node)) { |
777 GaimBuddy *buddy; | 781 GaimBuddy *buddy; |
1074 } | 1078 } |
1075 | 1079 |
1076 static gboolean | 1080 static gboolean |
1077 gtk_blist_key_press_cb(GtkWidget *tv, GdkEventKey *event, gpointer data) { | 1081 gtk_blist_key_press_cb(GtkWidget *tv, GdkEventKey *event, gpointer data) { |
1078 GaimBlistNode *node; | 1082 GaimBlistNode *node; |
1079 GValue val = { 0, }; | 1083 GValue val; |
1080 GtkTreeIter iter; | 1084 GtkTreeIter iter; |
1081 GtkTreeSelection *sel; | 1085 GtkTreeSelection *sel; |
1082 | 1086 |
1083 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(tv)); | 1087 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(tv)); |
1084 if(!gtk_tree_selection_get_selected(sel, NULL, &iter)) | 1088 if(!gtk_tree_selection_get_selected(sel, NULL, &iter)) |
1085 return FALSE; | 1089 return FALSE; |
1086 | 1090 |
1091 val.g_type = 0; | |
1087 gtk_tree_model_get_value(GTK_TREE_MODEL(gtkblist->treemodel), &iter, | 1092 gtk_tree_model_get_value(GTK_TREE_MODEL(gtkblist->treemodel), &iter, |
1088 NODE_COLUMN, &val); | 1093 NODE_COLUMN, &val); |
1089 node = g_value_get_pointer(&val); | 1094 node = g_value_get_pointer(&val); |
1090 | 1095 |
1091 if(event->state & GDK_CONTROL_MASK && | 1096 if(event->state & GDK_CONTROL_MASK && |
1307 | 1312 |
1308 static gboolean gtk_blist_button_press_cb(GtkWidget *tv, GdkEventButton *event, gpointer user_data) | 1313 static gboolean gtk_blist_button_press_cb(GtkWidget *tv, GdkEventButton *event, gpointer user_data) |
1309 { | 1314 { |
1310 GtkTreePath *path; | 1315 GtkTreePath *path; |
1311 GaimBlistNode *node; | 1316 GaimBlistNode *node; |
1312 GValue val = { 0, }; | 1317 GValue val; |
1313 GtkTreeIter iter; | 1318 GtkTreeIter iter; |
1314 GtkTreeSelection *sel; | 1319 GtkTreeSelection *sel; |
1315 GaimPlugin *prpl = NULL; | 1320 GaimPlugin *prpl = NULL; |
1316 GaimPluginProtocolInfo *prpl_info = NULL; | 1321 GaimPluginProtocolInfo *prpl_info = NULL; |
1317 struct _gaim_gtk_blist_node *gtknode; | 1322 struct _gaim_gtk_blist_node *gtknode; |
1319 | 1324 |
1320 /* Here we figure out which node was clicked */ | 1325 /* Here we figure out which node was clicked */ |
1321 if (!gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(tv), event->x, event->y, &path, NULL, NULL, NULL)) | 1326 if (!gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(tv), event->x, event->y, &path, NULL, NULL, NULL)) |
1322 return FALSE; | 1327 return FALSE; |
1323 gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel), &iter, path); | 1328 gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel), &iter, path); |
1329 val.g_type = 0; | |
1324 gtk_tree_model_get_value(GTK_TREE_MODEL(gtkblist->treemodel), &iter, NODE_COLUMN, &val); | 1330 gtk_tree_model_get_value(GTK_TREE_MODEL(gtkblist->treemodel), &iter, NODE_COLUMN, &val); |
1325 node = g_value_get_pointer(&val); | 1331 node = g_value_get_pointer(&val); |
1326 gtknode = (struct _gaim_gtk_blist_node *)node->ui_data; | 1332 gtknode = (struct _gaim_gtk_blist_node *)node->ui_data; |
1327 | 1333 |
1328 /* Right click draws a context menu */ | 1334 /* Right click draws a context menu */ |
1379 | 1385 |
1380 static gboolean | 1386 static gboolean |
1381 gaim_gtk_blist_popup_menu_cb(GtkWidget *tv, void *user_data) | 1387 gaim_gtk_blist_popup_menu_cb(GtkWidget *tv, void *user_data) |
1382 { | 1388 { |
1383 GaimBlistNode *node; | 1389 GaimBlistNode *node; |
1384 GValue val = { 0, }; | 1390 GValue val; |
1385 GtkTreeIter iter; | 1391 GtkTreeIter iter; |
1386 GtkTreeSelection *sel; | 1392 GtkTreeSelection *sel; |
1387 gboolean handled = FALSE; | 1393 gboolean handled = FALSE; |
1388 | 1394 |
1389 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(tv)); | 1395 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(tv)); |
1390 if (!gtk_tree_selection_get_selected(sel, NULL, &iter)) | 1396 if (!gtk_tree_selection_get_selected(sel, NULL, &iter)) |
1391 return FALSE; | 1397 return FALSE; |
1392 | 1398 |
1399 val.g_type = 0; | |
1393 gtk_tree_model_get_value(GTK_TREE_MODEL(gtkblist->treemodel), | 1400 gtk_tree_model_get_value(GTK_TREE_MODEL(gtkblist->treemodel), |
1394 &iter, NODE_COLUMN, &val); | 1401 &iter, NODE_COLUMN, &val); |
1395 node = g_value_get_pointer(&val); | 1402 node = g_value_get_pointer(&val); |
1396 | 1403 |
1397 /* Shift+F10 draws a context menu */ | 1404 /* Shift+F10 draws a context menu */ |
1637 { | 1644 { |
1638 GtkTreeRowReference *ref = g_object_get_data(G_OBJECT(dc), "gtk-tree-view-source-row"); | 1645 GtkTreeRowReference *ref = g_object_get_data(G_OBJECT(dc), "gtk-tree-view-source-row"); |
1639 GtkTreePath *sourcerow = gtk_tree_row_reference_get_path(ref); | 1646 GtkTreePath *sourcerow = gtk_tree_row_reference_get_path(ref); |
1640 GtkTreeIter iter; | 1647 GtkTreeIter iter; |
1641 GaimBlistNode *node = NULL; | 1648 GaimBlistNode *node = NULL; |
1642 GValue val = {0}; | 1649 GValue val; |
1643 if(!sourcerow) | 1650 if(!sourcerow) |
1644 return; | 1651 return; |
1645 gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel), &iter, sourcerow); | 1652 gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel), &iter, sourcerow); |
1653 val.g_type = 0; | |
1646 gtk_tree_model_get_value (GTK_TREE_MODEL(gtkblist->treemodel), &iter, NODE_COLUMN, &val); | 1654 gtk_tree_model_get_value (GTK_TREE_MODEL(gtkblist->treemodel), &iter, NODE_COLUMN, &val); |
1647 node = g_value_get_pointer(&val); | 1655 node = g_value_get_pointer(&val); |
1648 gtk_selection_data_set (data, | 1656 gtk_selection_data_set (data, |
1649 gdk_atom_intern ("GAIM_BLIST_NODE", FALSE), | 1657 gdk_atom_intern ("GAIM_BLIST_NODE", FALSE), |
1650 8, /* bits */ | 1658 8, /* bits */ |
1659 GtkTreePath *sourcerow; | 1667 GtkTreePath *sourcerow; |
1660 GtkTreeIter iter; | 1668 GtkTreeIter iter; |
1661 GaimBlistNode *node = NULL; | 1669 GaimBlistNode *node = NULL; |
1662 GaimBuddy *buddy; | 1670 GaimBuddy *buddy; |
1663 GaimConnection *gc; | 1671 GaimConnection *gc; |
1664 GValue val = {0}; | 1672 GValue val; |
1665 GString *str; | 1673 GString *str; |
1666 const char *protocol; | 1674 const char *protocol; |
1667 char *mime_str; | 1675 char *mime_str; |
1668 | 1676 |
1669 ref = g_object_get_data(G_OBJECT(dc), "gtk-tree-view-source-row"); | 1677 ref = g_object_get_data(G_OBJECT(dc), "gtk-tree-view-source-row"); |
1672 if (!sourcerow) | 1680 if (!sourcerow) |
1673 return; | 1681 return; |
1674 | 1682 |
1675 gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel), &iter, | 1683 gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel), &iter, |
1676 sourcerow); | 1684 sourcerow); |
1685 val.g_type = 0; | |
1677 gtk_tree_model_get_value(GTK_TREE_MODEL(gtkblist->treemodel), &iter, | 1686 gtk_tree_model_get_value(GTK_TREE_MODEL(gtkblist->treemodel), &iter, |
1678 NODE_COLUMN, &val); | 1687 NODE_COLUMN, &val); |
1679 | 1688 |
1680 node = g_value_get_pointer(&val); | 1689 node = g_value_get_pointer(&val); |
1681 | 1690 |
1746 memcpy(&n, sd->data, sizeof(n)); | 1755 memcpy(&n, sd->data, sizeof(n)); |
1747 if(gtk_tree_view_get_dest_row_at_pos(GTK_TREE_VIEW(widget), x, y, &path, &position)) { | 1756 if(gtk_tree_view_get_dest_row_at_pos(GTK_TREE_VIEW(widget), x, y, &path, &position)) { |
1748 /* if we're here, I think it means the drop is ok */ | 1757 /* if we're here, I think it means the drop is ok */ |
1749 GtkTreeIter iter; | 1758 GtkTreeIter iter; |
1750 GaimBlistNode *node; | 1759 GaimBlistNode *node; |
1751 GValue val = {0}; | 1760 GValue val; |
1752 struct _gaim_gtk_blist_node *gtknode; | 1761 struct _gaim_gtk_blist_node *gtknode; |
1753 | 1762 |
1754 gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel), | 1763 gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel), |
1755 &iter, path); | 1764 &iter, path); |
1765 val.g_type = 0; | |
1756 gtk_tree_model_get_value (GTK_TREE_MODEL(gtkblist->treemodel), | 1766 gtk_tree_model_get_value (GTK_TREE_MODEL(gtkblist->treemodel), |
1757 &iter, NODE_COLUMN, &val); | 1767 &iter, NODE_COLUMN, &val); |
1758 node = g_value_get_pointer(&val); | 1768 node = g_value_get_pointer(&val); |
1759 gtknode = node->ui_data; | 1769 gtknode = node->ui_data; |
1760 | 1770 |
1901 if (gtk_tree_view_get_dest_row_at_pos(GTK_TREE_VIEW(widget), | 1911 if (gtk_tree_view_get_dest_row_at_pos(GTK_TREE_VIEW(widget), |
1902 x, y, &path, &position)) | 1912 x, y, &path, &position)) |
1903 { | 1913 { |
1904 GtkTreeIter iter; | 1914 GtkTreeIter iter; |
1905 GaimBlistNode *node; | 1915 GaimBlistNode *node; |
1906 GValue val = {0}; | 1916 GValue val; |
1907 | 1917 |
1908 gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel), | 1918 gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel), |
1909 &iter, path); | 1919 &iter, path); |
1920 val.g_type = 0; | |
1910 gtk_tree_model_get_value (GTK_TREE_MODEL(gtkblist->treemodel), | 1921 gtk_tree_model_get_value (GTK_TREE_MODEL(gtkblist->treemodel), |
1911 &iter, NODE_COLUMN, &val); | 1922 &iter, NODE_COLUMN, &val); |
1912 node = g_value_get_pointer(&val); | 1923 node = g_value_get_pointer(&val); |
1913 | 1924 |
1914 if (GAIM_BLIST_NODE_IS_BUDDY(node)) | 1925 if (GAIM_BLIST_NODE_IS_BUDDY(node)) |
1962 if (gtk_tree_view_get_dest_row_at_pos(GTK_TREE_VIEW(widget), | 1973 if (gtk_tree_view_get_dest_row_at_pos(GTK_TREE_VIEW(widget), |
1963 x, y, &path, &position)) | 1974 x, y, &path, &position)) |
1964 { | 1975 { |
1965 GtkTreeIter iter; | 1976 GtkTreeIter iter; |
1966 GaimBlistNode *node; | 1977 GaimBlistNode *node; |
1967 GValue val = {0}; | 1978 GValue val; |
1968 | 1979 |
1969 gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel), | 1980 gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel), |
1970 &iter, path); | 1981 &iter, path); |
1982 val.g_type = 0; | |
1971 gtk_tree_model_get_value (GTK_TREE_MODEL(gtkblist->treemodel), | 1983 gtk_tree_model_get_value (GTK_TREE_MODEL(gtkblist->treemodel), |
1972 &iter, NODE_COLUMN, &val); | 1984 &iter, NODE_COLUMN, &val); |
1973 node = g_value_get_pointer(&val); | 1985 node = g_value_get_pointer(&val); |
1974 | 1986 |
1975 if (GAIM_BLIST_NODE_IS_BUDDY(node)) | 1987 if (GAIM_BLIST_NODE_IS_BUDDY(node)) |
1997 if (gtk_tree_view_get_dest_row_at_pos(GTK_TREE_VIEW(widget), | 2009 if (gtk_tree_view_get_dest_row_at_pos(GTK_TREE_VIEW(widget), |
1998 x, y, &path, &position)) | 2010 x, y, &path, &position)) |
1999 { | 2011 { |
2000 GtkTreeIter iter; | 2012 GtkTreeIter iter; |
2001 GaimBlistNode *node; | 2013 GaimBlistNode *node; |
2002 GValue val = {0}; | 2014 GValue val; |
2003 | 2015 |
2004 gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel), | 2016 gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel), |
2005 &iter, path); | 2017 &iter, path); |
2018 val.g_type = 0; | |
2006 gtk_tree_model_get_value (GTK_TREE_MODEL(gtkblist->treemodel), | 2019 gtk_tree_model_get_value (GTK_TREE_MODEL(gtkblist->treemodel), |
2007 &iter, NODE_COLUMN, &val); | 2020 &iter, NODE_COLUMN, &val); |
2008 node = g_value_get_pointer(&val); | 2021 node = g_value_get_pointer(&val); |
2009 | 2022 |
2010 if (GAIM_BLIST_NODE_IS_BUDDY(node) || GAIM_BLIST_NODE_IS_CONTACT(node)) { | 2023 if (GAIM_BLIST_NODE_IS_BUDDY(node) || GAIM_BLIST_NODE_IS_CONTACT(node)) { |
2210 static gboolean gaim_gtk_blist_expand_timeout(GtkWidget *tv) | 2223 static gboolean gaim_gtk_blist_expand_timeout(GtkWidget *tv) |
2211 { | 2224 { |
2212 GtkTreePath *path; | 2225 GtkTreePath *path; |
2213 GtkTreeIter iter; | 2226 GtkTreeIter iter; |
2214 GaimBlistNode *node; | 2227 GaimBlistNode *node; |
2215 GValue val = {0}; | 2228 GValue val; |
2216 struct _gaim_gtk_blist_node *gtknode; | 2229 struct _gaim_gtk_blist_node *gtknode; |
2217 | 2230 |
2218 if (!gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(tv), gtkblist->tip_rect.x, gtkblist->tip_rect.y, &path, NULL, NULL, NULL)) | 2231 if (!gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(tv), gtkblist->tip_rect.x, gtkblist->tip_rect.y, &path, NULL, NULL, NULL)) |
2219 return FALSE; | 2232 return FALSE; |
2220 gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel), &iter, path); | 2233 gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel), &iter, path); |
2234 val.g_type = 0; | |
2221 gtk_tree_model_get_value (GTK_TREE_MODEL(gtkblist->treemodel), &iter, NODE_COLUMN, &val); | 2235 gtk_tree_model_get_value (GTK_TREE_MODEL(gtkblist->treemodel), &iter, NODE_COLUMN, &val); |
2222 node = g_value_get_pointer(&val); | 2236 node = g_value_get_pointer(&val); |
2223 | 2237 |
2224 if(!GAIM_BLIST_NODE_IS_CONTACT(node)) { | 2238 if(!GAIM_BLIST_NODE_IS_CONTACT(node)) { |
2225 gtk_tree_path_free(path); | 2239 gtk_tree_path_free(path); |
2267 static gboolean gaim_gtk_blist_tooltip_timeout(GtkWidget *tv) | 2281 static gboolean gaim_gtk_blist_tooltip_timeout(GtkWidget *tv) |
2268 { | 2282 { |
2269 GtkTreePath *path; | 2283 GtkTreePath *path; |
2270 GtkTreeIter iter; | 2284 GtkTreeIter iter; |
2271 GaimBlistNode *node; | 2285 GaimBlistNode *node; |
2272 GValue val = {0}; | 2286 GValue val; |
2273 int scr_w, scr_h, w, h, x, y; | 2287 int scr_w, scr_h, w, h, x, y; |
2274 #if GTK_CHECK_VERSION(2,2,0) | 2288 #if GTK_CHECK_VERSION(2,2,0) |
2275 int mon_num; | 2289 int mon_num; |
2276 GdkScreen *screen = NULL; | 2290 GdkScreen *screen = NULL; |
2277 #endif | 2291 #endif |
2286 gaim_gtk_blist_tooltip_destroy(); | 2300 gaim_gtk_blist_tooltip_destroy(); |
2287 | 2301 |
2288 if (!gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(tv), gtkblist->tip_rect.x, gtkblist->tip_rect.y, &path, NULL, NULL, NULL)) | 2302 if (!gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(tv), gtkblist->tip_rect.x, gtkblist->tip_rect.y, &path, NULL, NULL, NULL)) |
2289 return FALSE; | 2303 return FALSE; |
2290 gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel), &iter, path); | 2304 gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel), &iter, path); |
2305 val.g_type = 0; | |
2291 gtk_tree_model_get_value (GTK_TREE_MODEL(gtkblist->treemodel), &iter, NODE_COLUMN, &val); | 2306 gtk_tree_model_get_value (GTK_TREE_MODEL(gtkblist->treemodel), &iter, NODE_COLUMN, &val); |
2292 node = g_value_get_pointer(&val); | 2307 node = g_value_get_pointer(&val); |
2293 | 2308 |
2294 gtk_tree_path_free(path); | 2309 gtk_tree_path_free(path); |
2295 | 2310 |
2495 * Crap * | 2510 * Crap * |
2496 ***************************************************/ | 2511 ***************************************************/ |
2497 static GtkItemFactoryEntry blist_menu[] = | 2512 static GtkItemFactoryEntry blist_menu[] = |
2498 { | 2513 { |
2499 /* Buddies menu */ | 2514 /* Buddies menu */ |
2500 { N_("/_Buddies"), NULL, NULL, 0, "<Branch>" }, | 2515 { N_("/_Buddies"), NULL, NULL, 0, "<Branch>", NULL }, |
2501 { N_("/Buddies/New Instant _Message..."), "<CTL>M", gaim_gtkdialogs_im, 0, "<StockItem>", GAIM_STOCK_IM }, | 2516 { N_("/Buddies/New Instant _Message..."), "<CTL>M", gaim_gtkdialogs_im, 0, "<StockItem>", GAIM_STOCK_IM }, |
2502 { N_("/Buddies/Join a _Chat..."), "<CTL>C", gaim_gtk_blist_joinchat_show, 0, "<StockItem>", GAIM_STOCK_CHAT }, | 2517 { N_("/Buddies/Join a _Chat..."), "<CTL>C", gaim_gtk_blist_joinchat_show, 0, "<StockItem>", GAIM_STOCK_CHAT }, |
2503 { N_("/Buddies/Get User _Info..."), "<CTL>I", gaim_gtkdialogs_info, 0, "<StockItem>", GAIM_STOCK_INFO }, | 2518 { N_("/Buddies/Get User _Info..."), "<CTL>I", gaim_gtkdialogs_info, 0, "<StockItem>", GAIM_STOCK_INFO }, |
2504 { N_("/Buddies/View User _Log..."), "<CTL>L", gaim_gtkdialogs_log, 0, "<StockItem>", GAIM_STOCK_LOG }, | 2519 { N_("/Buddies/View User _Log..."), "<CTL>L", gaim_gtkdialogs_log, 0, "<StockItem>", GAIM_STOCK_LOG }, |
2505 { "/Buddies/sep1", NULL, NULL, 0, "<Separator>" }, | 2520 { "/Buddies/sep1", NULL, NULL, 0, "<Separator>", NULL }, |
2506 { N_("/Buddies/Show _Offline Buddies"), NULL, gaim_gtk_blist_edit_mode_cb, 1, "<CheckItem>"}, | 2521 { N_("/Buddies/Show _Offline Buddies"), NULL, gaim_gtk_blist_edit_mode_cb, 1, "<CheckItem>", NULL }, |
2507 { N_("/Buddies/Show _Empty Groups"), NULL, gaim_gtk_blist_show_empty_groups_cb, 1, "<CheckItem>"}, | 2522 { N_("/Buddies/Show _Empty Groups"), NULL, gaim_gtk_blist_show_empty_groups_cb, 1, "<CheckItem>", NULL }, |
2508 { N_("/Buddies/Show Buddy _Details"), NULL, gaim_gtk_blist_buddy_details_cb, 1, "<CheckItem>"}, | 2523 { N_("/Buddies/Show Buddy _Details"), NULL, gaim_gtk_blist_buddy_details_cb, 1, "<CheckItem>", NULL }, |
2509 { N_("/Buddies/_Sort Buddies"), NULL, NULL, 0, "<Branch>" }, | 2524 { N_("/Buddies/_Sort Buddies"), NULL, NULL, 0, "<Branch>", NULL }, |
2510 { "/Buddies/sep2", NULL, NULL, 0, "<Separator>" }, | 2525 { "/Buddies/sep2", NULL, NULL, 0, "<Separator>", NULL }, |
2511 { N_("/Buddies/_Add Buddy..."), "<CTL>B", gaim_gtk_blist_add_buddy_cb, 0, "<StockItem>", GTK_STOCK_ADD }, | 2526 { N_("/Buddies/_Add Buddy..."), "<CTL>B", gaim_gtk_blist_add_buddy_cb, 0, "<StockItem>", GTK_STOCK_ADD }, |
2512 { N_("/Buddies/Add C_hat..."), NULL, gaim_gtk_blist_add_chat_cb, 0, "<StockItem>", GTK_STOCK_ADD }, | 2527 { N_("/Buddies/Add C_hat..."), NULL, gaim_gtk_blist_add_chat_cb, 0, "<StockItem>", GTK_STOCK_ADD }, |
2513 { N_("/Buddies/Add _Group..."), NULL, gaim_blist_request_add_group, 0, "<StockItem>", GTK_STOCK_ADD }, | 2528 { N_("/Buddies/Add _Group..."), NULL, gaim_blist_request_add_group, 0, "<StockItem>", GTK_STOCK_ADD }, |
2514 { "/Buddies/sep2", NULL, NULL, 0, "<Separator>" }, | 2529 { "/Buddies/sep2", NULL, NULL, 0, "<Separator>", NULL }, |
2515 { N_("/Buddies/_Quit"), "<CTL>Q", gaim_core_quit, 0, "<StockItem>", GTK_STOCK_QUIT }, | 2530 { N_("/Buddies/_Quit"), "<CTL>Q", gaim_core_quit, 0, "<StockItem>", GTK_STOCK_QUIT }, |
2516 | 2531 |
2517 /* Accounts menu */ | 2532 /* Accounts menu */ |
2518 { N_("/_Accounts"), NULL, NULL, 0, "<Branch>" }, | 2533 { N_("/_Accounts"), NULL, NULL, 0, "<Branch>", NULL }, |
2519 { N_("/Accounts/Add\\/Edit"), "<CTL>A", gaim_gtk_accounts_window_show, 0, "<StockItem>", GAIM_STOCK_ACCOUNTS }, | 2534 { N_("/Accounts/Add\\/Edit"), "<CTL>A", gaim_gtk_accounts_window_show, 0, "<StockItem>", GAIM_STOCK_ACCOUNTS }, |
2520 | 2535 |
2521 /* Tools */ | 2536 /* Tools */ |
2522 { N_("/_Tools"), NULL, NULL, 0, "<Branch>" }, | 2537 { N_("/_Tools"), NULL, NULL, 0, "<Branch>", NULL }, |
2523 { N_("/Tools/Buddy _Pounces"), NULL, gaim_gtk_pounces_manager_show, 0, "<StockItem>", GAIM_STOCK_POUNCE }, | 2538 { N_("/Tools/Buddy _Pounces"), NULL, gaim_gtk_pounces_manager_show, 0, "<StockItem>", GAIM_STOCK_POUNCE }, |
2524 { N_("/Tools/Plu_gins"), "<CTL>U", gaim_gtk_plugin_dialog_show, 0, "<StockItem>", GAIM_STOCK_PLUGIN }, | 2539 { N_("/Tools/Plu_gins"), "<CTL>U", gaim_gtk_plugin_dialog_show, 0, "<StockItem>", GAIM_STOCK_PLUGIN }, |
2525 { N_("/Tools/Pr_eferences"), "<CTL>P", gaim_gtk_prefs_show, 0, "<StockItem>", GTK_STOCK_PREFERENCES }, | 2540 { N_("/Tools/Pr_eferences"), "<CTL>P", gaim_gtk_prefs_show, 0, "<StockItem>", GTK_STOCK_PREFERENCES }, |
2526 { N_("/Tools/Pr_ivacy"), NULL, gaim_gtk_privacy_dialog_show, 0, "<StockItem>", GTK_STOCK_DIALOG_ERROR }, | 2541 { N_("/Tools/Pr_ivacy"), NULL, gaim_gtk_privacy_dialog_show, 0, "<StockItem>", GTK_STOCK_DIALOG_ERROR }, |
2527 { "/Tools/sep2", NULL, NULL, 0, "<Separator>" }, | 2542 { "/Tools/sep2", NULL, NULL, 0, "<Separator>", NULL }, |
2528 { N_("/Tools/_File Transfers"), "<CTL>T", gaim_show_xfer_dialog, 0, "<StockItem>", GAIM_STOCK_FILE_TRANSFER }, | 2543 { N_("/Tools/_File Transfers"), "<CTL>T", gaim_show_xfer_dialog, 0, "<StockItem>", GAIM_STOCK_FILE_TRANSFER }, |
2529 { N_("/Tools/R_oom List"), NULL, gaim_gtk_roomlist_dialog_show, 0, "<StockItem>", GTK_STOCK_INDEX }, | 2544 { N_("/Tools/R_oom List"), NULL, gaim_gtk_roomlist_dialog_show, 0, "<StockItem>", GTK_STOCK_INDEX }, |
2530 { N_("/Tools/System _Log"), NULL, gtk_blist_show_systemlog_cb, 0, "<StockItem>", GAIM_STOCK_LOG }, | 2545 { N_("/Tools/System _Log"), NULL, gtk_blist_show_systemlog_cb, 0, "<StockItem>", GAIM_STOCK_LOG }, |
2531 { "/Tools/sep3", NULL, NULL, 0, "<Separator>" }, | 2546 { "/Tools/sep3", NULL, NULL, 0, "<Separator>", NULL }, |
2532 { N_("/Tools/Mute _Sounds"), "<CTL>S", gaim_gtk_blist_mute_sounds_cb, 0, "<CheckItem>"}, | 2547 { N_("/Tools/Mute _Sounds"), "<CTL>S", gaim_gtk_blist_mute_sounds_cb, 0, "<CheckItem>", NULL }, |
2533 | 2548 |
2534 /* Help */ | 2549 /* Help */ |
2535 { N_("/_Help"), NULL, NULL, 0, "<Branch>" }, | 2550 { N_("/_Help"), NULL, NULL, 0, "<Branch>", NULL }, |
2536 { N_("/Help/Online _Help"), "F1", gtk_blist_show_onlinehelp_cb, 0, "<StockItem>", GTK_STOCK_HELP }, | 2551 { N_("/Help/Online _Help"), "F1", gtk_blist_show_onlinehelp_cb, 0, "<StockItem>", GTK_STOCK_HELP }, |
2537 { N_("/Help/_Debug Window"), NULL, toggle_debug, 0, "<StockItem>", GAIM_STOCK_DEBUG }, | 2552 { N_("/Help/_Debug Window"), NULL, toggle_debug, 0, "<StockItem>", GAIM_STOCK_DEBUG }, |
2538 { N_("/Help/_About"), NULL, gaim_gtkdialogs_about, 0, "<StockItem>", GAIM_STOCK_ABOUT }, | 2553 { N_("/Help/_About"), NULL, gaim_gtkdialogs_about, 0, "<StockItem>", GAIM_STOCK_ABOUT }, |
2539 }; | 2554 }; |
2540 | 2555 |
5094 #if GTK_CHECK_VERSION(2,2,1) | 5109 #if GTK_CHECK_VERSION(2,2,1) |
5095 | 5110 |
5096 static void sort_method_alphabetical(GaimBlistNode *node, GaimBuddyList *blist, GtkTreeIter groupiter, GtkTreeIter *cur, GtkTreeIter *iter) | 5111 static void sort_method_alphabetical(GaimBlistNode *node, GaimBuddyList *blist, GtkTreeIter groupiter, GtkTreeIter *cur, GtkTreeIter *iter) |
5097 { | 5112 { |
5098 GtkTreeIter more_z; | 5113 GtkTreeIter more_z; |
5099 GaimBlistNode *n; | |
5100 GValue val = {0,}; | |
5101 | 5114 |
5102 const char *my_name; | 5115 const char *my_name; |
5103 | 5116 |
5104 if(GAIM_BLIST_NODE_IS_CONTACT(node)) { | 5117 if(GAIM_BLIST_NODE_IS_CONTACT(node)) { |
5105 my_name = gaim_contact_get_alias((GaimContact*)node); | 5118 my_name = gaim_contact_get_alias((GaimContact*)node); |
5115 gtk_tree_store_insert(gtkblist->treemodel, iter, &groupiter, 0); | 5128 gtk_tree_store_insert(gtkblist->treemodel, iter, &groupiter, 0); |
5116 return; | 5129 return; |
5117 } | 5130 } |
5118 | 5131 |
5119 do { | 5132 do { |
5133 GValue val; | |
5134 GaimBlistNode *n; | |
5120 const char *this_name; | 5135 const char *this_name; |
5121 int cmp; | 5136 int cmp; |
5122 | 5137 |
5138 val.g_type = 0; | |
5123 gtk_tree_model_get_value (GTK_TREE_MODEL(gtkblist->treemodel), &more_z, NODE_COLUMN, &val); | 5139 gtk_tree_model_get_value (GTK_TREE_MODEL(gtkblist->treemodel), &more_z, NODE_COLUMN, &val); |
5124 n = g_value_get_pointer(&val); | 5140 n = g_value_get_pointer(&val); |
5125 | 5141 |
5126 if(GAIM_BLIST_NODE_IS_CONTACT(n)) { | 5142 if(GAIM_BLIST_NODE_IS_CONTACT(n)) { |
5127 this_name = gaim_contact_get_alias((GaimContact*)n); | 5143 this_name = gaim_contact_get_alias((GaimContact*)n); |
5158 } | 5174 } |
5159 | 5175 |
5160 static void sort_method_status(GaimBlistNode *node, GaimBuddyList *blist, GtkTreeIter groupiter, GtkTreeIter *cur, GtkTreeIter *iter) | 5176 static void sort_method_status(GaimBlistNode *node, GaimBuddyList *blist, GtkTreeIter groupiter, GtkTreeIter *cur, GtkTreeIter *iter) |
5161 { | 5177 { |
5162 GtkTreeIter more_z; | 5178 GtkTreeIter more_z; |
5163 GaimBlistNode *n; | |
5164 GValue val = {0,}; | |
5165 | 5179 |
5166 GaimBuddy *my_buddy, *this_buddy; | 5180 GaimBuddy *my_buddy, *this_buddy; |
5167 | 5181 |
5168 if(GAIM_BLIST_NODE_IS_CONTACT(node)) { | 5182 if(GAIM_BLIST_NODE_IS_CONTACT(node)) { |
5169 my_buddy = gaim_contact_get_priority_buddy((GaimContact*)node); | 5183 my_buddy = gaim_contact_get_priority_buddy((GaimContact*)node); |
5185 gtk_tree_store_insert(gtkblist->treemodel, iter, &groupiter, 0); | 5199 gtk_tree_store_insert(gtkblist->treemodel, iter, &groupiter, 0); |
5186 return; | 5200 return; |
5187 } | 5201 } |
5188 | 5202 |
5189 do { | 5203 do { |
5204 GValue val; | |
5205 GaimBlistNode *n; | |
5190 gint name_cmp; | 5206 gint name_cmp; |
5191 gint presence_cmp; | 5207 gint presence_cmp; |
5192 | 5208 |
5209 val.g_type = 0; | |
5193 gtk_tree_model_get_value (GTK_TREE_MODEL(gtkblist->treemodel), &more_z, NODE_COLUMN, &val); | 5210 gtk_tree_model_get_value (GTK_TREE_MODEL(gtkblist->treemodel), &more_z, NODE_COLUMN, &val); |
5194 n = g_value_get_pointer(&val); | 5211 n = g_value_get_pointer(&val); |
5195 | 5212 |
5196 if(GAIM_BLIST_NODE_IS_CONTACT(n)) { | 5213 if(GAIM_BLIST_NODE_IS_CONTACT(n)) { |
5197 this_buddy = gaim_contact_get_priority_buddy((GaimContact*)n); | 5214 this_buddy = gaim_contact_get_priority_buddy((GaimContact*)n); |
5246 } | 5263 } |
5247 | 5264 |
5248 static void sort_method_log(GaimBlistNode *node, GaimBuddyList *blist, GtkTreeIter groupiter, GtkTreeIter *cur, GtkTreeIter *iter) | 5265 static void sort_method_log(GaimBlistNode *node, GaimBuddyList *blist, GtkTreeIter groupiter, GtkTreeIter *cur, GtkTreeIter *iter) |
5249 { | 5266 { |
5250 GtkTreeIter more_z; | 5267 GtkTreeIter more_z; |
5251 GaimBlistNode *n = NULL, *n2; | |
5252 GValue val = {0,}; | |
5253 | 5268 |
5254 int log_size = 0, this_log_size = 0; | 5269 int log_size = 0, this_log_size = 0; |
5255 const char *buddy_name, *this_buddy_name; | 5270 const char *buddy_name, *this_buddy_name; |
5256 | 5271 |
5257 if(cur && (gtk_tree_model_iter_n_children(GTK_TREE_MODEL(gtkblist->treemodel), &groupiter) == 1)) { | 5272 if(cur && (gtk_tree_model_iter_n_children(GTK_TREE_MODEL(gtkblist->treemodel), &groupiter) == 1)) { |
5258 *iter = *cur; | 5273 *iter = *cur; |
5259 return; | 5274 return; |
5260 } | 5275 } |
5261 | 5276 |
5262 if(GAIM_BLIST_NODE_IS_CONTACT(node)) { | 5277 if(GAIM_BLIST_NODE_IS_CONTACT(node)) { |
5278 GaimBlistNode *n; | |
5263 for (n = node->child; n; n = n->next) | 5279 for (n = node->child; n; n = n->next) |
5264 log_size += gaim_log_get_total_size(GAIM_LOG_IM, ((GaimBuddy*)(n))->name, ((GaimBuddy*)(n))->account); | 5280 log_size += gaim_log_get_total_size(GAIM_LOG_IM, ((GaimBuddy*)(n))->name, ((GaimBuddy*)(n))->account); |
5265 buddy_name = gaim_contact_get_alias((GaimContact*)node); | 5281 buddy_name = gaim_contact_get_alias((GaimContact*)node); |
5266 } else if(GAIM_BLIST_NODE_IS_CHAT(node)) { | 5282 } else if(GAIM_BLIST_NODE_IS_CHAT(node)) { |
5267 /* we don't have a reliable way of getting the log filename | 5283 /* we don't have a reliable way of getting the log filename |
5283 gtk_tree_store_insert(gtkblist->treemodel, iter, &groupiter, 0); | 5299 gtk_tree_store_insert(gtkblist->treemodel, iter, &groupiter, 0); |
5284 return; | 5300 return; |
5285 } | 5301 } |
5286 | 5302 |
5287 do { | 5303 do { |
5304 GValue val; | |
5305 GaimBlistNode *n; | |
5306 GaimBlistNode *n2; | |
5288 int cmp; | 5307 int cmp; |
5289 | 5308 |
5309 val.g_type = 0; | |
5290 gtk_tree_model_get_value (GTK_TREE_MODEL(gtkblist->treemodel), &more_z, NODE_COLUMN, &val); | 5310 gtk_tree_model_get_value (GTK_TREE_MODEL(gtkblist->treemodel), &more_z, NODE_COLUMN, &val); |
5291 n = g_value_get_pointer(&val); | 5311 n = g_value_get_pointer(&val); |
5292 this_log_size = 0; | 5312 this_log_size = 0; |
5293 | 5313 |
5294 if(GAIM_BLIST_NODE_IS_CONTACT(n)) { | 5314 if(GAIM_BLIST_NODE_IS_CONTACT(n)) { |