minor feature patch for gtkfilesel.c

2001-03-23 Thread Andres Salomon

(from the README, at http://incandescent.mp3revolution.net/gtk+/)

filesel_memory.diff - Minor patch to gtk+-1.2.9, that allows it's
GtkFileSelection widget to remember which directory it came
from, when moving up parent directories, and position the
dir_list somewhere close to that child directory.

In other words; if you have 300 subdirectories, and go into
one of them, and then leave it (by double-clicking ".."),
instead of being dropped at the first directory in the
entire list, you're put someplace close to the directory
you just came from.  This is nice for things like xmms,
when you've got directories like "Artist-Album", and want
to click through a couple directories of the same artist.

I liken this to how (decent) browsers treat web pages.  You
click on a link, then go back, and the browser returns you
to the link, not to the top of the page.  I don't know
how most browsers behave when using file:// urls on your
hard drive, but I do know mozilla (m18) returns you to
the top of a directory listing (blech, broken imo), and
both links and lynx return you to somewhere close to
where you originated (proper behavior ;).

I haven't had the chance to thoroughly test this patch; as long
as something similar goes into gtk, I'd be happy.  This behavior
has annoyed me for a long time, I just got around to fixing
it tonight (I originally made a patch for xmms:
http://home.vh.net/~aas/util.c.diff , but was informed that this
is the sort of thing that should be in gtk+ itself).

-- 
"... being a Linux user is sort of like living in a house inhabited
by a large family of carpenters and architects. Every morning when
you wake up, the house is a little different. Maybe there is a new
turret, or some walls have moved. Or perhaps someone has temporarily
removed the floor under your bed." - Unix for Dummies, 2nd Edition
-- found in the .sig of Rob Riggs, [EMAIL PROTECTED]


diff -urN gtk+-1.2.9.orig/gtk/gtkfilesel.c gtk+-1.2.9/gtk/gtkfilesel.c
--- gtk+-1.2.9.orig/gtk/gtkfilesel.cThu Feb 15 23:36:19 2001
+++ gtk+-1.2.9/gtk/gtkfilesel.c Fri Mar 23 03:43:23 2001
@@ -1315,6 +1315,8 @@
   gchar* rem_path = rel_path;
   gchar* sel_text;
   gchar* text[2];
+  gchar* position_dir = NULL;
+  gint position_row = 0;
   gint did_recurse = FALSE;
   gint possible_count = 0;
   gint selection_index = -1;
@@ -1325,11 +1327,20 @@
   g_return_if_fail (GTK_IS_FILE_SELECTION (fs));
   
   cmpl_state = (CompletionState*) fs-cmpl_state;
+
+  /* if moving up to a parent directory, remember old child dir */
+  if ((strcmp(rel_path, "../") == 0)  (cmpl_state_okay (cmpl_state)))
+{
+  gchar* d = g_basename (cmpl_reference_position (cmpl_state));
+  position_dir = g_strconcat (d, "/", NULL);
+}
+
   poss = cmpl_completion_matches (rel_path, rem_path, cmpl_state);
 
   if (!cmpl_state_okay (cmpl_state))
 {
   /* Something went wrong. */
+  g_free (position_dir);
   gtk_file_selection_abort (fs);
   return;
 }
@@ -1373,6 +1384,10 @@
  int width = gdk_string_width(fs-dir_list-style-font,
   filename);
  row = gtk_clist_append (GTK_CLIST (fs-dir_list), text);
+
+ if ((position_dir != NULL)  (strcmp (filename, position_dir) == 0))
+   position_row = row;
+
  if(width  dir_list_width)
{
  dir_list_width = width;
@@ -1400,6 +1415,14 @@
 
   gtk_clist_thaw (GTK_CLIST (fs-dir_list));
   gtk_clist_thaw (GTK_CLIST (fs-file_list));
+
+  if (position_dir != NULL)
+{
+  /* remember which directory we came from, and position user near there. */
+  if (position_row  5)
+gtk_clist_moveto (GTK_CLIST (fs-dir_list), position_row - 5, 0, 0, 0);
+  g_free (position_dir);
+}
 
   /* File lists are set. */
 



Re: Save CTree to file? please help

2001-03-23 Thread Sebastian Geerken

On Thu, Mar 22, Matt Hillebrand wrote:
 What's a good way to save everything in a CTree to a file so that the
 tree can be easily rebuilt using this file?
 
 It's easy to get the data in each column, but I can't think of a good way
 to represent the nodes' structure (parents, children, siblings...) in a
 file.

I'd suggest using XML, e.g. by libxml. Below is a code fragment to
draw an XML doc into a tree, two attributes are used, "text" and
"expanded", extend it for your needs. The reverse should also be
simple. Or you hold the data all the time in an xmlDoc, and only use
the GtkCTree to display the data.

Sebastian

---8--8--8--8--8--8--8--8--8---

void draw_xml (xmlDoc *xml,
   GtkCTree *tree)  
{
   gtk_clist_freeze (GTK_CLIST (tree));
   gtk_clist_clear (GTK_CLIST (tree));
   draw_xml_node (xml-root, tree, NULL);
   gtk_clist_thaw (GTK_CLIST (tree));
}


static void draw_xml_node (xmlNode *xml_node,
   GtkCTree *tree,
   GtkCTreeNode *tree_node)
{
   xmlNode *xml_it;
   GtkCTreeNode *tree_it;
   char *text, *expanded;
   int is_expanded;
   
   for(xml_it = xml_node-childs; xml_it; xml_it = xml_it-next) {
  text = xmlGetProp(xml_it, "text");
  expanded = xmlGetProp(xml_it, "expanded");
  is_expanded = expanded == NULL || strcasecmp (expanded, "no") != 0;
  
  tree_it = gtk_ctree_insert_node (tree, tree_node, NULL,
   text, 5, NULL, NULL, NULL, NULL,
   FALSE, is_expanded); 
  draw_xml_node(xml_it, tree, tree_it);
   }
}

___
gtk-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-list



Re: GScanner

2001-03-23 Thread Tim Janik

On Thu, 22 Mar 2001, Michal Burda wrote:

 Why to use GScanner since there is Flex?
 Is GScanner in something better than Flex output?

flex is slower by orders of magnitude and gets very
inefficient as many static symbols arrive.
gscanner can also be used pretty esily to tokenize
in memory strings without generating lexing tables
and its runtime configurable for most things.

these are the main historical reasons gscanner was introduced.

 
 M. Burda
 

---
ciaoTJ


___
gtk-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-list



Re: gdk_window_get_origin()...

2001-03-23 Thread Tim Janik

On Fri, 23 Mar 2001, Marek Stochel wrote:

 What's the difference between functions:
 gdk_window_get_origin()
 and
 gdk_window_get_deskrelative_origin()?
 
 Both seem to me as they return the same values no matter whether they
 refer to
 main or child window.
 Thank in advance for any info,

for 1.2.x, get_deskrelative_origin returns correct coordinates
for you even if you use enlightenment which implements multiple
desktops via virtual root windows.

 
 Marek
 

---
ciaoTJ


___
gtk-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-list



RE: Save CTree to file?

2001-03-23 Thread Esquibel, Rick

Try using XML or an ASCII file using dot notation (i.e.
parent.node1.node2.node3.node4).

Cheers.
Rick Esquibel
Embedded Software/Engineer
5000 E. McDowell Road
Mesa, AZ 85215-9797
(480) 891-8423
[EMAIL PROTECTED]



___
gtk-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-list



Re: GScanner

2001-03-23 Thread Paul Davis

flex is slower by orders of magnitude and gets very
inefficient as many static symbols arrive.
gscanner can also be used pretty esily to tokenize
in memory strings without generating lexing tables
and its runtime configurable for most things.

if it integrated more naturally with bison, these might seem like
better arguments :) i could *perhaps* live without flex's input file, 
but making do without a bison grammar file as the basis for a parser
seems like a sure way towards madness. but then again, i've never
tried to use gscanner and bison, so perhaps its easier than it looks.
i also don't recall how much support for regexps gscanner has. i
should go and look.

--p


___
gtk-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-list



GTK+-Warning

2001-03-23 Thread User Cmdrpc

I have been running some application (gimp, gnucash, gtkbitchx, pan) all rely on GTK+ 
and all have been generating a warning message which states that 
libxfce.so is missing.  Does anyone know a reason why a library used for
XFCE would be need for these application?  Also, if someone has an idea as to how to 
stop the warning messages which does not require me to reload XFCE I 
would greatly appreciate it. Please send any response to my email address I do
not check this newsgroup regularly.
Thanks

___
gtk-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-list



help needed with gdk_drawable_get_size

2001-03-23 Thread Jered Bolton

Hi,

I'm trying to determine the size of a drawing area using
gdk_drawable_get_size, as documented in the GDK online reference
manual.  I'm a bit of a newbie to all this, but I had a peek in
/gdk/gdk.h and it doesn't seem to be in there, so does it still exist?
If not, how else can I determine the size of a drawing area?

Jered.


___
gtk-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-list



lack of const in glib::GDate

2001-03-23 Thread Ben Stanley


Hi,

I'm using the GDate stuff in glib-1.2.9, and I noticed that const has
not been used
anywhere.

I was wondering if there was a reason that it was designed that way, and
if there are any plans for changing it in the future.

I also noticed that const has been used in other places in the API.

Curious,
Ben.

BTW I'm not on the list.



___
gtk-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-list



OS X compile question

2001-03-23 Thread markhenry

Is it possible to compile/install GTK+/glib on a Mac OS X system?  I 
attempted to, but when configuring it had issues when checking host 
system type, saying i need to specify it ... but i couldn't find 
references to how to specify the system type in the install document.  
If anyone could please email me some help/suggestions/hints/rants on 
this at [EMAIL PROTECTED], it would be greatly appreciated :)  
Thanks for your time wot wot.

cheers,
george

___
gtk-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-list



GtkHTML

2001-03-23 Thread Matt Hillebrand

I can't figure out how to use this widget. It is installed. I tried
including gtkhtml.h and gtkhtml.c, but that doesn't work. I even installed
bonobo, gnome-print, gal, and glibwww.

I noticed that there weren't any executables after compiling gtkhtml.
Where is that testgtkhtml for example?


Matt


___
gtk-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-list



glib 2 warning.

2001-03-23 Thread Gediminas Paulauskas

here are some fixes for Makefile.am and configure.in, also ANSI fixes.

also, when  compile with --enable-ansi, I get warnings
"gdate.c:817: warning: implicit declaration of function `localtime_r'"
and similar. It means that __USE_POSIX is not defined (these functions
are declared inside #ifdef's).
maybe not a problem.

also, email addresses in HACKING and MAINTAINERS look strange a bit...

-- 
Gediminas Paulauskas

 build_ansi_fixes.diff.gz