Skip to content

Commit

Permalink
action-list: update menu dynamically
Browse files Browse the repository at this point in the history
  • Loading branch information
djdeath committed Sep 12, 2011
1 parent 42dcbde commit 34ee187
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 5 deletions.
25 changes: 21 additions & 4 deletions mex/mex-action-list.c
Expand Up @@ -240,6 +240,14 @@ mx_focusable_iface_init (MxFocusableIface *iface)
iface->accept_focus = mex_action_list_accept_focus;
}

static void
mex_action_list_content_updated_cb (MexContent *content,
GParamSpec *pspec,
MexActionList *action_list)
{
mex_action_list_refresh (action_list);
}

static void
mex_action_list_set_content (MexContentView *view,
MexContent *content)
Expand All @@ -251,12 +259,21 @@ mex_action_list_set_content (MexContentView *view,
return;

if (priv->content)
g_object_unref (priv->content);

priv->content = content;
{
g_signal_handlers_disconnect_by_func (priv->content,
mex_action_list_content_updated_cb,
action_list);
g_object_unref (priv->content);
priv->content = NULL;
}

if (content)
g_object_ref (content);
{
priv->content = g_object_ref (content);
g_signal_connect (priv->content, "notify",
G_CALLBACK (mex_action_list_content_updated_cb),
action_list);
}

mex_action_list_refresh (action_list);
}
Expand Down
5 changes: 5 additions & 0 deletions mex/mex-content-box.c
Expand Up @@ -353,6 +353,7 @@ mex_content_box_toggle_open (MexContentBox *box)
else
{
priv->is_closing = TRUE;

/* closing */
mex_push_focus (MX_FOCUSABLE (priv->tile));
clutter_timeline_set_direction (priv->timeline,
Expand Down Expand Up @@ -663,6 +664,10 @@ mex_content_box_timeline_completed (ClutterTimeline *timeline,
mx_stylable_set_style_class (MX_STYLABLE (box), "");
g_object_notify_by_pspec (G_OBJECT (box), properties[PROP_OPEN]);
}

if (!priv->is_open)
mex_content_view_set_content (MEX_CONTENT_VIEW (priv->action_list),
NULL);
}

static void
Expand Down
2 changes: 1 addition & 1 deletion mex/mex-queue-button.c
Expand Up @@ -507,7 +507,7 @@ mex_queue_button_set_content (MexContentView *view,
"notify::queued",
(GCallback)_content_notify_queued_cb,
self);
g_object_notify (G_OBJECT (priv->content), "queued");
mex_queue_button_update (self);
}
}

Expand Down

0 comments on commit 34ee187

Please sign in to comment.