Re: How to search through all entries in a column in GtkList



Vinod Joseph wrote:

$$$$ I have a column for password and obviously as name suggests..it
cannot be displayed..I have solved this problem by having a duplicate
entry private_password that does not have a column in the GtkList and
i compare with this private_pwd entry...

If I understand you correctly, you have two tasks to accomplish: 1.
displaying a GtkList with user information, like name and possibly other
attributes (columns), 2. check whether the password input from a
GtkEntry matches any of the passwords of any users. Correct, so far?

You probably should segregate list display and password storage, indeed.
Use the GtkList only to display columns with sensible, visible data.
Passwords are probably better kept and managed in a separate construct
of tools like memory chunks, linked lists, arrays or hashes, as provided
by GLib. By using GHashtables you wouldn't even need to carry out the
comparisons yourself. Care would be required, however, if the password
(and not the user name) were to be used as key. See section GLib data
types in its reference manual for further descriptions.

Anyways, thank you for the suggestions. I have obtained the correct
output .. using goto statement.. just needed to avoid using goto .....

The "goto" statement is not as evil as some C/C++ purists (and
tutorials) suggest. If used correctly, in certain situations it can
improve both readability of the source and performance of the
executable. Just don't use "goto" instead of "while" or "for" loops  :-)

However, basically there is always a way to emulate a "goto" statement
by one or more "break" statements. So if your loop works using "goto"
but not using "break" it may contain at least one other logical bug.
Possibly you were trying to break out of an outer loop from within an
inner loop? This can't be achieved by a single break. You either need a
probably more complex construct of at least two "break" statements or
one "goto" indeed. The question is just whether you're certain to know
what loop levels you are in?



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]