From f4fc3d626a425bf59886cd5773fd2f64ff285b10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Duval?= Date: Tue, 6 Jun 2006 12:35:27 +0000 Subject: [PATCH] * fixed some more GetSupportedSuites implementations * fixed some local variables names * fixed the case of some message attribute names git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17734 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/app/Application.cpp | 6 ++-- src/kits/app/Handler.cpp | 2 +- src/kits/app/Looper.cpp | 24 ++++++------- src/kits/interface/BTextView/TextView.cpp | 10 +++--- src/kits/interface/ChannelControl.cpp | 29 ++++++++++------ src/kits/interface/ChannelSlider.cpp | 14 +++++--- src/kits/interface/ListView.cpp | 41 +++++++++++++++++------ src/kits/interface/View.cpp | 14 ++++---- src/kits/interface/Window.cpp | 4 +-- 9 files changed, 85 insertions(+), 59 deletions(-) diff --git a/src/kits/app/Application.cpp b/src/kits/app/Application.cpp index 88ee5c8a12..fac8e8c552 100644 --- a/src/kits/app/Application.cpp +++ b/src/kits/app/Application.cpp @@ -911,10 +911,10 @@ BApplication::GetSupportedSuites(BMessage *data) if (!data) return B_BAD_VALUE; - status_t status = data->AddString("Suites", "suite/vnd.Be-application"); + status_t status = data->AddString("suites", "suite/vnd.Be-application"); if (status == B_OK) { - BPropertyInfo PropertyInfo(sPropertyInfo); - status = data->AddFlat("message", &PropertyInfo); + BPropertyInfo propertyInfo(sPropertyInfo); + status = data->AddFlat("messages", &propertyInfo); if (status == B_OK) status = BHandler::GetSupportedSuites(data); } diff --git a/src/kits/app/Handler.cpp b/src/kits/app/Handler.cpp index 67ed32c07b..b9d502b39d 100644 --- a/src/kits/app/Handler.cpp +++ b/src/kits/app/Handler.cpp @@ -471,7 +471,7 @@ BMessage: what = (0x0, or 0) err = data->AddString("suites", "suite/vnd.Be-handler"); if (!err) { BPropertyInfo propertyInfo(sHandlerPropInfo); - err = data->AddFlat("message", &propertyInfo); + err = data->AddFlat("messages", &propertyInfo); } } diff --git a/src/kits/app/Looper.cpp b/src/kits/app/Looper.cpp index 5f65a76370..9e7e075270 100644 --- a/src/kits/app/Looper.cpp +++ b/src/kits/app/Looper.cpp @@ -664,11 +664,11 @@ BLooper::ResolveSpecifier(BMessage* msg, int32 index, string comparisons -- which wouldn't tell the whole story anyway, because of the same name being used for multiple properties. */ - BPropertyInfo PropertyInfo(gLooperPropInfo); + BPropertyInfo propertyInfo(gLooperPropInfo); uint32 data; status_t err = B_OK; const char* errMsg = ""; - if (PropertyInfo.FindMatch(msg, index, specifier, form, property, &data) >= 0) { + if (propertyInfo.FindMatch(msg, index, specifier, form, property, &data) >= 0) { switch (data) { case BLOOPER_PROCESS_INTERNALLY: return this; @@ -701,10 +701,10 @@ BLooper::ResolveSpecifier(BMessage* msg, int32 index, property); } - BMessage Reply(B_MESSAGE_NOT_UNDERSTOOD); - Reply.AddInt32("error", err); - Reply.AddString("message", errMsg); - msg->SendReply(&Reply); + BMessage reply(B_MESSAGE_NOT_UNDERSTOOD); + reply.AddInt32("error", err); + reply.AddString("message", errMsg); + msg->SendReply(&reply); return NULL; } @@ -716,10 +716,10 @@ BLooper::GetSupportedSuites(BMessage* data) if (data == NULL) return B_BAD_VALUE; - status_t status = data->AddString("Suites", "suite/vnd.Be-handler"); + status_t status = data->AddString("suites", "suite/vnd.Be-handler"); if (status == B_OK) { BPropertyInfo PropertyInfo(gLooperPropInfo); - status = data->AddFlat("message", &PropertyInfo); + status = data->AddFlat("messages", &PropertyInfo); if (status == B_OK) status = BHandler::GetSupportedSuites(data); } @@ -1318,10 +1318,10 @@ BLooper::_QuitRequested(BMessage *msg) bool shutdown; if (msg->IsSourceWaiting() || (msg->FindBool("_shutdown_", &shutdown) == B_OK && shutdown)) { - BMessage ReplyMsg(B_REPLY); - ReplyMsg.AddBool("result", isQuitting); - ReplyMsg.AddInt32("thread", fTaskID); - msg->SendReply(&ReplyMsg); + BMessage replyMsg(B_REPLY); + replyMsg.AddBool("result", isQuitting); + replyMsg.AddInt32("thread", fTaskID); + msg->SendReply(&replyMsg); } if (isQuitting) diff --git a/src/kits/interface/BTextView/TextView.cpp b/src/kits/interface/BTextView/TextView.cpp index 3666f58aad..fd4b287464 100644 --- a/src/kits/interface/BTextView/TextView.cpp +++ b/src/kits/interface/BTextView/TextView.cpp @@ -117,14 +117,14 @@ const static rgb_color kRedInputColor = { 255, 152, 152, 255 }; static property_info sPropertyList[] = { { - "Selection", + "selection", { B_GET_PROPERTY, 0 }, { B_DIRECT_SPECIFIER, 0 }, "Returns the current selection.", 0, { B_INT32_TYPE, 0 } }, { - "Selection", + "selection", { B_SET_PROPERTY, 0 }, { B_DIRECT_SPECIFIER, 0 }, "Sets the current selection.", 0, @@ -990,16 +990,14 @@ BTextView::GetSupportedSuites(BMessage *data) return B_BAD_VALUE; status_t err = data->AddString("suites", "suite/vnd.Be-text-view"); - - if (err < B_OK) + if (err != B_OK) return err; BPropertyInfo prop_info(sPropertyList); err = data->AddFlat("messages", &prop_info); - if (err < B_OK) + if (err != B_OK) return err; - return BView::GetSupportedSuites(data); } diff --git a/src/kits/interface/ChannelControl.cpp b/src/kits/interface/ChannelControl.cpp index 3c16ea6557..d46f0e62af 100644 --- a/src/kits/interface/ChannelControl.cpp +++ b/src/kits/interface/ChannelControl.cpp @@ -11,20 +11,24 @@ static property_info sPropertyInfo[] = { { "ChannelCount", - { B_GET_PROPERTY, B_SET_PROPERTY, 0 }, - { B_DIRECT_SPECIFIER, 0 }, "", 0 }, + { B_GET_PROPERTY, B_SET_PROPERTY, 0 }, + { B_DIRECT_SPECIFIER, 0 }, NULL, 0, { B_INT32_TYPE } + }, { "CurrentChannel", - { B_GET_PROPERTY, B_SET_PROPERTY, 0 }, - { B_DIRECT_SPECIFIER, 0 }, "", 0 }, + { B_GET_PROPERTY, B_SET_PROPERTY, 0 }, + { B_DIRECT_SPECIFIER, 0 }, NULL, 0, { B_INT32_TYPE } + }, { "MaxLimitLabel", - { B_GET_PROPERTY, B_SET_PROPERTY, 0 }, - { B_DIRECT_SPECIFIER, 0 }, "", 0 }, + { B_GET_PROPERTY, B_SET_PROPERTY, 0 }, + { B_DIRECT_SPECIFIER, 0 }, NULL, 0, { B_STRING_TYPE } + }, { "MinLimitLabel", - { B_GET_PROPERTY, B_SET_PROPERTY, 0 }, - { B_DIRECT_SPECIFIER, 0 }, "", 0 }, + { B_GET_PROPERTY, B_SET_PROPERTY, 0 }, + { B_DIRECT_SPECIFIER, 0 }, NULL, 0, { B_STRING_TYPE } + }, { 0 } }; @@ -201,12 +205,15 @@ BChannelControl::GetSupportedSuites(BMessage *data) if (data == NULL) return B_BAD_VALUE; - data->AddString("suites", "suite/vnd.Be-channel-control"); + status_t err = data->AddString("suites", "suite/vnd.Be-channel-control"); BPropertyInfo propertyInfo(sPropertyInfo); - data->AddFlat("messages", &propertyInfo); + if (err == B_OK) + err = data->AddFlat("messages", &propertyInfo); - return BControl::GetSupportedSuites(data); + if (err == B_OK) + return BControl::GetSupportedSuites(data); + return err; } diff --git a/src/kits/interface/ChannelSlider.cpp b/src/kits/interface/ChannelSlider.cpp index ee6322954d..6174f8932d 100644 --- a/src/kits/interface/ChannelSlider.cpp +++ b/src/kits/interface/ChannelSlider.cpp @@ -52,8 +52,9 @@ kHorizontalKnobData[] = { static property_info sPropertyInfo[] = { { "Orientation", - { B_GET_PROPERTY, B_SET_PROPERTY, 0 }, - { B_DIRECT_SPECIFIER, 0 }, "" }, + { B_GET_PROPERTY, B_SET_PROPERTY, 0 }, + { B_DIRECT_SPECIFIER, 0 }, NULL, 0, { B_INT32_TYPE } + }, { 0 } }; @@ -438,12 +439,15 @@ BChannelSlider::GetSupportedSuites(BMessage *data) if (data == NULL) return B_BAD_VALUE; - data->AddString("suites", "suite/vnd.Be-channel-slider"); + status_t err = data->AddString("suites", "suite/vnd.Be-channel-slider"); BPropertyInfo propInfo(sPropertyInfo); - data->AddFlat("messages", &propInfo, 1); + if (err == B_OK) + err = data->AddFlat("messages", &propInfo); - return inherited::GetSupportedSuites(data); + if (err == B_OK) + return BChannelControl::GetSupportedSuites(data); + return err; } diff --git a/src/kits/interface/ListView.cpp b/src/kits/interface/ListView.cpp index ed0ff02b15..aaddce9f17 100644 --- a/src/kits/interface/ListView.cpp +++ b/src/kits/interface/ListView.cpp @@ -30,23 +30,36 @@ struct track_data { static property_info sProperties[] = { { "Item", { B_COUNT_PROPERTIES, 0 }, { B_DIRECT_SPECIFIER, 0 }, - "Returns the number of BListItems currently in the list." }, + "Returns the number of BListItems currently in the list.", 0, { B_INT32_TYPE } + }, + { "Item", { B_EXECUTE_PROPERTY, 0 }, { B_INDEX_SPECIFIER, B_REVERSE_INDEX_SPECIFIER, B_RANGE_SPECIFIER, B_REVERSE_RANGE_SPECIFIER, 0 }, - "Select and invoke the specified items, first removing any existing selection." }, + "Select and invoke the specified items, first removing any existing selection." + }, + { "Selection", { B_COUNT_PROPERTIES, 0 }, { B_DIRECT_SPECIFIER, 0 }, - "Returns int32 count of items in the selection." }, + "Returns int32 count of items in the selection.", 0, { B_INT32_TYPE } + }, + { "Selection", { B_EXECUTE_PROPERTY, 0 }, { B_DIRECT_SPECIFIER, 0 }, - "Invoke items in selection." }, + "Invoke items in selection." + }, + { "Selection", { B_GET_PROPERTY, 0 }, { B_DIRECT_SPECIFIER, 0 }, - "Returns int32 indices of all items in the selection." }, + "Returns int32 indices of all items in the selection.", 0, { B_INT32_TYPE } + }, + { "Selection", { B_SET_PROPERTY, 0 }, { B_INDEX_SPECIFIER, B_REVERSE_INDEX_SPECIFIER, B_RANGE_SPECIFIER, B_REVERSE_RANGE_SPECIFIER, 0 }, "Extends current selection or deselects specified items. Boolean field \"data\" " - "chooses selection or deselection." }, + "chooses selection or deselection.", 0, { B_BOOL_TYPE } + }, + { "Selection", { B_SET_PROPERTY, 0 }, { B_DIRECT_SPECIFIER, 0 }, "Select or deselect all items in the selection. Boolean field \"data\" chooses " - "selection or deselection." }, + "selection or deselection.", 0, { B_BOOL_TYPE } + }, }; @@ -1015,12 +1028,18 @@ BListView::ResolveSpecifier(BMessage* message, int32 index, status_t BListView::GetSupportedSuites(BMessage* data) { + if (data == NULL) + return B_BAD_VALUE; + + status_t err = data->AddString("suites", "suite/vnd.Be-list-view"); + BPropertyInfo propertyInfo(sProperties); + if (err == B_OK) + err = data->AddFlat("messages", &propertyInfo); - data->AddString("suites", "suite/vnd.Be-list-view"); - data->AddFlat("messages", &propertyInfo); - - return BView::GetSupportedSuites(data); + if (err == B_OK) + return BView::GetSupportedSuites(data); + return err; } // Perform diff --git a/src/kits/interface/View.cpp b/src/kits/interface/View.cpp index f7660e22b5..46cb1b2cbe 100644 --- a/src/kits/interface/View.cpp +++ b/src/kits/interface/View.cpp @@ -3480,14 +3480,12 @@ BView::GetSupportedSuites(BMessage *data) if (data == NULL) return B_BAD_VALUE; - status_t status = data->AddString("Suites", "suite/vnd.Be-view"); - if (status == B_OK) { - BPropertyInfo propertyInfo(sViewPropInfo); - - status = data->AddFlat("message", &propertyInfo); - if (status == B_OK) - status = BHandler::GetSupportedSuites(data); - } + status_t status = data->AddString("suites", "suite/vnd.Be-view"); + BPropertyInfo propertyInfo(sViewPropInfo); + if (status == B_OK) + status = data->AddFlat("messages", &propertyInfo); + if (status == B_OK) + return BHandler::GetSupportedSuites(data); return status; } diff --git a/src/kits/interface/Window.cpp b/src/kits/interface/Window.cpp index 15959b5ed2..ac0ee35171 100644 --- a/src/kits/interface/Window.cpp +++ b/src/kits/interface/Window.cpp @@ -2217,11 +2217,11 @@ BWindow::GetSupportedSuites(BMessage *data) if (data == NULL) return B_BAD_VALUE; - status_t status = data->AddString("Suites", "suite/vnd.Be-window"); + status_t status = data->AddString("suites", "suite/vnd.Be-window"); if (status == B_OK) { BPropertyInfo propertyInfo(sWindowPropInfo, sWindowValueInfo); - status = data->AddFlat("message", &propertyInfo); + status = data->AddFlat("messages", &propertyInfo); if (status == B_OK) status = BLooper::GetSupportedSuites(data); }