Re: [g-a-devel]gnopernicus cleanup patch ...



Hi Michael,

Thanks a lot for this patch and sorry for answering so late, but we all were 
in vacation until today.

Please see my comments/questions regarding compile-time warnings in the body 
of the original mail, between <ADI> tags. 

Please go ahead and commit !

Best regards,
Adi Dascal
BAUM Engineering, Romania

On Thursday 19 June 2003 17:29, Michael Meeks wrote:
> Hi guys,
>
> 	I hope you've all got back from GUADEC fine; great to meet you all
> there for the first time;
>
> 	As promised - a really boring patch undoing some ghastly cut / paste
> action in srcore - this bins a good many lines, improves readability
> etc. etc.  [ I'm still highly suspicious of this huge module for other
> areas of bloat though ]. To re-iterate, anyone cutting and pasting more
> than 2-3 lines of code more than 2-3 times needs their hand chopping off
> ;->
>
> 	This module is badly in need of un-global-variablizing as well IMHO; I
> didn't do a () -> (void) - to make it all rather clearer. One thing that
> is concerning is that there are a noticable set of compile-time
> warnings. 
<ADI>
We are aware that there is global-variablizing in our code and that we MUST 
fix it, but compile-time errors we can NOT see.

We are not using emacs, but compiling with make from command line. In order 
to detect unwanted warnings we set CFLAGS='-Wall -g -Werror', considering 
that -Wall option in conjunction with -Werror ( we are using this not to pass 
to the next task without fixing the current warning) will announce us about 
possible and resonable problems (as gcc's man page says). 

So the flags that we are not using to pass to gcc (2.96) are below:

<snip from gcc man page>
   The  remaining  `-W...'  options are not implied by `-Wall' because they 
warn about constructions that we consider reasonable to use, on
 occasion, in clean programs.

       -Wtraditional
       -Wshadow
       -Wid-clash-len
       -Wpointer-arith
       -Wcast-qual
       -Wcast-align
       -Wwrite-strings
       -Wconversion
       -Waggregate-return
       -Wstrict-prototypes
       -Wmissing-prototypes
       -Wmissing-declarations
       -Wredundant-decls
       -Wlong-long
       -Woverloaded-virtual
       -Winline
</snip from gcc man page>

If -Wall is not enough would tell us what other flags should we add so we 
will have a "GNOME-aligned" code. What flags are passed to the compiler by 
emacs?

Thanks!

</ADI>


If you guys are using emacs - then it's best to compile from
> within emacs itself, if you're recovering windows users simply add:
> (global-set-key [f7] 'compile) to your ~/.emacs and re-start to get the
> F7 effect. Then you can do C-x ` (ie. backtick) to get to the next
> warning/error. The net effect of most people doing this is that in order
> to get quickly to your errors on re-compile, you tend to fix warnings in
> passing ;-)
>
> 	Anyhow, I hope it's obvious how this improves the code; my feeling is
> that simply putting more effort into trying to make the code re-usable /
> re-factorable would help a lot moving forwards. May I commit ?
>
> 	Best regards,
>
> 		Michael.
>
> ? autom4te-2.53.cache
> ? autom4te.cache
> ? intltool-extract
> ? intltool-merge
> ? intltool-update
> ? stamp-h1
> ? po/de.gmo
> ? po/gnopernicus0.pot
> ? po/gnopernicus_MAJOR_VERSION.pot
> ? po/ro.gmo
> Index: ChangeLog
> ===================================================================
> RCS file: /cvs/gnome/gnopernicus/ChangeLog,v
> retrieving revision 1.223
> diff -u -p -u -r1.223 ChangeLog
> --- ChangeLog	17 Apr 2003 09:14:52 -0000	1.223
> +++ ChangeLog	19 Jun 2003 14:26:29 -0000
> @@ -1,3 +1,22 @@
> +2003-06-19  Michael Meeks  <michael ximian com>
> +
> +	* srcore/srmain.c (src_say_message): make src_message
> +	module static; constify message to reflect it's use.
> +
> +	* srcore/srctrl.c (src_mag_cursor_increase_size),
> +	(src_mag_cursor_decrease_size): factor out common code to
> +	(src_mag_cursor_adjust_size): here & improve flow.
> +	(src_mag_crosswire_adjust_size, src_mag_crosswire_decrease_size)
> +	(src_mag_crosswire_increase_size): the same treatment.
> +	(src_nav_parent_logic): split out cut & paste & genericise into
> +	(src_nav_logic): this thing.
> +	(src_nav_parent_logic): fold into
> +	(src_nav_parent): here.
> +	(src_nav_next_logic, src_nav_child_logic)
> +	(src_nav_previous_logic, src_nav_caret_logic)
> +	(src_nav_first_logic, src_nav_last_logic, src_nav_title_logic)
> +	(src_nav_toolbar_logic, src_nav_statusbar_logic): bin.
> +
>  2003-04-17 Remus Draica <rd baum ro>
>
>  	* srutil/SREvent.c:
> Index: srcore/srctrl.c
> ===================================================================
> RCS file: /cvs/gnome/gnopernicus/srcore/srctrl.c,v
> retrieving revision 1.62
> diff -u -p -u -r1.62 srctrl.c
> --- srcore/srctrl.c	11 Apr 2003 13:55:43 -0000	1.62
> +++ srcore/srctrl.c	19 Jun 2003 14:26:30 -0000
> @@ -384,16 +384,17 @@ src_mag_cursor_toggle ()
>  }
>
>  static gboolean
> -src_mag_cursor_decrease_size ()
> +src_mag_cursor_adjust_size (gint offset)
>  {
> -	gboolean cursor;
> -	gboolean default_cursor = DEFAULT_MAGNIFIER_CURSOR;
> -	if (!srconf_get_data_with_default (MAGNIFIER_CURSOR,
> -					   CFGT_BOOL,
> -					   &cursor,
> -					   (gpointer)&default_cursor,
> -					   MAGNIFIER_CONFIG_PATH)
> -	    ) return FALSE;
> +    gboolean cursor;
> +    gboolean default_cursor = DEFAULT_MAGNIFIER_CURSOR;
> +    if (!srconf_get_data_with_default (MAGNIFIER_CURSOR,
> +				       CFGT_BOOL,
> +				       &cursor,
> +				       (gpointer)&default_cursor,
> +				       MAGNIFIER_CONFIG_PATH)
> +	) return FALSE;
> +
>      if (src_use_magnifier && cursor)
>      {
>  	gint default_val = DEFAULT_MAGNIFIER_CURSOR_SIZE;
> @@ -406,8 +407,10 @@ src_mag_cursor_decrease_size ()
>  					   MAGNIFIER_CONFIG_PATH)
>  	    ) return FALSE;
>
> -	cursor_size = ((cursor_size - 4) < MIN_CURSOR_SIZE) ? MIN_CURSOR_SIZE
>
> : cursor_size - 4;
>
> -
> +	cursor_size = CLAMP (cursor_size + offset,
> +			     MIN_CROSSWIRE_SIZE,
> +			     MAX_CROSSWIRE_SIZE);
> +
>  	if (!srconf_set_data (MAGNIFIER_CURSOR_SIZE,
>  			      CFGT_INT,
>  			      &cursor_size,
> @@ -418,39 +421,15 @@ src_mag_cursor_decrease_size ()
>  }
>
>  static gboolean
> -src_mag_cursor_increase_size ()
> +src_mag_cursor_decrease_size ()
>  {
> -	gboolean cursor;
> -	gboolean default_cursor = DEFAULT_MAGNIFIER_CURSOR;
> -	if (!srconf_get_data_with_default (MAGNIFIER_CURSOR,
> -					   CFGT_BOOL,
> -					   &cursor,
> -					   (gpointer)&default_cursor,
> -					   MAGNIFIER_CONFIG_PATH)
> -	    ) return FALSE;
> -
> -    if (src_use_magnifier && cursor)
> -    {
> -	gint default_val = DEFAULT_MAGNIFIER_CURSOR_SIZE;
> -	gint cursor_size;
> -
> -	if (!srconf_get_data_with_default (MAGNIFIER_CURSOR_SIZE,
> -					   CFGT_INT,
> -					   &cursor_size,
> -					   (gpointer)&default_val,
> -					   MAGNIFIER_CONFIG_PATH)
> -	    ) return FALSE;
> +    return src_mag_cursor_adjust_size (-4);
> +}
>
> -
> -	cursor_size = ((cursor_size + 4) > MAX_CURSOR_SIZE) ? MAX_CURSOR_SIZE
>
> : cursor_size + 4;
>
> -
> -	if (!srconf_set_data (MAGNIFIER_CURSOR_SIZE,
> -			      CFGT_INT,
> -			      &cursor_size,
> -			      MAGNIFIER_CONFIG_PATH)
> -	    ) return FALSE;
> -    }
> -    return TRUE;
> +static gboolean
> +src_mag_cursor_increase_size ()
> +{
> +    return src_mag_cursor_adjust_size (4);
>  }
>
>  static gboolean
> @@ -488,23 +467,23 @@ src_mag_cursor_mag_on_off ()
>  }
>
>  static gboolean
> -src_mag_crosswire_decrease_size ()
> +src_mag_crosswire_adjust_size (guint offset)
>  {
> -	gboolean cursor, crosswire;
> -	gboolean default_cursor = DEFAULT_MAGNIFIER_CURSOR;
> -	gboolean default_crosswire = DEFAULT_MAGNIFIER_CROSSWIRE;
> -	if (!srconf_get_data_with_default (MAGNIFIER_CURSOR,
> -					   CFGT_BOOL,
> -					   &cursor,
> -					   (gpointer)&default_cursor,
> -					   MAGNIFIER_CONFIG_PATH)
> -	    ) return FALSE;
> -	if (!srconf_get_data_with_default (MAGNIFIER_CROSSWIRE,
> -					   CFGT_BOOL,
> -					   &crosswire,
> -					   (gpointer)&default_crosswire,
> -					   MAGNIFIER_CONFIG_PATH)
> -	    ) return FALSE;
> +    gboolean cursor, crosswire;
> +    gboolean default_cursor = DEFAULT_MAGNIFIER_CURSOR;
> +    gboolean default_crosswire = DEFAULT_MAGNIFIER_CROSSWIRE;
> +    if (!srconf_get_data_with_default (MAGNIFIER_CURSOR,
> +				       CFGT_BOOL,
> +				       &cursor,
> +				       (gpointer)&default_cursor,
> +				       MAGNIFIER_CONFIG_PATH)
> +	) return FALSE;
> +    if (!srconf_get_data_with_default (MAGNIFIER_CROSSWIRE,
> +				       CFGT_BOOL,
> +				       &crosswire,
> +				       (gpointer)&default_crosswire,
> +				       MAGNIFIER_CONFIG_PATH)
> +	) return FALSE;
>
>      if (src_use_magnifier && cursor && crosswire)
>      {
> @@ -518,7 +497,9 @@ src_mag_crosswire_decrease_size ()
>  					   MAGNIFIER_CONFIG_PATH)
>  	    ) return FALSE;
>
> -	crosswire_size = ((--crosswire_size ) < MIN_CROSSWIRE_SIZE) ?
> MIN_CROSSWIRE_SIZE : crosswire_size;
> +	crosswire_size = CLAMP (crosswire_size + offset,
> +				MIN_CROSSWIRE_SIZE,
> +				MAX_CROSSWIRE_SIZE);
>
>  	if (!srconf_set_data (MAGNIFIER_CROSSWIRE_SIZE,
>  			      CFGT_INT,
> @@ -530,46 +511,15 @@ src_mag_crosswire_decrease_size ()
>  }
>
>  static gboolean
> -src_mag_crosswire_increase_size ()
> +src_mag_crosswire_decrease_size ()
>  {
> -	gboolean cursor, crosswire;
> -	gboolean default_cursor = DEFAULT_MAGNIFIER_CURSOR;
> -	gboolean default_crosswire = DEFAULT_MAGNIFIER_CROSSWIRE;
> -	if (!srconf_get_data_with_default (MAGNIFIER_CURSOR,
> -					   CFGT_BOOL,
> -					   &cursor,
> -					   (gpointer)&default_cursor,
> -					   MAGNIFIER_CONFIG_PATH)
> -	    ) return FALSE;
> -	if (!srconf_get_data_with_default (MAGNIFIER_CROSSWIRE,
> -					   CFGT_BOOL,
> -					   &crosswire,
> -					   (gpointer)&default_crosswire,
> -					   MAGNIFIER_CONFIG_PATH)
> -	    ) return FALSE;
> -
> -    if (src_use_magnifier && cursor && crosswire)
> -    {
> -	gint default_val = DEFAULT_MAGNIFIER_CROSSWIRE_SIZE;
> -	gint crosswire_size;
> -
> -	if (!srconf_get_data_with_default (MAGNIFIER_CROSSWIRE_SIZE,
> -					   CFGT_INT,
> -					   &crosswire_size,
> -					   (gpointer)&default_val,
> -					   MAGNIFIER_CONFIG_PATH)
> -	    ) return FALSE;
> -
> -
> -	crosswire_size = ((++crosswire_size) > MAX_CROSSWIRE_SIZE) ?
> MAX_CROSSWIRE_SIZE : crosswire_size;
> +	return src_mag_crosswire_adjust_size (-1);
> +}
>
> -	if (!srconf_set_data (MAGNIFIER_CROSSWIRE_SIZE,
> -			      CFGT_INT,
> -			      &crosswire_size,
> -			      MAGNIFIER_CONFIG_PATH)
> -	    ) return FALSE;
> -    }
> -    return TRUE;
> +static gboolean
> +src_mag_crosswire_increase_size ()
> +{
> +	return src_mag_crosswire_adjust_size (+1);
>  }
>
>  static gboolean
> @@ -907,19 +857,19 @@ extern gboolean src_mouse_click;
>  static gint src_nav_mode = SR_NAV_MODE_WINDOW;
>
>  static gboolean
> -src_nav_parent_logic ()
> +src_nav_logic (SRNavigationDir dir, const char *missing_node)
>  {
> -    SRObject *parent;
> +    SRObject *node;
>      gboolean rv = FALSE;
>
>      if (!src_crt_sro)
>  	return FALSE;
>
> -    sro_get_sro (src_crt_sro, SR_NAV_PARENT, &parent, src_nav_mode);
> -    if (parent)
> +    sro_get_sro (src_crt_sro, dir, &node, src_nav_mode);
> +    if (node)
>      {
>  	sro_release_reference (src_crt_sro);
> -	src_crt_sro = parent;
> +	src_crt_sro = node;
>  	src_cmd_queue_add ("present current object");
>  	if (src_mouse_take)
>  	{
> @@ -933,7 +883,7 @@ src_nav_parent_logic ()
>      else
>      {
>  	if (src_use_speech)
> -	    src_say_message (_("no parent"));
> +            src_say_message (missing_node);
>      }
>
>      return rv;
> @@ -965,7 +915,7 @@ src_nav_parent ()
>      if (src_tracking_mode == SRC_MODE_FLAT_REVIEW)
>  	rv = src_nav_parent_flat ();
>      else
> -	rv = src_nav_parent_logic ();
> +        rv = src_nav_logic (SR_NAV_PARENT, _("no parent"));
>
>      return rv;
>  }
> @@ -981,42 +931,6 @@ src_nav_child_flat ()
>      return rv;
>  }
>
> -
> -static gboolean
> -src_nav_child_logic ()
> -{
> -    SRObject *child;
> -    gboolean rv = FALSE;
> -
> -    if (!src_crt_sro)
> -	return FALSE;
> -
> -    sro_get_sro (src_crt_sro, SR_NAV_CHILD, &child, src_nav_mode);
> -    if (child)
> -    {
> -	sro_release_reference (src_crt_sro);
> -	src_crt_sro = child;
> -	src_cmd_queue_add ("present current object");
> -	if (src_mouse_take)
> -	{
> -	    src_cmd_queue_add ("mouse goto current");
> -	    if (src_mouse_click)
> -		src_cmd_queue_add ("mouse left click");
> -	}
> -	src_cmd_queue_process ();
> -	rv = TRUE;
> -    }
> -    else
> -    {
> -	if (src_use_speech)
> -	    src_say_message (_("no children"));
> -    }
> -
> -    return rv;
> -}
> -
> -
> -
>  static gboolean
>  src_nav_child ()
>  {
> @@ -1025,12 +939,11 @@ src_nav_child ()
>      if (src_tracking_mode == SRC_MODE_FLAT_REVIEW)
>  	rv = src_nav_child_flat ();
>      else
> -	rv = src_nav_child_logic ();
> +	rv = src_nav_logic (SR_NAV_CHILD, _("no children"));
>
>      return rv;
>  }
>
> -
>  static gboolean src_flat_review_line (gint index);
>
>  static gboolean
> @@ -1047,39 +960,6 @@ src_nav_next_flat ()
>      return rv;
>  }
>
> -
> -static gboolean
> -src_nav_next_logic ()
> -{
> -    SRObject *next;
> -    gboolean rv = FALSE;
> -
> -    if (!src_crt_sro)
> -	return FALSE;
> -    sro_get_sro (src_crt_sro, SR_NAV_NEXT, &next, src_nav_mode);
> -    if (next)
> -    {
> -	sro_release_reference (src_crt_sro);
> -	src_crt_sro = next;
> -	src_cmd_queue_add ("present current object");
> -	if (src_mouse_take)
> -	{
> -	    src_cmd_queue_add ("mouse goto current");
> -	    if (src_mouse_click)
> -		src_cmd_queue_add ("mouse left click");
> -	}
> -	src_cmd_queue_process ();
> -	rv = TRUE;
> -    }
> -    else
> -    {
> -	if (src_use_speech)
> -	    src_say_message (_("no next"));
> -    }
> -
> -    return rv;
> -}
> -
>  static gboolean
>  src_nav_next ()
>  {
> @@ -1088,7 +968,7 @@ src_nav_next ()
>      if (src_tracking_mode == SRC_MODE_FLAT_REVIEW)
>  	rv = src_nav_next_flat ();
>      else
> -	rv = src_nav_next_logic ();
> +	rv = src_nav_logic (SR_NAV_NEXT, _("no next"));
>
>      return rv;
>  }
> @@ -1303,41 +1183,6 @@ src_nav_previous_flat ()
>      return rv;
>  }
>
> -
> -
> -static gboolean
> -src_nav_previous_logic ()
> -{
> -    SRObject *previous;
> -    gboolean rv = FALSE;
> -
> -    if (!src_crt_sro)
> -	return FALSE;
> -
> -    sro_get_sro (src_crt_sro, SR_NAV_PREV, &previous, src_nav_mode);
> -    if (previous)
> -    {
> -	sro_release_reference (src_crt_sro);
> -	src_crt_sro = previous;
> -	src_cmd_queue_add ("present current object");
> -	if (src_mouse_take)
> -	{
> -	    src_cmd_queue_add ("mouse goto current");
> -	    if (src_mouse_click)
> -		src_cmd_queue_add ("mouse left click");
> -	}
> -	src_cmd_queue_process ();
> -	rv = TRUE;
> -    }
> -    else
> -    {
> -	if (src_use_speech)
> -	    src_say_message (_("no previous"));
> -    }
> -
> -    return rv;
> -}
> -
>  static gboolean
>  src_nav_previous ()
>  {
> @@ -1346,7 +1191,7 @@ src_nav_previous ()
>      if (src_tracking_mode == SRC_MODE_FLAT_REVIEW)
>  	rv = src_nav_previous_flat ();
>      else
> -	rv = src_nav_previous_logic ();
> +	rv = src_nav_logic (SR_NAV_PREV, _("no previous"));
>
>      return rv;
>  }
> @@ -1359,41 +1204,6 @@ src_nav_caret_flat ()
>      return rv;
>  }
>
> -
> -static gboolean
> -src_nav_caret_logic ()
> -{
> -    SRObject *caret;
> -    gboolean rv = FALSE;
> -
> -    if (!src_crt_sro)
> -	return FALSE;
> -
> -    sro_get_sro (src_crt_sro, SR_NAV_CARET, &caret, src_nav_mode);
> -    if (caret)
> -    {
> -	sro_release_reference (src_crt_sro);
> -	src_crt_sro = caret;
> -	src_cmd_queue_add ("present current object");
> -	if (src_mouse_take)
> -	{
> -	    src_cmd_queue_add ("mouse goto current");
> -	    if (src_mouse_click)
> -		src_cmd_queue_add ("mouse left click");
> -	}
> -	src_cmd_queue_process ();
> -	rv = TRUE;
> -    }
> -    else
> -    {
> -	if (src_use_speech)
> -	    src_say_message (_("no caret"));
> -    }
> -
> -    return rv;
> -}
> -
> -
>  extern SRLong src_text_index;
>  static gboolean
>  src_caret_attributes ()
> @@ -1423,12 +1233,11 @@ src_nav_caret ()
>      if (src_tracking_mode == SRC_MODE_FLAT_REVIEW)
>  	rv = src_nav_caret_flat ();
>      else
> -	rv = src_nav_caret_logic ();
> +	rv = src_nav_logic (SR_NAV_CARET, _("no caret"));
>
>      return rv;
>  }
>
> -
>  static gboolean
>  src_nav_first_flat ()
>  {
> @@ -1437,40 +1246,6 @@ src_nav_first_flat ()
>      return rv;
>  }
>
> -
> -static gboolean
> -src_nav_first_logic ()
> -{
> -    SRObject *first;
> -    gboolean rv = FALSE;
> -
> -    if (!src_crt_sro)
> -	return FALSE;
> -
> -    sro_get_sro (src_crt_sro, SR_NAV_FIRST, &first, src_nav_mode);
> -    if (first)
> -    {
> -	sro_release_reference (src_crt_sro);
> -	src_crt_sro = first;
> -	src_cmd_queue_add ("present current object");
> -	if (src_mouse_take)
> -	{
> -	    src_cmd_queue_add ("mouse goto current");
> -	    if (src_mouse_click)
> -		src_cmd_queue_add ("mouse left click");
> -	}
> -	src_cmd_queue_process ();
> -	rv = TRUE;
> -    }
> -    else
> -    {
> -	if (src_use_speech)
> -	    src_say_message (_("already on first"));
> -    }
> -
> -    return rv;
> -}
> -
>  static gboolean
>  src_nav_first ()
>  {
> @@ -1479,12 +1254,11 @@ src_nav_first ()
>      if (src_tracking_mode == SRC_MODE_FLAT_REVIEW)
>  	rv = src_nav_first_flat ();
>      else
> -	rv = src_nav_first_logic ();
> +	rv = src_nav_logic (SR_NAV_FIRST, _("already on first"));
>
>      return rv;
>  }
>
> -
>  static gboolean
>  src_nav_last_flat ()
>  {
> @@ -1493,41 +1267,6 @@ src_nav_last_flat ()
>      return rv;
>  }
>
> -
> -static gboolean
> -src_nav_last_logic ()
> -{
> -    SRObject *last;
> -    gboolean rv = FALSE;
> -
> -    if (!src_crt_sro)
> -	return FALSE;
> -
> -    sro_get_sro (src_crt_sro, SR_NAV_LAST, &last, src_nav_mode);
> -    if (last)
> -    {
> -	sro_release_reference (src_crt_sro);
> -	src_crt_sro = last;
> -	src_cmd_queue_add ("present current object");
> -	if (src_mouse_take)
> -	{
> -	    src_cmd_queue_add ("mouse goto current");
> -	    if (src_mouse_click)
> -		src_cmd_queue_add ("mouse left click");
> -	}
> -	src_cmd_queue_process ();
> -	rv = TRUE;
> -    }
> -    else
> -    {
> -	if (src_use_speech)
> -	    src_say_message (_("already on last"));
> -    }
> -
> -    return rv;
> -}
> -
> -
>  static gboolean
>  src_nav_last ()
>  {
> @@ -1536,12 +1275,11 @@ src_nav_last ()
>      if (src_tracking_mode == SRC_MODE_FLAT_REVIEW)
>  	rv = src_nav_last_flat ();
>      else
> -	rv = src_nav_last_logic ();
> +	rv = src_nav_logic (SR_NAV_LAST, _("already on last"));
>
>      return rv;
>  }
>
> -
>  static gboolean
>  src_nav_change_mode ()
>  {
> @@ -1670,39 +1408,6 @@ src_nav_title_flat ()
>  }
>
>  static gboolean
> -src_nav_title_logic ()
> -{
> -    SRObject *title;
> -    gboolean rv = FALSE;
> -
> -    if (!src_crt_sro)
> -	return FALSE;
> -
> -    sro_get_sro (src_crt_sro, SR_NAV_TITLE, &title, src_nav_mode);
> -    if (title)
> -    {
> -	sro_release_reference (src_crt_sro);
> -	src_crt_sro = title;
> -	src_cmd_queue_add ("present current object");
> -	if (src_mouse_take)
> -	{
> -	    src_cmd_queue_add ("mouse goto current");
> -	    if (src_mouse_click)
> -		src_cmd_queue_add ("mouse left click");
> -	}
> -	src_cmd_queue_process ();
> -	rv = TRUE;
> -    }
> -    else
> -    {
> -	if (src_use_speech)
> -	    src_say_message (_("no title"));
> -    }
> -
> -    return rv;
> -}
> -
> -static gboolean
>  src_nav_title ()
>  {
>      gboolean rv = FALSE;
> @@ -1710,7 +1415,7 @@ src_nav_title ()
>      if (src_tracking_mode == SRC_MODE_FLAT_REVIEW)
>  	rv = src_nav_title_flat ();
>      else
> -	rv = src_nav_title_logic ();
> +	rv = src_nav_logic (SR_NAV_TITLE, _("no title"));
>
>      return rv;
>  }
> @@ -1724,38 +1429,6 @@ src_nav_menubar_flat ()
>  }
>
>  static gboolean
> -src_nav_menubar_logic ()
> -{
> -    SRObject *menu;
> -    gboolean rv = FALSE;
> -
> -    if (!src_crt_sro)
> -	return FALSE;
> -
> -    sro_get_sro (src_crt_sro, SR_NAV_MENU, &menu, src_nav_mode);
> -    if (menu)
> -    {
> -	sro_release_reference (src_crt_sro);
> -	src_crt_sro = menu;
> -	src_cmd_queue_add ("present current object");
> -	if (src_mouse_take)
> -	{
> -	    src_cmd_queue_add ("mouse goto current");
> -	    if (src_mouse_click)
> -		src_cmd_queue_add ("mouse left click");
> -	}
> -	src_cmd_queue_process ();
> -	rv = TRUE;
> -    }
> -    else
> -    {
> -	if (src_use_speech)
> -	    src_say_message (_("no menu bar"));
> -    }
> -    return rv;
> -}
> -
> -static gboolean
>  src_nav_menubar ()
>  {
>      gboolean rv = FALSE;
> @@ -1763,7 +1436,7 @@ src_nav_menubar ()
>      if (src_tracking_mode == SRC_MODE_FLAT_REVIEW)
>  	rv = src_nav_menubar_flat ();
>      else
> -	rv = src_nav_menubar_logic ();
> +	rv = src_nav_logic (SR_NAV_MENU, _("no menu bar"));
>
>      return rv;
>  }
> @@ -1777,40 +1450,6 @@ src_nav_toolbar_flat ()
>  }
>
>  static gboolean
> -src_nav_toolbar_logic ()
> -{
> -    SRObject *toolbar;
> -    gboolean rv = FALSE;
> -
> -    if (!src_crt_sro)
> -	return FALSE;
> -
> -    sro_get_sro (src_crt_sro, SR_NAV_TOOLBAR, &toolbar, src_nav_mode);
> -    if (toolbar)
> -    {
> -	sro_release_reference (src_crt_sro);
> -	src_crt_sro = toolbar;
> -	src_cmd_queue_add ("present current object");
> -	if (src_mouse_take)
> -	{
> -	    src_cmd_queue_add ("mouse goto current");
> -	    if (src_mouse_click)
> -		src_cmd_queue_add ("mouse left click");
> -	}
> -	src_cmd_queue_process ();
> -	rv = TRUE;
> -    }
> -    else
> -    {
> -	if (src_use_speech)
> -	    src_say_message (_("no tool bar"));
> -    }
> -
> -    return rv;
> -}
> -
> -
> -static gboolean
>  src_nav_toolbar ()
>  {
>      gboolean rv = FALSE;
> @@ -1818,7 +1457,7 @@ src_nav_toolbar ()
>      if (src_tracking_mode == SRC_MODE_FLAT_REVIEW)
>  	rv = src_nav_toolbar_flat ();
>      else
> -	rv = src_nav_toolbar_logic ();
> +	rv = src_nav_logic (SR_NAV_TOOLBAR, _("no tool bar"));
>
>      return rv;
>  }
> @@ -1832,39 +1471,6 @@ src_nav_statusbar_flat ()
>  }
>
>  static gboolean
> -src_nav_statusbar_logic ()
> -{
> -    SRObject *statusbar;
> -    gboolean rv = FALSE;
> -
> -    if (!src_crt_sro)
> -	return FALSE;
> -
> -    sro_get_sro (src_crt_sro, SR_NAV_STATUSBAR, &statusbar,
> src_nav_mode);
> -    if (statusbar)
> -    {
> -	sro_release_reference (src_crt_sro);
> -	src_crt_sro = statusbar;
> -	src_cmd_queue_add ("present current object");
> -	if (src_mouse_take)
> -	{
> -	    src_cmd_queue_add ("mouse goto current");
> -	    if (src_mouse_click)
> -		src_cmd_queue_add ("mouse left click");
> -	}
> -	src_cmd_queue_process ();
> -	rv = TRUE;
> -    }
> -    else
> -    {
> -	if (src_use_speech)
> -	    src_say_message (_("no status bar"));
> -    }
> -
> -    return rv;
> -}
> -
> -static gboolean
>  src_nav_statusbar ()
>  {
>      gboolean rv = FALSE;
> @@ -1872,7 +1478,7 @@ src_nav_statusbar ()
>      if (src_tracking_mode == SRC_MODE_FLAT_REVIEW)
>  	rv = src_nav_statusbar_flat ();
>      else
> -	rv = src_nav_statusbar_logic ();
> +	rv = src_nav_logic (SR_NAV_STATUSBAR, _("no status bar"));
>
>      return rv;
>  }
> Index: srcore/srmain.c
> ===================================================================
> RCS file: /cvs/gnome/gnopernicus/srcore/srmain.c,v
> retrieving revision 1.85
> diff -u -p -u -r1.85 srmain.c
> --- srcore/srmain.c	15 Apr 2003 13:16:24 -0000	1.85
> +++ srcore/srmain.c	19 Jun 2003 14:26:31 -0000
> @@ -2514,9 +2514,10 @@ src_get_defaults ()
>
>  }
>
> -gchar *src_message;
> +static gchar *src_message;
> +
>  gboolean
> -src_say_message (gchar *message)
> +src_say_message (const gchar *message)
>  {
>      if (src_message)
>  	g_free (src_message);
> Index: srcore/srmain.h
> ===================================================================
> RCS file: /cvs/gnome/gnopernicus/srcore/srmain.h,v
> retrieving revision 1.31
> diff -u -p -u -r1.31 srmain.h
> --- srcore/srmain.h	28 Nov 2002 12:20:33 -0000	1.31
> +++ srcore/srmain.h	19 Jun 2003 14:26:31 -0000
> @@ -45,6 +45,6 @@ gboolean src_kb_modifier_echo	   ();
>  gboolean src_kb_cursor_echo	   ();
>
>
> -gboolean src_say_message (gchar *message);
> +gboolean src_say_message (const gchar *message);
>
>  #endif /* _SRMAIN_H_ */



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