Skip to content

Commit

Permalink
Owner page: double click now opens edit window, name no longer
Browse files Browse the repository at this point in the history
editable in place.
Regarding the latter, changing names is rarely done, so it only leads
to confusion if the name field changes to editable by accidentally
clicking twice on it.

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@20764 57a11ea4-9604-0410-9ed3-97b8803252fd
  • Loading branch information
gjanssens committed Jun 16, 2011
1 parent ceb3097 commit e09efb1
Showing 1 changed file with 35 additions and 32 deletions.
67 changes: 35 additions & 32 deletions src/business/business-gnome/gnc-plugin-page-owner-tree.c
Expand Up @@ -503,9 +503,6 @@ gnc_plugin_page_owner_tree_create_widget (GncPluginPage *plugin_page)
"show-column-menu", TRUE,
NULL);

gnc_tree_view_owner_set_name_edited(GNC_TREE_VIEW_OWNER(tree_view),
gnc_tree_view_owner_name_edited_cb);

priv->tree_view = tree_view;
selection = gtk_tree_view_get_selection(tree_view);
g_signal_connect (G_OBJECT (selection), "changed",
Expand Down Expand Up @@ -639,6 +636,39 @@ gnc_plugin_page_owner_tree_recreate_page (GtkWidget *window,
return page;
}

/* Wrapper function to open the proper edit dialog, depending on the owner type */
static void gnc_ui_owner_edit (GncOwner *owner)
{
if (NULL == owner) return;

switch (owner->type)
{
case GNC_OWNER_NONE :
case GNC_OWNER_UNDEFINED :
break;
case GNC_OWNER_CUSTOMER :
{
gnc_ui_customer_edit (owner->owner.customer);
break;
}
case GNC_OWNER_JOB :
{
gnc_ui_job_edit (owner->owner.job);
break;
}
case GNC_OWNER_VENDOR :
{
gnc_ui_vendor_edit (owner->owner.vendor);
break;
}
case GNC_OWNER_EMPLOYEE :
{
gnc_ui_employee_edit (owner->owner.employee);
break;
}
}
}


/* Callbacks */

Expand Down Expand Up @@ -679,9 +709,7 @@ gnc_plugin_page_owner_tree_double_click_cb (GtkTreeView *treeview,

g_return_if_fail (GNC_IS_PLUGIN_PAGE_OWNER_TREE (page));
owner = gnc_tree_view_owner_get_owner_from_path (GNC_TREE_VIEW_OWNER(treeview), path);
/* FIXME does nothing for now. What should be the default action if a user
* double-clicks an owner entry ?
*/
gnc_ui_owner_edit (owner);
}

static void
Expand Down Expand Up @@ -765,32 +793,7 @@ gnc_plugin_page_owner_tree_cmd_edit_owner (GtkAction *action, GncPluginPageOwner

ENTER("action %p, page %p", action, page);

switch (owner->type)
{
case GNC_OWNER_NONE :
case GNC_OWNER_UNDEFINED :
break;
case GNC_OWNER_CUSTOMER :
{
gnc_ui_customer_edit (owner->owner.customer);
break;
}
case GNC_OWNER_JOB :
{
gnc_ui_job_edit (owner->owner.job);
break;
}
case GNC_OWNER_VENDOR :
{
gnc_ui_vendor_edit (owner->owner.vendor);
break;
}
case GNC_OWNER_EMPLOYEE :
{
gnc_ui_employee_edit (owner->owner.employee);
break;
}
}
gnc_ui_owner_edit (owner);

LEAVE(" ");
}
Expand Down

0 comments on commit e09efb1

Please sign in to comment.