diff options
author | Jakob Bornecrantz <jakob@vmware.com> | 2009-10-21 17:09:05 +0100 |
---|---|---|
committer | Jakob Bornecrantz <jakob@vmware.com> | 2009-10-21 17:09:05 +0100 |
commit | d7966693c005fbe060aacf43e400bab4c6aaeefd (patch) | |
tree | 50db6bb38b1a9be3bb0038ddbcabf53c8b68aec0 /src/context.c | |
parent | 6498f763a38869322c0063dd2a701fe5c06c70dc (diff) |
Dim buttons in context view if nothing is bound to them
Diffstat (limited to 'src/context.c')
-rw-r--r-- | src/context.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/context.c b/src/context.c index 03eea96..fa754c2 100644 --- a/src/context.c +++ b/src/context.c @@ -266,6 +266,7 @@ static gboolean context_action_info_info(struct rbug_event *e, GtkTreeIter iter; GdkPixbuf *buf = NULL; gboolean ret; + int k; info = (struct rbug_proto_context_info_reply *)header; @@ -297,6 +298,25 @@ static gboolean context_action_info_info(struct rbug_event *e, else gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(p->tool.break_after), FALSE); + + + /* disable buttons that don't have a valid target */ + gtk_action_set_sensitive(GTK_ACTION(p->context.ra[CTX_VIEW_FRAGMENT]), (info->fragment)); + gtk_action_set_sensitive(GTK_ACTION(p->context.ra[CTX_VIEW_VERTEX]), (info->vertex)); + gtk_action_set_sensitive(GTK_ACTION(p->context.ra[CTX_VIEW_GEOM]), false); + + for (k = 0; k < 8; k++) { + bool active = (unsigned)k < info->cbufs_len && info->cbufs[k]; + gtk_action_set_sensitive(GTK_ACTION(p->context.ra[CTX_VIEW_COLOR0+k]), active); + } + gtk_action_set_sensitive(GTK_ACTION(p->context.ra[CTX_VIEW_ZS]), (info->zsbuf)); + + for (k = 0; k < 16; k++) { + bool active = (unsigned)k < info->texs_len && info->texs[k]; + gtk_action_set_sensitive(GTK_ACTION(p->context.ra[CTX_VIEW_TEXTURE0+k]), active); + } + + /* find the proper view */ ret = FALSE; switch (p->context.view_id) { case CTX_VIEW_FRAGMENT: |