diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/app.c | 23 | ||||
-rw-r--r-- | src/ui/util.c | 26 | ||||
-rw-r--r-- | src/ui/util.h | 1 |
3 files changed, 34 insertions, 16 deletions
@@ -2035,9 +2035,8 @@ static iBool handleIdentityCreationCommands_(iWidget *dlg, const char *cmd) { | |||
2035 | } | 2035 | } |
2036 | if (equal_Command(cmd, "ident.scope")) { | 2036 | if (equal_Command(cmd, "ident.scope")) { |
2037 | iLabelWidget *scope = findChild_Widget(dlg, "ident.scope"); | 2037 | iLabelWidget *scope = findChild_Widget(dlg, "ident.scope"); |
2038 | setText_LabelWidget(scope, | 2038 | updateDropdownSelection_LabelWidget(scope, format_CStr(" arg:%d", arg_Command(cmd))); |
2039 | text_LabelWidget(child_Widget( | 2039 | updateSize_LabelWidget(scope); |
2040 | findChild_Widget(as_Widget(scope), "menu"), arg_Command(cmd)))); | ||
2041 | arrange_Widget(findWidget_App("ident")); | 2040 | arrange_Widget(findWidget_App("ident")); |
2042 | return iTrue; | 2041 | return iTrue; |
2043 | } | 2042 | } |
@@ -2104,19 +2103,11 @@ static iBool handleIdentityCreationCommands_(iWidget *dlg, const char *cmd) { | |||
2104 | organization, | 2103 | organization, |
2105 | country); | 2104 | country); |
2106 | /* Use in the chosen scope. */ { | 2105 | /* Use in the chosen scope. */ { |
2107 | const iLabelWidget *scope = findChild_Widget(dlg, "ident.scope"); | 2106 | int selScope = 2; |
2108 | const iString * selLabel = text_LabelWidget(scope); | 2107 | const char *scopeCmd = |
2109 | int selScope = 0; | 2108 | selectedDropdownCommand_LabelWidget(findChild_Widget(dlg, "ident.scope")); |
2110 | iConstForEach(ObjectList, | 2109 | if (startsWith_CStr(scopeCmd, "ident.scope arg:")) { |
2111 | i, | 2110 | selScope = arg_Command(scopeCmd); |
2112 | children_Widget(findChild_Widget(constAs_Widget(scope), "menu"))) { | ||
2113 | if (isInstance_Object(i.object, &Class_LabelWidget)) { | ||
2114 | const iLabelWidget *item = i.object; | ||
2115 | if (equal_String(text_LabelWidget(item), selLabel)) { | ||
2116 | break; | ||
2117 | } | ||
2118 | selScope++; | ||
2119 | } | ||
2120 | } | 2111 | } |
2121 | const iString *docUrl = url_DocumentWidget(document_Root(dlg->root)); | 2112 | const iString *docUrl = url_DocumentWidget(document_Root(dlg->root)); |
2122 | iString *useUrl = NULL; | 2113 | iString *useUrl = NULL; |
diff --git a/src/ui/util.c b/src/ui/util.c index efcb8b9f..912e1d37 100644 --- a/src/ui/util.c +++ b/src/ui/util.c | |||
@@ -1298,6 +1298,32 @@ void updateDropdownSelection_LabelWidget(iLabelWidget *dropButton, const char *s | |||
1298 | } | 1298 | } |
1299 | } | 1299 | } |
1300 | 1300 | ||
1301 | const char *selectedDropdownCommand_LabelWidget(const iLabelWidget *dropButton) { | ||
1302 | if (!dropButton) { | ||
1303 | return ""; | ||
1304 | } | ||
1305 | iWidget *menu = findChild_Widget(constAs_Widget(dropButton), "menu"); | ||
1306 | if (flags_Widget(menu) & nativeMenu_WidgetFlag) { | ||
1307 | iConstForEach(Array, i, userData_Object(menu)) { | ||
1308 | const iMenuItem *item = i.value; | ||
1309 | if (item->label && startsWithCase_CStr(item->label, "###")) { | ||
1310 | return item->command ? item->command : ""; | ||
1311 | } | ||
1312 | } | ||
1313 | } | ||
1314 | else { | ||
1315 | iForEach(ObjectList, i, children_Widget(menu)) { | ||
1316 | if (isInstance_Object(i.object, &Class_LabelWidget)) { | ||
1317 | iLabelWidget *item = i.object; | ||
1318 | if (flags_Widget(i.object) & selected_WidgetFlag) { | ||
1319 | return cstr_String(command_LabelWidget(item)); | ||
1320 | } | ||
1321 | } | ||
1322 | } | ||
1323 | } | ||
1324 | return ""; | ||
1325 | } | ||
1326 | |||
1301 | /*-----------------------------------------------------------------------------------------------*/ | 1327 | /*-----------------------------------------------------------------------------------------------*/ |
1302 | 1328 | ||
1303 | static iBool isTabPage_Widget_(const iWidget *tabs, const iWidget *page) { | 1329 | static iBool isTabPage_Widget_(const iWidget *tabs, const iWidget *page) { |
diff --git a/src/ui/util.h b/src/ui/util.h index 81fb1cbd..d13d751b 100644 --- a/src/ui/util.h +++ b/src/ui/util.h | |||
@@ -261,6 +261,7 @@ int checkContextMenu_Widget (iWidget *, const SDL_Event *ev) | |||
261 | 261 | ||
262 | iLabelWidget * makeMenuButton_LabelWidget (const char *label, const iMenuItem *items, size_t n); | 262 | iLabelWidget * makeMenuButton_LabelWidget (const char *label, const iMenuItem *items, size_t n); |
263 | void updateDropdownSelection_LabelWidget (iLabelWidget *dropButton, const char *selectedCommand); | 263 | void updateDropdownSelection_LabelWidget (iLabelWidget *dropButton, const char *selectedCommand); |
264 | const char * selectedDropdownCommand_LabelWidget (const iLabelWidget *dropButton); | ||
264 | 265 | ||
265 | /*-----------------------------------------------------------------------------------------------*/ | 266 | /*-----------------------------------------------------------------------------------------------*/ |
266 | 267 | ||