"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "gnucash/gnome-utils/gnc-tree-view-account.c" between
gnucash-5.0.tar.bz2 and gnucash-5.1.tar.bz2

About: GnuCash is personal and small-business financial-accounting software.

gnc-tree-view-account.c  (gnucash-5.0.tar.bz2):gnc-tree-view-account.c  (gnucash-5.1.tar.bz2)
skipping to change at line 27 skipping to change at line 27
* along with this program; if not, contact: * * along with this program; if not, contact: *
* * * *
* Free Software Foundation Voice: +1-617-542-5942 * * Free Software Foundation Voice: +1-617-542-5942 *
* 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 * * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 *
* Boston, MA 02110-1301, USA gnu@gnu.org * * Boston, MA 02110-1301, USA gnu@gnu.org *
* * * *
\**********************************************************************/ \**********************************************************************/
#include <config.h> #include <config.h>
#include <stdbool.h>
#include <gtk/gtk.h> #include <gtk/gtk.h>
#include <glib/gi18n.h> #include <glib/gi18n.h>
#include <string.h> #include <string.h>
#include "gnc-tree-view.h" #include "gnc-tree-view.h"
#include "gnc-tree-model-account.h" #include "gnc-tree-model-account.h"
#include "gnc-tree-model-account-types.h" #include "gnc-tree-model-account-types.h"
#include "gnc-tree-view-account.h" #include "gnc-tree-view-account.h"
#include "Account.h" #include "Account.h"
skipping to change at line 93 skipping to change at line 94
static void acc_color_data_func (GtkTreeViewColumn *col, static void acc_color_data_func (GtkTreeViewColumn *col,
GtkCellRenderer *renderer, GtkCellRenderer *renderer,
GtkTreeModel *model, GtkTreeModel *model,
GtkTreeIter *iter, GtkTreeIter *iter,
gpointer view); gpointer view);
static void gnc_tree_view_account_color_update (gpointer gsettings, static void gnc_tree_view_account_color_update (gpointer gsettings,
gchar *key, gpointer user_data); gchar *key, gpointer user_data);
static gboolean
gnc_tree_view_tooltip_cb (GtkWidget *widget, gint x, gint y, gboolean keyboard_t
ip,
GtkTooltip *tooltip, gpointer user_data);
typedef struct GncTreeViewAccountPrivate typedef struct GncTreeViewAccountPrivate
{ {
AccountViewInfo avi; AccountViewInfo avi;
gnc_tree_view_account_filter_func filter_fn; gnc_tree_view_account_filter_func filter_fn;
gpointer filter_data; gpointer filter_data;
GSourceFunc filter_destroy; GSourceFunc filter_destroy;
GtkTreeViewColumn *name_column; GtkTreeViewColumn *name_column;
GtkTreeViewColumn *code_column; GtkTreeViewColumn *code_column;
skipping to change at line 768 skipping to change at line 773
GtkTreePath *virtual_root_path = NULL; GtkTreePath *virtual_root_path = NULL;
const gchar *sample_type, *sample_commodity; const gchar *sample_type, *sample_commodity;
GncTreeViewAccountPrivate *priv; GncTreeViewAccountPrivate *priv;
GtkTreeViewColumn *tax_info_column, *acc_color_column, *acc_balance_limit_co lumn; GtkTreeViewColumn *tax_info_column, *acc_color_column, *acc_balance_limit_co lumn;
GtkCellRenderer *renderer; GtkCellRenderer *renderer;
GList *col_list = NULL, *node = NULL; GList *col_list = NULL, *node = NULL;
ENTER(" "); ENTER(" ");
/* Create our view */ /* Create our view */
view = g_object_new (GNC_TYPE_TREE_VIEW_ACCOUNT, view = g_object_new (GNC_TYPE_TREE_VIEW_ACCOUNT,
"has-tooltip", true,
"name", "gnc-id-account-tree", NULL); "name", "gnc-id-account-tree", NULL);
priv = GNC_TREE_VIEW_ACCOUNT_GET_PRIVATE(GNC_TREE_VIEW_ACCOUNT (view)); priv = GNC_TREE_VIEW_ACCOUNT_GET_PRIVATE(GNC_TREE_VIEW_ACCOUNT (view));
/* Get the show_account_color value from gsettings */ /* Get the show_account_color value from gsettings */
priv->show_account_color = gnc_prefs_get_bool(GNC_PREFS_GROUP_GENERAL, GNC_P REF_ACCOUNT_COLOR); priv->show_account_color = gnc_prefs_get_bool(GNC_PREFS_GROUP_GENERAL, GNC_P REF_ACCOUNT_COLOR);
/* Create/get a pointer to the existing model for this set of books. */ /* Create/get a pointer to the existing model for this set of books. */
model = gnc_tree_model_account_new (root); model = gnc_tree_model_account_new (root);
skipping to change at line 1047 skipping to change at line 1053
NULL); NULL);
/* Default the sorting to account name */ /* Default the sorting to account name */
gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(s_model), gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(s_model),
GNC_TREE_MODEL_ACCOUNT_COL_NAME, GNC_TREE_MODEL_ACCOUNT_COL_NAME,
GTK_SORT_ASCENDING); GTK_SORT_ASCENDING);
/* Set account find-as-you-type search function */ /* Set account find-as-you-type search function */
gtk_tree_view_set_search_equal_func (GTK_TREE_VIEW(view), gnc_tree_view_sear ch_compare, NULL, NULL); gtk_tree_view_set_search_equal_func (GTK_TREE_VIEW(view), gnc_tree_view_sear ch_compare, NULL, NULL);
g_signal_connect (G_OBJECT(view), "query-tooltip",
G_CALLBACK(gnc_tree_view_tooltip_cb), NULL);
gtk_widget_show(GTK_WIDGET(view)); gtk_widget_show(GTK_WIDGET(view));
LEAVE("%p", view); LEAVE("%p", view);
return GTK_TREE_VIEW(view); return GTK_TREE_VIEW(view);
} }
/* /*
* Create a new account tree view with (optional) top level root node. * Create a new account tree view with (optional) top level root node.
* This view will be based on a model that is common to all view of * This view will be based on a model that is common to all view of
* the same set of books, but will have its own private filter on that * the same set of books, but will have its own private filter on that
* model. * model.
skipping to change at line 2878 skipping to change at line 2887
gnc_tree_view_set_editing_started_cb (GNC_TREE_VIEW(view), gnc_tree_view_set_editing_started_cb (GNC_TREE_VIEW(view),
editing_started_cb, editing_cb_data); editing_started_cb, editing_cb_data);
} }
void gnc_tree_view_account_set_editing_finished_cb(GncTreeViewAccount *view, void gnc_tree_view_account_set_editing_finished_cb(GncTreeViewAccount *view,
GFunc editing_finished_cb, gpointer editing_cb_data) GFunc editing_finished_cb, gpointer editing_cb_data)
{ {
gnc_tree_view_set_editing_finished_cb (GNC_TREE_VIEW(view), gnc_tree_view_set_editing_finished_cb (GNC_TREE_VIEW(view),
editing_finished_cb, editing_cb_data); editing_finished_cb, editing_cb_data);
} }
static gboolean
gnc_tree_view_tooltip_cb (GtkWidget *widget, gint x, gint y, gboolean keyboard_t
ip,
GtkTooltip *tooltip, gpointer user_data)
{
GtkTreeView *tree_view = GTK_TREE_VIEW(widget);
GtkTreePath *path = NULL;
GtkTreeViewColumn *column = NULL;
gtk_tree_view_convert_widget_to_bin_window_coords (tree_view, x, y, &x, &y);
if (keyboard_tip || !gtk_tree_view_get_path_at_pos (tree_view, x, y, &path,
&column, NULL, NULL))
{
gtk_tree_path_free (path);
return false;
}
// Get the iter pointing to our current column
gboolean show_tooltip = false;
GtkTreeModel *model = gtk_tree_view_get_model (tree_view);
GtkTreeIter iter;
if (gtk_tree_model_get_iter (model, &iter, path) && column)
{
gchar *ttip = NULL;
// Select text based on column
switch (gtk_tree_view_column_get_sort_column_id (column))
{
case GNC_TREE_MODEL_ACCOUNT_COL_BALANCE_LIMIT:
gtk_tree_model_get (model, &iter,
GNC_TREE_MODEL_ACCOUNT_COL_BALANCE_LIMIT_EXPLANA
TION, &ttip,
-1);
break;
default:
break;
}
// Did we select any text? If yes, display the tooltip
if (ttip && *ttip)
{
show_tooltip = true;
gtk_tooltip_set_text (tooltip, ttip);
gtk_tree_view_set_tooltip_cell (tree_view, tooltip, path, column, NU
LL);
}
g_free (ttip);
}
// Clean up the object
gtk_tree_path_free (path);
return show_tooltip;
}
 End of changes. 5 change blocks. 
0 lines changed or deleted 10 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)