to extend GObject for browser engine, like gtkhtml2?

2002-04-25 Thread Kang Jeong-Hee

Hi!
I have a plan to make gnome2-based browser engine,
which invoke components of libxml2, gnome basic, bonobo, etc.
but sadly I'm novice to heavy project than honourable hackers of gnome world.
I have to learn more inside of GNOME and GTK+.

as beginning, I think I have to implement the extention of GObject.
nowadays I'm interested in GStreamer. so did wonder if I study GstObject or so. (it's 
well designed and built I think)
but gst is multimedia framework, therefore it's not a straightforward to browser 
engine.

gtkhtml2 the ultimate browser engine of gnome world will be a good model.
but I couldn't find gtk-doc style(=gnome-general) reference. (in fact even a piece of 
reference document) on gtkhtml2.codefactory.se.
this post has the gtkhtml2 mailing list, that I've just subscribed in, as CC.
I hope a hundreds of millions of replies from both lists. :)

frankly I don't know what I need to know.
is there a guidebook to extend GObject to particular object model?
if I could get read gtkhtml2 object index and hierarchial information, it'll be 
greatly helpful.

say to html, xml, js, or so, I think I'm a _user_ in level of veteran.
does this fact help me to develop browser engine?
it'll be long journey, like it to heaven. :-)

thanks.
now let me get reply. ;]
___
gtk-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-list



gtkhtml reference

2002-04-25 Thread Neil Hodge

All:

Could someone please point me to a gtkhtml reference?  Thanks.

-- 
Neil Hodge
[EMAIL PROTECTED]

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



Re: GtkPreview changed behaviour

2002-04-25 Thread maurits . rijk

Hi Sven,

>> I noticed a difference in behaviour between the GTK 1.2 and GTK 2.0
>> GtkPreview widget. Somehow the following code used to work in GTK 1.2
>> (with gtk_signal_connect iso g_signal_connect, etc.) but in 2.0 the
>> "motion_notify_event" doesn't seem to get handled.
>> 
>> g_signal_connect(G_OBJECT(widget), "motion_notify_event",
>>                           G_CALLBACK(button_motion), factory);
>> 
>> The funtion 'button_motion' is never called.
>
>are you sure? I had a quick look at the state of the plug-in in CVS
>and it seems as if preview_move() gets called since the coordinates
>in the statusbar are correctly updated. 

Yep, that's one of the things I don't understand: the preview_move() get's called, but the button_motion() isn't, even though both are connected to the same event ("motion_notify_event").  Which makes me think right now that I might have used the wrong declaration for preview_move(). If it's supposed to return a value (will look that up this evening) I can imagine that the other callback function is never called.

>The use of GDK_MOTION_NOTIFY as an event_mask (see your PREVIEW_MASK
>definition) is wrong by the way. It didn't do any harm however.

Ah, ok I just copied that part from another plugin a long time ago. Why shouldn't it be used and can I just remove it?

Kind regards,

Maurits

Re: GtkPreview changed behaviour

2002-04-25 Thread maurits . rijk

Hi Sven,

>perhaps removing this (braindead) code in dialog creation could help:
>
> gtk_widget_set_size_request(dlg, 0, 0);
> gtk_widget_realize(dlg);
>
>not sure what you had in mind here, but you should avoid fiddling with
>size requests whereever possible. Realizing widgets manually is also

I haven't the slightest idea why that code was in there. Probably copied
from some other code a long time ago (back in '98) when I started coding
this plugin. Anyhow, the good news is that after removal of this code the
whole thing seems to work again. I will try to make a patch for GIMP 1.3.6
or 1.3.7.

Thanks for your great help,

Maurits

1.2.10: CList bad behaviour

2002-04-25 Thread David Robin

First of all, please forgive me if my message is out of topic, as I
haven't read the ML for a very long time.

I think I've found a bug with 1.2.10 while I was trying to implement a
2-column clist. When using gtk_clist_new(), I get only one column, and I
have to use gtk_clist_new_with_title() to obtain 2 columns. Here follows
the corresponding samples:

1/ GTK_CLIST_NEW
#include 
#include 
#include 
[...]

GtkWidget winDebug, clReg;
unsigned int i;
char **txtReg;
txtReg=malloc(2*sizeof(char*));
txtReg[0]=malloc(16*sizeof(char));
txtReg[1]=malloc(64*sizeof(char));
strcpy(txtReg[0],"REGISTERS");
strcpy(txtReg[1],"UNDEFINED");

winDebug = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_title( GTK_WINDOW(winDebug), "Debugger" );

clReg = gtk_clist_new(2);
for(i=0; i<16; i++)
{
  gtk_clist_append(GTK_CLIST(clReg), txtReg );
}



2/ GTK_CLIST_NEW_WITH_TITLES
GtkWidget winDebug, clReg;
unsigned int i;
char **txtReg;
txtReg=malloc(2*sizeof(char*));
txtReg[0]=malloc(16*sizeof(char));
txtReg[1]=malloc(64*sizeof(char));
strcpy(txtReg[0],"REGISTERS");
strcpy(txtReg[1],"UNDEFINED");

winDebug = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_title( GTK_WINDOW(winDebug), "Debugger" );

clReg = gtk_clist_new_with_titles(2, txtReg );
for(i=0; i<16; i++)
{
  gtk_clist_append(GTK_CLIST(clReg), txtReg );
}



Is there some bug in my code, or is it in gtk_clist_new code?
Thank you all.

David

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



Image in GtkCheckMenuItem and GtkRadioMenuItem

2002-04-25 Thread maurits . rijk

Hi,

Does anyone know if it's possible to have an image (like for example the stock icon in the File/Open menu) in a GtkCheckMenuItem or a GtkRadioMenuItem? I'm not sure yet if having both an icon and a radio/check marker in a menu entry might be confusing, but I want to use this for example in a radio menu in which I have 4 entries (arrow, rectangle, circle and polygon) and I want to put icons in front of these entries.

Maurits

GtkSpinButton in GtkTreeViewColumn?

2002-04-25 Thread maurits . rijk

Hi,

I was just wondering if it would be possible to have a GtkSpinButton inside a GtkTreeViewColumn. As far as I can see from the documentation and the source code it's possible to render a column with GtkCellRendererText and make it editable, but that will always create a GtkEntry widget in the cell you want to edit. I would like to have a GtkSpinButton for numerical cells. For example, I have a GtkTreeView that contains (x, y) coordinates I'd like to edit.

Maurits

Re: GtkPreview changed behaviour

2002-04-25 Thread maurits . rijk

Hi,


>> supposed to return a value (will look that up this evening) I can imagine 
>> that the other callback function is never called.
>
>sure, all event callbacks have a gboolean return value (they used to
>have in 1.2 too) and the signal emission is stopped after the first
>signal handler returns TRUE indicating that it has handled the
>event. I was assuming you read

Read??? I'm a software developer. I don't read manuals, I write code :) 

> http://developer.gnome.org/doc/API/2.0/gtk/gtk-changes-2-0.html

But seriously though, I actually have read that doc, but I probably overlooked 
that section or didn't think it was applicable.

Now if I only can find out why my plugin starts with the size of a stamp and
GTK is complaining about a negative size of -9 for some widget I use..

Thanks,

Maurits 

Help with upgrade.

2002-04-25 Thread Wyatt Greenway

Hello, I have tried to upgrade to gtk version 2.0.1,
but I install glib, atk, pango, then when I try to
install the gtk rpm, it says. 
libc.so.6(GLIBC_2.2.3) failed dependency check. Please
make sure that it is installed. 
Or it says something in that line any way. Help me
please. I have Redhat Linux 7.1, Thanks


__
Do You Yahoo!?
Yahoo! Games - play chess, backgammon, pool and more
http://games.yahoo.com/
___
gtk-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-list



Follow-up: FW: Repost: finely tuned drag-n-drop

2002-04-25 Thread James D. Watson

Good evening,

  I found a way to solve this (possibly uninteresting) problem.  My sample
code is >500 lines, though, so instead of posting it to the group, would be
happy to directly email the code to anyone who emails me privately.

  I ended up doing the bulk of the work in a drag_drop handler.

Regards,
James


-Original Message-
From: James D. Watson [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, April 24, 2002 8:24 PM
To: [EMAIL PROTECTED]
Subject: Repost: finely tuned drag-n-drop


Good evening,

  I remain hopeful I could get some help with the posting at history.  First
time I didn't get any takers :-).  Does anyone have any [germane] thoughts
to throw my way?

  I appreciate any help folks can offer.

Thank you,
Regards,
James

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On
Behalf Of James D. Watson
Sent: Sunday, April 14, 2002 1:33 PM
To: [EMAIL PROTECTED]
Subject: Q: finely tuned drag-n-drop


Good morning,

  GTK+-2.0 documentation for GtkTreeView::gtk_tree_view_set_reorderable
reads "This function does not give you any degree of control over the
order -- any reorderering is allowed. If more control is needed, you should
probably handle drag and drop manually."

  That's what I'm trying to do :-)

  I'm trying to limit the order in which a user can place my GtkTreeView
rows.  My GtkTreeModel has "above" and "below" gint columns for which
adjoining rows must match.  e.g.,

 rowname  above   below
  row_a15  20
  row_b20  20
  row_c20  15

Note that:

  row_a's "below" must match row_b's "above"
  row_b's "below" must match row_c's "above"

  I want to support reordering such that someone *could*

   o   move row_c on top of row_a (because then row_c's "below" would
   match row_a's "above")

but could *not*

   o   move row_a below row_b (because even though row_c's "above" would
   match row_a's "below", row_b's "below" would not match row_a's
   "above").

  If I tie in to the "drag_drop" signal, I can do:

 GtkTreeSelection *sel =
  gtk_tree_view_get_selection(GTK_TREE_VIEW(widget));

 gtk_tree_model_get(model, &iter,
ABOVE_COLUMN, &above,
BELOW_COLUMN, &below,
-1);

which tells me the above/below for the current selection which is the one
being moved.  (My selection type is "SINGLE".)

But this doesn't seem to be the right signal to tie in to since I want to
find out *where* in the GtkTreeView (i.e., what row) the current selection
is trying to be dropped, whereupon I could then make an "accept" or "reject"
decision.

I'd certainly appreciate some tips.

Regards,
James

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

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



Embedding widgets in GtkTreeView?

2002-04-25 Thread Michael Ivanov

Hallo!

I'm developing an application using gtk2 and I have some questions regarding
GtkTreeView interface. Regrettably, on this part the documentation is what I
would call terse :-)

Now to the questions:

1. Is it possible to use an enumeration as a value for a column in TreeView,
   for instance to embed a non-editable combo widget into a column? I have a
   list of serial devices and for each device I want to individually select
   a communication speed from a set of predefined speeds.

2. How can I disable the row highlighting in the list created using GtkTreeView?

3. Is it possible to replace a standard toggle widget by something more
   good-looking, for instance make with a standard radio button, but still have it
   act as a toggle?

Thanks a lot.
--
 \   / |   |
 (OvO) |  Michael Ivanov   |
 (^^^) |  Voice:   +7 (812) 328-1907   |
  \^/  |  E-mail:  [EMAIL PROTECTED]   |
  ^ ^  |   |

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



Re: gtk2 TextBuffer and emacs key bindings

2002-04-25 Thread Havoc Pennington


Tomasz Wegrzanowski <[EMAIL PROTECTED]> writes:
> How can I tell gtk2 to use emacs key bindings instead of windoze ones ?

Using gnome 2 there's a control panel to switch to emacs key theme.

You can also do gtk-key-theme=emacs or something like that in your
~/.gtkrc-2.0

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



Re: GLIB Hash Data

2002-04-25 Thread Ruben I Safir

Seems that worked


On 2002.04.25 14:31 "Campbell, Matthew A" wrote:
> > > 
> > > They need to be:
> > > 
> > > guint HashFunction (gconstpointer key);
> > > gboolean  HashCompare  (gconstpointer a, gconstpointer b);
> > Ahh
> > 
> > 
> > I was following the example in the book.  I see, but isn't gboolean
> > #DEFINED as an int?  There is no BOOL in C.
> 
> The more important thing is the difference between "gpointer" and
> "gconstpointer" in the parameters to your functions.
> 
> I had the same difficulty at first, until I re-examined the documentation
> very closely.  (I actually had to look it up three times before the subtle
> difference caught my eye.)
> 
> Hope this helps.
> 
-- 
__

Brooklyn Linux Solutions
__
http://www.mrbrklyn.com - Consulting
http://www.brooklynonline.com - For the love of Brooklyn
http://www.nylxs.com - Leadership Development in Free Software
http://www.nyfairuse.org - The foundation of Democracy
http://www2.mrbrklyn.com/resources - Unpublished Archive or stories and articles from 
around the net
http://www2.mrbrklyn.com/mp3/dr.mp3 - Imagine my surprise when I saw you...
http://www2.mrbrklyn.com/downtown.html - See the New Downtown Brooklyn

1-718-382-5752



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



RE: GLIB Hash Data

2002-04-25 Thread Campbell, Matthew A

> > 
> > They need to be:
> > 
> > guint HashFunction (gconstpointer key);
> > gboolean  HashCompare  (gconstpointer a, gconstpointer b);
> Ahh
> 
> 
> I was following the example in the book.  I see, but isn't gboolean
> #DEFINED as an int?  There is no BOOL in C.

The more important thing is the difference between "gpointer" and
"gconstpointer" in the parameters to your functions.

I had the same difficulty at first, until I re-examined the documentation
very closely.  (I actually had to look it up three times before the subtle
difference caught my eye.)

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



Re: GLIB Hash Data

2002-04-25 Thread Ruben I Safir


> 
> They need to be:
> 
> guint HashFunction (gconstpointer key);
> gboolean  HashCompare  (gconstpointer a, gconstpointer b);
Ahh


I was following the example in the book.  I see, but isn't gboolean
#DEFINED as an int?  There is no BOOL in C.



> 
> The reference material online is fairly complete, but it is not
> especially verbose. People such as myself actually *prefer* this, 


Yes


Once your more experienced with the dialect, short and sweet IS the way.
Unfortunately, I'm cutting my teeth and resurrecting my C skills at the
same time.  I'm groping a little.  I always hated the "I'm a Newbie with
Perl and I don't know what to do - posts".  Now I'm victemizing you with
them :)

Thanks for the patients.


> for UNIX for at least the last decade.
> 
> If you are using UNIX, type "man strdup", and you should find it. It
> fits in with strcpy(), strcmp(), etc., which un-coincidentally, is
> exactly where GLIB has placed it.
> 

Thanks



Reuvain ---

-- 
__

Brooklyn Linux Solutions
__
http://www.mrbrklyn.com - Consulting
http://www.brooklynonline.com - For the love of Brooklyn
http://www.nylxs.com - Leadership Development in Free Software
http://www.nyfairuse.org - The foundation of Democracy
http://www2.mrbrklyn.com/resources - Unpublished Archive or stories and articles from 
around the net
http://www2.mrbrklyn.com/mp3/dr.mp3 - Imagine my surprise when I saw you...
http://www2.mrbrklyn.com/downtown.html - See the New Downtown Brooklyn

1-718-382-5752



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



Re: GLIB Hash Data

2002-04-25 Thread Mark Mielke

On Thu, Apr 25, 2002 at 12:26:10PM -0400, Ruben I Safir wrote:
> > From the API reference:
> > g_strdup ()
> > gchar*  g_strdup(const gchar *str);
> > Duplicates a string. The returned string should be freed when no
> > longer needed.
> > str : the string to duplicate. 
> > Returns : a newly-allocated copy of str.  

> I would just have documented that it creates a newly allocated
> string which safely allocates memory to a new memory location in the
> returned char pointer.
> Why did you paste the documentation which is already on line?  

To show that it says exactly what you want it to say, just in a more
terse format.

> I have one more squestion.  When compiling I get this warning:
> warning: passing arg 1 of `g_hash_table_new' from incompatible pointer type
> from this line: hTable = g_hash_table_new(HashFunction, HashCompare);
> Should I cast the function pointers to some type?

>From the documentation:

GHashTable* g_hash_table_new(GHashFunc hash_func,
 GEqualFunc key_equal_func);
...
guint   (*GHashFunc)(gconstpointer key);
...
gboolean(*GEqualFunc)   (gconstpointer a,
 gconstpointer b);

It looks to me as your functions are defined as:

guint HashFunction (gpointer key);
gint  HashCompare  (gpointer a, gpointer b);

They need to be:

guint HashFunction (gconstpointer key);
gboolean  HashCompare  (gconstpointer a, gconstpointer b);

Something you should realize: Almost all technical documentation is
either written by techies, or written by technical writers that may
not understand what the techie actually wants to know. A compromise
always need to be made between too much information (i.e. annoying and
hard to use as 'reference material' for the knowledgable), and too
little information (people that are just getting started throwing
themselves into a project, and realizing they don't understand the
basics).

The reference material online is fairly complete, but it is not
especially verbose. People such as myself actually *prefer* this, as
the other details are usually incorrect, limit further implementation
changes, and take up a lot more room in the documents that could be
spent on other, more complicated subjects.

In this case, strdup() may not officially be ANSI (I'm surprised that
it might not be...), but it has been in most libc.a implementations
for UNIX for at least the last decade.

If you are using UNIX, type "man strdup", and you should find it. It
fits in with strcpy(), strcmp(), etc., which un-coincidentally, is
exactly where GLIB has placed it.

mark

-- 
[EMAIL PROTECTED][EMAIL PROTECTED][EMAIL PROTECTED] __
.  .  _  ._  . .   .__.  . ._. .__ .   . . .__  | Neighbourhood Coder
|\/| |_| |_| |/|_ |\/|  |  |_  |   |/  |_   | 
|  | | | | \ | \   |__ .  |  | .|. |__ |__ | \ |__  | Ottawa, Ontario, Canada

  One ring to rule them all, one ring to find them, one ring to bring them all
   and in the darkness bind them...

   http://mark.mielke.cc/

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



gtk2 TextBuffer and emacs key bindings

2002-04-25 Thread Tomasz Wegrzanowski

How can I tell gtk2 to use emacs key bindings instead of windoze ones ?
___
gtk-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-list



Re: GLIB Hash Data

2002-04-25 Thread Ruben I Safir

Hello

strdup is not in my copy of ANSI c, which is in the  KN King book,
C Programming, A Modern Approach.  I originally learned
C from this text about 6 years ago.  So I'm not familiar with strdup.

I would just have documented that it creates a newly allocated string which
safely allocates memory to a new memory location in the returned char pointer.

Why did you paste the documentation which is already on line?  

I have one more squestion.  When compiling I get this warning:

warning: passing arg 1 of `g_hash_table_new' from incompatible pointer type
from this line: hTable = g_hash_table_new(HashFunction, HashCompare);
Should I cast the function pointers to some type?

Ruben


On 2002.04.25 12:10 Mark Mielke wrote:
> On Thu, Apr 25, 2002 at 11:33:15AM -0400, Ruben I Safir wrote:
> > In regards to g_strdup, do I need to allocate the memory for the
> > returned string.  It's not clear in the documentation.  Or do I
> > still need to allocate the memory seperately
> 
> >From the API reference:
> 
> g_strdup ()
> gchar*  g_strdup(const gchar *str);
>  
> Duplicates a string. The returned string should be freed when no
> longer needed.
> 
> str : the string to duplicate. 
> Returns : a newly-allocated copy of str.  
> 
> "A newly-allocated copy of str."
> 
> I suppose it could have an entire paragraph that details how it happens
> to use g_new() and strcpy() underneath... but really...
> 
> Anybody who has ever used C before for any length of time, knows what
> strdup() is. One would assume that g_strdup() worked very similar to
> strdup()...
> 
> I suggest you read the documentation over once before beginning.
> 
> mark
> 
> -- 
> [EMAIL PROTECTED][EMAIL PROTECTED][EMAIL PROTECTED] __
> .  .  _  ._  . .   .__.  . ._. .__ .   . . .__  | Neighbourhood Coder
> |\/| |_| |_| |/|_ |\/|  |  |_  |   |/  |_   | 
> |  | | | | \ | \   |__ .  |  | .|. |__ |__ | \ |__  | Ottawa, Ontario, Canada
> 
>   One ring to rule them all, one ring to find them, one ring to bring them all
>and in the darkness bind them...
> 
>http://mark.mielke.cc/
> 
-- 
__

Brooklyn Linux Solutions
__
http://www.mrbrklyn.com - Consulting
http://www.brooklynonline.com - For the love of Brooklyn
http://www.nylxs.com - Leadership Development in Free Software
http://www.nyfairuse.org - The foundation of Democracy
http://www2.mrbrklyn.com/resources - Unpublished Archive or stories and articles from 
around the net
http://www2.mrbrklyn.com/mp3/dr.mp3 - Imagine my surprise when I saw you...
http://www2.mrbrklyn.com/downtown.html - See the New Downtown Brooklyn

1-718-382-5752



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



glib String function suggestion

2002-04-25 Thread Campbell, Matthew A

This has nothing to do with GTK as such, but I can't find a more appropriate
place to post about glib.

Trying to hammer out some code using a bunch of GStrings, I ran across a
case where I wanted to concatenate them into a new GString, separated by a
delimiter - much like g_strjoin.  To my astonishment, this function did not
yet exist, so I hacked it up myself (okay, more cut and paste than true
hacking, but what the heck).  Here it is... I humbly recommend it to be
added to glib in future releases.  But then again, I'm just a lowly
neo-hacker, so what do I know?  ;)

/* g_string_join - concatenates zero or more GStrings 
   into a new GString, separated by an optional separator */
GString* g_string_join (const gchar *separator, ...) {
  GString *string, *s;
  va_list args;

  if (separator == NULL)
separator = "";

  string = g_string_new ("");

  va_start (args, separator);
  s = va_arg (args, GString*);
  if (s) {
g_string_append (string, s->str);
s = va_arg (args, GString*);
while (s) {
  g_string_append (string, separator);
  g_string_append (string, s->str);
  s = va_arg (args, GString*);
}
  }

  va_end (args);

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



Re: GLIB Hash Data

2002-04-25 Thread Mark Mielke

On Thu, Apr 25, 2002 at 11:33:15AM -0400, Ruben I Safir wrote:
> In regards to g_strdup, do I need to allocate the memory for the
> returned string.  It's not clear in the documentation.  Or do I
> still need to allocate the memory seperately

>From the API reference:

g_strdup ()
gchar*  g_strdup(const gchar *str);
 
Duplicates a string. The returned string should be freed when no
longer needed.

str : the string to duplicate. 
Returns : a newly-allocated copy of str.  

"A newly-allocated copy of str."

I suppose it could have an entire paragraph that details how it happens
to use g_new() and strcpy() underneath... but really...

Anybody who has ever used C before for any length of time, knows what
strdup() is. One would assume that g_strdup() worked very similar to
strdup()...

I suggest you read the documentation over once before beginning.

mark

-- 
[EMAIL PROTECTED][EMAIL PROTECTED][EMAIL PROTECTED] __
.  .  _  ._  . .   .__.  . ._. .__ .   . . .__  | Neighbourhood Coder
|\/| |_| |_| |/|_ |\/|  |  |_  |   |/  |_   | 
|  | | | | \ | \   |__ .  |  | .|. |__ |__ | \ |__  | Ottawa, Ontario, Canada

  One ring to rule them all, one ring to find them, one ring to bring them all
   and in the darkness bind them...

   http://mark.mielke.cc/

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



Re: GLIB Hash Data

2002-04-25 Thread Ruben I Safir

In regards to g_strdup, do I need to allocate the memory for the returned string.  
It's not
clear in the documentation.  Or do I still need to allocate the memory seperately

Ruben

On 2002.04.25 11:28 Ruben I Safir wrote:
> Thanks
> 
> Is it common practice to use GStrings in this circumstance?
> 
> 
> Ruben
> 
> On 2002.04.25 07:33 Sven Neumann wrote:
> > Hi,
> > 
> > Ruben I Safir <[EMAIL PROTECTED]> writes:
> > 
> > > The example is very simple.  Take in data from STDIN and use it for hash
> > > keys and values.  I have to create a new pointer every time to do this
> > > with the hash functions in glib.  The only way I can think of doing this is 
> > > with mallac.  The STDIN has to go into a defined buffer which will point
> > > to the same emmory location  every time.  Even strcpy would be useless
> > > in this case without mallocing new memory by hand every time.
> > 
> > that's why there's g_strdup() which does just that.
> > 
> > > IF it sees it's a char * it should just take in the data.
> > 
> > there is no way for glib to check if the pointer passed in is pointing
> > to a character array. Even if there would be a way, how is it supposed
> > to know if it needs to copy the string or if you are using static
> > strings?
> > 
> > 
> > Salut, Sven
> > 
> -- 
> __
> 
> Brooklyn Linux Solutions
> __
> http://www.mrbrklyn.com - Consulting
> http://www.brooklynonline.com - For the love of Brooklyn
> http://www.nylxs.com - Leadership Development in Free Software
> http://www.nyfairuse.org - The foundation of Democracy
> http://www2.mrbrklyn.com/resources - Unpublished Archive or stories and articles 
>from around the net
> http://www2.mrbrklyn.com/mp3/dr.mp3 - Imagine my surprise when I saw you...
> http://www2.mrbrklyn.com/downtown.html - See the New Downtown Brooklyn
> 
> 1-718-382-5752
> 
> 
> 
-- 
__

Brooklyn Linux Solutions
__
http://www.mrbrklyn.com - Consulting
http://www.brooklynonline.com - For the love of Brooklyn
http://www.nylxs.com - Leadership Development in Free Software
http://www.nyfairuse.org - The foundation of Democracy
http://www2.mrbrklyn.com/resources - Unpublished Archive or stories and articles from 
around the net
http://www2.mrbrklyn.com/mp3/dr.mp3 - Imagine my surprise when I saw you...
http://www2.mrbrklyn.com/downtown.html - See the New Downtown Brooklyn

1-718-382-5752



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



Re: GLIB Hash Data

2002-04-25 Thread Ruben I Safir

Thanks

Is it common practice to use GStrings in this circumstance?


Ruben

On 2002.04.25 07:33 Sven Neumann wrote:
> Hi,
> 
> Ruben I Safir <[EMAIL PROTECTED]> writes:
> 
> > The example is very simple.  Take in data from STDIN and use it for hash
> > keys and values.  I have to create a new pointer every time to do this
> > with the hash functions in glib.  The only way I can think of doing this is 
> > with mallac.  The STDIN has to go into a defined buffer which will point
> > to the same emmory location  every time.  Even strcpy would be useless
> > in this case without mallocing new memory by hand every time.
> 
> that's why there's g_strdup() which does just that.
> 
> > IF it sees it's a char * it should just take in the data.
> 
> there is no way for glib to check if the pointer passed in is pointing
> to a character array. Even if there would be a way, how is it supposed
> to know if it needs to copy the string or if you are using static
> strings?
> 
> 
> Salut, Sven
> 
-- 
__

Brooklyn Linux Solutions
__
http://www.mrbrklyn.com - Consulting
http://www.brooklynonline.com - For the love of Brooklyn
http://www.nylxs.com - Leadership Development in Free Software
http://www.nyfairuse.org - The foundation of Democracy
http://www2.mrbrklyn.com/resources - Unpublished Archive or stories and articles from 
around the net
http://www2.mrbrklyn.com/mp3/dr.mp3 - Imagine my surprise when I saw you...
http://www2.mrbrklyn.com/downtown.html - See the New Downtown Brooklyn

1-718-382-5752



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



Re: Declaring objects on the stack

2002-04-25 Thread Havoc Pennington


Marc Tardif <[EMAIL PROTECTED]> writes:
> Is there a way to declare a GString object on the stack and then pass a 
> reference to that object to an initialization method? For example:
> 
> GString str, *ptr;
> ptr = g_string_assign(&str, "foo");
> 
> Of course, I realize that the above is not valid because g_string_assign 
> expects cooked values in &str whereas values declared on the stack are likely 
> to contain garbage. So is there some other method which has the purpose of 
> initializing &str without allocating memory for the object on the heap?
> 

Nope. The actual size of a GString exceeds sizeof(GString), look at
gstring.c implementation code.

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



Re: Problem with compile.

2002-04-25 Thread Sven Neumann

Hi,

Wyatt Greenway <[EMAIL PROTECTED]> writes:

> Hello, I have a problem when I try to compile! I type
> this
> gcc -o3 -o gtk01 gtk01.c `pkg-config --libs --cflags
> gtk+-2.0`
> then it says
> Undifined reference to g_signal_connect
> Help please!!!
> I also typed this
> pkg-config --modversion gtk+-2.0
> and it said
> 1.3.2

it's about time to upgrade. The current version is 2.0.2 while 1.3.2
is an unstable development version that is about a year old.


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



Re: GLIB Hash Data

2002-04-25 Thread Sven Neumann

Hi,

Ruben I Safir <[EMAIL PROTECTED]> writes:

> The example is very simple.  Take in data from STDIN and use it for hash
> keys and values.  I have to create a new pointer every time to do this
> with the hash functions in glib.  The only way I can think of doing this is 
> with mallac.  The STDIN has to go into a defined buffer which will point
> to the same emmory location  every time.  Even strcpy would be useless
> in this case without mallocing new memory by hand every time.

that's why there's g_strdup() which does just that.

> IF it sees it's a char * it should just take in the data.

there is no way for glib to check if the pointer passed in is pointing
to a character array. Even if there would be a way, how is it supposed
to know if it needs to copy the string or if you are using static
strings?


Salut, Sven

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



Re: GLIB Hash Data

2002-04-25 Thread John . Cupitt

I'm afraid Mark is right: you need to g_strdup() your keys and values 
before you put them in the hash. It's the downside of C ... you have to 
do the storage management.

John

Ruben I Safir wrote:
>>Your example is useless.
> 
> 
> The example is very simple.  Take in data from STDIN and use it for hash
> keys and values.  I have to create a new pointer every time to do this
> with the hash functions in glib.  The only way I can think of doing this
is 
> with mallac.  The STDIN has to go into a defined buffer which will point
> to the same emmory location  every time.  Even strcpy would be useless
> in this case without mallocing new memory by hand every time.
> 
> IF it sees it's a char * it should just take in the data.
> 
> Ruben
> 
> 
> 
> GLIB is doing exactly what you asked it to.
> 
>>GLIB cannot possibly know, and would not want to know, the nature of
>>your data. You give it a pointer. How does it know the length of the
>>pointer? How does it know you are not passing it a structure, and
>>intend to have it copy the structure recursively?
>>
>>If you need it to do strcpy(), pass the key and value through g_strdup()
>>before storing.
>>
>>mark
>>
>>
>>On Wed, Apr 24, 2002 at 06:28:22PM -0400, Ruben I Safir wrote:
>>
>>>I'm wondering how useful the hashing system can be ibn GLIB
>>>
>>>I tried this code, and it seems that instead of copying strings, it just
copies the pointer value
>>>resulting in making it impossible to look through input and assigning it
to key values, unless I'm
>>>doing something worng.   This is just about useless
>>>
>>>#include 
>>>#include 
>>>#include 
>>>
>>>GHashTable * hTable;
>>>
>>>guint HashFunction(gpointer key){
>>> char *sKey;
>>> guint giHashValue = 0;
>>> int nIndex;
>>> 
>>> sKey = key;
>>> if(key == NULL) return(0);
>>>
>>> for (nIndex = 0; nIndex < strlen(sKey); nIndex++){
>>> giHashValue = (giHashValue << 4) + (giHashValue ^(guint)
sKey[nIndex]);
>>> }
>>> return (giHashValue);
>>>}
>>>
>>>gint HashCompare( gpointer sName1, gpointer sName2){
>>> return (!strcmp((char *)sName1, (char *) sName2));
>>>}
>>>
>>>void print_hash(gpointer key, gpointer value, gpointer otherdata){
>>> g_print ("Key: %s ==> Value: %s\n", (gchar *) key, (gchar *) value);
>>>}
>>>
>>>int main(int argc, char *argv[]){
>>> gchar buff_key[255];
>>> gchar buff_val[255];
>>> hTable = g_hash_table_new(HashFunction, HashCompare);
>>> while(1){
>>> if(scanf("%255s", buff_key) < 1 ) break;
>>> if(scanf("%255s", buff_val)< 1) break;
>>> g_print("%s %s\n", buff_key, buff_val);
>>> 
>>> g_hash_table_insert(hTable, buff_key, buff_val);
>>> }
>>>
>>>
>>> g_hash_table_foreach(hTable, (GHFunc) print_hash, NULL);
>>>
>>>exit(1);
>>>}
>>>
>>>
>>>ruben@www2:~/gtk > ./hash
>>>One
>>>Two
>>>One Two
>>>Three
>>>Four
>>>Three Four
>>>Five
>>>Six
>>>Five Six
>>>
>>>Key: Five ==> Value: Six
>>>Key: Five ==> Value: Six
>>>Key: Five ==> Value: Six
>>>
>>>
>>>If it doesn't work like strcpy, it doesn't do much.



== 
Aelbert Cuyp 13 February - 12 May 2002 

For information and tickets: 
http://www.nationalgallery.org.uk/exhibitions/cuyp/
___
gtk-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-list



Re: Performance issues using gdk_draw_rgb_image

2002-04-25 Thread John . Cupitt

David J. Singer wrote:
> I'm writing an application under Linux that generates realtime audio and
uses
> GTK as the GUI.  I've been using "gdk_draw_rgb_image" to update the
interface
> components onto a backing pixmap, then copy the whole lot to a drawing
area
> at regular intervals.  The graphics stored in memory are all 24bpp, loaded

> from PNG files.
> 
> All has been well until recently I changed my X session from 16bpp to
24bpp 
> and now the whole application seems to be struggling; there are noticable 
> breakups in the audio.  
> 
> Is there a real performance issue with gdk_draw_rgb_image?  Is there a
faster
> way to do it?  And why does changing from 16bpp to 24bpp screw everything
> up so much...?

Hi, gdk_draw_rgb_image() is about as quick as you can get with X. It 
does all the obvious speed tricks (shared memory access to the server, 
etc.). Try running testrgb in the 16 and 24bpp modes ... it prints a 
pixels per second figure. You'll at least be able to see how much slower 
24bpp is.

I can think of a couple of reasons why 24bpp could be slower. First, 
your card is may not really be 24 bits: a lot are are 32-bit. 
gdk_draw_rgb_image() will therefore be building temp images twice the 
size of the old 16bpp ones, so there could be a x2 slowdown there.

Second, your X server may not have hardware accel available at higher 
bit depths, either because of the hardware on the card, or because of 
the driver. If you see more than a x2 slowdown moving to 24bpp in 
testrgb this is probably the problem. You need a new card, or a new 
driver (or maybe the next Xfree version :-)

You could try to get a speed up by going to a lower level. For example, 
if your card is 32bpp, you can unpack your PNGs to 32bpp once and do the 
GdkImage painting yourself. Alternatively, you could just do less 
painting: if you want your app to be useful on a range of machines, it's 
probably a good idea for it to have a mechanism to drop the framerate if 
there's not enough horsepower available.

> As an aside, I've noticed there are also problems when I swap down to 8bpp

> mode I have problems displaying the colours correctly.  I thought this
might 
> be a dithering issue, but I've tried GDK_RGB_DITHER_MAX and 
> GDK_RGB_DITHER_NONE and both seem to have the same effect.

Not sure here. Have you tried playing with gdk_rgb_set_min_colors()?

John



== 
Aelbert Cuyp 13 February - 12 May 2002 

For information and tickets: 
http://www.nationalgallery.org.uk/exhibitions/cuyp/
___
gtk-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-list