lists.geany.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
List overview
Plugins-Commits
March 2024
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
plugins-commits@lists.geany.org
1 participants
13 discussions
Start a n
N
ew thread
[geany/geany-plugins] f89952: geanyctags: update the readtags library
by Jiří Techet
17 Mar '24
17 Mar '24
Branch: refs/heads/master Author: Jiří Techet <techet(a)gmail.com> Committer: Jiří Techet <techet(a)gmail.com> Date: Tue, 05 Mar 2024 22:13:42 UTC Commit: f89952d514b2e7a7e8451fddd27ac033c1b140cd
https://github.com/geany/geany-plugins/commit/f89952d514b2e7a7e8451fddd27ac…
Log Message: ----------- geanyctags: update the readtags library Modified Paths: -------------- geanyctags/src/readtags.c geanyctags/src/readtags.h Modified: geanyctags/src/readtags.c 367 lines changed, 257 insertions(+), 110 deletions(-) =================================================================== @@ -32,28 +32,39 @@ typedef struct { char *buffer; } vstring; +/* Define readtags' own off_t. */ +#ifdef _WIN32 +typedef long long rt_off_t; +#else +typedef off_t rt_off_t; +#endif + /* Information about current tag file */ struct sTagFile { /* has the file been opened and this structure initialized? */ - short initialized; + unsigned char initialized; /* format of tag file */ - short format; + unsigned char format; + /* 1 "u-ctags" is set to !_TAG_OUTPUT_MODE pseudo tag + * and "slash" is set to !_TAG_OUTPUT_FILESEP + * pseudo tag in the tags file. */ + unsigned char inputUCtagsMode; /* how is the tag file sorted? */ tagSortType sortMethod; /* pointer to file structure */ FILE* fp; /* file position of first character of `line' */ - off_t pos; + rt_off_t pos; /* size of tag file in seekable positions */ - off_t size; + rt_off_t size; /* last line read */ vstring line; /* name of tag in last line read */ vstring name; /* defines tag search state */ struct { /* file position of last match for tag */ - off_t pos; + rt_off_t pos; /* name of tag last searched for */ char *name; /* length of name for partial matches */ @@ -97,8 +108,34 @@ static const size_t PseudoTagPrefixLength = 2; * FUNCTION DEFINITIONS */ +static rt_off_t readtags_ftell(FILE *fp) +{ + rt_off_t pos; + +#ifdef _WIN32 + pos = _ftelli64(fp); +#else + pos = ftell(fp); +#endif + + return pos; +} + +static int readtags_fseek(FILE *fp, rt_off_t pos, int whence) +{ + int ret; + +#ifdef _WIN32 + ret = _fseeki64(fp, pos, whence); +#else + ret = fseek(fp, pos, whence); +#endif + + return ret; +} + /* Converts a hexadecimal digit to its value */ -static int xdigitValue (char digit) +static int xdigitValue (unsigned char digit) { if (digit >= '0' && digit <= '9') return digit - '0'; @@ -114,39 +151,42 @@ static int xdigitValue (char digit) * Reads the first character from the string, possibly un-escaping it, and * advances *s to the start of the next character. */ -static int readTagCharacter (const char **s) +static int readTagCharacter (const char **const s) { - int c = **(const unsigned char **)s; + const unsigned char *p = (const unsigned char *) *s; + int c = *p; - (*s)++; + p++; if (c == '\\') { - switch (**s) + switch (*p) { - case 't': c = '\t'; (*s)++; break; - case 'r': c = '\r'; (*s)++; break; - case 'n': c = '\n'; (*s)++; break; - case '\\': c = '\\'; (*s)++; break; + case 't': c = '\t'; p++; break; + case 'r': c = '\r'; p++; break; + case 'n': c = '\n'; p++; break; + case '\\': c = '\\'; p++; break; /* Universal-CTags extensions */ - case 'a': c = '\a'; (*s)++; break; - case 'b': c = '\b'; (*s)++; break; - case 'v': c = '\v'; (*s)++; break; - case 'f': c = '\f'; (*s)++; break; + case 'a': c = '\a'; p++; break; + case 'b': c = '\b'; p++; break; + case 'v': c = '\v'; p++; break; + case 'f': c = '\f'; p++; break; case 'x': - if (isxdigit ((*s)[1]) && isxdigit ((*s)[2])) + if (isxdigit (p[1]) && isxdigit (p[2])) { - int val = (xdigitValue ((*s)[1]) << 4) | xdigitValue ((*s)[2]); + int val = (xdigitValue (p[1]) << 4) | xdigitValue (p[2]); if (val < 0x80) { - (*s) += 3; + p += 3; c = val; } } break; } } + *s = (const char *) p; + return c; } @@ -285,7 +325,7 @@ static int readTagLineRaw (tagFile *const file, int *err) char *const pLastChar = file->line.buffer + file->line.size - 2; char *line; - file->pos = ftell (file->fp); + file->pos = readtags_ftell (file->fp); if (file->pos < 0) { *err = errno; @@ -312,7 +352,8 @@ static int readTagLineRaw (tagFile *const file, int *err) *err = ENOMEM; result = 0; } - if (fseek (file->fp, file->pos, SEEK_SET) < 0) + + if (readtags_fseek (file->fp, file->pos, SEEK_SET) < 0) { *err = errno; result = 0; @@ -485,26 +526,15 @@ static unsigned int countContinuousBackslashesBackward(const char *from, return counter; } -static tagResult parseTagLine (tagFile *file, tagEntry *const entry, int *err) +/* When unescaping, the input string becomes shorter. + * e.g. \t occupies two bytes on the tag file. + * It is converted to 0x9 and occupies one byte. + * memmove called here for shortening the line + * buffer. */ +static char *unescapeInPlace (char *q, char **tab, size_t *p_len) { - int i; - char *p = file->line.buffer; - size_t p_len = strlen (p); - char *tab = strchr (p, TAB); - - memset(entry, 0, sizeof(*entry)); - - entry->name = p; - if (tab != NULL) - { - *tab = '\0'; - } + char *p = q; - /* When unescaping, the input string becomes shorter. - * e.g. \t occupies two bytes on the tag file. - * It is converted to 0x9 and occupies one byte. - * memmove called here for shortening the line - * buffer. */ while (*p != '\0') { const char *next = p; @@ -513,21 +543,50 @@ static tagResult parseTagLine (tagFile *file, tagEntry *const entry, int *err) *p = (char) ch; p++; - p_len -= skip; + *p_len -= skip; if (skip > 1) { /* + 1 is for moving the area including the last '\0'. */ - memmove (p, next, p_len + 1); - if (tab) - tab -= skip - 1; + memmove (p, next, *p_len + 1); + if (*tab) + *tab -= skip - 1; } } + return p; +} + +static tagResult parseTagLine (tagFile *file, tagEntry *const entry, int *err) +{ + int i; + char *p = file->line.buffer; + size_t p_len = strlen (p); + char *tab = strchr (p, TAB); + + memset(entry, 0, sizeof(*entry)); + + entry->name = p; + if (tab != NULL) + { + *tab = '\0'; + } + + p = unescapeInPlace (p, &tab, &p_len); + if (tab != NULL) { p = tab + 1; entry->file = p; tab = strchr (p, TAB); + if (file->inputUCtagsMode) + { + if (tab != NULL) + { + *tab = '\0'; + } + p = unescapeInPlace (p, &tab, &p_len); + } + if (tab != NULL) { int fieldsPresent; @@ -554,12 +613,12 @@ static tagResult parseTagLine (tagFile *file, tagEntry *const entry, int *err) else ++p; } - else if (isdigit ((int) *(unsigned char*) p)) + else if (isdigit (*(unsigned char*) p)) { /* parse line number */ entry->address.pattern = p; entry->address.lineNumber = atol (p); - while (isdigit ((int) *(unsigned char*) p)) + while (isdigit (*(unsigned char*) p)) ++p; if (p) { @@ -636,6 +695,8 @@ static tagResult readPseudoTags (tagFile *const file, tagFileInfo *const info) int err = 0; tagResult result = TagSuccess; const size_t prefixLength = strlen (PseudoTagPrefix); + int tag_output_mode_u_ctags = 0; + int tag_output_filesep_slash = 0; info->file.format = 1; info->file.sort = TAG_UNSORTED; @@ -683,7 +744,7 @@ static tagResult readPseudoTags (tagFile *const file, tagFileInfo *const info) err = TagErrnoUnexpectedFormat; break; } - file->format = (short) m; + file->format = (unsigned char) m; } else if (strcmp (key, "TAG_PROGRAM_AUTHOR") == 0) { @@ -721,6 +782,16 @@ static tagResult readPseudoTags (tagFile *const file, tagFileInfo *const info) break; } } + else if (strcmp (key, "TAG_OUTPUT_MODE") == 0) + { + if (strcmp (value, "u-ctags") == 0) + tag_output_mode_u_ctags = 1; + } + else if (strcmp (key, "TAG_OUTPUT_FILESEP") == 0) + { + if (strcmp (value, "slash") == 0) + tag_output_filesep_slash = 1; + } info->file.format = file->format; info->file.sort = file->sortMethod; @@ -730,6 +801,10 @@ static tagResult readPseudoTags (tagFile *const file, tagFileInfo *const info) info->program.version = file->program.version; } } + + if (tag_output_mode_u_ctags && tag_output_filesep_slash) + file->inputUCtagsMode = 1; + if (fsetpos (file->fp, &startOfLine) < 0) err = errno; @@ -748,7 +823,7 @@ static tagResult gotoFirstLogicalTag (tagFile *const file) { fpos_t startOfLine; - if (fseek(file->fp, 0L, SEEK_SET) == -1) + if (readtags_fseek(file->fp, 0, SEEK_SET) == -1) { file->err = errno; return TagFailure; @@ -798,37 +873,55 @@ static tagFile *initialize (const char *const filePath, tagFileInfo *const info) result->fields.max, sizeof (tagExtensionField)); if (result->fields.list == NULL) goto mem_error; - result->fp = fopen (filePath, "rb"); + +#if defined(__GLIBC__) && (__GLIBC__ >= 2) \ + && defined(__GLIBC_MINOR__) && (__GLIBC_MINOR__ >= 3) + result->fp = fopen (filePath, "rbm"); +#endif + if (result->fp == NULL) + { + errno = 0; + result->fp = fopen (filePath, "rb"); + } if (result->fp == NULL) { info->status.error_number = errno; goto file_error; } - else - { - if (fseek (result->fp, 0, SEEK_END) == -1) - { - info->status.error_number = errno; - goto file_error; - } - result->size = ftell (result->fp); - if (result->size == -1) - { - info->status.error_number = errno; - goto file_error; - } - if (fseek(result->fp, 0L, SEEK_SET) == -1) - { - info->status.error_number = errno; - goto file_error; - } - if (readPseudoTags (result, info) == TagFailure) - goto file_error; + /* Record the size of the tags file to `size` field of result. */ + if (readtags_fseek (result->fp, 0, SEEK_END) == -1) + { + info->status.error_number = errno; + goto file_error; + } + result->size = readtags_ftell (result->fp); + if (result->size == -1) + { + /* fseek() retruns an int value. + * We observed following behavior on Windows; + * if sizeof(int) of the platform is too small for + * representing the size of the tags file, fseek() + * returns -1 and it doesn't set errno. + */ + info->status.error_number = errno; + if (info->status.error_number == 0) + info->status.error_number = TagErrnoFileMaybeTooBig; - info->status.opened = 1; - result->initialized = 1; + goto file_error; + } + if (readtags_fseek(result->fp, 0, SEEK_SET) == -1) + { + info->status.error_number = errno; + goto file_error; } + + if (readPseudoTags (result, info) == TagFailure) + goto file_error; + + info->status.opened = 1; + result->initialized = 1; + return result; mem_error: info->status.error_number = ENOMEM; @@ -870,19 +963,23 @@ static void terminate (tagFile *const file) static tagResult readNext (tagFile *const file, tagEntry *const entry) { tagResult result; - if (file == NULL || ! file->initialized) + + if (file == NULL) + return TagFailure; + + if (! file->initialized) { file->err = TagErrnoInvalidArgument; - result = TagFailure; - } - else if (! readTagLine (file, &file->err)) - result = TagFailure; - else - { - result = (entry != NULL) - ? parseTagLine (file, entry, &file->err) - : TagSuccess; + return TagFailure; } + + if (! readTagLine (file, &file->err)) + return TagFailure; + + result = (entry != NULL) + ? parseTagLine (file, entry, &file->err) + : TagSuccess; + return result; } @@ -901,9 +998,9 @@ static const char *readFieldValue ( return result; } -static int readTagLineSeek (tagFile *const file, const off_t pos) +static int readTagLineSeek (tagFile *const file, const rt_off_t pos) { - if (fseek (file->fp, pos, SEEK_SET) < 0) + if (readtags_fseek (file->fp, pos, SEEK_SET) < 0) { file->err = errno; return 0; @@ -947,11 +1044,11 @@ static tagResult findFirstNonMatchBefore (tagFile *const file) #define JUMP_BACK 512 int more_lines; int comp; - off_t start = file->pos; - off_t pos = start; + rt_off_t start = file->pos; + rt_off_t pos = start; do { - if (pos < (off_t) JUMP_BACK) + if (pos < (rt_off_t) JUMP_BACK) pos = 0; else pos = pos - JUMP_BACK; @@ -967,7 +1064,7 @@ static tagResult findFirstMatchBefore (tagFile *const file) { tagResult result = TagFailure; int more_lines; - off_t start = file->pos; + rt_off_t start = file->pos; if (findFirstNonMatchBefore (file) != TagSuccess) return TagFailure; do @@ -984,10 +1081,10 @@ static tagResult findFirstMatchBefore (tagFile *const file) static tagResult findBinary (tagFile *const file) { tagResult result = TagFailure; - off_t lower_limit = 0; - off_t upper_limit = file->size; - off_t last_pos = 0; - off_t pos = upper_limit / 2; + rt_off_t lower_limit = 0; + rt_off_t upper_limit = file->size; + rt_off_t last_pos = 0; + rt_off_t pos = upper_limit / 2; while (result != TagSuccess) { if (! readTagLineSeek (file, pos)) @@ -1034,7 +1131,10 @@ static tagResult findSequentialFull (tagFile *const file, int (* isAcceptable) (tagFile *const, void *), void *data) { - if (file == NULL || !file->initialized || file->err) + if (file == NULL) + return TagFailure; + + if (!file->initialized || file->err) { file->err = TagErrnoInvalidArgument; return TagFailure; @@ -1076,37 +1176,31 @@ static tagResult find (tagFile *const file, tagEntry *const entry, file->search.nameLength = strlen (name); file->search.partial = (options & TAG_PARTIALMATCH) != 0; file->search.ignorecase = (options & TAG_IGNORECASE) != 0; - if (fseek (file->fp, 0, SEEK_END) < 0) + if (readtags_fseek (file->fp, 0, SEEK_END) < 0) { file->err = errno; return TagFailure; } - file->size = ftell (file->fp); + file->size = readtags_ftell (file->fp); if (file->size == -1) { file->err = errno; return TagFailure; } - if (fseek(file->fp, 0L, SEEK_SET) == -1) + if (readtags_fseek(file->fp, 0, SEEK_SET) == -1) { file->err = errno; return TagFailure; } if ((file->sortMethod == TAG_SORTED && !file->search.ignorecase) || (file->sortMethod == TAG_FOLDSORTED && file->search.ignorecase)) { -#ifdef DEBUG - fputs ("<performing binary search>\n", stderr); -#endif result = findBinary (file); if (result == TagFailure && file->err) return TagFailure; } else { -#ifdef DEBUG - fputs ("<performing sequential search>\n", stderr); -#endif result = findSequential (file); if (result == TagFailure && file->err) return TagFailure; @@ -1155,15 +1249,18 @@ static tagResult findNext (tagFile *const file, tagEntry *const entry) static tagResult findPseudoTag (tagFile *const file, int rewindBeforeFinding, tagEntry *const entry) { - if (file == NULL || (!file->initialized) || file->err) + if (file == NULL) + return TagFailure; + + if (!file->initialized || file->err) { - file->err= TagErrnoInvalidArgument;; + file->err = TagErrnoInvalidArgument; return TagFailure; } if (rewindBeforeFinding) { - if (fseek(file->fp, 0L, SEEK_SET) == -1) + if (readtags_fseek(file->fp, 0, SEEK_SET) == -1) { file->err = errno; return TagFailure; @@ -1188,7 +1285,10 @@ extern tagFile *tagsOpen (const char *const filePath, tagFileInfo *const info) extern tagResult tagsSetSortType (tagFile *const file, const tagSortType type) { - if (file == NULL || (!file->initialized) || file->err) + if (file == NULL) + return TagFailure; + + if (!file->initialized || file->err) { file->err = TagErrnoInvalidArgument; return TagFailure; @@ -1209,7 +1309,10 @@ extern tagResult tagsSetSortType (tagFile *const file, const tagSortType type) extern tagResult tagsFirst (tagFile *const file, tagEntry *const entry) { - if (file == NULL || (!file->initialized) || file->err) + if (file == NULL) + return TagFailure; + + if (!file->initialized || file->err) { file->err = TagErrnoInvalidArgument; return TagFailure; @@ -1222,7 +1325,10 @@ extern tagResult tagsFirst (tagFile *const file, tagEntry *const entry) extern tagResult tagsNext (tagFile *const file, tagEntry *const entry) { - if (file == NULL || (!file->initialized) || file->err) + if (file == NULL) + return TagFailure; + + if (!file->initialized || file->err) { file->err = TagErrnoInvalidArgument; return TagFailure; @@ -1242,21 +1348,29 @@ extern const char *tagsField (const tagEntry *const entry, const char *const key extern tagResult tagsFind (tagFile *const file, tagEntry *const entry, const char *const name, const int options) { - if (file == NULL || !file->initialized || file->err) + if (file == NULL) + return TagFailure; + + if (!file->initialized || file->err) { file->err = TagErrnoInvalidArgument; return TagFailure; } + return find (file, entry, name, options); } extern tagResult tagsFindNext (tagFile *const file, tagEntry *const entry) { - if (file == NULL || !file->initialized || file->err) + if (file == NULL) + return TagFailure; + + if (!file->initialized || file->err) { file->err = TagErrnoInvalidArgument; return TagFailure; } + return findNext (file, entry); } @@ -1270,6 +1384,39 @@ extern tagResult tagsNextPseudoTag (tagFile *const file, tagEntry *const entry) return findPseudoTag (file, 0, entry); } +extern tagResult tagsFindPseudoTag (tagFile *const file, tagEntry *const entry, + const char *const name, const int match) +{ + size_t len; + tagEntry entry0; + tagEntry *entryp = entry? entry: &entry0; + + tagResult r = tagsFirstPseudoTag (file, entryp); + if (r != TagSuccess) + return r; + + if (match & TAG_PARTIALMATCH) + len = strlen (name); + + do + { + if (match & TAG_PARTIALMATCH) + { + if (strncmp (entryp->name, name, len) == 0) + return TagSuccess; + } + else + { + if (strcmp (entryp->name, name) == 0) + return TagSuccess; + } + r = tagsNextPseudoTag (file, entryp); + } + while (r == TagSuccess); + + return r; +} + extern tagResult tagsClose (tagFile *const file) { tagResult result = TagFailure; Modified: geanyctags/src/readtags.h 20 lines changed, 18 insertions(+), 2 deletions(-) =================================================================== @@ -39,7 +39,7 @@ typedef enum { #define sortType tagSortType #endif -/* Options for tagsFind() */ +/* Options for tagsFind() and tagsFindPseudoTag() */ #define TAG_FULLMATCH 0x0 #define TAG_PARTIALMATCH 0x1 @@ -59,6 +59,7 @@ typedef enum { * (Zero or a positive integer is expected.) */ TagErrnoInvalidArgument = -4, /* Unexpected argument passed to the API * function */ + TagErrnoFileMaybeTooBig = -5, /* Maybe the tags file is too big */ } tagErrno; struct sTagFile; @@ -258,7 +259,7 @@ extern tagResult tagsFindNext (tagFile *const file, tagEntry *const entry); /* * Does the same as tagsFirst(), but is specialized to pseudo tags. -* If tagFileInfo doesn't contain pseudo tags you are interested, read +* If tagFileInfo doesn't contain pseudo tags you are interested in, read * them sequentially with this function and tagsNextPseudoTag(). */ extern tagResult tagsFirstPseudoTag (tagFile *const file, tagEntry *const entry); @@ -269,6 +270,21 @@ extern tagResult tagsFirstPseudoTag (tagFile *const file, tagEntry *const entry) */ extern tagResult tagsNextPseudoTag (tagFile *const file, tagEntry *const entry); +/* +* Does the same as tagsFind(), but is specialized to pseudo tags. +* The available values for `match' are: +* +* TAG_PARTIALMATCH +* Tags whose leading characters match `name' will qualify. +* +* TAG_FULLMATCH +* Only tags whose full lengths match `name' will qualify. +* +* NOTE: unlike tagsFind(), this function uses liner-searching even if +* the tags file is sorted. +*/ +extern tagResult tagsFindPseudoTag (tagFile *const file, tagEntry *const entry, const char *const name, const int match); + /* * Call tagsClose() at completion of reading the tag file, which will * close the file and free any internal memory allocated. The function will -------------- This E-Mail was brought to you by github_commit_mail.py (Source:
https://github.com/geany/infrastructure
).
1
0
0
0
[geany/geany-plugins] 7c2e48: geanyctags: fix some warnings
by Jiří Techet
17 Mar '24
17 Mar '24
Branch: refs/heads/master Author: Jiří Techet <techet(a)gmail.com> Committer: Jiří Techet <techet(a)gmail.com> Date: Tue, 05 Mar 2024 22:09:04 UTC Commit: 7c2e488ed4c76db3a8ea1207f70537904138a5ef
https://github.com/geany/geany-plugins/commit/7c2e488ed4c76db3a8ea1207f7053…
Log Message: ----------- geanyctags: fix some warnings Modified Paths: -------------- geanyctags/src/geanyctags.c Modified: geanyctags/src/geanyctags.c 12 lines changed, 6 insertions(+), 6 deletions(-) =================================================================== @@ -545,7 +545,7 @@ static void create_dialog_find_file(void) size_group = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); label = gtk_label_new_with_mnemonic(_("_Search for:")); - gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); + gtk_label_set_xalign(GTK_LABEL(label), 0.0); gtk_size_group_add_widget(size_group, label); s_ft_dialog.combo = gtk_combo_box_text_new_with_entry(); @@ -557,13 +557,13 @@ static void create_dialog_find_file(void) ui_entry_add_clear_icon(GTK_ENTRY(entry)); gtk_entry_set_activates_default(GTK_ENTRY(entry), TRUE); - ebox = gtk_hbox_new(FALSE, 6); + ebox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 6); gtk_box_pack_start(GTK_BOX(ebox), label, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(ebox), s_ft_dialog.combo, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(vbox), ebox, TRUE, FALSE, 0); label = gtk_label_new_with_mnemonic(_("_Match type:")); - gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); + gtk_label_set_xalign(GTK_LABEL(label), 0.0); gtk_size_group_add_widget(size_group, label); s_ft_dialog.combo_match = gtk_combo_box_text_new(); @@ -573,16 +573,16 @@ static void create_dialog_find_file(void) gtk_combo_box_set_active(GTK_COMBO_BOX(s_ft_dialog.combo_match), 1); gtk_label_set_mnemonic_widget(GTK_LABEL(label), s_ft_dialog.combo_match); - ebox = gtk_hbox_new(FALSE, 6); + ebox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 6); gtk_box_pack_start(GTK_BOX(ebox), label, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(ebox), s_ft_dialog.combo_match, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(vbox), ebox, TRUE, FALSE, 0); s_ft_dialog.case_sensitive = gtk_check_button_new_with_mnemonic(_("C_ase sensitive")); - gtk_button_set_focus_on_click(GTK_BUTTON(s_ft_dialog.case_sensitive), FALSE); + gtk_widget_set_focus_on_click(s_ft_dialog.case_sensitive, FALSE); s_ft_dialog.declaration = gtk_check_button_new_with_mnemonic(_("_Declaration")); - gtk_button_set_focus_on_click(GTK_BUTTON(s_ft_dialog.declaration), FALSE); + gtk_widget_set_focus_on_click(s_ft_dialog.declaration, FALSE); g_object_unref(G_OBJECT(size_group)); /* auto destroy the size group */ -------------- This E-Mail was brought to you by github_commit_mail.py (Source:
https://github.com/geany/infrastructure
).
1
0
0
0
[geany/geany-plugins] a8f26a: Merge pull request #1317 from techee/ctags-fixes
by Jiří Techet
17 Mar '24
17 Mar '24
Branch: refs/heads/master Author: Jiří Techet <techet(a)gmail.com> Committer: GitHub <noreply(a)github.com> Date: Sun, 17 Mar 2024 21:34:21 UTC Commit: a8f26ab20668206588aac8ffd3f56045575bebd6
https://github.com/geany/geany-plugins/commit/a8f26ab20668206588aac8ffd3f56…
Log Message: ----------- Merge pull request #1317 from techee/ctags-fixes geanyctags: eliminate some warnings and update the readtags library Modified Paths: -------------- geanyctags/src/geanyctags.c geanyctags/src/readtags.c geanyctags/src/readtags.h Modified: geanyctags/src/geanyctags.c 12 lines changed, 6 insertions(+), 6 deletions(-) =================================================================== @@ -545,7 +545,7 @@ static void create_dialog_find_file(void) size_group = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); label = gtk_label_new_with_mnemonic(_("_Search for:")); - gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); + gtk_label_set_xalign(GTK_LABEL(label), 0.0); gtk_size_group_add_widget(size_group, label); s_ft_dialog.combo = gtk_combo_box_text_new_with_entry(); @@ -557,13 +557,13 @@ static void create_dialog_find_file(void) ui_entry_add_clear_icon(GTK_ENTRY(entry)); gtk_entry_set_activates_default(GTK_ENTRY(entry), TRUE); - ebox = gtk_hbox_new(FALSE, 6); + ebox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 6); gtk_box_pack_start(GTK_BOX(ebox), label, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(ebox), s_ft_dialog.combo, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(vbox), ebox, TRUE, FALSE, 0); label = gtk_label_new_with_mnemonic(_("_Match type:")); - gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); + gtk_label_set_xalign(GTK_LABEL(label), 0.0); gtk_size_group_add_widget(size_group, label); s_ft_dialog.combo_match = gtk_combo_box_text_new(); @@ -573,16 +573,16 @@ static void create_dialog_find_file(void) gtk_combo_box_set_active(GTK_COMBO_BOX(s_ft_dialog.combo_match), 1); gtk_label_set_mnemonic_widget(GTK_LABEL(label), s_ft_dialog.combo_match); - ebox = gtk_hbox_new(FALSE, 6); + ebox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 6); gtk_box_pack_start(GTK_BOX(ebox), label, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(ebox), s_ft_dialog.combo_match, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(vbox), ebox, TRUE, FALSE, 0); s_ft_dialog.case_sensitive = gtk_check_button_new_with_mnemonic(_("C_ase sensitive")); - gtk_button_set_focus_on_click(GTK_BUTTON(s_ft_dialog.case_sensitive), FALSE); + gtk_widget_set_focus_on_click(s_ft_dialog.case_sensitive, FALSE); s_ft_dialog.declaration = gtk_check_button_new_with_mnemonic(_("_Declaration")); - gtk_button_set_focus_on_click(GTK_BUTTON(s_ft_dialog.declaration), FALSE); + gtk_widget_set_focus_on_click(s_ft_dialog.declaration, FALSE); g_object_unref(G_OBJECT(size_group)); /* auto destroy the size group */ Modified: geanyctags/src/readtags.c 367 lines changed, 257 insertions(+), 110 deletions(-) =================================================================== @@ -32,28 +32,39 @@ typedef struct { char *buffer; } vstring; +/* Define readtags' own off_t. */ +#ifdef _WIN32 +typedef long long rt_off_t; +#else +typedef off_t rt_off_t; +#endif + /* Information about current tag file */ struct sTagFile { /* has the file been opened and this structure initialized? */ - short initialized; + unsigned char initialized; /* format of tag file */ - short format; + unsigned char format; + /* 1 "u-ctags" is set to !_TAG_OUTPUT_MODE pseudo tag + * and "slash" is set to !_TAG_OUTPUT_FILESEP + * pseudo tag in the tags file. */ + unsigned char inputUCtagsMode; /* how is the tag file sorted? */ tagSortType sortMethod; /* pointer to file structure */ FILE* fp; /* file position of first character of `line' */ - off_t pos; + rt_off_t pos; /* size of tag file in seekable positions */ - off_t size; + rt_off_t size; /* last line read */ vstring line; /* name of tag in last line read */ vstring name; /* defines tag search state */ struct { /* file position of last match for tag */ - off_t pos; + rt_off_t pos; /* name of tag last searched for */ char *name; /* length of name for partial matches */ @@ -97,8 +108,34 @@ static const size_t PseudoTagPrefixLength = 2; * FUNCTION DEFINITIONS */ +static rt_off_t readtags_ftell(FILE *fp) +{ + rt_off_t pos; + +#ifdef _WIN32 + pos = _ftelli64(fp); +#else + pos = ftell(fp); +#endif + + return pos; +} + +static int readtags_fseek(FILE *fp, rt_off_t pos, int whence) +{ + int ret; + +#ifdef _WIN32 + ret = _fseeki64(fp, pos, whence); +#else + ret = fseek(fp, pos, whence); +#endif + + return ret; +} + /* Converts a hexadecimal digit to its value */ -static int xdigitValue (char digit) +static int xdigitValue (unsigned char digit) { if (digit >= '0' && digit <= '9') return digit - '0'; @@ -114,39 +151,42 @@ static int xdigitValue (char digit) * Reads the first character from the string, possibly un-escaping it, and * advances *s to the start of the next character. */ -static int readTagCharacter (const char **s) +static int readTagCharacter (const char **const s) { - int c = **(const unsigned char **)s; + const unsigned char *p = (const unsigned char *) *s; + int c = *p; - (*s)++; + p++; if (c == '\\') { - switch (**s) + switch (*p) { - case 't': c = '\t'; (*s)++; break; - case 'r': c = '\r'; (*s)++; break; - case 'n': c = '\n'; (*s)++; break; - case '\\': c = '\\'; (*s)++; break; + case 't': c = '\t'; p++; break; + case 'r': c = '\r'; p++; break; + case 'n': c = '\n'; p++; break; + case '\\': c = '\\'; p++; break; /* Universal-CTags extensions */ - case 'a': c = '\a'; (*s)++; break; - case 'b': c = '\b'; (*s)++; break; - case 'v': c = '\v'; (*s)++; break; - case 'f': c = '\f'; (*s)++; break; + case 'a': c = '\a'; p++; break; + case 'b': c = '\b'; p++; break; + case 'v': c = '\v'; p++; break; + case 'f': c = '\f'; p++; break; case 'x': - if (isxdigit ((*s)[1]) && isxdigit ((*s)[2])) + if (isxdigit (p[1]) && isxdigit (p[2])) { - int val = (xdigitValue ((*s)[1]) << 4) | xdigitValue ((*s)[2]); + int val = (xdigitValue (p[1]) << 4) | xdigitValue (p[2]); if (val < 0x80) { - (*s) += 3; + p += 3; c = val; } } break; } } + *s = (const char *) p; + return c; } @@ -285,7 +325,7 @@ static int readTagLineRaw (tagFile *const file, int *err) char *const pLastChar = file->line.buffer + file->line.size - 2; char *line; - file->pos = ftell (file->fp); + file->pos = readtags_ftell (file->fp); if (file->pos < 0) { *err = errno; @@ -312,7 +352,8 @@ static int readTagLineRaw (tagFile *const file, int *err) *err = ENOMEM; result = 0; } - if (fseek (file->fp, file->pos, SEEK_SET) < 0) + + if (readtags_fseek (file->fp, file->pos, SEEK_SET) < 0) { *err = errno; result = 0; @@ -485,26 +526,15 @@ static unsigned int countContinuousBackslashesBackward(const char *from, return counter; } -static tagResult parseTagLine (tagFile *file, tagEntry *const entry, int *err) +/* When unescaping, the input string becomes shorter. + * e.g. \t occupies two bytes on the tag file. + * It is converted to 0x9 and occupies one byte. + * memmove called here for shortening the line + * buffer. */ +static char *unescapeInPlace (char *q, char **tab, size_t *p_len) { - int i; - char *p = file->line.buffer; - size_t p_len = strlen (p); - char *tab = strchr (p, TAB); - - memset(entry, 0, sizeof(*entry)); - - entry->name = p; - if (tab != NULL) - { - *tab = '\0'; - } + char *p = q; - /* When unescaping, the input string becomes shorter. - * e.g. \t occupies two bytes on the tag file. - * It is converted to 0x9 and occupies one byte. - * memmove called here for shortening the line - * buffer. */ while (*p != '\0') { const char *next = p; @@ -513,21 +543,50 @@ static tagResult parseTagLine (tagFile *file, tagEntry *const entry, int *err) *p = (char) ch; p++; - p_len -= skip; + *p_len -= skip; if (skip > 1) { /* + 1 is for moving the area including the last '\0'. */ - memmove (p, next, p_len + 1); - if (tab) - tab -= skip - 1; + memmove (p, next, *p_len + 1); + if (*tab) + *tab -= skip - 1; } } + return p; +} + +static tagResult parseTagLine (tagFile *file, tagEntry *const entry, int *err) +{ + int i; + char *p = file->line.buffer; + size_t p_len = strlen (p); + char *tab = strchr (p, TAB); + + memset(entry, 0, sizeof(*entry)); + + entry->name = p; + if (tab != NULL) + { + *tab = '\0'; + } + + p = unescapeInPlace (p, &tab, &p_len); + if (tab != NULL) { p = tab + 1; entry->file = p; tab = strchr (p, TAB); + if (file->inputUCtagsMode) + { + if (tab != NULL) + { + *tab = '\0'; + } + p = unescapeInPlace (p, &tab, &p_len); + } + if (tab != NULL) { int fieldsPresent; @@ -554,12 +613,12 @@ static tagResult parseTagLine (tagFile *file, tagEntry *const entry, int *err) else ++p; } - else if (isdigit ((int) *(unsigned char*) p)) + else if (isdigit (*(unsigned char*) p)) { /* parse line number */ entry->address.pattern = p; entry->address.lineNumber = atol (p); - while (isdigit ((int) *(unsigned char*) p)) + while (isdigit (*(unsigned char*) p)) ++p; if (p) { @@ -636,6 +695,8 @@ static tagResult readPseudoTags (tagFile *const file, tagFileInfo *const info) int err = 0; tagResult result = TagSuccess; const size_t prefixLength = strlen (PseudoTagPrefix); + int tag_output_mode_u_ctags = 0; + int tag_output_filesep_slash = 0; info->file.format = 1; info->file.sort = TAG_UNSORTED; @@ -683,7 +744,7 @@ static tagResult readPseudoTags (tagFile *const file, tagFileInfo *const info) err = TagErrnoUnexpectedFormat; break; } - file->format = (short) m; + file->format = (unsigned char) m; } else if (strcmp (key, "TAG_PROGRAM_AUTHOR") == 0) { @@ -721,6 +782,16 @@ static tagResult readPseudoTags (tagFile *const file, tagFileInfo *const info) break; } } + else if (strcmp (key, "TAG_OUTPUT_MODE") == 0) + { + if (strcmp (value, "u-ctags") == 0) + tag_output_mode_u_ctags = 1; + } + else if (strcmp (key, "TAG_OUTPUT_FILESEP") == 0) + { + if (strcmp (value, "slash") == 0) + tag_output_filesep_slash = 1; + } info->file.format = file->format; info->file.sort = file->sortMethod; @@ -730,6 +801,10 @@ static tagResult readPseudoTags (tagFile *const file, tagFileInfo *const info) info->program.version = file->program.version; } } + + if (tag_output_mode_u_ctags && tag_output_filesep_slash) + file->inputUCtagsMode = 1; + if (fsetpos (file->fp, &startOfLine) < 0) err = errno; @@ -748,7 +823,7 @@ static tagResult gotoFirstLogicalTag (tagFile *const file) { fpos_t startOfLine; - if (fseek(file->fp, 0L, SEEK_SET) == -1) + if (readtags_fseek(file->fp, 0, SEEK_SET) == -1) { file->err = errno; return TagFailure; @@ -798,37 +873,55 @@ static tagFile *initialize (const char *const filePath, tagFileInfo *const info) result->fields.max, sizeof (tagExtensionField)); if (result->fields.list == NULL) goto mem_error; - result->fp = fopen (filePath, "rb"); + +#if defined(__GLIBC__) && (__GLIBC__ >= 2) \ + && defined(__GLIBC_MINOR__) && (__GLIBC_MINOR__ >= 3) + result->fp = fopen (filePath, "rbm"); +#endif + if (result->fp == NULL) + { + errno = 0; + result->fp = fopen (filePath, "rb"); + } if (result->fp == NULL) { info->status.error_number = errno; goto file_error; } - else - { - if (fseek (result->fp, 0, SEEK_END) == -1) - { - info->status.error_number = errno; - goto file_error; - } - result->size = ftell (result->fp); - if (result->size == -1) - { - info->status.error_number = errno; - goto file_error; - } - if (fseek(result->fp, 0L, SEEK_SET) == -1) - { - info->status.error_number = errno; - goto file_error; - } - if (readPseudoTags (result, info) == TagFailure) - goto file_error; + /* Record the size of the tags file to `size` field of result. */ + if (readtags_fseek (result->fp, 0, SEEK_END) == -1) + { + info->status.error_number = errno; + goto file_error; + } + result->size = readtags_ftell (result->fp); + if (result->size == -1) + { + /* fseek() retruns an int value. + * We observed following behavior on Windows; + * if sizeof(int) of the platform is too small for + * representing the size of the tags file, fseek() + * returns -1 and it doesn't set errno. + */ + info->status.error_number = errno; + if (info->status.error_number == 0) + info->status.error_number = TagErrnoFileMaybeTooBig; - info->status.opened = 1; - result->initialized = 1; + goto file_error; + } + if (readtags_fseek(result->fp, 0, SEEK_SET) == -1) + { + info->status.error_number = errno; + goto file_error; } + + if (readPseudoTags (result, info) == TagFailure) + goto file_error; + + info->status.opened = 1; + result->initialized = 1; + return result; mem_error: info->status.error_number = ENOMEM; @@ -870,19 +963,23 @@ static void terminate (tagFile *const file) static tagResult readNext (tagFile *const file, tagEntry *const entry) { tagResult result; - if (file == NULL || ! file->initialized) + + if (file == NULL) + return TagFailure; + + if (! file->initialized) { file->err = TagErrnoInvalidArgument; - result = TagFailure; - } - else if (! readTagLine (file, &file->err)) - result = TagFailure; - else - { - result = (entry != NULL) - ? parseTagLine (file, entry, &file->err) - : TagSuccess; + return TagFailure; } + + if (! readTagLine (file, &file->err)) + return TagFailure; + + result = (entry != NULL) + ? parseTagLine (file, entry, &file->err) + : TagSuccess; + return result; } @@ -901,9 +998,9 @@ static const char *readFieldValue ( return result; } -static int readTagLineSeek (tagFile *const file, const off_t pos) +static int readTagLineSeek (tagFile *const file, const rt_off_t pos) { - if (fseek (file->fp, pos, SEEK_SET) < 0) + if (readtags_fseek (file->fp, pos, SEEK_SET) < 0) { file->err = errno; return 0; @@ -947,11 +1044,11 @@ static tagResult findFirstNonMatchBefore (tagFile *const file) #define JUMP_BACK 512 int more_lines; int comp; - off_t start = file->pos; - off_t pos = start; + rt_off_t start = file->pos; + rt_off_t pos = start; do { - if (pos < (off_t) JUMP_BACK) + if (pos < (rt_off_t) JUMP_BACK) pos = 0; else pos = pos - JUMP_BACK; @@ -967,7 +1064,7 @@ static tagResult findFirstMatchBefore (tagFile *const file) { tagResult result = TagFailure; int more_lines; - off_t start = file->pos; + rt_off_t start = file->pos; if (findFirstNonMatchBefore (file) != TagSuccess) return TagFailure; do @@ -984,10 +1081,10 @@ static tagResult findFirstMatchBefore (tagFile *const file) static tagResult findBinary (tagFile *const file) { tagResult result = TagFailure; - off_t lower_limit = 0; - off_t upper_limit = file->size; - off_t last_pos = 0; - off_t pos = upper_limit / 2; + rt_off_t lower_limit = 0; + rt_off_t upper_limit = file->size; + rt_off_t last_pos = 0; + rt_off_t pos = upper_limit / 2; while (result != TagSuccess) { if (! readTagLineSeek (file, pos)) @@ -1034,7 +1131,10 @@ static tagResult findSequentialFull (tagFile *const file, int (* isAcceptable) (tagFile *const, void *), void *data) { - if (file == NULL || !file->initialized || file->err) + if (file == NULL) + return TagFailure; + + if (!file->initialized || file->err) { file->err = TagErrnoInvalidArgument; return TagFailure; @@ -1076,37 +1176,31 @@ static tagResult find (tagFile *const file, tagEntry *const entry, file->search.nameLength = strlen (name); file->search.partial = (options & TAG_PARTIALMATCH) != 0; file->search.ignorecase = (options & TAG_IGNORECASE) != 0; - if (fseek (file->fp, 0, SEEK_END) < 0) + if (readtags_fseek (file->fp, 0, SEEK_END) < 0) { file->err = errno; return TagFailure; } - file->size = ftell (file->fp); + file->size = readtags_ftell (file->fp); if (file->size == -1) { file->err = errno; return TagFailure; } - if (fseek(file->fp, 0L, SEEK_SET) == -1) + if (readtags_fseek(file->fp, 0, SEEK_SET) == -1) { file->err = errno; return TagFailure; } if ((file->sortMethod == TAG_SORTED && !file->search.ignorecase) || (file->sortMethod == TAG_FOLDSORTED && file->search.ignorecase)) { -#ifdef DEBUG - fputs ("<performing binary search>\n", stderr); -#endif result = findBinary (file); if (result == TagFailure && file->err) return TagFailure; } else { -#ifdef DEBUG - fputs ("<performing sequential search>\n", stderr); -#endif result = findSequential (file); if (result == TagFailure && file->err) return TagFailure; @@ -1155,15 +1249,18 @@ static tagResult findNext (tagFile *const file, tagEntry *const entry) static tagResult findPseudoTag (tagFile *const file, int rewindBeforeFinding, tagEntry *const entry) { - if (file == NULL || (!file->initialized) || file->err) + if (file == NULL) + return TagFailure; + + if (!file->initialized || file->err) { - file->err= TagErrnoInvalidArgument;; + file->err = TagErrnoInvalidArgument; return TagFailure; } if (rewindBeforeFinding) { - if (fseek(file->fp, 0L, SEEK_SET) == -1) + if (readtags_fseek(file->fp, 0, SEEK_SET) == -1) { file->err = errno; return TagFailure; @@ -1188,7 +1285,10 @@ extern tagFile *tagsOpen (const char *const filePath, tagFileInfo *const info) extern tagResult tagsSetSortType (tagFile *const file, const tagSortType type) { - if (file == NULL || (!file->initialized) || file->err) + if (file == NULL) + return TagFailure; + + if (!file->initialized || file->err) { file->err = TagErrnoInvalidArgument; return TagFailure; @@ -1209,7 +1309,10 @@ extern tagResult tagsSetSortType (tagFile *const file, const tagSortType type) extern tagResult tagsFirst (tagFile *const file, tagEntry *const entry) { - if (file == NULL || (!file->initialized) || file->err) + if (file == NULL) + return TagFailure; + + if (!file->initialized || file->err) { file->err = TagErrnoInvalidArgument; return TagFailure; @@ -1222,7 +1325,10 @@ extern tagResult tagsFirst (tagFile *const file, tagEntry *const entry) extern tagResult tagsNext (tagFile *const file, tagEntry *const entry) { - if (file == NULL || (!file->initialized) || file->err) + if (file == NULL) + return TagFailure; + + if (!file->initialized || file->err) { file->err = TagErrnoInvalidArgument; return TagFailure; @@ -1242,21 +1348,29 @@ extern const char *tagsField (const tagEntry *const entry, const char *const key extern tagResult tagsFind (tagFile *const file, tagEntry *const entry, const char *const name, const int options) { - if (file == NULL || !file->initialized || file->err) + if (file == NULL) + return TagFailure; + + if (!file->initialized || file->err) { file->err = TagErrnoInvalidArgument; return TagFailure; } + return find (file, entry, name, options); } extern tagResult tagsFindNext (tagFile *const file, tagEntry *const entry) { - if (file == NULL || !file->initialized || file->err) + if (file == NULL) + return TagFailure; + + if (!file->initialized || file->err) { file->err = TagErrnoInvalidArgument; return TagFailure; } + return findNext (file, entry); } @@ -1270,6 +1384,39 @@ extern tagResult tagsNextPseudoTag (tagFile *const file, tagEntry *const entry) return findPseudoTag (file, 0, entry); } +extern tagResult tagsFindPseudoTag (tagFile *const file, tagEntry *const entry, + const char *const name, const int match) +{ + size_t len; + tagEntry entry0; + tagEntry *entryp = entry? entry: &entry0; + + tagResult r = tagsFirstPseudoTag (file, entryp); + if (r != TagSuccess) + return r; + + if (match & TAG_PARTIALMATCH) + len = strlen (name); + + do + { + if (match & TAG_PARTIALMATCH) + { + if (strncmp (entryp->name, name, len) == 0) + return TagSuccess; + } + else + { + if (strcmp (entryp->name, name) == 0) + return TagSuccess; + } + r = tagsNextPseudoTag (file, entryp); + } + while (r == TagSuccess); + + return r; +} + extern tagResult tagsClose (tagFile *const file) { tagResult result = TagFailure; Modified: geanyctags/src/readtags.h 20 lines changed, 18 insertions(+), 2 deletions(-) =================================================================== @@ -39,7 +39,7 @@ typedef enum { #define sortType tagSortType #endif -/* Options for tagsFind() */ +/* Options for tagsFind() and tagsFindPseudoTag() */ #define TAG_FULLMATCH 0x0 #define TAG_PARTIALMATCH 0x1 @@ -59,6 +59,7 @@ typedef enum { * (Zero or a positive integer is expected.) */ TagErrnoInvalidArgument = -4, /* Unexpected argument passed to the API * function */ + TagErrnoFileMaybeTooBig = -5, /* Maybe the tags file is too big */ } tagErrno; struct sTagFile; @@ -258,7 +259,7 @@ extern tagResult tagsFindNext (tagFile *const file, tagEntry *const entry); /* * Does the same as tagsFirst(), but is specialized to pseudo tags. -* If tagFileInfo doesn't contain pseudo tags you are interested, read +* If tagFileInfo doesn't contain pseudo tags you are interested in, read * them sequentially with this function and tagsNextPseudoTag(). */ extern tagResult tagsFirstPseudoTag (tagFile *const file, tagEntry *const entry); @@ -269,6 +270,21 @@ extern tagResult tagsFirstPseudoTag (tagFile *const file, tagEntry *const entry) */ extern tagResult tagsNextPseudoTag (tagFile *const file, tagEntry *const entry); +/* +* Does the same as tagsFind(), but is specialized to pseudo tags. +* The available values for `match' are: +* +* TAG_PARTIALMATCH +* Tags whose leading characters match `name' will qualify. +* +* TAG_FULLMATCH +* Only tags whose full lengths match `name' will qualify. +* +* NOTE: unlike tagsFind(), this function uses liner-searching even if +* the tags file is sorted. +*/ +extern tagResult tagsFindPseudoTag (tagFile *const file, tagEntry *const entry, const char *const name, const int match); + /* * Call tagsClose() at completion of reading the tag file, which will * close the file and free any internal memory allocated. The function will -------------- This E-Mail was brought to you by github_commit_mail.py (Source:
https://github.com/geany/infrastructure
).
1
0
0
0
[geany/geany-plugins] 07f0fd: projectorganizer: fix various warnings
by Jiří Techet
17 Mar '24
17 Mar '24
Branch: refs/heads/master Author: Jiří Techet <techet(a)gmail.com> Committer: Jiří Techet <techet(a)gmail.com> Date: Tue, 05 Mar 2024 17:40:10 UTC Commit: 07f0fdc1ef2ccaf104b5f9591bfcf3a56f035c4f
https://github.com/geany/geany-plugins/commit/07f0fdc1ef2ccaf104b5f9591bfcf…
Log Message: ----------- projectorganizer: fix various warnings Modified Paths: -------------- projectorganizer/src/prjorg-sidebar.c Modified: projectorganizer/src/prjorg-sidebar.c 9 lines changed, 3 insertions(+), 6 deletions(-) =================================================================== @@ -382,7 +382,8 @@ void on_open_file_manager(G_GNUC_UNUSED GtkMenuItem * menuitem, G_GNUC_UNUSED gp if (locale_path) { - gchar *command, *open_command; + const gchar *open_command; + gchar *command; open_command = PRJORG_COMMAND_OPEN; command = g_strconcat (open_command, " \"", locale_path, "\"", NULL); @@ -1562,7 +1563,7 @@ gchar **prjorg_sidebar_get_expanded_paths(void) (GtkTreeViewMappingFunc)on_map_expanded, expanded_paths); g_ptr_array_add(expanded_paths, NULL); - return g_ptr_array_free(expanded_paths, FALSE); + return (gchar **)g_ptr_array_free(expanded_paths, FALSE); } @@ -1587,10 +1588,6 @@ void prjorg_sidebar_update_full(gboolean reload, gchar **expanded_paths) if (reload) { - GtkTreeSelection *treesel; - GtkTreeIter iter; - GtkTreeModel *model; - expand_data->expanded_paths = expanded_paths != NULL ? expanded_paths : prjorg_sidebar_get_expanded_paths(); expand_data->selected_path = get_selected_path(); -------------- This E-Mail was brought to you by github_commit_mail.py (Source:
https://github.com/geany/infrastructure
).
1
0
0
0
[geany/geany-plugins] 00f0f0: projectorganizer: eliminate some depreciation warnings
by Jiří Techet
17 Mar '24
17 Mar '24
Branch: refs/heads/master Author: Jiří Techet <techet(a)gmail.com> Committer: Jiří Techet <techet(a)gmail.com> Date: Tue, 05 Mar 2024 21:42:46 UTC Commit: 00f0f07c40c72a024b7623197248ab6daca3242f
https://github.com/geany/geany-plugins/commit/00f0f07c40c72a024b7623197248a…
Log Message: ----------- projectorganizer: eliminate some depreciation warnings Modified Paths: -------------- projectorganizer/src/prjorg-project.c projectorganizer/src/prjorg-sidebar.c Modified: projectorganizer/src/prjorg-project.c 77 lines changed, 49 insertions(+), 28 deletions(-) =================================================================== @@ -655,83 +655,100 @@ void prjorg_project_read_properties_tab(void) GtkWidget *prjorg_project_add_properties_tab(GtkWidget *notebook) { - GtkWidget *vbox, *hbox, *hbox1; - GtkWidget *table; + GtkWidget *vbox, *hbox, *hbox1, *ebox, *table_box; GtkWidget *label; gchar *str; + GtkSizeGroup *size_group; e = g_new0(PropertyDialogElements, 1); - vbox = gtk_vbox_new(FALSE, 0); + vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); - table = gtk_table_new(5, 2, FALSE); - gtk_table_set_row_spacings(GTK_TABLE(table), 6); - gtk_table_set_col_spacings(GTK_TABLE(table), 12); + table_box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 12); + gtk_box_set_spacing(GTK_BOX(table_box), 6); + + size_group = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); label = gtk_label_new(_("Source patterns:")); - gtk_misc_set_alignment(GTK_MISC(label), 0, 0); + gtk_label_set_xalign(GTK_LABEL(label), 0.0); + gtk_size_group_add_widget(size_group, label); e->source_patterns = gtk_entry_new(); - ui_table_add_row(GTK_TABLE(table), 0, label, e->source_patterns, NULL); ui_entry_add_clear_icon(GTK_ENTRY(e->source_patterns)); gtk_widget_set_tooltip_text(e->source_patterns, _("Space separated list of patterns that are used to identify source files. " "Used for header/source swapping.")); str = g_strjoinv(" ", prj_org->source_patterns); gtk_entry_set_text(GTK_ENTRY(e->source_patterns), str); g_free(str); + ebox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 6); + gtk_box_pack_start(GTK_BOX(ebox), label, FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(ebox), e->source_patterns, TRUE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(table_box), ebox, TRUE, FALSE, 0); label = gtk_label_new(_("Header patterns:")); - gtk_misc_set_alignment(GTK_MISC(label), 0, 0); + gtk_label_set_xalign(GTK_LABEL(label), 0.0); + gtk_size_group_add_widget(size_group, label); e->header_patterns = gtk_entry_new(); ui_entry_add_clear_icon(GTK_ENTRY(e->header_patterns)); - ui_table_add_row(GTK_TABLE(table), 1, label, e->header_patterns, NULL); gtk_widget_set_tooltip_text(e->header_patterns, _("Space separated list of patterns that are used to identify headers. " "Used for header/source swapping.")); str = g_strjoinv(" ", prj_org->header_patterns); gtk_entry_set_text(GTK_ENTRY(e->header_patterns), str); g_free(str); + ebox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 6); + gtk_box_pack_start(GTK_BOX(ebox), label, FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(ebox), e->header_patterns, TRUE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(table_box), ebox, TRUE, FALSE, 0); label = gtk_label_new(_("Ignored file patterns:")); - gtk_misc_set_alignment(GTK_MISC(label), 0, 0); + gtk_label_set_xalign(GTK_LABEL(label), 0.0); + gtk_size_group_add_widget(size_group, label); e->ignored_file_patterns = gtk_entry_new(); ui_entry_add_clear_icon(GTK_ENTRY(e->ignored_file_patterns)); - ui_table_add_row(GTK_TABLE(table), 2, label, e->ignored_file_patterns, NULL); gtk_widget_set_tooltip_text(e->ignored_file_patterns, _("Space separated list of patterns that are used to identify files " "that are not displayed in the project tree.")); str = g_strjoinv(" ", prj_org->ignored_file_patterns); gtk_entry_set_text(GTK_ENTRY(e->ignored_file_patterns), str); g_free(str); + ebox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 6); + gtk_box_pack_start(GTK_BOX(ebox), label, FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(ebox), e->ignored_file_patterns, TRUE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(table_box), ebox, TRUE, FALSE, 0); label = gtk_label_new(_("Ignored directory patterns:")); - gtk_misc_set_alignment(GTK_MISC(label), 0, 0); + gtk_label_set_xalign(GTK_LABEL(label), 0.0); + gtk_size_group_add_widget(size_group, label); e->ignored_dirs_patterns = gtk_entry_new(); ui_entry_add_clear_icon(GTK_ENTRY(e->ignored_dirs_patterns)); - ui_table_add_row(GTK_TABLE(table), 3, label, e->ignored_dirs_patterns, NULL); gtk_widget_set_tooltip_text(e->ignored_dirs_patterns, _("Space separated list of patterns that are used to identify directories " "that are not scanned for source files.")); str = g_strjoinv(" ", prj_org->ignored_dirs_patterns); gtk_entry_set_text(GTK_ENTRY(e->ignored_dirs_patterns), str); g_free(str); + ebox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 6); + gtk_box_pack_start(GTK_BOX(ebox), label, FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(ebox), e->ignored_dirs_patterns, TRUE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(table_box), ebox, TRUE, FALSE, 0); - gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, 6); + gtk_box_pack_start(GTK_BOX(vbox), table_box, FALSE, FALSE, 6); - hbox1 = gtk_hbox_new(FALSE, 0); + hbox1 = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); label = gtk_label_new(_("The patterns above affect only sidebar and indexing and are not used in the Find in Files\n" "dialog. You can further restrict the files belonging to the project by setting the\n" "File Patterns under the Project tab (these are also used for the Find in Files dialog).")); gtk_box_pack_start(GTK_BOX(hbox1), label, FALSE, FALSE, 12); gtk_box_pack_start(GTK_BOX(vbox), hbox1, FALSE, FALSE, 0); - hbox1 = gtk_hbox_new(FALSE, 0); + hbox1 = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); label = gtk_label_new(NULL); gtk_label_set_markup(GTK_LABEL(label), _("<b>Various</b>")); gtk_box_pack_start(GTK_BOX(hbox1), label, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox), hbox1, FALSE, FALSE, 12); - hbox1 = gtk_hbox_new(FALSE, 0); + hbox1 = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); e->show_empty_dirs = gtk_check_button_new_with_label(_("Show empty directories in sidebar")); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(e->show_empty_dirs), prj_org->show_empty_dirs); gtk_widget_set_tooltip_text(e->show_empty_dirs, @@ -741,12 +758,14 @@ GtkWidget *prjorg_project_add_properties_tab(GtkWidget *notebook) gtk_box_pack_start(GTK_BOX(hbox1), e->show_empty_dirs, FALSE, FALSE, 12); gtk_box_pack_start(GTK_BOX(vbox), hbox1, FALSE, FALSE, 0); - table = gtk_table_new(1, 2, FALSE); - gtk_table_set_row_spacings(GTK_TABLE(table), 6); - gtk_table_set_col_spacings(GTK_TABLE(table), 12); + table_box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 12); + gtk_box_set_spacing(GTK_BOX(table_box), 6); + + size_group = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); label = gtk_label_new(_("Index all project files:")); - gtk_misc_set_alignment(GTK_MISC(label), 0, 0); + gtk_label_set_xalign(GTK_LABEL(label), 0.0); + gtk_size_group_add_widget(size_group, label); e->generate_tag_prefs = gtk_combo_box_text_new(); gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(e->generate_tag_prefs), _("Auto (index if less than 1000 files)")); gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(e->generate_tag_prefs), _("Yes")); @@ -755,16 +774,18 @@ GtkWidget *prjorg_project_add_properties_tab(GtkWidget *notebook) gtk_widget_set_tooltip_text(e->generate_tag_prefs, _("Generate symbol list for all project files instead of only for the currently opened files. " "Might be slow for big projects.")); + ebox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 6); + gtk_box_pack_start(GTK_BOX(ebox), label, FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(ebox), e->generate_tag_prefs, TRUE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(table_box), ebox, TRUE, FALSE, 0); - ui_table_add_row(GTK_TABLE(table), 1, label, e->generate_tag_prefs, NULL); - - hbox1 = gtk_hbox_new(FALSE, 0); - gtk_box_pack_start(GTK_BOX(hbox1), table, FALSE, FALSE, 12); - gtk_box_pack_start(GTK_BOX(vbox), hbox1, FALSE, FALSE, 0); + hbox1 = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); + gtk_box_pack_start(GTK_BOX(hbox1), table_box, FALSE, FALSE, 12); + gtk_box_pack_start(GTK_BOX(vbox), hbox1, FALSE, FALSE, 6); label = gtk_label_new("Project Organizer"); - hbox = gtk_hbox_new(FALSE, 0); + hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); gtk_box_pack_start(GTK_BOX(hbox), vbox, TRUE, TRUE, 6); gtk_notebook_append_page(GTK_NOTEBOOK(notebook), hbox, label); Modified: projectorganizer/src/prjorg-sidebar.c 39 lines changed, 19 insertions(+), 20 deletions(-) =================================================================== @@ -138,7 +138,7 @@ static gint show_dialog_find_file(gchar *utf8_path, gchar **pattern, gboolean *c size_group = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); label = gtk_label_new(_("Search for:")); - gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); + gtk_label_set_xalign(GTK_LABEL(label), 0.0); gtk_size_group_add_widget(size_group, label); s_fif_dialog.combo = gtk_combo_box_text_new_with_entry(); entry = gtk_bin_get_child(GTK_BIN(s_fif_dialog.combo)); @@ -147,29 +147,29 @@ static gint show_dialog_find_file(gchar *utf8_path, gchar **pattern, gboolean *c ui_entry_add_clear_icon(GTK_ENTRY(entry)); gtk_entry_set_activates_default(GTK_ENTRY(entry), TRUE); - ebox = gtk_hbox_new(FALSE, 6); + ebox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 6); gtk_box_pack_start(GTK_BOX(ebox), label, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(ebox), s_fif_dialog.combo, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(vbox), ebox, TRUE, FALSE, 0); label = gtk_label_new(_("Search inside:")); - gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); + gtk_label_set_xalign(GTK_LABEL(label), 0.0); gtk_size_group_add_widget(size_group, label); s_fif_dialog.dir_label = gtk_label_new(""); - gtk_misc_set_alignment(GTK_MISC(s_fif_dialog.dir_label), 0, 0.5); + gtk_label_set_xalign(GTK_LABEL(s_fif_dialog.dir_label), 0.0); - ebox = gtk_hbox_new(FALSE, 6); + ebox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 6); gtk_box_pack_start(GTK_BOX(ebox), label, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(ebox), s_fif_dialog.dir_label, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(vbox), ebox, TRUE, FALSE, 0); s_fif_dialog.case_sensitive = gtk_check_button_new_with_mnemonic(_("C_ase sensitive")); - gtk_button_set_focus_on_click(GTK_BUTTON(s_fif_dialog.case_sensitive), FALSE); + gtk_widget_set_focus_on_click(s_fif_dialog.case_sensitive, FALSE); s_fif_dialog.full_path = gtk_check_button_new_with_mnemonic(_("Search in full path")); - gtk_button_set_focus_on_click(GTK_BUTTON(s_fif_dialog.full_path), FALSE); + gtk_widget_set_focus_on_click(s_fif_dialog.full_path, FALSE); gtk_box_pack_start(GTK_BOX(vbox), s_fif_dialog.case_sensitive, TRUE, FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox), s_fif_dialog.full_path, TRUE, FALSE, 0); @@ -727,7 +727,7 @@ static void create_dialog_find_tag(void) size_group = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); label = gtk_label_new(_("Search for:")); - gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); + gtk_label_set_xalign(GTK_LABEL(label), 0.0); gtk_size_group_add_widget(size_group, label); s_ft_dialog.combo = gtk_combo_box_text_new_with_entry(); @@ -739,13 +739,13 @@ static void create_dialog_find_tag(void) ui_entry_add_clear_icon(GTK_ENTRY(entry)); gtk_entry_set_activates_default(GTK_ENTRY(entry), TRUE); - ebox = gtk_hbox_new(FALSE, 6); + ebox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 6); gtk_box_pack_start(GTK_BOX(ebox), label, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(ebox), s_ft_dialog.combo, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(vbox), ebox, TRUE, FALSE, 0); label = gtk_label_new(_("Match type:")); - gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); + gtk_label_set_xalign(GTK_LABEL(label), 0.0); gtk_size_group_add_widget(size_group, label); s_ft_dialog.combo_match = gtk_combo_box_text_new(); @@ -755,28 +755,28 @@ static void create_dialog_find_tag(void) gtk_combo_box_set_active(GTK_COMBO_BOX(s_ft_dialog.combo_match), 1); gtk_label_set_mnemonic_widget(GTK_LABEL(label), s_ft_dialog.combo_match); - ebox = gtk_hbox_new(FALSE, 6); + ebox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 6); gtk_box_pack_start(GTK_BOX(ebox), label, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(ebox), s_ft_dialog.combo_match, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(vbox), ebox, TRUE, FALSE, 0); label = gtk_label_new(_("Search inside:")); - gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); + gtk_label_set_xalign(GTK_LABEL(label), 0.0); gtk_size_group_add_widget(size_group, label); s_ft_dialog.dir_label = gtk_label_new(""); - gtk_misc_set_alignment(GTK_MISC(s_ft_dialog.dir_label), 0, 0.5); + gtk_label_set_xalign(GTK_LABEL(s_ft_dialog.dir_label), 0.0); - ebox = gtk_hbox_new(FALSE, 6); + ebox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 6); gtk_box_pack_start(GTK_BOX(ebox), label, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(ebox), s_ft_dialog.dir_label, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(vbox), ebox, TRUE, FALSE, 0); s_ft_dialog.case_sensitive = gtk_check_button_new_with_mnemonic(_("C_ase sensitive")); - gtk_button_set_focus_on_click(GTK_BUTTON(s_ft_dialog.case_sensitive), FALSE); + gtk_widget_set_focus_on_click(s_ft_dialog.case_sensitive, FALSE); s_ft_dialog.declaration = gtk_check_button_new_with_mnemonic(_("_Declaration")); - gtk_button_set_focus_on_click(GTK_BUTTON(s_ft_dialog.declaration), FALSE); + gtk_widget_set_focus_on_click(s_ft_dialog.declaration, FALSE); g_object_unref(G_OBJECT(size_group)); /* auto destroy the size group */ @@ -1086,8 +1086,7 @@ static gboolean on_button_release(G_GNUC_UNUSED GtkWidget * widget, GdkEventButt gtk_widget_set_sensitive(s_popup_menu.delete, delete_enabled); - gtk_menu_popup(GTK_MENU(s_popup_menu.widget), NULL, NULL, NULL, NULL, - event->button, event->time); + gtk_menu_popup_at_pointer(GTK_MENU(s_popup_menu.widget), (GdkEvent *)event); return TRUE; } @@ -1208,7 +1207,7 @@ static void create_branch(gint level, GSList *leaf_list, GtkTreeIter *parent, icon = NULL; } else - gtk_icon_info_free(icon_info); + g_object_unref(icon_info); } g_free(content_type); } @@ -1655,7 +1654,7 @@ void prjorg_sidebar_init(void) PangoFontDescription *pfd; GList *focus_chain = NULL; - s_file_view_vbox = gtk_vbox_new(FALSE, 0); + s_file_view_vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); /**** toolbar ****/ -------------- This E-Mail was brought to you by github_commit_mail.py (Source:
https://github.com/geany/infrastructure
).
1
0
0
0
[geany/geany-plugins] 8d8068: projectorganizer: fix invalid string comparison
by Jiří Techet
17 Mar '24
17 Mar '24
Branch: refs/heads/master Author: Jiří Techet <techet(a)gmail.com> Committer: Jiří Techet <techet(a)gmail.com> Date: Tue, 05 Mar 2024 17:36:37 UTC Commit: 8d80688c9a8503b0ad8f464be0390691dfe2d47d
https://github.com/geany/geany-plugins/commit/8d80688c9a8503b0ad8f464be0390…
Log Message: ----------- projectorganizer: fix invalid string comparison Modified Paths: -------------- projectorganizer/src/prjorg-sidebar.c Modified: projectorganizer/src/prjorg-sidebar.c 2 lines changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -346,7 +346,7 @@ static gchar *get_fallback_dir_of_selection(void) { locale_path = g_path_get_dirname(doc->real_path); - if (locale_path && locale_path == '.') + if (locale_path && *locale_path == '.') { g_free(locale_path); locale_path = NULL; -------------- This E-Mail was brought to you by github_commit_mail.py (Source:
https://github.com/geany/infrastructure
).
1
0
0
0
[geany/geany-plugins] ec9651: projectorganizer: Add missing includes to header files
by Jiří Techet
17 Mar '24
17 Mar '24
Branch: refs/heads/master Author: Jiří Techet <techet(a)gmail.com> Committer: Jiří Techet <techet(a)gmail.com> Date: Tue, 05 Mar 2024 17:39:53 UTC Commit: ec96512db966857596068959f5e39fe82ce8910d
https://github.com/geany/geany-plugins/commit/ec96512db966857596068959f5e39…
Log Message: ----------- projectorganizer: Add missing includes to header files Fixes warnings in clangd Modified Paths: -------------- projectorganizer/src/prjorg-menu.h projectorganizer/src/prjorg-project.h projectorganizer/src/prjorg-sidebar.h projectorganizer/src/prjorg-utils.h Modified: projectorganizer/src/prjorg-menu.h 2 lines changed, 2 insertions(+), 0 deletions(-) =================================================================== @@ -19,6 +19,8 @@ #ifndef __PRJORG_MENU_H__ #define __PRJORG_MENU_H__ +#include <glib.h> + void prjorg_menu_init(void); void prjorg_menu_activate_menu_items(gboolean activate); void prjorg_menu_cleanup(void); Modified: projectorganizer/src/prjorg-project.h 2 lines changed, 2 insertions(+), 0 deletions(-) =================================================================== @@ -19,6 +19,8 @@ #ifndef __PRJORG_PROJECT_H__ #define __PRJORG_PROJECT_H__ +#include <gtk/gtk.h> + #define PRJORG_PATTERNS_SOURCE "*.c *.C *.cpp *.cxx *.c++ *.cc *.m" #define PRJORG_PATTERNS_HEADER "*.h *.H *.hpp *.hxx *.h++ *.hh" #define PRJORG_PATTERNS_IGNORED_DIRS ".* CVS" Modified: projectorganizer/src/prjorg-sidebar.h 1 lines changed, 1 insertions(+), 0 deletions(-) =================================================================== @@ -19,6 +19,7 @@ #ifndef __PRJORG_SIDEBAR_H__ #define __PRJORG_SIDEBAR_H__ +#include <gtk/gtk.h> void prjorg_sidebar_init(void); void prjorg_sidebar_cleanup(void); Modified: projectorganizer/src/prjorg-utils.h 3 lines changed, 3 insertions(+), 0 deletions(-) =================================================================== @@ -19,6 +19,9 @@ #ifndef __PRJORG_UTILS_H__ #define __PRJORG_UTILS_H__ +#include <gtk/gtk.h> +#include <geanyplugin.h> + gchar *get_relative_path(const gchar *utf8_parent, const gchar *utf8_descendant); gboolean patterns_match(GSList *patterns, const gchar *str); -------------- This E-Mail was brought to you by github_commit_mail.py (Source:
https://github.com/geany/infrastructure
).
1
0
0
0
[geany/geany-plugins] db2698: Merge pull request #1315 from techee/prjorg-fixes
by Jiří Techet
17 Mar '24
17 Mar '24
Branch: refs/heads/master Author: Jiří Techet <techet(a)gmail.com> Committer: GitHub <noreply(a)github.com> Date: Sun, 17 Mar 2024 21:34:00 UTC Commit: db2698cc869274aef353ba7af23d70921d944166
https://github.com/geany/geany-plugins/commit/db2698cc869274aef353ba7af23d7…
Log Message: ----------- Merge pull request #1315 from techee/prjorg-fixes projectorganizer: Eliminate some compiler warnings Modified Paths: -------------- projectorganizer/src/prjorg-menu.h projectorganizer/src/prjorg-project.c projectorganizer/src/prjorg-project.h projectorganizer/src/prjorg-sidebar.c projectorganizer/src/prjorg-sidebar.h projectorganizer/src/prjorg-utils.h Modified: projectorganizer/src/prjorg-menu.h 2 lines changed, 2 insertions(+), 0 deletions(-) =================================================================== @@ -19,6 +19,8 @@ #ifndef __PRJORG_MENU_H__ #define __PRJORG_MENU_H__ +#include <glib.h> + void prjorg_menu_init(void); void prjorg_menu_activate_menu_items(gboolean activate); void prjorg_menu_cleanup(void); Modified: projectorganizer/src/prjorg-project.c 77 lines changed, 49 insertions(+), 28 deletions(-) =================================================================== @@ -655,83 +655,100 @@ void prjorg_project_read_properties_tab(void) GtkWidget *prjorg_project_add_properties_tab(GtkWidget *notebook) { - GtkWidget *vbox, *hbox, *hbox1; - GtkWidget *table; + GtkWidget *vbox, *hbox, *hbox1, *ebox, *table_box; GtkWidget *label; gchar *str; + GtkSizeGroup *size_group; e = g_new0(PropertyDialogElements, 1); - vbox = gtk_vbox_new(FALSE, 0); + vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); - table = gtk_table_new(5, 2, FALSE); - gtk_table_set_row_spacings(GTK_TABLE(table), 6); - gtk_table_set_col_spacings(GTK_TABLE(table), 12); + table_box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 12); + gtk_box_set_spacing(GTK_BOX(table_box), 6); + + size_group = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); label = gtk_label_new(_("Source patterns:")); - gtk_misc_set_alignment(GTK_MISC(label), 0, 0); + gtk_label_set_xalign(GTK_LABEL(label), 0.0); + gtk_size_group_add_widget(size_group, label); e->source_patterns = gtk_entry_new(); - ui_table_add_row(GTK_TABLE(table), 0, label, e->source_patterns, NULL); ui_entry_add_clear_icon(GTK_ENTRY(e->source_patterns)); gtk_widget_set_tooltip_text(e->source_patterns, _("Space separated list of patterns that are used to identify source files. " "Used for header/source swapping.")); str = g_strjoinv(" ", prj_org->source_patterns); gtk_entry_set_text(GTK_ENTRY(e->source_patterns), str); g_free(str); + ebox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 6); + gtk_box_pack_start(GTK_BOX(ebox), label, FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(ebox), e->source_patterns, TRUE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(table_box), ebox, TRUE, FALSE, 0); label = gtk_label_new(_("Header patterns:")); - gtk_misc_set_alignment(GTK_MISC(label), 0, 0); + gtk_label_set_xalign(GTK_LABEL(label), 0.0); + gtk_size_group_add_widget(size_group, label); e->header_patterns = gtk_entry_new(); ui_entry_add_clear_icon(GTK_ENTRY(e->header_patterns)); - ui_table_add_row(GTK_TABLE(table), 1, label, e->header_patterns, NULL); gtk_widget_set_tooltip_text(e->header_patterns, _("Space separated list of patterns that are used to identify headers. " "Used for header/source swapping.")); str = g_strjoinv(" ", prj_org->header_patterns); gtk_entry_set_text(GTK_ENTRY(e->header_patterns), str); g_free(str); + ebox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 6); + gtk_box_pack_start(GTK_BOX(ebox), label, FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(ebox), e->header_patterns, TRUE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(table_box), ebox, TRUE, FALSE, 0); label = gtk_label_new(_("Ignored file patterns:")); - gtk_misc_set_alignment(GTK_MISC(label), 0, 0); + gtk_label_set_xalign(GTK_LABEL(label), 0.0); + gtk_size_group_add_widget(size_group, label); e->ignored_file_patterns = gtk_entry_new(); ui_entry_add_clear_icon(GTK_ENTRY(e->ignored_file_patterns)); - ui_table_add_row(GTK_TABLE(table), 2, label, e->ignored_file_patterns, NULL); gtk_widget_set_tooltip_text(e->ignored_file_patterns, _("Space separated list of patterns that are used to identify files " "that are not displayed in the project tree.")); str = g_strjoinv(" ", prj_org->ignored_file_patterns); gtk_entry_set_text(GTK_ENTRY(e->ignored_file_patterns), str); g_free(str); + ebox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 6); + gtk_box_pack_start(GTK_BOX(ebox), label, FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(ebox), e->ignored_file_patterns, TRUE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(table_box), ebox, TRUE, FALSE, 0); label = gtk_label_new(_("Ignored directory patterns:")); - gtk_misc_set_alignment(GTK_MISC(label), 0, 0); + gtk_label_set_xalign(GTK_LABEL(label), 0.0); + gtk_size_group_add_widget(size_group, label); e->ignored_dirs_patterns = gtk_entry_new(); ui_entry_add_clear_icon(GTK_ENTRY(e->ignored_dirs_patterns)); - ui_table_add_row(GTK_TABLE(table), 3, label, e->ignored_dirs_patterns, NULL); gtk_widget_set_tooltip_text(e->ignored_dirs_patterns, _("Space separated list of patterns that are used to identify directories " "that are not scanned for source files.")); str = g_strjoinv(" ", prj_org->ignored_dirs_patterns); gtk_entry_set_text(GTK_ENTRY(e->ignored_dirs_patterns), str); g_free(str); + ebox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 6); + gtk_box_pack_start(GTK_BOX(ebox), label, FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(ebox), e->ignored_dirs_patterns, TRUE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(table_box), ebox, TRUE, FALSE, 0); - gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, 6); + gtk_box_pack_start(GTK_BOX(vbox), table_box, FALSE, FALSE, 6); - hbox1 = gtk_hbox_new(FALSE, 0); + hbox1 = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); label = gtk_label_new(_("The patterns above affect only sidebar and indexing and are not used in the Find in Files\n" "dialog. You can further restrict the files belonging to the project by setting the\n" "File Patterns under the Project tab (these are also used for the Find in Files dialog).")); gtk_box_pack_start(GTK_BOX(hbox1), label, FALSE, FALSE, 12); gtk_box_pack_start(GTK_BOX(vbox), hbox1, FALSE, FALSE, 0); - hbox1 = gtk_hbox_new(FALSE, 0); + hbox1 = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); label = gtk_label_new(NULL); gtk_label_set_markup(GTK_LABEL(label), _("<b>Various</b>")); gtk_box_pack_start(GTK_BOX(hbox1), label, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox), hbox1, FALSE, FALSE, 12); - hbox1 = gtk_hbox_new(FALSE, 0); + hbox1 = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); e->show_empty_dirs = gtk_check_button_new_with_label(_("Show empty directories in sidebar")); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(e->show_empty_dirs), prj_org->show_empty_dirs); gtk_widget_set_tooltip_text(e->show_empty_dirs, @@ -741,12 +758,14 @@ GtkWidget *prjorg_project_add_properties_tab(GtkWidget *notebook) gtk_box_pack_start(GTK_BOX(hbox1), e->show_empty_dirs, FALSE, FALSE, 12); gtk_box_pack_start(GTK_BOX(vbox), hbox1, FALSE, FALSE, 0); - table = gtk_table_new(1, 2, FALSE); - gtk_table_set_row_spacings(GTK_TABLE(table), 6); - gtk_table_set_col_spacings(GTK_TABLE(table), 12); + table_box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 12); + gtk_box_set_spacing(GTK_BOX(table_box), 6); + + size_group = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); label = gtk_label_new(_("Index all project files:")); - gtk_misc_set_alignment(GTK_MISC(label), 0, 0); + gtk_label_set_xalign(GTK_LABEL(label), 0.0); + gtk_size_group_add_widget(size_group, label); e->generate_tag_prefs = gtk_combo_box_text_new(); gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(e->generate_tag_prefs), _("Auto (index if less than 1000 files)")); gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(e->generate_tag_prefs), _("Yes")); @@ -755,16 +774,18 @@ GtkWidget *prjorg_project_add_properties_tab(GtkWidget *notebook) gtk_widget_set_tooltip_text(e->generate_tag_prefs, _("Generate symbol list for all project files instead of only for the currently opened files. " "Might be slow for big projects.")); + ebox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 6); + gtk_box_pack_start(GTK_BOX(ebox), label, FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(ebox), e->generate_tag_prefs, TRUE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(table_box), ebox, TRUE, FALSE, 0); - ui_table_add_row(GTK_TABLE(table), 1, label, e->generate_tag_prefs, NULL); - - hbox1 = gtk_hbox_new(FALSE, 0); - gtk_box_pack_start(GTK_BOX(hbox1), table, FALSE, FALSE, 12); - gtk_box_pack_start(GTK_BOX(vbox), hbox1, FALSE, FALSE, 0); + hbox1 = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); + gtk_box_pack_start(GTK_BOX(hbox1), table_box, FALSE, FALSE, 12); + gtk_box_pack_start(GTK_BOX(vbox), hbox1, FALSE, FALSE, 6); label = gtk_label_new("Project Organizer"); - hbox = gtk_hbox_new(FALSE, 0); + hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); gtk_box_pack_start(GTK_BOX(hbox), vbox, TRUE, TRUE, 6); gtk_notebook_append_page(GTK_NOTEBOOK(notebook), hbox, label); Modified: projectorganizer/src/prjorg-project.h 2 lines changed, 2 insertions(+), 0 deletions(-) =================================================================== @@ -19,6 +19,8 @@ #ifndef __PRJORG_PROJECT_H__ #define __PRJORG_PROJECT_H__ +#include <gtk/gtk.h> + #define PRJORG_PATTERNS_SOURCE "*.c *.C *.cpp *.cxx *.c++ *.cc *.m" #define PRJORG_PATTERNS_HEADER "*.h *.H *.hpp *.hxx *.h++ *.hh" #define PRJORG_PATTERNS_IGNORED_DIRS ".* CVS" Modified: projectorganizer/src/prjorg-sidebar.c 50 lines changed, 23 insertions(+), 27 deletions(-) =================================================================== @@ -138,7 +138,7 @@ static gint show_dialog_find_file(gchar *utf8_path, gchar **pattern, gboolean *c size_group = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); label = gtk_label_new(_("Search for:")); - gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); + gtk_label_set_xalign(GTK_LABEL(label), 0.0); gtk_size_group_add_widget(size_group, label); s_fif_dialog.combo = gtk_combo_box_text_new_with_entry(); entry = gtk_bin_get_child(GTK_BIN(s_fif_dialog.combo)); @@ -147,29 +147,29 @@ static gint show_dialog_find_file(gchar *utf8_path, gchar **pattern, gboolean *c ui_entry_add_clear_icon(GTK_ENTRY(entry)); gtk_entry_set_activates_default(GTK_ENTRY(entry), TRUE); - ebox = gtk_hbox_new(FALSE, 6); + ebox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 6); gtk_box_pack_start(GTK_BOX(ebox), label, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(ebox), s_fif_dialog.combo, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(vbox), ebox, TRUE, FALSE, 0); label = gtk_label_new(_("Search inside:")); - gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); + gtk_label_set_xalign(GTK_LABEL(label), 0.0); gtk_size_group_add_widget(size_group, label); s_fif_dialog.dir_label = gtk_label_new(""); - gtk_misc_set_alignment(GTK_MISC(s_fif_dialog.dir_label), 0, 0.5); + gtk_label_set_xalign(GTK_LABEL(s_fif_dialog.dir_label), 0.0); - ebox = gtk_hbox_new(FALSE, 6); + ebox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 6); gtk_box_pack_start(GTK_BOX(ebox), label, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(ebox), s_fif_dialog.dir_label, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(vbox), ebox, TRUE, FALSE, 0); s_fif_dialog.case_sensitive = gtk_check_button_new_with_mnemonic(_("C_ase sensitive")); - gtk_button_set_focus_on_click(GTK_BUTTON(s_fif_dialog.case_sensitive), FALSE); + gtk_widget_set_focus_on_click(s_fif_dialog.case_sensitive, FALSE); s_fif_dialog.full_path = gtk_check_button_new_with_mnemonic(_("Search in full path")); - gtk_button_set_focus_on_click(GTK_BUTTON(s_fif_dialog.full_path), FALSE); + gtk_widget_set_focus_on_click(s_fif_dialog.full_path, FALSE); gtk_box_pack_start(GTK_BOX(vbox), s_fif_dialog.case_sensitive, TRUE, FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox), s_fif_dialog.full_path, TRUE, FALSE, 0); @@ -346,7 +346,7 @@ static gchar *get_fallback_dir_of_selection(void) { locale_path = g_path_get_dirname(doc->real_path); - if (locale_path && locale_path == '.') + if (locale_path && *locale_path == '.') { g_free(locale_path); locale_path = NULL; @@ -382,7 +382,8 @@ void on_open_file_manager(G_GNUC_UNUSED GtkMenuItem * menuitem, G_GNUC_UNUSED gp if (locale_path) { - gchar *command, *open_command; + const gchar *open_command; + gchar *command; open_command = PRJORG_COMMAND_OPEN; command = g_strconcat (open_command, " \"", locale_path, "\"", NULL); @@ -726,7 +727,7 @@ static void create_dialog_find_tag(void) size_group = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); label = gtk_label_new(_("Search for:")); - gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); + gtk_label_set_xalign(GTK_LABEL(label), 0.0); gtk_size_group_add_widget(size_group, label); s_ft_dialog.combo = gtk_combo_box_text_new_with_entry(); @@ -738,13 +739,13 @@ static void create_dialog_find_tag(void) ui_entry_add_clear_icon(GTK_ENTRY(entry)); gtk_entry_set_activates_default(GTK_ENTRY(entry), TRUE); - ebox = gtk_hbox_new(FALSE, 6); + ebox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 6); gtk_box_pack_start(GTK_BOX(ebox), label, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(ebox), s_ft_dialog.combo, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(vbox), ebox, TRUE, FALSE, 0); label = gtk_label_new(_("Match type:")); - gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); + gtk_label_set_xalign(GTK_LABEL(label), 0.0); gtk_size_group_add_widget(size_group, label); s_ft_dialog.combo_match = gtk_combo_box_text_new(); @@ -754,28 +755,28 @@ static void create_dialog_find_tag(void) gtk_combo_box_set_active(GTK_COMBO_BOX(s_ft_dialog.combo_match), 1); gtk_label_set_mnemonic_widget(GTK_LABEL(label), s_ft_dialog.combo_match); - ebox = gtk_hbox_new(FALSE, 6); + ebox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 6); gtk_box_pack_start(GTK_BOX(ebox), label, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(ebox), s_ft_dialog.combo_match, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(vbox), ebox, TRUE, FALSE, 0); label = gtk_label_new(_("Search inside:")); - gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); + gtk_label_set_xalign(GTK_LABEL(label), 0.0); gtk_size_group_add_widget(size_group, label); s_ft_dialog.dir_label = gtk_label_new(""); - gtk_misc_set_alignment(GTK_MISC(s_ft_dialog.dir_label), 0, 0.5); + gtk_label_set_xalign(GTK_LABEL(s_ft_dialog.dir_label), 0.0); - ebox = gtk_hbox_new(FALSE, 6); + ebox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 6); gtk_box_pack_start(GTK_BOX(ebox), label, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(ebox), s_ft_dialog.dir_label, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(vbox), ebox, TRUE, FALSE, 0); s_ft_dialog.case_sensitive = gtk_check_button_new_with_mnemonic(_("C_ase sensitive")); - gtk_button_set_focus_on_click(GTK_BUTTON(s_ft_dialog.case_sensitive), FALSE); + gtk_widget_set_focus_on_click(s_ft_dialog.case_sensitive, FALSE); s_ft_dialog.declaration = gtk_check_button_new_with_mnemonic(_("_Declaration")); - gtk_button_set_focus_on_click(GTK_BUTTON(s_ft_dialog.declaration), FALSE); + gtk_widget_set_focus_on_click(s_ft_dialog.declaration, FALSE); g_object_unref(G_OBJECT(size_group)); /* auto destroy the size group */ @@ -1085,8 +1086,7 @@ static gboolean on_button_release(G_GNUC_UNUSED GtkWidget * widget, GdkEventButt gtk_widget_set_sensitive(s_popup_menu.delete, delete_enabled); - gtk_menu_popup(GTK_MENU(s_popup_menu.widget), NULL, NULL, NULL, NULL, - event->button, event->time); + gtk_menu_popup_at_pointer(GTK_MENU(s_popup_menu.widget), (GdkEvent *)event); return TRUE; } @@ -1207,7 +1207,7 @@ static void create_branch(gint level, GSList *leaf_list, GtkTreeIter *parent, icon = NULL; } else - gtk_icon_info_free(icon_info); + g_object_unref(icon_info); } g_free(content_type); } @@ -1562,7 +1562,7 @@ gchar **prjorg_sidebar_get_expanded_paths(void) (GtkTreeViewMappingFunc)on_map_expanded, expanded_paths); g_ptr_array_add(expanded_paths, NULL); - return g_ptr_array_free(expanded_paths, FALSE); + return (gchar **)g_ptr_array_free(expanded_paths, FALSE); } @@ -1587,10 +1587,6 @@ void prjorg_sidebar_update_full(gboolean reload, gchar **expanded_paths) if (reload) { - GtkTreeSelection *treesel; - GtkTreeIter iter; - GtkTreeModel *model; - expand_data->expanded_paths = expanded_paths != NULL ? expanded_paths : prjorg_sidebar_get_expanded_paths(); expand_data->selected_path = get_selected_path(); @@ -1658,7 +1654,7 @@ void prjorg_sidebar_init(void) PangoFontDescription *pfd; GList *focus_chain = NULL; - s_file_view_vbox = gtk_vbox_new(FALSE, 0); + s_file_view_vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); /**** toolbar ****/ Modified: projectorganizer/src/prjorg-sidebar.h 1 lines changed, 1 insertions(+), 0 deletions(-) =================================================================== @@ -19,6 +19,7 @@ #ifndef __PRJORG_SIDEBAR_H__ #define __PRJORG_SIDEBAR_H__ +#include <gtk/gtk.h> void prjorg_sidebar_init(void); void prjorg_sidebar_cleanup(void); Modified: projectorganizer/src/prjorg-utils.h 3 lines changed, 3 insertions(+), 0 deletions(-) =================================================================== @@ -19,6 +19,9 @@ #ifndef __PRJORG_UTILS_H__ #define __PRJORG_UTILS_H__ +#include <gtk/gtk.h> +#include <geanyplugin.h> + gchar *get_relative_path(const gchar *utf8_parent, const gchar *utf8_descendant); gboolean patterns_match(GSList *patterns, const gchar *str); -------------- This E-Mail was brought to you by github_commit_mail.py (Source:
https://github.com/geany/infrastructure
).
1
0
0
0
[geany/geany-plugins] cfbe00: vimode: eliminate warning
by Jiří Techet
17 Mar '24
17 Mar '24
Branch: refs/heads/master Author: Jiří Techet <techet(a)gmail.com> Committer: Jiří Techet <techet(a)gmail.com> Date: Tue, 05 Mar 2024 21:50:35 UTC Commit: cfbe000271b21846df228943cb19768084146fb1
https://github.com/geany/geany-plugins/commit/cfbe000271b21846df228943cb197…
Log Message: ----------- vimode: eliminate warning Modified Paths: -------------- vimode/src/backends/backend-viw.c Modified: vimode/src/backends/backend-viw.c 2 lines changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -221,7 +221,7 @@ int main(int argc, char **argv) open_file(argv[1]); statusbar = gtk_statusbar_new(); - vbox = gtk_vbox_new(FALSE, 0); + vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); gtk_box_pack_start(GTK_BOX(vbox), editor, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(vbox), statusbar, FALSE, FALSE, 0); gtk_container_add(GTK_CONTAINER(window), vbox); -------------- This E-Mail was brought to you by github_commit_mail.py (Source:
https://github.com/geany/infrastructure
).
1
0
0
0
[geany/geany-plugins] ee7aac: Merge pull request #1316 from techee/vimode-fixes
by Enrico Tröger
17 Mar '24
17 Mar '24
Branch: refs/heads/master Author: Enrico Tröger <enrico.troeger(a)uvena.de> Committer: GitHub <noreply(a)github.com> Date: Sun, 17 Mar 2024 16:54:45 UTC Commit: ee7aac3ded21b6c4a9d3b375502538e463351c35
https://github.com/geany/geany-plugins/commit/ee7aac3ded21b6c4a9d3b37550253…
Log Message: ----------- Merge pull request #1316 from techee/vimode-fixes vimode: eliminate a warning Modified Paths: -------------- vimode/src/backends/backend-viw.c Modified: vimode/src/backends/backend-viw.c 2 lines changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -221,7 +221,7 @@ int main(int argc, char **argv) open_file(argv[1]); statusbar = gtk_statusbar_new(); - vbox = gtk_vbox_new(FALSE, 0); + vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); gtk_box_pack_start(GTK_BOX(vbox), editor, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(vbox), statusbar, FALSE, FALSE, 0); gtk_container_add(GTK_CONTAINER(window), vbox); -------------- This E-Mail was brought to you by github_commit_mail.py (Source:
https://github.com/geany/infrastructure
).
1
0
0
0
← Newer
1
2
Older →
Jump to page:
1
2
Results per page:
10
25
50
100
200