summaryrefslogtreecommitdiff
path: root/src/app.c
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2020-12-01 18:33:42 +0200
committerJaakko Keränen <jaakko.keranen@iki.fi>2020-12-01 18:33:42 +0200
commit7d2744f839fb6adb9b4e13957ab53dc57293ae6d (patch)
tree0a69a8d0e26130e3aed77fcbb35722c26b7e85ea /src/app.c
parent319b3d8bba5793a56654d143a4ac75170698e141 (diff)
Editing feed title in Feed Settings dialog
Diffstat (limited to 'src/app.c')
-rw-r--r--src/app.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/app.c b/src/app.c
index 3daf7c03..610403f0 100644
--- a/src/app.c
+++ b/src/app.c
@@ -912,6 +912,12 @@ static iBool handleFeedSettingCommands_(iWidget *dlg, const char *cmd) {
912 return iTrue; 912 return iTrue;
913 } 913 }
914 if (equal_Command(cmd, "feedcfg.accept")) { 914 if (equal_Command(cmd, "feedcfg.accept")) {
915 iString *feedTitle =
916 collect_String(copy_String(text_InputWidget(findChild_Widget(dlg, "feedcfg.title"))));
917 trim_String(feedTitle);
918 if (isEmpty_String(feedTitle)) {
919 return iTrue;
920 }
915 int id = argLabel_Command(cmd, "bmid"); 921 int id = argLabel_Command(cmd, "bmid");
916 const iBool headings = isSelected_Widget(findChild_Widget(dlg, "feedcfg.type.headings")); 922 const iBool headings = isSelected_Widget(findChild_Widget(dlg, "feedcfg.type.headings"));
917 const iString *tags = collectNewFormat_String("subscribed%s", headings ? " headings" : ""); 923 const iString *tags = collectNewFormat_String("subscribed%s", headings ? " headings" : "");
@@ -920,7 +926,7 @@ static iBool handleFeedSettingCommands_(iWidget *dlg, const char *cmd) {
920 const iString *url = url_DocumentWidget(document_App()); 926 const iString *url = url_DocumentWidget(document_App());
921 add_Bookmarks(d->bookmarks, 927 add_Bookmarks(d->bookmarks,
922 url, 928 url,
923 bookmarkTitle_DocumentWidget(document_App()), 929 feedTitle,
924 tags, 930 tags,
925 siteIcon_GmDocument(document_DocumentWidget(document_App()))); 931 siteIcon_GmDocument(document_DocumentWidget(document_App())));
926 if (numSubs == 0) { 932 if (numSubs == 0) {
@@ -931,6 +937,7 @@ static iBool handleFeedSettingCommands_(iWidget *dlg, const char *cmd) {
931 else { 937 else {
932 iBookmark *bm = get_Bookmarks(d->bookmarks, id); 938 iBookmark *bm = get_Bookmarks(d->bookmarks, id);
933 if (bm) { 939 if (bm) {
940 set_String(&bm->title, feedTitle);
934 set_String(&bm->tags, tags); 941 set_String(&bm->tags, tags);
935 } 942 }
936 } 943 }
@@ -1288,11 +1295,8 @@ iBool handleCommand_App(const char *cmd) {
1288 uint32_t id = findUrl_Bookmarks(d->bookmarks, url); 1295 uint32_t id = findUrl_Bookmarks(d->bookmarks, url);
1289 const iBookmark *bm = id ? get_Bookmarks(d->bookmarks, id) : NULL; 1296 const iBookmark *bm = id ? get_Bookmarks(d->bookmarks, id) : NULL;
1290 iWidget * dlg = makeFeedSettings_Widget(id); 1297 iWidget * dlg = makeFeedSettings_Widget(id);
1291 setText_LabelWidget(findChild_Widget(dlg, "feedcfg.title"), 1298 setText_InputWidget(findChild_Widget(dlg, "feedcfg.title"),
1292 collectNewFormat_String( 1299 bm ? &bm->title : feedTitle_DocumentWidget(document_App()));
1293 uiHeading_ColorEscape "%s",
1294 bm ? cstr_String(&bm->title)
1295 : cstr_String(bookmarkTitle_DocumentWidget(document_App()))));
1296 setFlags_Widget(findChild_Widget(dlg, 1300 setFlags_Widget(findChild_Widget(dlg,
1297 hasTag_Bookmark(bm, "headings") ? "feedcfg.type.headings" 1301 hasTag_Bookmark(bm, "headings") ? "feedcfg.type.headings"
1298 : "feedcfg.type.gemini"), 1302 : "feedcfg.type.gemini"),