Re: GtkCalendar improved keyboard focus movement



Detlef Reichl <detlef reichl arcormail de> writes:

> The attached patch changes the movement of the focus in GtkCalendar in
> that way, that if the focus reaches the first or last day in month, it
> will jump with the next key press to the last of the previous or the
> first of the following month.
> >From the top row it will jump to same day of the week in the previous
> month on key press up. Key press down the same.
> It is all handled in that way, that only days of type MONTH_CURRENT are

It's really best to submit patches to bugzilla (file a bug report,
attach the patch), or it's very likely that the patch will be
forgotten about.

Two comments about your patch:

 * The coding style needs to match that in GTK+. The GTK+
   coding style is basically that documented in 
   pango/docs/TEXT/coding-style, with the difference 
   that gint/gchar/getc. are used rather than int/char.

 * I think this needs to obey the GTK_CALENDAR_NO_MONTH change
   flag or you could seriously confuse some applications.

Other than that, the idea sounds fine, though I'd like to get
some additioanl reaction on it from people who use GtkCalendar
in their applications.

I'll point out one style thing in particular:

> +		else
> +		  ndays_in_prev_month =
> +					month_length[leap (calendar->year)][calendar->month];
> +
> +		calendar->focus_col = 6;
> +		ndays_in_prev_month == 28 ?
> +					  (calendar->focus_row = 3) : (calendar->focus_row = 4);

Creative, but not particularuly a good idea. :-). Either do the simple:

 if (ndays_in_prev_month == 28)
   calendar->focus_row = 3;
 else
   calendar->focus_row = 4;

Or else use the ternary in the normal way:
 
 calender->focus_row = (ndays_in_prev_month == 28) ? 3 : 4;

Thanks for the patch,
                                        Owen




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