summaryrefslogtreecommitdiff
path: root/src/app.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/app.c')
-rw-r--r--src/app.c94
1 files changed, 1 insertions, 93 deletions
diff --git a/src/app.c b/src/app.c
index dd4d4ed2..77fbf430 100644
--- a/src/app.c
+++ b/src/app.c
@@ -990,49 +990,6 @@ static iBool handleIdentityCreationCommands_(iWidget *dlg, const char *cmd) {
990 return iFalse; 990 return iFalse;
991} 991}
992 992
993static iBool handleFeedSettingCommands_(iWidget *dlg, const char *cmd) {
994 iApp *d = &app_;
995 if (equal_Command(cmd, "cancel")) {
996 destroy_Widget(dlg);
997 return iTrue;
998 }
999 if (equal_Command(cmd, "feedcfg.accept")) {
1000 iString *feedTitle =
1001 collect_String(copy_String(text_InputWidget(findChild_Widget(dlg, "feedcfg.title"))));
1002 trim_String(feedTitle);
1003 if (isEmpty_String(feedTitle)) {
1004 return iTrue;
1005 }
1006 int id = argLabel_Command(cmd, "bmid");
1007 const iBool headings = isSelected_Widget(findChild_Widget(dlg, "feedcfg.type.headings"));
1008 const iString *tags = collectNewFormat_String("subscribed%s", headings ? " headings" : "");
1009 if (!id) {
1010 const size_t numSubs = numSubscribed_Feeds();
1011 const iString *url = url_DocumentWidget(document_App());
1012 add_Bookmarks(d->bookmarks,
1013 url,
1014 feedTitle,
1015 tags,
1016 siteIcon_GmDocument(document_DocumentWidget(document_App())));
1017 if (numSubs == 0) {
1018 /* Auto-refresh after first addition. */
1019 postCommand_App("feeds.refresh");
1020 }
1021 }
1022 else {
1023 iBookmark *bm = get_Bookmarks(d->bookmarks, id);
1024 if (bm) {
1025 set_String(&bm->title, feedTitle);
1026 set_String(&bm->tags, tags);
1027 }
1028 }
1029 postCommand_App("bookmarks.changed");
1030 destroy_Widget(dlg);
1031 return iTrue;
1032 }
1033 return iFalse;
1034}
1035
1036iBool willUseProxy_App(const iRangecc scheme) { 993iBool willUseProxy_App(const iRangecc scheme) {
1037 return schemeProxy_App(scheme) != NULL; 994 return schemeProxy_App(scheme) != NULL;
1038} 995}
@@ -1403,57 +1360,8 @@ iBool handleCommand_App(const char *cmd) {
1403 if (isEmpty_String(url)) { 1360 if (isEmpty_String(url)) {
1404 return iTrue; 1361 return iTrue;
1405 } 1362 }
1406 uint32_t id = findUrl_Bookmarks(d->bookmarks, url); 1363 makeFeedSettings_Widget(findUrl_Bookmarks(d->bookmarks, url));
1407 const iBookmark *bm = id ? get_Bookmarks(d->bookmarks, id) : NULL;
1408 iWidget * dlg = makeFeedSettings_Widget(id);
1409 setText_InputWidget(findChild_Widget(dlg, "feedcfg.title"),
1410 bm ? &bm->title : feedTitle_DocumentWidget(document_App()));
1411 setFlags_Widget(findChild_Widget(dlg,
1412 hasTag_Bookmark(bm, "headings") ? "feedcfg.type.headings"
1413 : "feedcfg.type.gemini"),
1414 selected_WidgetFlag,
1415 iTrue);
1416 setCommandHandler_Widget(dlg, handleFeedSettingCommands_);
1417 return iTrue; 1364 return iTrue;
1418#if 0
1419 const size_t numSubs = numSubscribed_Feeds();
1420 if (!isEmpty_String(url)) {
1421 iBool wasCreated = iFalse;
1422 uint32_t id = findUrl_Bookmarks(d->bookmarks, url);
1423 if (!id) {
1424 add_Bookmarks(d->bookmarks,
1425 url,
1426 bookmarkTitle_DocumentWidget(document_App()),
1427 collectNewCStr_String("subscribed"),
1428 siteIcon_GmDocument(document_DocumentWidget(document_App())));
1429 wasCreated = iTrue;
1430 }
1431
1432 if (numSubs == 0 && !cmp_String(tag, "subscribed")) {
1433 postCommand_App("feeds.refresh");
1434 }
1435 }
1436#endif
1437#if 0
1438 const iString *tag = string_Command(cmd, "tag");
1439 const iString *url = url_DocumentWidget(document_App());
1440 const size_t numSubs = numSubscribed_Feeds();
1441 if (!isEmpty_String(url)) {
1442 uint32_t id = findUrl_Bookmarks(d->bookmarks, url);
1443 if (id) {
1444 addTag_Bookmark(get_Bookmarks(d->bookmarks, id), cstr_String(tag));
1445 }
1446 else {
1447 add_Bookmarks(d->bookmarks, url, bookmarkTitle_DocumentWidget(document_App()),
1448 tag, siteIcon_GmDocument(document_DocumentWidget(document_App())));
1449 }
1450 postCommand_App("bookmarks.changed");
1451 if (numSubs == 0 && !cmp_String(tag, "subscribed")) {
1452 postCommand_App("feeds.refresh");
1453 }
1454 }
1455 return iTrue;
1456#endif
1457 } 1365 }
1458 else if (equal_Command(cmd, "bookmarks.changed")) { 1366 else if (equal_Command(cmd, "bookmarks.changed")) {
1459 save_Bookmarks(d->bookmarks, dataDir_App_); 1367 save_Bookmarks(d->bookmarks, dataDir_App_);