diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/ege-select-one-action.cpp | 15 | ||||
| -rw-r--r-- | src/ege-select-one-action.h | 8 |
2 files changed, 23 insertions, 0 deletions
diff --git a/src/ege-select-one-action.cpp b/src/ege-select-one-action.cpp index 50967ecb2..834b06b3b 100644 --- a/src/ege-select-one-action.cpp +++ b/src/ege-select-one-action.cpp @@ -278,6 +278,21 @@ gint ege_select_one_action_get_active( EgeSelectOneAction* action ) return action->private_data->active; } +gchar *ege_select_one_action_get_active_text( EgeSelectOneAction* action ) +{ + GtkTreeIter iter; + gchar *str = 0; + g_return_val_if_fail( IS_EGE_SELECT_ONE_ACTION(action), 0 ); + + if ( gtk_tree_model_iter_nth_child( action->private_data->model, &iter, NULL, action->private_data->active ) ) { + gtk_tree_model_get( action->private_data->model, &iter, + action->private_data->labelColumn, &str, + -1 ); + } + + return str; +} + void ege_select_one_action_set_active( EgeSelectOneAction* action, gint val ) { g_object_set( G_OBJECT(action), "active", val, NULL ); diff --git a/src/ege-select-one-action.h b/src/ege-select-one-action.h index d0c9d6de7..2ecf7efc5 100644 --- a/src/ege-select-one-action.h +++ b/src/ege-select-one-action.h @@ -122,6 +122,14 @@ GtkTreeModel *ege_select_one_action_get_model(EgeSelectOneAction* action ); gint ege_select_one_action_get_active( EgeSelectOneAction* action ); /** + * Returns the text of the currently selected item. + * + * @param action The action to fetch the text for. + * @return the selected text. The caller is responsible to call g_free() on it when done. + */ +gchar *ege_select_one_action_get_active_text( EgeSelectOneAction* action ); + +/** * Sets the currently selected item. * * @param action The action to fetch the selected index for. |
