mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-30 13:41:48 +00:00
keep track of the type of selected objects
This commit is contained in:
parent
5a8ce641ee
commit
59ecab2421
1 changed files with 14 additions and 2 deletions
|
@ -40,6 +40,7 @@ typedef struct App
|
||||||
GtkAction *delete;
|
GtkAction *delete;
|
||||||
GtkAction *play;
|
GtkAction *play;
|
||||||
GstState state;
|
GstState state;
|
||||||
|
GType selected_type;
|
||||||
} App;
|
} App;
|
||||||
|
|
||||||
App *app_new (void);
|
App *app_new (void);
|
||||||
|
@ -238,10 +239,11 @@ void
|
||||||
app_update_selection (App * app)
|
app_update_selection (App * app)
|
||||||
{
|
{
|
||||||
GList *cur;
|
GList *cur;
|
||||||
|
GType type;
|
||||||
|
|
||||||
/* clear old selection */
|
/* clear old selection */
|
||||||
for (cur = app->selected_objects; cur; cur = cur->next) {
|
for (cur = app->selected_objects; cur; cur = cur->next) {
|
||||||
disconnect_from_filesource (cur->data, app);
|
disconnect_from_object (cur->data, app);
|
||||||
g_object_unref (cur->data);
|
g_object_unref (cur->data);
|
||||||
cur->data = NULL;
|
cur->data = NULL;
|
||||||
}
|
}
|
||||||
|
@ -254,9 +256,17 @@ app_update_selection (App * app)
|
||||||
selection_foreach, &app->selected_objects);
|
selection_foreach, &app->selected_objects);
|
||||||
|
|
||||||
for (cur = app->selected_objects; cur; cur = cur->next) {
|
for (cur = app->selected_objects; cur; cur = cur->next) {
|
||||||
connect_to_filesource (cur->data, app);
|
connect_to_object (cur->data, app);
|
||||||
app->n_selected++;
|
app->n_selected++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type = G_TYPE_NONE;
|
||||||
|
if (app->selected_objects) {
|
||||||
|
/* TODO: when we allow multiple selections, only set this if all values
|
||||||
|
* are the same */
|
||||||
|
type = G_TYPE_FROM_INSTANCE (app->selected_objects->data);
|
||||||
|
}
|
||||||
|
app->selected_type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -324,6 +334,8 @@ app_new (void)
|
||||||
App *ret;
|
App *ret;
|
||||||
ret = g_new0 (App, 1);
|
ret = g_new0 (App, 1);
|
||||||
|
|
||||||
|
ret->selected_type = G_TYPE_NONE;
|
||||||
|
|
||||||
if (!ret)
|
if (!ret)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue