Re: patch: toggle-btn-get-active



There are only 3 other examples of using a macro for a *_get_* and
those are all in gtkcompat.h. 

Other things which could be written as macros are currently functions,
such as gtk_button_get_relief(), gtk_editable_get_position(), etc.

One of the reasons is that the functions provided check to make sure you 
have the right type of object before accessing it, thus providing a little 
guard against segfaulting.

If it should be done, it should probably be done consistantly.

-Shawn

On Tue, Jan 19, 1999 at 11:52:16AM -0500, Jeff Garzik wrote:
> Is this patch acceptable?   It adds gtk_toggle_button_get_active macro.
> Doesn't add any code weight, and creates a counterpart to
> gtk_toggle_button_set_active.
> 
> 	Jeff
> 
> 
> 
> 

Content-Description: gtk_toggle_button_get_active patch
> Index: ChangeLog
> ===================================================================
> RCS file: /debian/home/gnomecvs/gtk+/ChangeLog,v
> retrieving revision 1.938
> diff -u -r1.938 ChangeLog
> --- ChangeLog	1999/01/18 23:51:31	1.938
> +++ ChangeLog	1999/01/19 16:50:06
> @@ -1,3 +1,8 @@
> +Tue Jan 19 11:48:26 1999  Jeff Garzik  <jgarzik@pobox.com>
> +
> +	* gtk/gtktogglebutton.h:
> +	Added gtk_toggle_button_get_active macro.
> +
>  Tue Jan 19 00:21:15 1999  Tim Janik  <timj@gtk.org>
>  
>  	* gtk/gtkcompat.h: add compatibility define for
> Index: gtk/gtktogglebutton.h
> ===================================================================
> RCS file: /debian/home/gnomecvs/gtk+/gtk/gtktogglebutton.h,v
> retrieving revision 1.5
> diff -u -r1.5 gtktogglebutton.h
> --- gtktogglebutton.h	1999/01/11 18:49:51	1.5
> +++ gtktogglebutton.h	1999/01/19 16:50:09
> @@ -66,6 +66,7 @@
>  					     gboolean         is_active);
>  void       gtk_toggle_button_toggled        (GtkToggleButton *toggle_button);
>  
> +#define	   gtk_toggle_button_get_active(btn) (GTK_TOGGLE_BUTTON (btn)->active)
>  
>  #ifdef __cplusplus
>  }
> 
--
Shawn T. Amundson               
amundson@gimp.org               http://www.gimp.org/~amundson

"The assumption that the universe looks the same in every
 direction is clearly not true in reality." - Stephen Hawking



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