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

Re: gEDA-user: pcb- no library dialog window on startup



On Mon, 2009-03-09 at 18:55 -0700, Josh Jordan wrote:
> 
> +gboolean 
> +ghid_library_window_get_visibility (void)
> +{
> +  if (library_window == NULL)
> +    {
> +      return FALSE;
> +    }
> +  else
> +    {
> +      return TRUE;
> +    }
> +}

The patch pedant in me says:

+gboolean 
+ghid_library_window_get_visibility (void)
+{
+  return (library_window != NULL);
+}

Or to use the appropriate GTK function to get true visibility (not
tested, but something like):

+gboolean 
+ghid_library_window_get_visibility (void)
+{
+  if (library_window != NULL && GTK_WIDGET_VISIBLE (library_window))
+    return TRUE;
+  return FALSE;
+}


I presume the former code works because PCB doesn't currently keep an
unshown GtkWindow widget hanging around in the library_window variable.

However.. I'm not sure why LibraryChanged() needs to re-show the library
window in the first-place (for any situation). Since we pass raised =
FALSE, and if I assume that the window is already visible, the only
executed code is:


  gtk_editable_select_region (GTK_EDITABLE
			      (GHID_LIBRARY_WINDOW (library_window)->
			       entry_filter), 0, -1);

  /* Set the focus to the filter entry only if it is in the current
     displayed tab */
  notebook = GTK_NOTEBOOK (GHID_LIBRARY_WINDOW (library_window)->viewtabs);
  current_tab = gtk_notebook_get_nth_page (notebook,
					   gtk_notebook_get_current_page
					   (notebook));
  entry_filter =
    GTK_WIDGET (GHID_LIBRARY_WINDOW (library_window)->entry_filter);
  if (gtk_widget_is_ancestor (entry_filter, current_tab))
    {
      gtk_widget_grab_focus (entry_filter);
    }


Does anything break if you just remove the ghid_library_window_show
(&ghid_port, FALSE); call from the "LibraryChanged" function?

I'd guess you'd need to put a printf in the LibraryChanged function and
ensure that it gets triggered at least once or twice in testing, to
verify that nothing unexpected happens, such as the library window going
out of sync.


-- 
Peter Clifton

Electrical Engineering Division,
Engineering Department,
University of Cambridge,
9, JJ Thomson Avenue,
Cambridge
CB3 0FA

Tel: +44 (0)7729 980173 - (No signal in the lab!)




_______________________________________________
geda-user mailing list
geda-user@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-user