* Added some unit tests for ModestTextUtils
[modest] / src / widgets / modest-account-view.c
index f190fce..e236c69 100644 (file)
@@ -27,6 +27,7 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#include <glib/gi18n.h>
 #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;
+}