X-Git-Url: http://git.maemo.org/git/?a=blobdiff_plain;f=src%2Fwidgets%2Fmodest-account-view.c;h=e236c694490a298a623d98e0003307af11146b53;hb=b43518714ee9ac0b6fdd0ab7d08f2c1de67846f5;hp=f190fcec4ab3ed2d5eee0cd19b5d290bc6bc0988;hpb=6185209baf729caa6db7b4ac0ad32885acfdd1fc;p=modest diff --git a/src/widgets/modest-account-view.c b/src/widgets/modest-account-view.c index f190fce..e236c69 100644 --- a/src/widgets/modest-account-view.c +++ b/src/widgets/modest-account-view.c @@ -27,6 +27,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include #include "modest-account-view.h" /* include other impl specific header files */ @@ -82,6 +83,7 @@ modest_account_view_get_type (void) sizeof(ModestAccountView), 1, /* n_preallocs */ (GInstanceInitFunc) modest_account_view_init, + NULL }; my_type = g_type_register_static (GTK_TYPE_TREE_VIEW, "ModestAccountView", @@ -309,3 +311,22 @@ modest_account_view_new (ModestAccountMgr *account_mgr) return MODEST_ACCOUNT_VIEW(obj); } +const gchar * +modest_account_view_get_selected_account (ModestAccountView *self) +{ + const gchar *account_name = NULL; + GtkTreeSelection *sel; + GtkTreeModel *model; + GtkTreeIter iter; + + g_return_val_if_fail (MODEST_IS_ACCOUNT_VIEW (self), NULL); + + sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (self)); + if (gtk_tree_selection_get_selected (sel, &model, &iter)) { + gtk_tree_model_get (model, &iter, + NAME_COLUMN, &account_name, + -1); + } + + return account_name; +}