status, x/y, size etc. for compose window.



hello,

here's a little 'alpha' patch for the things shown in the subject.
unfortunately i know motif better than gtk but i work on it.

oki, apply the patch and have a look, btw there might be the
possibility for segfault when leaving balsa, but as i said i am
working on this one and the main reason why i post this now is
because i need some 'hints' from other programmers.

- well i opened a statusline
- i attached a signal
- i made this callback

everything works so far, the status window is there, the signal
gets attached and the callback operates.

now the problem that i dont understand is, the gtktext structure
has cursor_pos_x and cursor_pos_y gint's that keep the cursor's
x/y position, but when moving in the text, i detect that it doesnt
behave correctly, e.g. when it has to be on 1/1, it counts weird,
sometimes some values up and sometimes values down, well you get
a hint, if you apply this patch for testing and move around with
the coursor. the strange thing is, that i used to go 2 different
ways on implementing this stuff and both ways cause the same problem.

i want to continue moving on the way as the attachment file shows,
the other way is this:

;--------------------------------------------------------------------
static gint
balsa_event_key_press_cb(GtkWidget *widget, GdkEventKey *event, BalsaSendmsg *msg)
{
        guint length = 0;
        guint point = 0;

        gchar *statustext = NULL;
        gchar *message = NULL;

        int size = 0;
        int line = 0;
        int row = 0;

        g_return_if_fail(widget != NULL);

//      length = gtk_text_get_length(GTK_TEXT(msg->text));
        point = gtk_text_get_point(GTK_TEXT(msg->text));

        message = gtk_editable_get_chars(GTK_EDITABLE(msg->text), 0, -1);

        while (message[size] != '\0' && size < point) {
                if (message[size] == '\n') {
                        line++;
                        row = 0;
                } else {
                        row++;
                }

                size++;
        }

        g_free(message);

        statustext = g_strdup_printf(_("Size: %ld - Point: %ld - Line: %ld - Row: %ld"), size,
		point, line + 1, row + 1);

	gnome_appbar_set_default(balsa_app.appbar, statustext);
        g_free(statustext);

        return TRUE;
}

;--------------------------------------------------------------------

but this step was dropped by me, since i see no reason calculating the
contens over and over again, while it was already done by gtk, see attached
patch its the way i prefer going.

any help, hints ideas are welcome.

-- 
Name....: Ali Akcaagac
Status..: Student Of Computer & Economic Science
E-Mail..: mailto:ali.akcaagac@stud.fh-wilhelmshaven.de
WWW.....: http://www.fh-wilhelmshaven.de/~akcaagaa

balsa-coordinates.patch



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