Re: Question on gtk_label_set_selectable

2007-10-19 Thread Yeti
On Fri, Oct 19, 2007 at 03:06:55PM +0200, Gian Mario Tagliaretti wrote:
 
 You can also set the can-focus property to FALSE on the label which
 will be still selectable.

Not exactly.  It will be only selectable *with mouse*.

Yeti

--
http://gwyddion.net/
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Question on gtk_label_set_selectable

2007-10-19 Thread Yeti
On Fri, Oct 19, 2007 at 07:44:19PM +0800, Gregory Hosler wrote:
 Gregory Hosler wrote:
  Hi all,
  
  I have labels, which I wish to allow the user to select the text for the 
  purpose
  of cut/pasting. So I set
  
  gtk_label_set_selectable (GTK_LABEL (dlabel), 1)
  
  on the label.
  
  The problem I have now is that when the label is created, not only is the 
  text
  selectable, but it is also SELECTED as an initial state. I would prefer for 
  the
  text to be selectable, BUT NOT selected (at least as a default state).
  
  How might I turn off selected ?
  
  any tips ?
 
 After some exploring, and looking at the gtk samples, I have an answer.
 I'm not happy with it. It seems (to me) like there is a bug, so let me
 explain what works, and what doesn't work.
 
 If I have a window (dwindow), and then create a label as follows:
 
 dlabel=gtk_label_new();
 gtk_label_set_text(GTK_LABEL(dlabel), my text);
 gtk_label_set_line_wrap(GTK_LABEL(dlabel),1);
 gtk_label_set_selectable (GTK_LABEL (dlabel), 1);
 
 Then attach my label to the window and then:
 
 gtk_widget_show_all(dwindow);
 
 My label will show up, as selectable, BUT the label text will be
 initially selected.
 
 If I change the above sequence to this:
 
 dlabel=gtk_label_new();
 gtk_label_set_text(GTK_LABEL(dlabel), my text);
 gtk_label_set_line_wrap(GTK_LABEL(dlabel),1);
 
 Then attach my label to the window and then:
 
 gtk_widget_show_all(dwindow);
 gtk_label_set_selectable (GTK_LABEL (dlabel), 1);
 
 i.e. setting the selectable attribute AFTER the label is realized,
 created, etc. *then* the label text will NOT be selected (but it is
 still selectable).
 
 I do not understand why in one case the initial state of the text is
 selected and in the 2nd case it is NOT selected.
 
 Is this a bug? Or is there a reason this is like this?
 
 thoughts ?

I have not seen the code, but...

Your label the first widget in the window that accepts focus
(selectable labels can receive focus, unlike normal labels).
Therefore the label will get focus, which selects its text
-- at least this seems to be the default behaviour.

If you add the label after it's decided which widget should
receive focus, the label does not get focus and therefore
its text is not selected.

Yeti

--
http://gwyddion.net/
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: ld error multiple definitions

2007-10-13 Thread Yeti
On Sat, Oct 13, 2007 at 11:50:17AM +0200, Joël Krähemann wrote:
 hello I get strange errors like
 
 /home/link/ags/file/ags_file.o: In function `ags_file_class_init':
 /home/link/ags/file/ags_file.c:32: multiple definition of 
 `ags_file_class_init'
 /home/link/ags/file/ags_file.o:/home/link/ags/file/ags_file.c:32:
 first defined here

If you get definitions from the very same file and line
clashing, you are trying to link this file twice -- one way
or another.  Also, I wonder why ags_file_class_init() is
exported; it should be static.

Yeti

--
http://gwyddion.net/
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: How to disable reading of ~/.config/gtk-2.0 ?

2007-10-12 Thread Yeti
On Fri, Oct 12, 2007 at 11:40:38AM +0200, Geoff Bache wrote:
 Ed Mansur wrote:
  It's an internal implementation detail, so your documentation is the
  source - look at gtk/gtkfilechoosersettings.c.
 Is there another way users are supposed to edit it then?

It remembers the setup of the chooser to reproduce it the
next time a file chooser is invoked.  There's no point
editing the file, it will be overwritten the next time you
use the file chooser.

Yeti

--
http://gwyddion.net/
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: Multi dim array

2007-10-12 Thread Yeti
On Fri, Oct 12, 2007 at 08:55:54PM +0200, [EMAIL PROTECTED] wrote:
 [EMAIL PROTECTED] a écrit :
  Paul Davis a écrit :
  On Fri, 2007-10-12 at 20:26 +0200, [EMAIL PROTECTED] wrote:
  hello,
 
  Is possible to make static or dynamic multi dim array with glib ?
 
  this is a basic C programming question. why are you asking about glib?
 
 Question is about to make multi dim array with glib not with libc, maybe with 
 GArray, GPtrArray, GByteArray or something else, ...

You can make a GArray of GArrays or use a G[foo]Array
with suitable indexing as the storage base for
a multidimensional array.

But why?

Since your original question mentions static arrays, some
misunderstanding is going on here.  Essentially the only
added value of G[foo]Array is that it can automatically grow
on request -- and you pay a high price for that: type safety
(with the exception of GByteArray).  Static GArrays do not
make any sense at all, multidimensional or not, because they
cannot grow.

The wildly varying behaviours people might want from
automatically growing multidimensional arrays is probably
one of the reasons why GLib implements no such thing.

Yeti

--
http://gwyddion.net/
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: GtkPageSetupUnixDialog and GtkPrintUnixDialog

2007-10-09 Thread Yeti
On Tue, Oct 09, 2007 at 10:26:30AM -0700, Lance Dillon wrote:
 GtkPageSetupUnixDialog and GtkPrintUnixDialog don't exist on my system, even 
 though it seems that they should.

They do.

 Fedora 7
 gtk2-2.10.14-3.fc7
 gtk2-devel-2.10.14-3.fc7

  rpm -q gtk2-devel | grep unix

should clarify things a lot...

 ...

 So, is something wrong with my system?  With the packages provided by Fedora? 
  Or is the documentation incorrect?

The Gtk+ Unix printing stuff is in gtk+-unix-print-2.0
pkg-config package.  If you really need to use the
non-portable Unix part of the API, you have to add flags
from this package.

Yeti

--
http://gwyddion.net/
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: calling functions defined in gtk's source file

2007-10-07 Thread Yeti
On Sun, Oct 07, 2007 at 03:15:57PM +0200, Joël Krähemann wrote:
 hello I want to call in my application functions like gtk_window_show,
 gtk_widget_real_show and others

You cannot.  These are private Gtk+ functions (you should
have noticed they are delcared as static and therefore
visible ony to the source file that contains them).  They do
not belong to the public API and they can disappear, be
renamed or change the arguments and return values any time

Well, those implementing a virtual method cannot really
change arguments, but if they implement a virtual method,
then you should invoke the virtual method, NOT the function
implementing it.

 the c file
 
 void
 ags_window_class_init(AgsWindow *window)
 {
   GtkWidgetClass *widget = (GtkWidgetClass *) window;
 
   widget-show = ags_window_show;
 }
 
 void
 ags_window_show(GtkWidget *widget)
 {
   gtk_window_show(widget);
 }

And if you want to call the parent's virtual method in
a subclass, do precisely that.  How do you know the nearest
parent that actually implements the method?  In most cases
you cannot.  It can even change from version to version.

That's why you can find this idiom common in the Gtk+ code:

  if (GTK_WIDGET_CLASS(args_window_parent_class)-show)
  GTK_WIDGET_CLASS(args_window_parent_class)-show(widget);

where args_window_parent_class is defined automatically if
you use the G_DEFINE_TYPE template macros.

If you are 100% sure the parent class always has implemented
and always will implement the virtual function, you can omit
the if-clause and just call the method.

Yeti

--
http://gwyddion.net/
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: pkg-config availability

2007-10-03 Thread Yeti
On Tue, Oct 02, 2007 at 04:10:13PM +0200, Willem Ferguson wrote:
 Dunno where to find pkg-config in order to install GTK+. The 
 dependencies folder in the GTK FTP site does not exist. Can anyone help, 
 by any chance?

Google, for instance?

  http://google.com/search?q=pkg-configbtnI

Yeti

--
http://gwyddion.net/
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: Switch contents in the same window

2007-10-01 Thread Yeti
On Mon, Oct 01, 2007 at 10:54:32AM +0200, [EMAIL PROTECTED] wrote:
 Sorry Yeti, but it's not what I'm searching for: I cannot implement 
 GtkAssistant
 because I'm working on GTK+ 2.6 on an embedded system...

You can still look at GtkAssistant source code as an example
implementation (although perhaps a bit too complex for your
needs).

Yeti

--
http://gwyddion.net/
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: pixbuf color count

2007-10-01 Thread Yeti
On Mon, Oct 01, 2007 at 10:49:06AM -0600, Kevin DeKorte wrote:
 Is there a way to get the number of unique colors in that pixbuf.

gdk-pixbuf is not a full-fledged image manipulation library,
it provides just a few basic functions related to loading,
saving and on-screen rendering.  So you have to either use
an image manipulation library or count the distinct colours
yourself.

Yeti

--
http://gwyddion.net/
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Spontaneous background colors in treeview

2007-09-30 Thread Yeti
On Sun, Sep 30, 2007 at 11:08:05AM -0600, Jeffrey Barish wrote:
 After making some changes to my program (not directly related to the GUI), I
 find that one treeview has a background of alternating light and dark
 bands, but only for certain data sets.  I never set the background in my
 code, so I expect it to be white for every data set.  The program has this
 behavior only under Ubuntu.  On another platform, I do get a white
 background for all data sets (with the same code).  Does anyone have a clue
 what might be causing this bizarre behavior?

Can it be

http://library.gnome.org/devel/gtk/stable/GtkTreeView.html#GtkTreeView--rules-hint
http://library.gnome.org/devel/gtk/stable/GtkTreeView.html#GtkTreeView--allow-rules

?

The alternating colors are controlled by the theme then.

Yeti

--
http://gwyddion.net/
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: How to get all the key press event in a textview?

2007-09-28 Thread Yeti
On Fri, Sep 28, 2007 at 05:40:56PM +0800, Magicloud Magiclouds wrote:
  As in Emacs, something like Ctrl+Alt+a work, even in a gnome-terminal.

How is Emacs related to this?

  But in my simple gtk program,

What program?

  I just get ctrl+65507(keyval) in key release event.

This is the release of Ctrl (when Alt is no longer pressed).
If you release Alt before Ctrl, you should get this event.
If you release Ctrl first, the Alt flag will be set too in
the Ctrl-release event because Alt is still held.

Do you mean this is the *only* key release event you receive?

  How to make it work? Thanks.

In *my* simple Gtk+ program, it works normally.  Pressing
Ctrl, pressing Alt, pressing l (Ctrl-Alt-a is taken by my
window manager), releasing l, releasing Alt, releasing Ctrl
prints:

press: keyval=ffe3 state=0x
press: keyval=ffe9 state=0x0004
press: keyval=006c state=0x000c
release: keyval=006c state=0x000c
release: keyval=ffe9 state=0x000c
release: keyval=ffe3 state=0x0004

This is what xev prints, too.  Of course, since the modifier
state is the state when the event occurred, you can get
various combinations of states in the l-release event
depending on the order of key releases.   But in all cases
user's actions are faithfully reprorted.

Yeti

--
http://gwyddion.net/


=
#include gtk/gtk.h

static gboolean
key_event(G_GNUC_UNUSED GtkWidget *widget,
  GdkEventKey *event)
{
g_printerr(%s: keyval=%04x state=0x%04x\n,
   event-type == GDK_KEY_PRESS ? press : release,
   event-keyval, event-state);
return FALSE;
}

int
main(int argc, char *argv[])
{
GtkWidget *window, *view;

gtk_init(argc, argv);
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_default_size(GTK_WINDOW(window), 320, 240);
g_signal_connect(window, destroy, G_CALLBACK(gtk_main_quit), NULL);

view = gtk_text_view_new();
g_signal_connect(view, key-press-event, G_CALLBACK(key_event), NULL);
g_signal_connect(view, key-release-event, G_CALLBACK(key_event), NULL);
gtk_container_add(GTK_CONTAINER(window), view);

gtk_widget_show_all(window);
gtk_main();

return 0;
}

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: 16 bits grayscale images

2007-09-27 Thread Yeti

On Thu, Sep 27, 2007 at 04:45:10PM +0200, alex wrote:
 I want to create a grayscale image from a CCD camera.
 Data are from a function wich gives me an 16 bits array corresponding to
 the CCD's pixels.
 I take a look at the pixbuf class, but it seems to use a RGB structure.
 How can I do my job ?

If you don't expect the graphics system to be actually
capable of displaying 16bpc images, it is easiest to just
convert the data to 8bpp RGB (which is a trivial operation).

Yeti

--
http://gwyddion.net/
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Pango error while executing gtk-demo

2007-09-27 Thread Yeti

Please don't cross-post.

On Thu, Sep 27, 2007 at 04:55:44PM +0530, Prashant J Zaveri wrote:
 I have cross-compiled Xfbdev for ARM9 core and running it on a
 board powered by Freescale's i.MX21 processor running on Kernel
 Vanilla 2.6.22 with a few board-specific patches.
 
 I am able to run sample X program using matchbox-window-manager on it.
 
 I have also cross compiled Cairo 1.4.10, Pango 1.17.5,

Why an unstable version?

 Glib 2.14.0,
 Gtk 2.10.14 and ported on it.
 
 While executing gtk-demo program on board, It gives  me following error :
 
 Pango-ERROR **: file pangocairo-fontmap.c: line 101
 (pango_cairo_font_map_new): should not be reached aborting...
 
 What could be the reason for this ?

The relevant code is

  PangoFontMap *
  pango_cairo_font_map_new (void)
  {
/* Make sure that the type system is initialized */
g_type_init ();

  #if defined(HAVE_CAIRO_ATSUI)
return g_object_new (PANGO_TYPE_CAIRO_ATSUI_FONT_MAP, NULL);
  #elif defined(HAVE_CAIRO_WIN32)
return g_object_new (PANGO_TYPE_CAIRO_WIN32_FONT_MAP, NULL);
  #elif defined(HAVE_CAIRO_FREETYPE)
return g_object_new (PANGO_TYPE_CAIRO_FC_FONT_MAP, NULL);
  #else
g_assert_not_reached ();
return NULL;
  #endif
  }

which means you do not have any of the font backends
compiled in.

Yeti

--
http://gwyddion.net/
___
gtk-i18n-list mailing list
gtk-i18n-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-i18n-list


Re: 16 bits grayscale images

2007-09-27 Thread Yeti

On Thu, Sep 27, 2007 at 04:45:10PM +0200, alex wrote:
 I want to create a grayscale image from a CCD camera.
 Data are from a function wich gives me an 16 bits array corresponding to
 the CCD's pixels.
 I take a look at the pixbuf class, but it seems to use a RGB structure.
 How can I do my job ?

If you don't expect the graphics system to be actually
capable of displaying 16bpc images, it is easiest to just
convert the data to 8bpp RGB (which is a trivial operation).

Yeti

--
http://gwyddion.net/
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: 16 bits grayscale images

2007-09-27 Thread Yeti
On Thu, Sep 27, 2007 at 09:44:11AM -0700, Sergei Steshenko wrote:
 
 Exactly my point.
 
 First processing with/at full accuracy, then display at whatever accuracy the 
 display
 device allows.

I was talking about converting for display -- the idea of
destroying the valuable original data is so silly that it
can be probably mentioned only when one attempts to attibute
it to someone else.  I agree anything can be made as
complicated as one wishes though (since we all know ICC
profiles of our monitors).  The point that you should
perform the conversion holds.

Yeti

--
http://gwyddion.net/
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: releasing 1.9 soon...

2007-09-26 Thread Yeti
On Wed, Sep 26, 2007 at 11:15:32PM +0300, Stefan Kost wrote:
 I am giving up for tonight. jhbuild gives me a bunch of those:
 
   echo '-- Installing ./html/index.sgml' ; \
   /home/ensonic/bin/install-check -m 644 ./html/index.sgml
 /opt/gnome-svn/share/gtk-doc/html/gconf || :; \
 fi
 -- Nothing to install
 gtkdoc-rebase --relative --destdir=
 --html-dir=/opt/gnome-svn/share/gtk-doc/html/gconf
 Unknown option: destdir
 Use of uninitialized value in substitution (s///) at
 /opt/gnome-svn/bin/gtkdoc-rebase line 211.
 Use of uninitialized value in substitution (s///) at
 /opt/gnome-svn/bin/gtkdoc-rebase line 211.
 Can't open HTML directory /opt/gnome-svn/share/gtk-doc/html/gconf/: File or
 Directory not found at /opt/gnome-svn/bin/gtkdoc-rebase line 227.
 make[3]: [install-data-local] Fehler 2 (ignored)
 
 basic problem is that the perl option parse does not like
  --destdir= --next-option
 which is caused by empty DESTDIR. Before I add more crack to the rules, I go 
 for
 a sleep. Suggestions are welcome :)

1) --destdir='$(DESTDIR)' or --destdir=$(DESTDIR).
But then we have the SCAN_OPTIONS situation again if someone
quotes DESTDIR.  Incidentally, I see

  if test x$(DESTDIR) = x; then \

in the makefile, which suffers from the same problem.

And if it was there when you were performing the builds,
then I have no idea what's going on.

2) Use

  Getopt::Long qw(:config gnu_getopt);

to make Getopt::Long fully GNU getopt_long() compatible.  Or
at least :config gnu_compat to change the behaviour of empty
--opt=.

Note however, according to my Getopt::Long man page empty
--opt is either GNU compatible or gives an error.  So in no
case it should eat the next option; something strange is
going on here.

3) Change $DESTDIR style from option to an argument and run
it just

  gtkdoc-rebase OPTIONS... $DESTDIR

Although rebase has no non-option arguments so this would
work, it's quite ugly and I don't like it.

4) Change the ($DESTDIR, $DESTDIR$TARGET_DIR) pair of
directories to ($TARGET_DIR, $DESTDIR$TARGET_DIR), that are
always defined, and let rebase extract $DESTDIR.

Not very nice either.  Passing two competely unrelated
directories as --html-dir and --dest-dir is a bit weird,
nevertheless it makes some sense with --relative (I have
a staging area, but in a different place I'm installing this
particular documentation).  In the new pair one directory
would have to be the tail of another.

-

The only approach that could get my is 2), the rest is just
a dump of random ideas.

I don't know what is the cause of the Getopt::Long behaviour
in jhbuild though.

Yeti

--
http://gwyddion.net/
___
gtk-doc-list mailing list
gtk-doc-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-doc-list


Re: Updating (showing) the widgets of a dialog in a g_thread

2007-09-23 Thread Yeti
On Sat, Sep 22, 2007 at 10:49:56PM -0400, Andrew Smith wrote:
 I have the following setup:
 
 gpointer thread1(gpointer data)
 {
  run_long_function();
  return NULL;
 }
 
 gpointer thread2(gpointer data)
 {
  GtkWidget* dialog;
 
  gdk_threads_enter();
  dialog = gtk_message_dialog_new(GTK_WINDOW(win_main),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_INFO, GTK_BUTTONS_CLOSE, asd);
  gtk_window_set_modal(GTK_WINDOW(dialog), TRUE);
  gtk_widget_show(dialog);
  gdk_threads_leave();
 
  while (thread1 is running)
  {
  gdk_threads_enter();
  //!! I want to make sure the dialog is shown
  // the following does not help
  while (gtk_events_pending())
  gtk_main_iteration();
  gdk_threads_leave();
 
  usleep(50);
  }
 
  gdk_threads_enter();
  gtk_widget_destroy(dialog);
  gdk_threads_leave();
 
  return NULL;
 }

Scratch all this.

Access the GUI only from the thread running gtk_main() (AKA
main thread).

Never manually serialize Gtk+ main loop iterations with
gtk_main_iteration() (you are writing a *multithreaded*
program, remember).

NEVER do things like

usleep(50);

in the main thread.

Just construct and show the dialog and let the Gtk+ main
loop run normally (by quitting the function that constructs
it).

Add

g_idle_add(long_function_finished, whatever);

to the end of the thread running long_function():
long_function_finished() will be executed in the main loop,
i.e. the main thread.

No locks, no obscure constructs, works on Win32 too.

Yeti

--
http://gwyddion.net/
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: releasing 1.9 soon...

2007-09-23 Thread Yeti
On Sun, Sep 23, 2007 at 02:41:00PM +0300, Stefan Kost wrote:
 
 Well then our understanding differs here. If a bug is closed as a reporter I
 would like to know which release will have the fix. In the case of libraries I
 could e.g. add a configure check for that version and disable a workaround if
 the user has a recent enough version.

This is not about understanding, this is about misuse.
However worthy your goal might be, misuse of bugzilla fields
should not be the solution.

  The list is incomplete anyway.  What about 322035, 383456,
  445596, 450338, 465365, 466559?
  
  If you want to know bugs fixed since the last gtk-doc
  release, just ask bugzilla for it.
 
 Exactly, therefore I use the field.

And my list is an illustration it does not work[*].  These
bugs were fixed by 1.9 byt they are not marked with 1.9
target milestone -- yet I easily found them by asking
bugzilla.

Exporting both bug lists to CSV and running diff on them
would reveal the complete set of fixed bugs that cannot be
found by looking for target milestone 1.9.

[*] Of course, you can run the proper query and then use the
mass bug changer to add a milestone to each in the list --
but what's the point when you can use the query?

 How will the user then know that it actaully happend. Once we release 1.10 one
 has to make a query to bugzilla to get all open bug with that target milestone
 and either postpone the release or move that target-milestone to 1.11.

At the moment we release 1.10 there should be no open bugs
with target milestone 1.10.

I'm not sure who `one' is in your description -- target
milestone is a developers' tool to keep track of issues that
should/must be resolved in a particular version or time
frame.

*Before* we (developers) release 1.10 we should deal with
all issues with target milestone 1.10: either resolve them
or decide to postpone them and change the target milestone.

  Considering interesting error messages vary wildly (from perl
  complaints such as `Use of uninitialized value...' to various
  WARNINGs to xsltproc messages), how we find them in the
  flood?
 
 I am open to ideas here. Its more a sanity check that ensure that now build
 aborts etc.

If I knew how to find the start and end of documentation
build in the logs reliably, I'd just filter out everything
known to be harmless (Writing foo for refentry(bar)..., ID
recommended on..., gtk-doc: Running baz..., make:
Leaving/Entering directory ..., \-continued blocks that
looks like our commands, ...) and look at what remained.

Perhaps we can assume there is no interesting message before
`gtk-doc: Scanning header files' and that `touch
html-build.stamp' is the last thing printed, but it's not
exactly reliable.

Well, I don't even know how to get the actual logs from
build.gnome.org.  Moreover it seems most interestring builds
started failing on 16 September due to some infrastructure
change.

Yeti

--
http://gwyddion.net/
___
gtk-doc-list mailing list
gtk-doc-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-doc-list


Re: Requesting help with error in xml interface creation

2007-09-23 Thread Yeti
On Sat, Sep 22, 2007 at 11:43:00PM -0700, Pradeep Chimakurthy wrote:
 I rebuilt everything on a different machine and when i ran the
 debugger I could get a trace of the problem.
 
 Program received signal SIGSEGV, Segmentation fault.
 find_image_offset (cache=0x8ae1158, icon_name=0x5a8a3a gtk-ok,
 directory=0x5a1dfd 16) at gtkiconcache.c:224
 
 #0  find_image_offset (cache=0x8ae1158, icon_name=0x5a8a3a gtk-ok,
 directory=0x5a1dfd 16) at gtkiconcache.c:224
 #1  0x0044402a in _gtk_icon_cache_get_icon_flags (cache=0x8ae1158,
 icon_name=0x5a8a3a gtk-ok, directory=0x5a1dfd 16) at 
 gtkiconcache.c:269
 #2  0x0044ab66 in theme_dir_get_icon_suffix (dir=0x40199900,
 icon_name=0x5a8a3a gtk-ok, has_icon_file=0x0) at gtkicontheme.c:1885
 #3  0x0044ac0a in theme_lookup_icon (theme=0x8ae7438,
 icon_name=0x5a8a3a gtk-ok, size=20, allow_svg=0, use_builtin=4)
 at gtkicontheme.c:1948
 #4  0x00449f24 in gtk_icon_theme_lookup_icon (icon_theme=0x8ae7940,
 icon_name=0x5a8a3a gtk-ok, size=20, flags=GTK_ICON_LOOKUP_USE_BUILTIN)
 at gtkicontheme.c:1289
 #5  0x0044a191 in gtk_icon_theme_load_icon (icon_theme=0x8aab8a0,
 icon_name=0x5a8a3a gtk-ok, size=20, flags=GTK_ICON_LOOKUP_USE_BUILTIN,
 error=0xbfff5174) at gtkicontheme.c:1406
 #6  0x00446fb5 in render_icon_name_pixbuf (icon_source=0x8ae4c60,
 style=0x8ace450, direction=GTK_TEXT_DIR_LTR, state=GTK_STATE_NORMAL,
 size=GTK_ICON_SIZE_BUTTON, widget=0x8abc160, detail=0x0)
 at gtkiconfactory.c:1463
 
 
 I could not find any icons  in any of the installed directories. Is
 there anything i have to do after running make install to seperately
 copy the icons as I am cross compiling ? Also do I have to copy
 anything into the pixmaps directory.

Normally, the build process generates gtkbuiltincache.h
containing all the built-in icons -- and this is compiled
directly into Gtk+.  Hwoever, this is not possible when
cross-compiling (gtk-update-icon-cache cannot be run on the
build system), which I suspect is the source of your
problems.  I don't how to fix it though, I don't cross-compile
Gtk+.

Yeti

--
http://gwyddion.net/
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: emit keypress event into event loop

2007-09-22 Thread Yeti
On Fri, Sep 21, 2007 at 03:32:49PM -0100, vano wrote:
 
 Anybody has idea how to emit in GTK (2.11.6) some keypress event into
 main event loop?
 
 I have mouse clickable button and want to send to my text_view a
 keyboard press.
 
 I'm doing this way:
 
 in main code:
 
 g_signal_connect(G_OBJECT(my_button), button-press-event,
  G_CALLBACK(press_callback), G_OBJECT(textview));

Why on Earth you are connecting to button-press-event
instead of clicked of the button?  (And with a handler that
has the wrong prototype -- event signals have a boolean return
value.)

 in callback:
 
 static void press_callback( GtkWidget *widget,
 GdkEventButton *e, GtkWidget *text_view )
 {
 g_print(button press\n);
 
 GdkEvent *event;
 
 event = gdk_event_new(GDK_KEY_PRESS);
 
 event-key.keyval = GDK_K;
 event-key.window = gtk_text_view_get_window(text_view,
 GTK_TEXT_WINDOW_TEXT);
 event-key.time = 0;
 
 gtk_main_do_event(event);

If your compiler does not complain loudly on this line,
enable some warnings, it will save you lots of troubles.
(And if it does, read what is says before asking in the
list...)

You pass the wrong type to gtk_main_do_event() (one level of
pointerness too many).

 or if trying another approach with sending event directly to text_view
 widget:
 
 static void press_callback( GtkWidget *widget,
 GdkEventButton *e, GtkWidget *text_view )
 {
 g_print(button press\n);
 
 GdkEvent *event;
 
 event = gdk_event_new(GDK_KEY_PRESS);
 
 event-key.keyval = GDK_K;
 event-key.window = gtk_text_view_get_window(text_view,
 GTK_TEXT_WINDOW_TEXT);
 event-key.time = 0;
 
   g_signal_emit_by_name(GTK_TEXT_VIEW(text_view), key_press_event, 
 event);
 
 }
 
 the program seems go in correct way, but I get segmentation fault:

First, event signals cannot be sent this simple way as other
signals.

Anyway, event signals have boolean return value and you do
not pass any return location (see g_signal_emit_by_name()
documentation), therefore it overwrites some stuff on the
stack that follows the arguments.

Now something constructive: Synthetizing events is almost
always a bad idea.  At the end, you want the button to
behave normally (i.e. connect to clicked) and perform some
specific action: insert text, delete text, change text, ...
For all these things GtkTextView/Buffer have methods.  Use
them directly.

Yeti

--
http://gwyddion.net/
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: GdkPixbuf object from stock icons

2007-09-22 Thread Yeti
On Sat, Sep 22, 2007 at 03:17:51PM +0300, Zeeshan Ali wrote:
   I was looking for a non-hackish way of creating a GdkPixbuf object
 out of stock icon. The first thing that comes to mind is:
 
 --CODE SNIPPET BEGIN--
 
 image = gtk_image_new_from_stock (stock_id, size);
 pixbuf = gtk_image_get_pixbuf (image);
 
 --CODE SNIPPET END-
 
  However that doesn't work since the created image if of storage type
 GTK_IMAGE_STOCK and gtk_image_get_pixbuf() doesn't like that.

Yes, the image is not backed by a pixbuf therefore it cannot
return it (a GtkImage method to render the image to a pixbuf
whatever it is backed with could be perhaps written, but it
would be something different).

 Following is the only way i could come up with:
 
 --CODE SNIPPET BEGIN--
 
 image = gtk_image_new ();
 pixbuf = gtk_widget_render_icon (image, stock_id, size, NULL);
 
 --CODE SNIPPET END-
 
This one works quite fine but is obviously hackish, Does anyone
 know of any better way of doing the same?

Not so obviously.  The primary difficulty is that your
problem is ill-posed.  The stock icon look is affected by
theme, state and whatnot.  It can even differ for different
widgets.

So depending on your preferred amount of manual work you
have the choice of

  gtk_widget_render_icon()
  gtk_icon_set_render_icon()
  gtk_style_render_icon()

The most raw method is

  gtk_icon_theme_lookup_icon() +  gtk_icon_info_load_icon()

However, the icon will probably end up rendered on some
widget -- and then use gtk_widget_render_icon() for this
widget.

Yeti

--
http://gwyddion.net/
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: releasing 1.9 soon...

2007-09-22 Thread Yeti
On Sat, Sep 22, 2007 at 11:09:45PM +0300, Stefan Kost wrote:
 
 I hope now all patches have been applied. I also added a target milestone to 
 the
 bug we fixed in this cycle.

Please don't.  Bugzilla Target Milestone field is intended
for open bugs -- to track what to get done in a particular
version, timeframe, ...  Generally, it's a classification of
when in the future the issue is expected to be resolved.

(The stricter Gnome Target Milestone means that Gnome X.Y
cannot be released until all open bugs with X.Y milestone
are fixed.)

 This allow me to pull the buglist out of bugzilla
 fro the release notes - sorry for the resulting spam.

The list is incomplete anyway.  What about 322035, 383456,
445596, 450338, 465365, 466559?

If you want to know bugs fixed since the last gtk-doc
release, just ask bugzilla for it.

 I have also created 1.10
 target milestone, so please us that when closing bugs after the release.

While 1.10 target milestone is a good idea, I'm going to
mark bugs that should be fixed in 1.10 with it (e.g. the
postponed VPATH stuff) because this is what this flag means.

 Next I'll try to see if the build.gnome.org could run build with snv-trunk
 version of gtk-doc. If I have time I'll try a jhbuild of gnome-2.20 locally 
 too.

Considering interesting error messages vary wildly (from perl
complaints such as `Use of uninitialized value...' to various
WARNINGs to xsltproc messages), how we find them in the
flood?

Yeti

--
http://gwyddion.net/
___
gtk-doc-list mailing list
gtk-doc-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-doc-list


Re: start-editing signal?

2007-09-21 Thread Yeti
On Fri, Sep 21, 2007 at 03:11:12PM -0400, Allin Cottrell wrote:
 I'm trying to connect a callback to start-editing on a cell 
 renderer, but I must be doing something wrong.  My code is
 basically
 
 static void create_cell_renderer (gpointer p)
 {
 GtkCellRenderer *r;
 
 r = gtk_cell_renderer_text_new();
 
 g_object_set(r, ypad, 1, 
xalign, 1.0, 
mode, GTK_CELL_RENDERER_MODE_EDITABLE,
NULL);
 g_signal_connect(r, start-editing,
G_CALLBACK(cell_edit_start), p);
 }
 
 When this code is invoked, I'm getting
 
 GLib-GObject-WARNING **: gsignal.c:1669: signal `start-editing' is 
 invalid for instance `0x822a5f0'
 
 I've verified that 0x822a5f0 is indeed the return value from
 gtk_cell_renderer_text_new.
 
 Can anyone tell me how to make a valid hook-up?

Start with the correct signal name:

http://library.gnome.org/devel/gtk/stable/GtkCellRenderer.html#GtkCellRenderer-editing-started

Looking at the documentation should be first thing when you
get a GObject complaint about invalid signal/property name.

Yeti

--
http://gwyddion.net/
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: cross compilation of pango

2007-09-21 Thread Yeti
On Fri, Sep 21, 2007 at 01:26:13PM +0530, Shilpa Singh wrote:
 /usr/arm/bin/arm-linux-gcc -DHAVE_CONFIG_H -I. -I../.. 
 -DSYSCONFDIR=\/opt/gtkdfb-arm/etc\ -DLIBDIR=\/opt/gtkdfb-arm/lib\ 
 -DG_DISABLE_CAST_CHECKS -I../.. -g -O2 -Wall -MT fribidi.lo -MD -MP -MF 
 .deps/fribidi.Tpo -c fribidi.c  -fPIC -DPIC -o .libs/fribidi.o
 In file included from fribidi.h:31,
  from fribidi.c:28:
 fribidi_config.h:1:18: error: glib.h: No such file or directory

Obviously, GLib compiler flags are completely missing here
and therefore it cannot find glib.h. There must be
-I/path/to/glib/includes somehwere (actually two -Is, the
second to the arch-specific glibconfig.h, as pkg-config
normally prints them).  Without them it cannot work, so
whatever `In make file i have specified glib flags
correctly' means, they are not specified correctly.

Yeti

--
http://gwyddion.net/
___
gtk-i18n-list mailing list
gtk-i18n-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-i18n-list


Re: Abstract string properties with getter/setter functions

2007-09-19 Thread Yeti
On Wed, Sep 19, 2007 at 06:48:25PM +0200, Raffaele Sandrini wrote:
   Since we do not see a way around this (yet) and we could not find an
   example with strings in another project. I'm asking here if there is a
   nice way around this.
  
  i'm really not sure i understand your problem here...
 
 We need a way to steal the string from the property i.e. to make sure
 its not a copy of the original.

The property does not need to be actually backed by
a string.  It just has to accept a string in the setter and
produce a string -- a new string -- in the getter.  For
instance GtkCellRendererText has properties background
wich is a string (write-only though) and background-gdk
which is a GdkColor. They are views of same thing and
what is this actual internal representation is none of your
business.

To sum it up, you cannot steal something that is owned by
you from the begining.

Yeti

--
http://gwyddion.net/
___
gtk-devel-list mailing list
gtk-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-devel-list


Re: releasing 1.9 soon...

2007-09-19 Thread Yeti
On Wed, Sep 19, 2007 at 08:54:55PM +0300, Stefan Kost wrote:
 regarding gtkdoc-fixxref.pl should I just revert that patch:
 http://bugzilla.gnome.org/attachment.cgi?id=91852

It seems, I don't recall any related change that would have
to be reverted, the feature has never been actually used.

 Regarding your proposal below - sounds good. So this means we merely document
 that users can use DISTCLEANFILES in the userdocs and in the gtkdoc.mak. Can 
 you
 suppy a new patch?

Of course.

 Ich checked out the webpage and will start to prepare release notes.

IMO we should test build of documentation of Gnome 2.20
versions of everything at

  http://library.gnome.org/devel/references

before releasing a new gtk-doc.  People of course built
their API documentation, but not necessarily with what we
are going to release and not looking for the same kind of
issues we would.

Yeti

--
http://gwyddion.net/
Index: gtk-doc.make
===
--- gtk-doc.make(revision 493)
+++ gtk-doc.make(working copy)
@@ -165,6 +165,7 @@
cp $(srcdir)/html/* $(distdir)/html
cp $(srcdir)/$(DOC_MODULE).types $(distdir)/
cp $(srcdir)/$(DOC_MODULE)-sections.txt $(distdir)/
+   cd $(distdir)  rm -f $(DISTCLEANFILES)
-gtkdoc-rebase --online --relative --html-dir=$(distdir)/html
 
 .PHONY : dist-hook-local docs
Index: gtk-doc.notmpl.make
===
--- gtk-doc.notmpl.make (revision 493)
+++ gtk-doc.notmpl.make (working copy)
@@ -146,6 +146,7 @@
cp $(srcdir)/html/* $(distdir)/html
cp $(srcdir)/$(DOC_MODULE).types $(distdir)/
cp $(srcdir)/$(DOC_MODULE)-sections.txt $(distdir)/
+   cd $(distdir)  rm -f $(DISTCLEANFILES)
-gtkdoc-rebase --online --relative --html-dir=$(distdir)/html
 
 .PHONY : dist-hook-local docs
___
gtk-doc-list mailing list
gtk-doc-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-doc-list


Re: [gtk-list] problems during configuring before making gtk+ 2.10.14

2007-09-19 Thread Yeti
On Wed, Sep 19, 2007 at 01:59:49PM +0800, tkdchen wrote:
 Hi, everybody. A problem is boring me. I am going to install GTK+
 2.10.14 on FreeBSD 6.2. However, during the process of configure
 shell, I always get a message  WARNING: *** TIFF loader will not be
 built (TIFF library not found) ***
 , but I had exactly installed tiff 3.7.4 and another newer version.
 Why configure told me that?

The reason is in config.log.

Yeti

--
http://gwyddion.net/
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: [gtk-list] problems during configuring before making gtk+ 2.10.14

2007-09-19 Thread Yeti
On Wed, Sep 19, 2007 at 03:44:16PM +0800, tkdchen wrote:
 Following is a piece of config.log related to tiff error:
 
 configure:27935: result: no
 configure:28101: checking for TIFFWriteScanline in -ltiff
 configure:28136: gcc -o conftest -DG_DISABLE_DEPRECATED -g -O2 -Wall
 conftest.c -ltiff -ljpeg -lz -lm   5
 /usr/bin/ld: cannot find -ltiff
 
 What does the -ltiff mean? Sorry, I am a new guy to FreeBSD. Thanks!

-ltiff means find libtiff (.a or .so) and link with it.

If you say you have libtiff, it might be BSD search paths...
Try

  export LDFLAGS=-L/usr/local/lib
  export CFLAGS=-I/usr/local/include

(or the equivalent in your shell) and re-run configure.
I suppose you have libtiff installed from ports.  However,
it the Gtk+ 2.10.14 you are trying to install is also the
port, it should Just Work.  So where is your libtiff and
what exactly you are doing?

Yeti

--
http://gwyddion.net/
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: [gtk-list] problems during configuring before making gtk+ 2.10.14

2007-09-19 Thread Yeti
On Wed, Sep 19, 2007 at 04:16:45PM +0800, ?? wrote:
 maybe your system missing tiff.pc file,

I've yet to see a system that *has* a tiff.pc file.  Libtiff
does not install a .pc file therefore it would have to be
added by the packager.

 this file is in /usr/lib/pkgconfig
 directory,

Definitely not on FreeBSD.  Since everyone knows libtiff
does not install a .pc file, no one tests libtiff
availability with pkg-config...

 use 'pkg-config --cflags tiff' see what happen, if get error, try
 create a tiff.pc and place it in /usr/lib/pkgconfig,

...and even if someone perhaps tries to, Gtk+ does not, so
a tiff.pc would have no effect on Gtk+.  Creating it manually
would be a futile excercise.

Yeti

--
http://gwyddion.net/
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: Window with no maximize button

2007-09-17 Thread Yeti
On Mon, Sep 17, 2007 at 05:01:05PM +0530, aniket ray wrote:
 I wanted to create a Window with only the minimize and close decoration
 buttons (and no maximize button).
 
 The code of what I basically did was:
 windowPointer = gtk_window_new(GTK_WINDOW_TOPLEVEL);
 gtk_widget_realize(windowPointer);
 mainWindow = windowPointer-window;
 gdk_window_set_decorations(mainWindow, GDK_DECOR_BORDER | GDK_DECOR_RESIZEH
 | GDK_DECOR_TITLE | GDK_DECOR_MENU | GDK_DECOR_MINIMIZE); //everything but
 maximize
 gtk_widget_show(windowPointer);
 
 
 This does not seem to work as I still get the maximize button on the window.
 I am using an FC6, with default GNOME installation (and its Metacity WM).
 On the other hand, if I give a DIALOG hint to the window with
 gtk_window_set_type_hint(), I am able to remove the maximize and minimize
 buttons.
 Is there a difference in which the 2 methods send hints to the WM?

The DIALOG hint (_NET_WM_WINDOW_TYPE_DIALOG) is an
independent hit.  So it can influence the window manager
decisions independently.

Hints are just hints.  The window manager decides how to
decorate the windows.  Apparently, Metacity thinks it's
a good idea to remove the two buttons from dialogs.  Whatever.
My window manager always shows the buttons I told it and
only them.  Someone else's window manager never shows any
window frame at all.  You cannot rely on window managers
following the hints, some do not even have any meaning with
some window management styles.

Just set the hints logicaally, i.e. do not randomly choose
hints that happen to make your particular window manager
behave as you wish.

 How can I
 get this to work?

You cannot ultimately control the window decorations.  And
let me immediately add, it's a good thing.

Yeti

--
http://gwyddion.net/
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: releasing 1.9 soon...

2007-09-17 Thread Yeti
On Mon, Sep 17, 2007 at 04:47:39PM +0200, Stefan Kost wrote:
 allthough ugly, adding a gtkdoc-disthelper script that gets invoked on
 dist-hook:
   gtkdoc-disthelper $(SCAN_OPTIONS)
 distclean-local:
   gtkdoc-disthelper $(SCAN_OPTIONS)
 could help.

This does not work either, see for instance gtk-doc's own
test suite which sets the variable

  SCAN_OPTIONS=--deprecated-guards=GTKDOC_TESTER_DISABLE_DEPRECATED 21 | 
tee gtkdoc-scan.log

I.e., make distclean would create file gtk-scan.log.

Yeti

--
http://gwyddion.net/
___
gtk-doc-list mailing list
gtk-doc-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-doc-list


Re: Behaviour of getters wrt dup/ref

2007-09-16 Thread Yeti
On Sat, Sep 15, 2007 at 11:08:38PM -0400, Behdad Esfahbod wrote:
 On Fri, 2007-09-14 at 10:35 -0400, Alexander Larsson wrote:
  
  char *  g_data_input_stream_get_line (GDataInputStream *data_stream,
gsize *length,
GCancellable *cancellable,
GError   **error);
  
  This actually reads new data from the stream, so it has to dup. One
  could imagine a similar call that returns some form of object instead
  of a string. 
 
 I think it's pretty common in glib and pango at least to return
 g_strdup'ed strings.  The no-ref-count rule is mostly for objects that
 have a literal ref/unref pair.
 
 Other than that, for functions that return read data from the stream,
 some people may have reasons to want to avoid malloc/free'ing on each
 line.  One way to work around that is to have the function take a
 GString, so you can reuse the buffer from the previous line.  I know
 most people are not a big fan of that idea though.

The right interface for this type of functions have been
already invented: that of glibc's getline.  It can allocate
new buffers, it can reuse existing buffers resizing them if
necessary -- and it can be even used with GStrings [if they
use the same memory allocator] although that's a bit dirty.

Yeti

--
http://gwyddion.net/
___
gtk-devel-list mailing list
gtk-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-devel-list


Re: Behaviour of getters wrt dup/ref

2007-09-16 Thread Yeti
On Sun, Sep 16, 2007 at 12:12:11PM -0400, Behdad Esfahbod wrote:
  
  The right interface for this type of functions have been
  already invented: that of glibc's getline.  It can allocate
  new buffers, it can reuse existing buffers resizing them if
  necessary -- and it can be even used with GStrings [if they
  use the same memory allocator] although that's a bit dirty.
 
 Well, that's exactly what happens if you make the API take GString.

I reacted to the remark that many people do not like having
to pass a GString (perhaps understandably).  The `decomposed
GString' interface of getline() is then the next reasonable
candidate.

Yeti

--
http://gwyddion.net/
___
gtk-devel-list mailing list
gtk-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-devel-list


Re: gtk installation problems

2007-09-16 Thread Yeti
On Sun, Sep 16, 2007 at 04:54:06PM +0100, Kenneth Strouts wrote:
 gtk is apparently installed on my system (according to YAST.)  I am
 missing a crucial file called gtk-config.  Any ideas why?

gtk-config is a Gtk+ 1.2 thing.  Gtk+ 2.x has never
installed any such file.  The equivalent for Gtk+ 2.x is

  pkg-config [OPTIONS...] gtk+-2.0

Why you think you need gtk-config?

 If I try to
 install a newer version of gtk I encounter a number of errors;
 
 collect2: ld returned 1 exit status
 make[3]: *** [gtk-query-immodules-2.0] Error 1
 make[3]: Leaving directory `/home/kstro/InstApp/gtk+-2.10.13/gtk'
 make[2]: *** [install-recursive] Error 1
 make[2]: Leaving directory `/home/kstro/InstApp/gtk+-2.10.13/gtk'
 make[1]: *** [install] Error 2
 make[1]: Leaving directory `/home/kstro/InstApp/gtk+-2.10.13/gtk'
 make: *** [install-recursive] Error 1

See

  http://mail.gnome.org/archives/gtk-list/2007-August/msg00165.html

Yeti

--
http://gwyddion.net/
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: releasing 1.9 soon...

2007-09-14 Thread Yeti
On Fri, Sep 14, 2007 at 01:55:42AM +0200, David Nečas (Yeti) wrote:
 Well, it's always possible to distribute the files even if
 they are generated and useless.

Stefan, please apply the attached patch.  I can't see any
reliable method to check whether types and sections are
built files that would be less ugly than distributing them
even if they are built.

Yeti

--
http://gwyddion.net/
Index: gtk-doc.make
===
--- gtk-doc.make(revision 490)
+++ gtk-doc.make(working copy)
@@ -123,12 +123,6 @@
cd $(srcdir)  \
  rm -rf xml $(REPORT_FILES) \
 $(DOC_MODULE)-decl-list.txt $(DOC_MODULE)-decl.txt
-   case x $(SCAN_OPTIONS)  in \
- *' --rebuild-types '*) rm -f $(srcdir)/$(DOC_MODULE).types;; \
-   esac
-   case x $(SCAN_OPTIONS)  in \
- *' --rebuild-sections '*) rm -f 
$(srcdir)/$(DOC_MODULE)-sections.txt;; \
-   esac
 
 maintainer-clean-local: clean
cd $(srcdir)  rm -rf xml html
@@ -169,14 +163,8 @@
-cp $(srcdir)/tmpl/*.sgml $(distdir)/tmpl
-cp $(srcdir)/xml/*.xml $(distdir)/xml
cp $(srcdir)/html/* $(distdir)/html
-   case x $(SCAN_OPTIONS)  in \
- *' --rebuild-types '*) ;; \
- *) cp $(srcdir)/$(DOC_MODULE).types $(distdir)/;; \
-   esac
-   case x $(SCAN_OPTIONS)  in \
- *' --rebuild-sections '*) ;; \
- *) cp $(srcdir)/$(DOC_MODULE)-sections.txt $(distdir)/;; \
-   esac
+   cp $(srcdir)/$(DOC_MODULE).types $(distdir)/
+   cp $(srcdir)/$(DOC_MODULE)-sections.txt $(distdir)/
-gtkdoc-rebase --online --relative --html-dir=$(distdir)/html
 
 .PHONY : dist-hook-local docs
Index: gtk-doc.notmpl.make
===
--- gtk-doc.notmpl.make (revision 490)
+++ gtk-doc.notmpl.make (working copy)
@@ -108,12 +108,6 @@
cd $(srcdir)  \
  rm -rf xml $(REPORT_FILES) \
 $(DOC_MODULE)-decl-list.txt $(DOC_MODULE)-decl.txt
-   case x $(SCAN_OPTIONS)  in \
- *' --rebuild-types '*) rm -f $(srcdir)/$(DOC_MODULE).types;; \
-   esac
-   case x $(SCAN_OPTIONS)  in \
- *' --rebuild-sections '*) rm -f 
$(srcdir)/$(DOC_MODULE)-sections.txt;; \
-   esac
 
 maintainer-clean-local: clean
cd $(srcdir)  rm -rf html
@@ -150,14 +144,8 @@
 dist-hook: dist-check-gtkdoc dist-hook-local
mkdir $(distdir)/html
cp $(srcdir)/html/* $(distdir)/html
-   case x $(SCAN_OPTIONS)  in \
- *' --rebuild-types '*) ;; \
- *) cp $(srcdir)/$(DOC_MODULE).types $(distdir)/;; \
-   esac
-   case x $(SCAN_OPTIONS)  in \
- *' --rebuild-sections '*) ;; \
- *) cp $(srcdir)/$(DOC_MODULE)-sections.txt $(distdir)/;; \
-   esac
+   cp $(srcdir)/$(DOC_MODULE).types $(distdir)/
+   cp $(srcdir)/$(DOC_MODULE)-sections.txt $(distdir)/
-gtkdoc-rebase --online --relative --html-dir=$(distdir)/html
 
 .PHONY : dist-hook-local docs
___
gtk-doc-list mailing list
gtk-doc-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-doc-list


Re: Lower case to upper case german ess-zet

2007-09-13 Thread Yeti
On Thu, Sep 13, 2007 at 10:01:03PM +0200, Luis Ramirez wrote:
 Thanks for your comments. I have entered the enclosed code in the begining
 and I get:
 
 Headers version: 2.12
 Lib version: 2.12
 
 I have compiled the code in GNU/Linux and in Windows XP with Mingw and I get
 the same version 2.12, and the same results.
 Which version do you have used?

Installed:
  glib2-2.12.13-1.fc7.x86_64 (Fedora 7 RPM)

Reading code of:
  svn trunk

In http://svn.gnome.org/viewcvs/glib/trunk/glib/guniprop.c?annotate=5713
line 575 you can see what happens when the character is
lowercase (line 570) and its uppercase counterpart is
a number = 0x100 (line 573).

These contions are true for sharp s (U+00DF) as you can see
in http://svn.gnome.org/viewcvs/glib/trunk/glib/gunichartables.h?annotate=4897
line 117 (G_UNICODE_LOWERCASE_LETTER) and line 9484 (the
0x100 value).

Since the uppercase value is 0x100, p will point to the
first entry of special_case_table in gunichartables.h, line
11978:

  \x00\x53\x53\x00\x53\x73\0 /* offset 0 */

It starts with \x00 (single-char uppercase does not exist),
therefore val at line 576 of guniprop.c becomes 0.  And in
this case the original character is returned at line 582.

The code was changed on Thu Mar 22 09:11:27 2007 UTC, so if
your GLib is older than that (i.e. a stable release older
than 2.12.12), it's too old.

Yeti

--
http://gwyddion.net/
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Changing a previously created GtkImage

2007-09-12 Thread Yeti
On Wed, Sep 12, 2007 at 01:52:43PM -0700, tsaud wrote:
 
 I have created an image from a file using 
 image1 = gtk_image_new_from_file(pictures/Empty.gif);
 gtk_widget_set_name (image1, image1);
 
 and displalyed it using:
 gtk_widget_show(image1);
 gtk_box_pack_start(GTK_BOX (hbox1), image1, TRUE, TRUE, 0);
 
 and that works fine.  The image is correctly displayed where I want it. 
 Later, when a particular event happens (right now I have assigned it to a
 button press), I want to change the image to the image in the file
 pictures/Full.gif (which is exactly the same size as Empty.gif).  To do
 that, I did the following:
 
 void on_button1_pressed (GtkButton *button, gpointer user_data)
 {
GtkWidget *imageptr;
imageptr = lookup_widget(GTK_WIDGET(button), image1);
if(imageptr != NULL)
{
   gtk_image_set_from_file(GTK_IMAGE(imageptr), pictures/Full.gif);
}
else
   fprintf(stderr, image1 not found\n);
 }
 
 When I press the button, the image is replaced by a broken image icon, not
 the new image.  What am I doing wrong?  I am obviously getting the correct
 widget with the lookup_widget call, since the image changed.  The file
 Empty.gif and the file Full.gif are in the same directory, and when I
 change the gtk_image_new_from_file() call to load the Full.gif file, that
 works fine as well, so I know the file is there and readable.  I just don't
 understand why it didn't change to the new image.

Can't the working directory change meanwhile?  Paths such as
pictures/Full.gif seem quite fragile to me.

1) Try g_file_test() to check whether pictures/Full.gif
   exists as the time on_button1_pressed() is called.
2) Try to load the image with gdk_pixbuf_load() and look at
   the error your obtain.

Yeti

--
http://gwyddion.net/
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Question about gchar g_strconcat()

2007-09-12 Thread Yeti
On Wed, Sep 12, 2007 at 08:20:18PM +0200, [EMAIL PROTECTED] wrote:
 gchar *file;
 file=test;
   
 file = g_strconcat(/some/path/, file, .txt, NULL);
 g_printf(%s, file);
 
 
 My question is do i must allocate memory for file ?

The topic of this list is the development of Gtk+, not with
Gtk+.  Direct questions like this to gtk-list.

The short answer is: No, but you have to *free* it.  See the
documentation of g_strconcat().  And you should use
g_build_filename().

Yeti

--
http://gwyddion.net/
___
gtk-devel-list mailing list
gtk-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-devel-list


Re: How to detect gtk widget partial visible? visibility-notify-event?

2007-09-11 Thread Yeti
On Tue, Sep 11, 2007 at 05:54:54PM +0800, MD Tsai wrote:
 Is it possible for a gtk widget to detect it is partial visible? For
 example, I can drag one window on another window. The covered window can be
 notified that it is partial visible?
 
 I've registered the visibility-notify-event but never receive callback,

gtk_widget_add_events(widget, GDK_VISIBILITY_NOTIFY_MASK);

Yeti

--
http://gwyddion.net/
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Lower case to upper case german ess-zet

2007-09-11 Thread Yeti
On Tue, Sep 11, 2007 at 06:12:53PM +, Luis Ramirez wrote:
 I have a problem converting german ess-zet (ß) from lower to uppercase
 when using g_unichar_toupper, but it works fine using g_utf8_strup.
 Using g_unichar_toupper I get a 0 as result.

You should not, both according to my reading of GLib source
code and experiment.  Since the uppercase is not
repesentable with a signle character, you should get the
input character back from g_unichar_toupper(), exactly as
the documentation states -- and this is also what I observe.

 Here it is a sample. The output is:

Note embedding these things in mail makes them subject to
abritrary reencoding and can result in recipients trying
entirely different code if they are not very careful -- use
\xc3\x9f representation.

 g_unichar_toupper. Lower:'ß', Upper:''
 g_utf8_strup. Lower:'ß', Upper:'SS'

I get

g_unichar_toupper. Lower:'ß', Upper:'ß'
g_utf8_strup. Lower:'ß', Upper:'SS'

as expected.  Perhaps a too old GLib?

Yeti

--
http://gwyddion.net/
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: How to convert a jpg image to a GtkImage ?

2007-09-11 Thread Yeti
On Tue, Sep 11, 2007 at 10:53:02PM +0200, Jonathan Winterflood wrote:
 As for adding a click to the reference count, if it works, would probably be
 the best way to go

Of course it works and it is recommended in
gdk_pixbuf_loader_get_pixbuf() documentation -- if anyone
bothered to read it...

Yeti

--
http://gwyddion.net/
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: gtk pango draw rotated text

2007-09-10 Thread Yeti
On Mon, Sep 10, 2007 at 01:27:48PM +0100, Luis Rodrigues wrote:
 It's not on my system.
 
 I use Debian, do you happen do know the package name?

http://packages.debian.org/search?searchon=contentskeywords=gtk-demomode=pathsuite=stablearch=any

Yeti

--
http://gwyddion.net/
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Using GtkFileChooserWidget

2007-09-10 Thread Yeti
On Sun, Sep 09, 2007 at 11:54:01PM +0200, Nikolaj Thygesen wrote:
 I'll just reply to my own post with an example on how to reproduce 
 the error-dump. This is no pretty program which simply either inserts or 
 removes the same widget every other time the window close widget is 
 clicked - just to keep it brief. Who might I contact regarding this issue??

Probably bugzilla.gnome.org.

Yeti

--
http://gwyddion.net/
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: releasing 1.9 soon...

2007-09-10 Thread Yeti
On Mon, Sep 10, 2007 at 10:14:24PM +0300, Stefan Kost wrote:
 http://bugzilla.gnome.org/show_bug.cgi?id=448879
 Use a footer when generating HTML documentation
 - I don't adding a footer so much

I don't have any opinion.  I view documentation with dillo,
therefore it has been always working for me...

Design-wise, large spacer at the bottom is an issue mainly
if it's followed by a footer.

 http://bugzilla.gnome.org/show_bug.cgi?id=338342
 pkg-config check in gtk-doc.m4 isn't versionned
 - closing?

Dunno, shouldn't we check for pkg-config = 0.19 in
gtk-doc.m4 as suggested?  What

  # Make sure we have pkg-config = 0.19, so installing in $(datadir) is OK.

in gtk-doc's configure.in tries to achieve?

Yeti

--
http://gwyddion.net/
___
gtk-doc-list mailing list
gtk-doc-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-doc-list


Re: How to convert a jpg image to a GtkImage ?

2007-09-09 Thread Yeti
On Sun, Sep 09, 2007 at 06:30:02PM +0800, Gregory Hosler wrote:
 
 This works fine, but now I have a concern as regards to memory leak.
 ...
 
 The reason for new'ing a new loader each time is that, from the documentation,
 it appears that once I loader_close(), I can no longer write to the loader,
 and it is not clear that I can do sequential loader writes's followed by
 loader_get_pixbuf's, thereby reusing the same (original) loader.
 
 I also am not seeing a convenient way to destroy the loader. (it does happen 
 to
 have a finalize routine, but I'm not sure how to invoke it :)

GdkPixbufLoader is a GObject, you get rid of it as of
anything else: by releasing the last reference with
g_object_unref().

   reusing the loader (if possible).

This is not possible (the loader is tied to its pixbuf).

Yeti

--
http://gwyddion.net/
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Regrading gtk thread

2007-09-08 Thread Yeti
On Sat, Sep 08, 2007 at 02:17:11AM -0700, Sohel wrote:
 I have two buttons using one button I start a thread and using the other 
 button I want to stop this thread. I get the following error when trying to 
 do this :
 
 Xlib: unexpected async reply (sequence 0x26ad)!
 
 
 How do I solve this error  and if there is a better way to do this ??

Filter question: Did you read and follow

  http://library.gnome.org/devel/gdk/stable/gdk-Threads.html

?

Yeti

--
http://gwyddion.net/
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Conversion functions.

2007-09-08 Thread Yeti
On Fri, Sep 07, 2007 at 05:02:37PM +0200, Magnus Myrefors wrote:
 By the way I have found out that I used 
 a way of reading lines from the input-file which can cause
 some problem. I read in a book that fgets(string, sizeof(string), input)
 should read one line up to sizeof(string) -1 or to the first newline-
 character. But when I tested I found out that that wasn't the case.

If sizeof(sizeof) does not stand for the allocated size of
the string but is meant literally, then either the book was
utter crap or you misunderstood it.  I suggest to read the
GNU libc info pages instead, the explanations there are
clear.

sizeof(a-pointer-to-char) is the size of the pointer,
usually 8 or 4.  The second fgets() argument should be the
allocated size of the string (or a smaller positive number).

Yeti

--
http://gwyddion.net/
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: GTK drawing area cannot get keyboard events

2007-09-08 Thread Yeti
On Sat, Sep 08, 2007 at 02:21:11PM -0700, Tom Trebisky wrote:
 I have spent a couple of half-days trying to get keyboard events from a
 GTK drawing area with no luck,

I suppose you have read thread

  http://mail.gnome.org/archives/gtk-list/2007-September/msg00015.html

 I am getting mouse events nicely from the drawing area, but have been
 entirely stumped in getting keyboard events.  I have done google searches
 on the topic and taken the advice given, the code that I think is
 relevant is:
 
GTK_WIDGET_SET_FLAGS ( da, GTK_CAN_FOCUS );

This is OK.

  g_signal_connect ( GTK_OBJECT(da), focus_event,
GTK_SIGNAL_FUNC(focus_handler), NULL );

This is written in some archaic dialect (although not
entirely, the corresponding archaic counterpart of
g_signal_connect() is gtk_signal_connect()).  Code written
in the last 5 years should read

g_signal_connect(da, focus-event,
 G_CALLBACK(focus_handler), NULL);

Nevertheless, the functionality is the same.

gtk_widget_add_events ( GTK_WIDGET(da), GDK_FOCUS_CHANGE );

And this is the bug.  GDK_FOCUS_CHANGE is not an event mask
(i.e. GdkEventMask value), it's an event type (i.e.
GdkEventType valye).  It should be GDK_FOCUS_CHANGE_MASK.
Ditto in the key press case.

Also ensure you add events before the widget is realized.

Yeti

--
http://gwyddion.net/
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: DrawingArea and Toolbar focus issues

2007-09-08 Thread Yeti
On Sat, Sep 08, 2007 at 11:02:07AM -0400, Brian Ahr wrote:
 I've set up a GtkDrawingArea to catch keypress and keyrelease events. 
 However, if a toolbar created via gtk_ui_manager_get_widget() is 
 visible, the toolbar's first button seems to steal those events - 
 despite my attempts to change the focus, disable key press/release 
 events to the toolbar, etc. If the toolbar isn't visible, everything 
 works as expected. Does anyone have any suggestions on this one?

GtkDrawingArea area does not accept keyboard focus.  If it's
the only widget in the window it gets the keyboard events
anyway, but if there are widgets that accept keyboard focus
(at least one), then the widget with keyboard focus gets
these events -- and this is never your GtkDrawingArea.

You have to make it accept focus:

   GTK_WIDGET_SET_FLAGS(widget, GTK_CAN_FOCUS);

In additon you probably want to grab focus when the user
clicks on it with mouse, i.e. call

   if (!GTK_WIDGET_HAS_FOCUS(widget))
 gtk_widget_grab_focus(widget);

in the button-press-event handler.

Yeti


P.S.: If you are writing something nontrivial, it might make
more sense to subclass GtkWiget directly -- if basing
widgets on GtkDrawingArea would be such a great idea, Gtk+
itself would be full of such widgets, isn't it?


--
http://gwyddion.net/
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: Conversion functions.

2007-09-07 Thread Yeti
On Fri, Sep 07, 2007 at 01:45:09AM +0200, Magnus Myrefors wrote:
 
 yeti I have tested your minimal testprogram with the whole
 test-file. Unfortunately the program doesn't print anything to
 stdout. It doesn't seem to be any data stored in the GSList
 or in the datastructure, Data *data.

If there is any line that starts with a digit (after
possible whitespace), it has to print either the data or an
error.  If it doesn't, then there is no line whose first
non-whitespace character would satisfy g_ascii_isdigit(c) or
it does not end up in the list. This means either
- g_ascii_isdigit(c) does not evaluate to TRUE for digits
  on your system
- g_slist_prepend() does not work
- g_slist_reverse() does not work
- the file looks different than you sent

Which one is it?

 (I tried to print a field
 every time a new line was about to be read in the while-loop).
 Furthermore, I wonder if the test,
  if(end == start)
failfield = Latitude;,
 can conclude that the string was converted correctly with
 g_ascii_strtod(). If g_ascii_strtod() converts only a fraction 
 of the string, it will result in (end != start) and failfield
 won't be set which results in no output to stderr.

end is the input to the next conversion, therefore failfield
will be set in the next conversion (or trailing garbage
message will be printed if it was the last).  Unless the
file contain one of the few possible cases of concatenated
floating point numbers that can be parsed back -- these can
be catched by checking whether *end is space or '\0'.

But this does not matter at all.  Either way you get *some*
output, either data or errors (or both in the case of
trailing garbage).  You must get some output even if
g_ascii_strtod() and strtol() return completely random
values.  So I just don't believe you.  Period.

Yeti

--
http://gwyddion.net/
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: pango_layout_get_pixel_extents crash on Win32

2007-09-07 Thread Yeti
On Thu, Sep 06, 2007 at 05:12:05PM -0400, Owen Taylor wrote:
 
 To render to an
 offscreen in-memory image, use cairo. With pango/cairo, you can render
 to offscreen images using the exact same font catalog that GTK+ is
 using

Could you please hint a bit more?  I would rather avoid
repeating the same mistake.

Can I assume the map returned by pango_cairo_font_map_get_default()
is the same map as Gtk+ (Gdk) uses?  Or how do I draw on an
image surface with the same font a widget would use on-screen?

It seems to me I still need to transfer the font
description between two contexts.

Yeti

--
http://gwyddion.net/
___
gtk-i18n-list mailing list
gtk-i18n-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-i18n-list


Re: pango_layout_get_pixel_extents crash on Win32

2007-09-07 Thread Yeti
On Fri, Sep 07, 2007 at 01:26:42AM +0200, David Nečas (Yeti) wrote:
 
 I can try to cripple my font config to reproduce the crash
 though -- if having no fonts configured is the cause.

The best I can manage is program termination with

  No fonts found; this probably means that the fontconfig
  library is not correctly configured. You may need to
  edit the fonts.conf configuration file. More information
  about fontconfig can be found in the fontconfig(3) manual
  page and on http://fontconfig.org

printed to the console (if enabled).  While silent
application termination is not good either, users report
crashes/hangs with the accompanying Windows error boxes, so
probably something different.  I'm sorry.

Thanks for the hints, I will try different off-screen
rendering methods.

Yeti

--
http://gwyddion.net/
___
gtk-i18n-list mailing list
gtk-i18n-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-i18n-list


Re: Conversion functions.

2007-09-06 Thread Yeti
On Thu, Sep 06, 2007 at 11:00:11AM -0300, Matí­as Alejandro Torres wrote:
 Here's the minimal program to read that. The reading part is kind of 
 crappy but it works with that example.

The trouble with the reading part is not that it's kind of
crappy (well, it is IMO, reading by character makes no sense
when g_ascii_strtod() and strtol() can perfectly iterate
themselves *and* have error-reporting, g_slist_append() is
O(N) making the reading O(N^2), it is a waste of time to
construct a big GSList just to fill a GtkListStore from it
instead of filling the store directly -- and if Data is
a data structure used elsewhere in the program it makes
little sense to break it into columns instead of storing it
directly in a G_TYPE_BOXED/G_TYPE_POINTER column), but that:
- it assigns the fgetc() return value to a gchar, breaking
  EOF testing
- it uses a fixed unchecked buffer of size 50 we do now know
  whether overflows or not on your data
- it takes any sequence of non-[ \t] as a field and reads
  it without checking so we do not know what actually
  happens on your data
- it uses g_strtod() (NOT g_ascii_strtod() you've been
  talking about) which tries to accept both C and your
  current locale formats and therefore is not predictable
  (and won't help reading data that someone with
  a *different* local wrote in the locale-specific manner
  anyway)

If the attached program reads the complete file and prints
back its contents correctly, then I dare to say your problem
is not broken g_ascii_strtod().  As a bonus, the attached
program prints a detailed error to stderr if there are
malformed data rows in the file.

Yeti

--
http://gwyddion.net/


=
#define _GNU_SOURCE 1
#include stdlib.h
#include stdio.h
#include string.h
#include errno.h
#include glib.h

typedef struct _Data {
gchar   *log;
gdouble latitude;
gintaltitude;
gintinterval;
gintheartbeat;
gdouble speed;
} Data;


int
main(int argc,
 char *argv[])
{
const gchar *filename, *failfield;
gchar *buf = NULL;
size_t buf_size = 0, lineno;
ssize_t line_len;
FILE *fh;
GSList *l, *stuff = NULL;
Data *data;

if (argc != 2) {
g_printerr(readstuff FILE\n);
return 1;
}

filename = argv[1];
if (!(fh = fopen(filename, r))) {
g_printerr(Cannot open %s: %s\n, filename, g_strerror(errno));
return 1;
}

lineno = 0;
failfield = NULL;
while ((line_len = getline(buf, buf_size, fh)) != -1) {
gchar *start, *end;
guint len;

lineno++;
start = g_strstrip(buf);
/* Skip non-data lines */
if (!buf[0] || !g_ascii_isdigit(buf[0]))
continue;

data = g_new(Data, 1);
len = strcspn(start,  \t);
data-log = g_strndup(start, len);
start += len;

data-latitude = g_ascii_strtod(start, end);
if (end == start) {
failfield = Latitude;
break;
}
start = end;

data-altitude = strtol(start, end, 10);
if (end == start) {
failfield = Altitude;
break;
}
start = end;

data-interval = strtol(start, end, 10);
if (end == start) {
failfield = IntervalTime;
break;
}
start = end;

data-heartbeat = strtol(start, end, 10);
if (end == start) {
failfield = HeartRate;
break;
}
start = end;

data-speed = g_ascii_strtod(start, end);
if (end == start) {
failfield = Speed;
break;
}

stuff = g_slist_prepend(stuff, data);

if (*end)
fprintf(stderr, Warning: trailing garbage at line %lu of %s: %s\n,
(unsigned long int)lineno, filename, buf);
}

fclose(fh);
free(buf);

if (failfield) {
fprintf(stderr, Cannot parse %s at line %lu of %s: %s\n,
failfield, (unsigned long int)lineno, filename, buf);
g_free(data-log);
g_free(data);
}
else {
stuff = g_slist_reverse(stuff);
for (l = stuff; l; l = l-next) {
data = (Data*)l-data;
printf(%s %.5f %d %d %d %.2f\n,
   data-log, data-latitude, data-altitude,
   data-interval, data-heartbeat, data-speed);
}
}

for (l = stuff; l; l = l-next) {
data = (Data*)l-data;
g_free(data-log);
g_free(data);
}
g_slist_free(stuff);

return !!failfield;
}
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: focus-out-event and GtkEntry

2007-09-06 Thread Yeti
On Thu, Sep 06, 2007 at 02:49:12PM -0400, Zvi Sebrow wrote:
 I need to check data a user inputs on one of numerous GtkEntry's on window,
 and I need to handle the situation when the entry loses focus (by TABing out
 of the field, or by mouse control.  When I encouter bad input, I bring up a
 dialog box.  The problem is I get an GtkWarning and GtkError:
 ...

Check the focus-out-event signal handler prototype

  
http://library.gnome.org/devel/gtk/stable/GtkWidget.html#GtkWidget-focus-out-event

*including the return value*, you must return FALSE if you
want the default handler to run.

Yeti

--
http://gwyddion.net/
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


pango_layout_get_pixel_extents crash on Win32

2007-09-06 Thread Yeti

Hello,

I have a problem with pango_layout_get_pixel_extents()
crashing on Win32 with a layout created from FT2 context.

I cannot reproduce the problem myself which complicates
debugging a bit...  However, I extracted the problem into
a relatively minimal program that my users confirm crashing
the same way as the application -- it's attached at the end.

The program works flawlessly on Unix/X11.

It crashes on Windows XP -- for some people -- on the
pango_layout_get_pixel_extents() line (marked Bang!) with no
run-time errors messages before.

The users who report the crashes generally run the latest
(or about) version of GladeWin32 runtime if it matters.

Is there something obviously wrong in the program?
What kind of problem it can be that it just crashes without
any failed assertion message?

Yeti

--
http://gwyddion.net/



#include pango/pangoft2.h
#include gtk/gtk.h

PangoFontMap *ft2_font_map;

gboolean
try_layout(gpointer user_data)
{
GtkWidget *widget = GTK_WIDGET(user_data);
PangoFontDescription *fontdesc;
PangoContext *context, *ft2_context;
PangoRectangle rect;
PangoLayout *layout;

ft2_context
= pango_ft2_font_map_create_context(PANGO_FT2_FONT_MAP(ft2_font_map));

context = gtk_widget_get_pango_context(widget);
fontdesc = pango_context_get_font_description(context);
fontdesc = pango_font_description_copy_static(fontdesc);
pango_font_description_set_size(fontdesc, 12*PANGO_SCALE);
pango_context_set_font_description(ft2_context, fontdesc);
pango_font_description_free(fontdesc);

layout = pango_layout_new(ft2_context);
pango_layout_set_width(layout, -1);
pango_layout_set_alignment(layout, PANGO_ALIGN_LEFT);

pango_layout_set_text(layout, 1, -1);
/* Bang! */
pango_layout_get_pixel_extents(layout, NULL, rect);

gtk_widget_destroy(widget);

return FALSE;
}

int
main(int argc, char *argv[])
{
GtkWidget *widget;

gtk_init(argc, argv);

/* FT2 font map */
ft2_font_map = pango_ft2_font_map_new();
pango_ft2_font_map_set_resolution(PANGO_FT2_FONT_MAP(ft2_font_map), 72, 72);

/* Create some widget */
widget = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_default_size(GTK_WINDOW(widget), 300, 300);
g_signal_connect(widget, destroy, G_CALLBACK(gtk_main_quit), NULL);
gtk_widget_show_all(widget);

/* After the widget is realized, do not put it into the callback... */
g_timeout_add(500, try_layout, widget);

gtk_main();

return 0;
}

___
gtk-i18n-list mailing list
gtk-i18n-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-i18n-list


Re: pango_layout_get_pixel_extents crash on Win32

2007-09-06 Thread Yeti
On Thu, Sep 06, 2007 at 06:54:31PM -0400, Behdad Esfahbod wrote:
 
 Can you at least give us a backtrace or something?

I would love to.  I just don't know how to get a backtrace
with the current procedure: I build something and find a
user (who does not have compilers, debuggers and similar
stuff) willing to run it and report me results.

I can try to cripple my font config to reproduce the crash
though -- if having no fonts configured is the cause.

Yeti

--
http://gwyddion.net/
___
gtk-i18n-list mailing list
gtk-i18n-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-i18n-list


Re: pango_layout_get_pixel_extents crash on Win32

2007-09-06 Thread Yeti
On Thu, Sep 06, 2007 at 05:12:05PM -0400, Owen Taylor wrote:
 
  - Your code assumes that the fonts for the Pango backend used on GTK+
 are the same as those for the FT2 backend ... true on X11, where both
 are using fontconfig. False on windows, where GTK+ uses the native
 font catalog and font system. Now, of course, using a font description
 that doesn't point to a known font shouldn't *crash*,

Should't I get either the requested font or a replacement
(possibly being awarded with a Pango warning)?

 but it's quite
 possible that your users have *no fonts at all* configured for the FT2
 backend, and at that point, it's more likely that there might be a
 crash.
 
  - Using FT2 on Windows is generally a poor idea.

Hm, I thought Gimp had been using FT2 so it could not be so
bad -- but maybe I was mistaken.  Anyway, if it's possible
that there are no fonts at all configured for FT2 then
obviously I cannot use it, at least not on Win32.

  To render to an
 offscreen in-memory image, use cairo. With pango/cairo, you can render
 to offscreen images using the exact same font catalog that GTK+ is
 using, rather than dragging in an nonnative, innappropriate
 dependencies (FreeType/fontconfig).

I see.  The trouble is my application has still Gtk+ 2.6 as
the lowest supported version (and changing requirements in
a minor stable version is a bit unfortunate).

Does any safe off-screen text rendering method exist that
does not require Cairo?  I do not need much features, simple
strings with some default font would be sufficient.

Since I need off-screen text rendering only in a few places
I could also branch the code according to the platform, but
I'd rather avoid this too if there is another way...

Yeti

--
http://gwyddion.net/
___
gtk-i18n-list mailing list
gtk-i18n-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-i18n-list


Re: starting gtk

2007-09-06 Thread Yeti
On Thu, Sep 06, 2007 at 03:19:22PM -0400, Bill Cunningham wrote:
 Can someone help me with a small hello world program in gtk2+? In just 
 a small window or button.

Isn't the tutorial

  http://www.gtk.org/tutorial/c39.html#SEC-HELLOWORLD

good enough?

Yeti

--
http://gwyddion.net/
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: Pass multiple arguments to a signal event

2007-09-05 Thread Yeti
On Wed, Sep 05, 2007 at 03:58:25PM +0200, [EMAIL PROTECTED] wrote:
 I can't figure how to pass multiple arguments to a signal event.I'll be very 
 grateful if someone could explain it to me or write some example.

You can pass a pointer and this is enough becuase a pointer
can point to arbitrarily complex data structures.  Therefore
you can pass arbitrarily complex data structures, even
though sometimes it can be less convenient than passing
multiple arguments directly.

Also, in some cases you can use g_object_set_data() to
attach data related to widgets (and other objects) directly
to them and pick them later in the callback with
g_object_get_data().

 For example, let's say I have in a window 2 entries and a button. How can I 
 pass the 2 entry widgets to the signal function for working with them? 
 
 As far as I know I can't do something like:
 
 g_signal_connect_swapped(button, clicked, G_CALLBACK 
 (callback_func_example), here_the_two_widgets );

You can:

  GtkWidget **here_the_two_widgets;

  here_the_two_widgets = g_new(GtkWidget*, 2);
  here_the_two_widgets[0] = entry1;
  here_the_two_widgets[1] = entry2;
  g_signal_connect_swapped(button, clicked,
   G_CALLBACK(callback_func_example),
   here_the_two_widgets);

(not the best example, but hopefully gives the idea).

Yeti

--
http://gwyddion.net/
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Conversion functions.

2007-09-04 Thread Yeti
On Tue, Sep 04, 2007 at 01:12:11AM +0200, Magnus Myrefors wrote:
 
 when I start the test I am in the same state
 and I use the same text-file evey time.
 The converted values can be different
 or the same between different test-runs so 
 the wrong values seem to occur randomly.

Then try valgrind as I suggested, it's the easiest thing to
try.

Yeti

--
http://gwyddion.net/
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Conversion functions.

2007-09-04 Thread Yeti
On Tue, Sep 04, 2007 at 11:55:58PM +0200, Magnus Myrefors wrote:
 
 I tried with strtod() but it only worked with strings with no
 decimal-point, otherwise the resulting double was truncated.
 ...
  - if the numbers are normal, i.e. supported by underlying
strtod(), try to use it directly -- be careful with the
  ^^^
locale in this case
  ^^^

strtod() is locale dependent, g_ascii_strtod() is not (well,
sort of, it uses strtod() so if the locale or strtod()
implementation is weird, g_ascii_strtod() can be still
affected).  This is what g_ascii_strtod() is all about.
Your locale uses decimal comma or something like that.  As
if I didn't warn...

 I also tried to copy g_ascii_strtod() (from glib-2.12-9) into
 my code but it didn't compile

My crystal ball says you are missing

  #include locale.h

but it's a bit cloudy.

 and I didn't quite understand
 the if-statement if(decimal_point_pos) {} where decimal_point_pos
 was declared as const char *decimal_point_pos.
 I thought that a pointer was an address in memory and I haven't
 seen a pointer in a if-statement like that before.

That's a common idiom.  NULL is zero and zero is false.
Anything else is nonzero and therefore true.

 I guess I have to write my own conversion-function.

Good luck with that (I still think a bug in the program and
not in GLib is the most probable cause).

Yeti

--
http://gwyddion.net/
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: GtkWidgets and their underlying GdkWindows

2007-09-04 Thread Yeti
On Tue, Sep 04, 2007 at 04:42:22PM +1000, Andrew Cowie wrote:
 We all know that some GtkWidgets have their own GdkWindows (ie
 GtkButtons), and some do not (ie GtkLabels). At least, that's what the
 documentation tells us.

GtkButtons don't have their own windows, try for instance
GtkEntry or GtkTreeView.

   g_print(0x%X\n, window-window);
   g_print(0x%X\n, vbox-window);
   g_print(0x%X\n, label-window);
   g_print(0x%X\n, button-window);

This prints only 32 bits of the pointer, which means
depending on what you run it on you can easily miss
different adresses.  Why don't you use %p?

Yeti

--
http://gwyddion.net/
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: Conversion functions.

2007-09-03 Thread Yeti
On Mon, Sep 03, 2007 at 08:46:51PM +0200, Magnus Myrefors wrote:
   I am currently trying to use the glib-functions g_ascii_strtod(x,y)
   and g_ascii_strtoll(x,y) to convert values from a text-file.
   It works fine most of the time but occasionally the converted values
   are absolutely wrong or just a bit wrong. I am using the glib
   libraries (libglib2.0-dev v.2.12.4-2) and (libglib2.0-0 v.2.12.4-2).
   Has anyone had similar problems with these functions ?

No; can you extract the problem into a simple test case?  If
the wrong values occur randomly and/or depend on the state
of the rest of the program in a complex way, memory
corruption elsewhere in your program is the likely cause
(try valgrind).  If wrong values are rare but reproducible,
it should be easy to prepare a simple test case.

Yeti

--
http://gwyddion.net/
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Toggle and the Inconsistent Property

2007-09-02 Thread Yeti
On Sun, Sep 02, 2007 at 01:07:48PM -0400, dhk wrote:
 What is the inconsistent property to a toggle?  
 
 I want to be able to flag rows in a treeview for possible deletion so
 they can be reviewed before flagging them for deletion.  So the check
 box needs to have three states, kind of like the minesweeper game,
 checked, unchecked, and an inbetween state.  Does anyone know how to do
 this?

The inconsistent property is to display the toggle as
in-between, or rather neither-yes-nor-no, state.

However, what you describe does not really look like an
in-between state.  You have two states:
- not marked for deletion
- marked for deletion
where the second has two sub-states.  I suggest to think
about a different presentation than abusing inconsistent
(adding a small mark to one of the substates for instance),
especially since the rendering of the states is theme
dependent.

Yeti

--
http://gwyddion.net/
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: pressing arrow key terminates the application

2007-09-01 Thread Yeti
On Fri, Aug 31, 2007 at 10:30:59PM -0700, varun_shrivastava wrote:
 
 i have written a simple gtk application which only loads a webpage.
 I have used following widgets
 
 GtkWindow-GtkVBox
 GtkVbox contains Gtk Entry for url display and GtkNotebook for webpage
 display.
 
 while the webpage is loading and i press down arrow
 the application terminates.
 
 please help
 
 here is a snapshot of gdb
 
 varun http://www.nabble.com/file/p12421393/snap.jpg snap.jpg 

You are on Unix, instead of making 200kB screenshots of
terminals with semitransparent background, you can use
script(1) or just select the text and paste it to the
e-mail.

The problem is not in _gtk_marshal_BOOLEAN__BOXED().  This
function is very simple, generated(!) according to a known
pattern and called a zillion times in every Gtk+ application
-- every time an event is delivered.

So you have either
- treading problem (not likely if the bug is deterministic)
- bug in your code that causes stack and/or other memory
  corruption
- bug in the way you use the (unknown) HTML renderer
- bug in the (unknown) HTML renderer

Use valgrind.  Do not strip the libraries to see more
information.  Try if it still crashes if you don't put it
into a notebook (then the (unknown) HTML renderer perhaps
cannot handle disappearing while loading the page).  And
what `I press down arrow' means anyway? -- which widget has
the keyboard focus at that time?  Just the normal debugging,
unless a clairvoyant reads this list, no one will tell you
anything from a corrupted stack trace (beside the fact that
the stack seems corrupted).

Yeti

--
http://gwyddion.net/
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: How to convert a jpg image to a GtkImage ?

2007-08-31 Thread Yeti
On Fri, Aug 31, 2007 at 02:11:15PM -0700, Mike Melanson wrote:
  
  I have an application, that amoung other things, is receiving a jpg file
  from a network connection. Once that file is in memory (it's relatively
  small), I wish to load it into a GtkImage (so that I can display it,
  e.g. by adding the GtkImage to a vbox, or something like that).
  
  ...
 
 My first impulse is that you will need to drag libjpeg into this (pretty
 standard everywhere) and delegate image decoding over to that module.
 Then create a new image in memory with gdk_image_new() and copy the
 decoded RGB data over.

No, explicit use of libjpeg is not necessary.  Create a
GdkPixbufLoader, feed the in-memory image date to it with
gdk_pixbuf_loader_write() and if everything is all right
fetch the GdkPixbuf from it.  Then construct the GtkImage
with gtk_image_new_from_pixbuf().

Yeti

--
http://gwyddion.net/
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: problem building gtk+ 2.10.13

2007-08-31 Thread Yeti
On Fri, Aug 31, 2007 at 08:13:23PM +, [EMAIL PROTECTED] wrote:
 I've run into a problem building gtk+ 2.10.14.  My distro has an older 
 version of
 gnome, and I'm trying to install an application that requires a more 
 up-to-date
 gtk+; but I don't want to replace the system library, since that will likely 
 break
 everything else.  So my approach is to build gtk+ and the libraries it 
 depends on
 into a separate prefix.  
 
 So glib 2.12.13, cairo 1.2.4, and pango 1.16.4 have all been installed into 
 the
 prefix /home/dc/local/AU/1, PKG_CONFIG points to 
 /home/dc/local/AU/1/lib/pkgconfig,
 LD_LIBRARY_PATH points to /home/dc/local/AU/1/lib.  ./configure 
 --prefix=/home/dc/local/AU/1
 is happy, including reporting that it found glib version 2.12.13.  But 
 make, after
 much effort, fails here:
 
 /bin/sh ../libtool --mode=link gcc  -DG_DISABLE_DEPRECATED -g -O2 -Wall   -o 
 gtk-query-immodules-2.0  queryimmodules.o libgtk-x11-2.0.la 
 ../gdk-pixbuf/libgdk_pixbuf-2.0.la ../gdk/libgdk-x11-2.0.la
 gcc -DG_DISABLE_DEPRECATED -g -O2 -Wall -o .libs/gtk-query-immodules-2.0 
 queryimmodules.o  ./.libs/libgtk-x11-2.0.so -L/home/dc/local/AU/1/lib 
 /home/dc/support/gtk+-2.10.14/gdk/.libs/libgdk-x11-2.0.so -L/usr/X11R6/lib 
 /usr/lib/libatk-1.0.so ../gdk-pixbuf/.libs/libgdk_pixbuf-2.0.so 
 ../gdk/.libs/libgdk-x11-2.0.so -lXrandr -lXinerama 
 /usr/lib/libpangocairo-1.0.so /usr/lib/libcairo.so 
 /usr/lib/libpangoft2-1.0.so /usr/lib/libpango-1.0.so 
 /usr/lib/libgobject-2.0.so /usr/lib/libgmodule-2.0.so /usr/lib/libglib-2.0.so 
 /home/dc/local/AU/1/lib/libpango-1.0.so /home/dc/local/AU/1/lib/libcairo.so 
 -lSM -lICE -lpng12 /usr/X11R6/lib/libfontconfig.so /usr/lib/libfreetype.so 
 -lz /usr/lib/libexpat.so -lXcursor -lXrender -lXext -lXfixes -lX11 
 /home/dc/support/gtk+-2.10.14/gdk-pixbuf/.libs/libgdk_pixbuf-2.0.so 
 /home/dc/local/AU/1/lib/libgmodule-2.0.so -ldl 
 /home/dc/local/AU/1/lib/libgobject-2.0.so 
 /home/dc/local/AU/1/lib/libglib-2.0.so -lm -Wl,--rpath 
 -Wl,/home/dc/local/AU/1/lib
 ./.libs/libgtk-x11-2.0.so: undefined reference to `g_bookmark_file_get_title'
 ./.libs/libgtk-x11-2.0.so: undefined reference to 
 `g_bookmark_file_get_is_private'
 ... and then many more undefined references.
 
 Is this failing because it's searching the glib in /usr/lib before the new 
 one in
 /home/dc/local/AU/1/lib? If so, why is it doing this?  Any ideas how I can 
 debug this?

I don't know why, but this is what libtool does when some
libraries from the stack are linked with the old libs and
some with new ones.  A workaround is to compile also Atk
with the new GLib.

Yeti

--
http://gwyddion.net/
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: Pango Cairo build problems

2007-08-31 Thread Yeti
On Fri, Aug 31, 2007 at 01:19:11PM -0700, Alan Pae wrote:
 I'm trying to compile Pango 1.18.0 with Cairo 1.4.10 as a backend.
 
 Pango's configure script has the following item:
 
 checking for cairo_ft_scaled_font_lock_face in -lcairo... no
 
 When I checked with the Pango maintainers they said that I had somehow 
 managed to build Cairo without a font backend.  The tail end of my Cairo 
 configure looks like:
 
 the following font backends:
FreeType:  yes
Win32: no (requires a Win32 platform)
ATSUI: no (disabled, use --enable-atsui to enable)
 
 So, how do I get Pango to acknowledge cairo_ft_scaled_font_lock_face so 
 that Pango will use it as a backend?

Make sure you link to the desired version of cairo.
Look at config.log, the details why it could not find the
symbol are there.  If it will be still unclear, post the
details here.

Yeti

--
http://gwyddion.net/
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: Setting treeview column width

2007-08-30 Thread Yeti
On Thu, Aug 30, 2007 at 01:22:31PM +0800, Binary Chen wrote:
 With following code, I still can't make a fixed sized treeview column,
 the column's width is large even after I have set its size, whats wrong
 with it? Any other thing affect it?
 
 column = gtk_tree_view_column_new();
 gtk_tree_view_column_set_title(column, _(Name));
 gtk_tree_view_column_set_fixed_width(column, 3);
 gtk_tree_view_column_set_sizing(column,
 GTK_TREE_VIEW_COLUMN_FIXED);
 gtk_tree_view_insert_column(GTK_TREE_VIEW(treeview), column,
 -1);
 gtk_tree_view_column_set_resizable(column, FALSE);

If the column is the last in the treeview, it will fill all
the remaning width even if it's fixed-size -- unless there
are some expanding columns present.

Yeti

--
http://gwyddion.net/
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Check Boxes Don't Work Independently

2007-08-30 Thread Yeti
On Thu, Aug 30, 2007 at 10:00:55AM -0400, dhk wrote:
 The attached and inline program

Please, please, send it with something that does not wrap
lines the next time, the code does not like it when it
happens in the middle of a string or //-comment.

 Can someone explain why this happens and where the mouseover event is
 coming from?  If you run the program you'll see what I mean.

 ...

   /* Redisplay the toggle with the appropriate state.
* gtk-demo doesn't have this but it seems necessary. */
   gtk_cell_renderer_toggle_set_active(cell, toggle_item);

The Gtk+ demo is right and your are wrong here.  Please read
what I replied you the last time -- or the Gtk+ Tree View
Tutorial if my gibbernglish is too hard to understand -- to
grasp the concepts.

Your code (equivalent to g_object_set(cell, active, TRUE, NULL);)
here says:

  I'm setting the active property to TRUE.  Therefore any
  time in the future, if you wish to render a cell with this
  renderer, render it as active.

And that's exactly what happens, all cells start to be
rendered as active (or inactive).

You have to either use a cell data function or bind the
model column to the active property.  But not

   // Why does setting attributes cause errors and seems unnecessary
 anyway?
   //gtk_tree_view_column_set_attributes(column, renderer, activatable,
 TRUE, active, FALSE, NULL);

like this.  The arguments of gtk_tree_view_column_set_attributes()
are *columns* (column numbers), not values.  Since TRUE is 1
and FALSE is 0, you bind activatable to the model column 1
and active to the model column 0.  Not what you want.

You always want the cell renderer to be activatable, so just
set

  g_object_set(renderer, activatable, TRUE, NULL);

and you want its active property be controlled by the
column DISABLE so just set

  gtk_tree_view_column_add_attribute(column, renderer,
 active, COL_DISABLE);

(the meaning will be `enable' not `disable' of course, if
you want the view to display the opposite of what's in the
model, you have to set a cell data function -- like for
essentially any other transform).

Yeti

--
http://gwyddion.net/
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Send mouse button press event to widget??

2007-08-30 Thread Yeti
On Thu, Aug 30, 2007 at 05:24:21AM -0700, eminemence wrote:
 
 I am creating a virtual cursor on a web page and want to simulate the left
 click of the mouse button
 when the user presses the enter button.
 So I tried even using the gdk_event_put on the global window itself,assuming
 the event would find it's 
 way to the control under the cursor.
 The gdk_event_put has not been successful,so what is the way to achieve
 this?

I don't recall a working example now (the Gtk+ source code
has some though), but:
- create the event with gdk_event_new()
- fill the fields
  - cursor position (in GdkWindow coordinates) can be obtained
with gdk_window_get_pointer()
  - window fields have to be g_object_ref()ed IIRC as
something unrefs them later
  - send_event should be TRUE
  - other information can be obtained from the original
event or other means
- send the event with gtk_widget_event()
- free event
- remember if you send a button presses and no button
  releases, widgets can get confused

Yeti

--
http://gwyddion.net/
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: pixbuf in event box in treeview

2007-08-30 Thread Yeti
On Thu, Aug 30, 2007 at 09:59:33PM +0800, Binary Chen wrote:
 I want to put a event box in a treeview column, with a pixbuf in the
 event box, how to set the column render?

Cell renderers are not widgets, so this is impossible (==
does not make sense). In some cases you can use (or abuse)
the `activate' mechanism, subclass a cell renderer class and
and override the activate() virtual method.  But IIRC only
button press events are delivered this way.  So generally it
will be probably necessary to track the events in the whole
tree view and use the provided helper functions to find the
cell corresponding to the event's coordinates.

Yeti

--
http://gwyddion.net/
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: elastic tabstops implemented for GTK

2007-08-30 Thread Yeti
On Wed, Aug 29, 2007 at 07:11:35PM +0200, Nick Gravgaard wrote:
 On 29/08/2007, David Nečas (Yeti) [EMAIL PROTECTED] wrote:
  Alex Jones wrote:
I really can't wait to get this functionality, it finally puts an end to
   all of the nonsense over how many spaces there should be in a tab!
 
  The option to avoid tabs has been here since ever.
  Did it put an end to the tab size nonsense?
  What makes you think this option will?
 
 Because the usual way to interpret a tab character has been to place
 the text after it at the next tabstop where the tabstop was a multiple
 of N. Elastic tabstops don't work like that all. Please read the
 website linked to in an earlier post.

You missed the point.  It is irrelevant *what* it does.

The primary problem is the undefined meaning of tabs.  How
inventing yet another option solves this problem?  Not at
all, it makes it worse.  Unless, of cousre, you are going to
eliminate all people who use tabs differently than you...

Yeti

--
http://gwyddion.net/
___
gtk-devel-list mailing list
gtk-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-devel-list


Re: elastic tabstops implemented for GTK

2007-08-29 Thread Yeti
On Wed, Aug 29, 2007 at 01:38:36PM +0200, Nick Gravgaard wrote:
 
 The problem is that indenting is already broken regardless of whether
 you use tabs or spaces. Tabs are broken because if you don't get the
 size right things won't line up (appear all wrong), and spaces are
 broken because you're forcing everyone to use your indentation size.

Please explain how spaces break compatibility with other
editors (the original objection).

Spaces are not broken.  Granted, you get one particular
indentation with spaces, but it is unambiguous and everyone
can display this particular style right.  The amount of
indentation is a single coding style issue of many.  Does it
worth the ado if the rest is still present (`enforced' in
your terms)?

In addition, the most problematic part of identation is
figuring out what to do with tabs -- incidentally the part
you seem to intend to make *much harder*.

 My approach fixes these problems.

To me it looks like an attempt to force everyone to use
gedit (or whatever chosen editor) to display the text.

Also please explain how another possible interpretation of
tabs fixes anything instead of creating more mess.

 If you look at the plugin I made for gedit (watch the video at the
 link I mentioned above) you can see that it is possible to convert
 between elastic tabstops and spaces. You lose some of the advantages
 this way (you can't manipulate the files using tools like sed and
 still have everything line up when you load it in the editor), but can
 work on projects that mandate the use of spaces for
 indenting/alignment.

Manipluating the text with sed is a cool idea, but I guess
most people would trade it for the ability to display the
text as intended (which can be ensured only by expanding to
spaces).

The editor can present the text any way it wishes and let
the user do any transforms on it.  No problem with this.
But changing the storage format and expecting everyone else
to adapt?  Have Microsoft arrived here?

Yeti


P.S.: I should probably welcome this after all.  Each new
misuse of tabs is a point against using them at all.


--
http://gwyddion.net/
___
gtk-devel-list mailing list
gtk-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-devel-list


Re: elastic tabstops implemented for GTK

2007-08-29 Thread Yeti
Alex Jones wrote:
  I really can't wait to get this functionality, it finally puts an end to
 all of the nonsense over how many spaces there should be in a tab!

The option to avoid tabs has been here since ever.
Did it put an end to the tab size nonsense?
What makes you think this option will?

Yeti

--
http://gwyddion.net/
___
gtk-devel-list mailing list
gtk-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-devel-list


Re: gtk_cell_renderer_toggle_new()

2007-08-27 Thread Yeti
On Mon, Aug 27, 2007 at 07:33:54AM -0400, dhk wrote:
 Why do all toggles get activated or deactivated in a treeview when only
 one gets clicked?  Also, moving the mouse over the rows seems to
 redisplay the toggles as checked or unchecked depending on the value of
 the last toggle.

I'm not sure what exactly you do (I cannot see any code
posted) but likely you use the cell renderer wrong.

The cell renderer is one and it is used to render cells in
all rows.  The look is determined by its properties at the
moment the rendering is performed.  Something has to set its
properties before rednering each cell to defined how this
particular cell should be rendered.  This is done by any
combination of:

- binding a property to a model column with (e.g.)
  gtk_tree_view_column_add_attribute()

- sepcifying a cell data function called before rendering each
  cell with gtk_tree_view_column_set_cell_data_func(), that
  sets the properties with g_object_set()

- setting the properties globally with g_object_set() -- only
  possible for those that are the same for all rows

See for instance the Gtk+ demo (or the source code of any
Gtk+ application that has a tree view with toggles) for
a correct use of cell renderers.

Yeti

--
http://gwyddion.net/
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: GtkDialog problems again

2007-08-27 Thread Yeti
On Mon, Aug 27, 2007 at 03:01:00PM +0200, [EMAIL PROTECTED] wrote:
 I need a dialog in my application that simply show a label (so without any
 button) and then hide itself after some processing occurred.
 The problem is that I can't send any :response signal to the dialog, so it
 remains blocked in the loop after gtk_dialog_run has been called.
 I tried to use the example posted in the GTK+ reference manual, but without
 success.
 
 
 Here is the code snippet:
 
 appdata-dialogLabel = gtk_label_new(NULL);
 gtk_label_set_text(GTK_LABEL(appdata-dialogLabel),
   Opening camera...);
 
 appdata-dialog = gtk_dialog_new_with_buttons(Open Camera,
   GTK_WINDOW(appdata-window),
   GTK_DIALOG_NO_SEPARATOR | GTK_DIALOG_DESTROY_WITH_PARENT,
   NULL);
 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(appdata-dialog)-vbox),
 appdata-dialogLabel);
 
 gtk_widget_show_all(appdata-dialog);
 // program stops here
 gint result = gtk_dialog_run(GTK_DIALOG(appdata-dialog));
 switch (result) {
case GTK_RESPONSE_ACCEPT:
   gtk_widget_hide_all(appdata-dialog);
   break;
default:
   gtk_dialog_response(GTK_DIALOG(appdata-dialog),
 GTK_RESPONSE_DELETE_EVENT);
   start_pipeline(appdata);
   add_camera_tab(appdata);
   break;
 }
 gtk_widget_destroy(appdata-dialog);
 
 
 
 
 I need that the dialog hides itself after start_pipeline() and 
 add_camera_tab()
 is called.

Make the dialog non-modal, i.e. do not use gtk_dialog_run(),
just show_all the dialog, connect to its response signal
(process any user response in the callback) and let the main
loop continue.

Otherwise I'm unsure what you are trying (things such as
calling gtk_widget_hide_all() and then immediately
gtk_widget_destroy() on the dialog do not make much sense to
me).

Yeti

--
http://gwyddion.net/
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: gtk header files

2007-08-27 Thread Yeti
On Sun, Aug 26, 2007 at 11:30:45PM -0700, hong zhang wrote:
 I want to compile an embedded browser using gtk-1.2
 but package download from www.gtk.org does not have
 header files for gtk package.

It definitely has them.

 Does anyone know where I can get gtk header files?

http://www.gtk.org/download/ has `GTK+ 1.2' section, which
points to the source code.  The souce code contains all the
header files and other stuff required for development.  It's
the complete Gtk+ 1.2 source code.

Anyway, doesn't your operating system come with a Gtk+ 1.2
development package?  It is *much* easier to use than to
compile Gtk+ 1.2 from source code.

Yeti

--
http://gwyddion.net/
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: GtkColorButton and GtkFontButton problems

2007-08-24 Thread Yeti
On Fri, Aug 24, 2007 at 09:10:30AM +0200, Miroslav Rajcic wrote:
 I am having two GtkColorButton and GtkFontButton widgets on my options 
 dialog.
 
 My problem is that when user clicks to one of those widgets, selection 
 dialog that opens on the click, is opened correctly, but is being displayed 
 underneath the options dialog
 (which uses gtk_window_set_keep_above(GTK_WINDOW (Options), TRUE); )!
 
 Is there any way to get the signal when such selector windows are displayed, 
 and to bring them into the top of the stack (I want to keep keep_above style 
 on Option dialog) ?

If this happens on MS Windows and the dialogs are modal,
a workaround is to make the parent dialog temporarily
non-modal for the time the child dialog is displayed.
However, it's not so easy to do this for the selectors as
they do not provide any interface regarding the child
dialogs.

 Is this a bug in those widgets ? Should I report this as a bug ?

More likely elsewhere, I encountered it with various kinds
of modal dialogs, e.g. child message dialogs and my own
subdialogs.  If you can create a minimal example and the
bug has not been reported yet, then please report.

Yeti

--
http://gwyddion.net/
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: multiple selection and drag-n-drop

2007-08-23 Thread Yeti
On Thu, Aug 23, 2007 at 10:29:47AM -0400, Allin Cottrell wrote:
 I suppose somebody else must have come across this issue -- and if 
 so I'd be grateful for any ideas.
 
 I have a treeview in which GTK_SELECTION_MULTIPLE is enabled.  
 And there's a meaning attached to dragging elements from this 
 treeview to another window.  
 
 The design problem is that if the user has selected multiple 
 elements in the treeview (using shift- or ctrl-click), and then 
 she presses the mouse button to start a drag, that press undoes 
 the multiple selection, and only the element directly under the 
 mouse pointer actually gets dragged.

A very old bug.  See http://bugzilla.gnome.org/show_bug.cgi?id=70479

Yeti

--
http://gwyddion.net/
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: *** Pango not found. Pango built with Cairo support is required

2007-08-23 Thread Yeti

Behdad Esfahbod wrote:
  Ok, pkg-config is complaining that pangocairo is not found; but
  pangocairo.pc can be found in pango-1.18.0.
  configure did create the file but did not install it with make install. Is
 
 That's very unlikely.

Maybe I am not following here... however, pangocairo.pc is
created always, but actually installed only if you compile
pango with cairo.  I cannot see any mention of how pango was
configured in the previous e-mails, so who knows.

Yeti

--
http://gwyddion.net/
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: drawing on X11, above all applications, emulating an alpha channel

2007-08-21 Thread Yeti
On Tue, Aug 21, 2007 at 12:28:30AM -0700, Ana wrote:
 
 and...  if possible, update the image, from time to time, with whatever
 X11 would be displaying if my application weren't there, in order to
 emulate numbers/graphics painted over an X-level-alpha-channel.

Ah, I missed you want alpha channel.  IMO emulating it now
when people are starting to use compositing managers and
RGBA visuals would be a waste of time.  Look at
http://macslow.thepimp.net/?page_id=23

Yeti

--
http://gwyddion.net/
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: how to scroll a gtk_scrolled_window ?

2007-08-19 Thread Yeti
On Sun, Aug 19, 2007 at 09:32:20PM +0800, Gregory Hosler wrote:
 I have a gtk_scrolled_window() in a window, and occasionally there times when 
 I
 wish to force the window to be at the last line, regardless of where the
 scrollbar is presently set.
 
 In particular, I have widgets below the scrolled_window that hide/show
 themselves as times, and when then show themselves, the scrolled window will
 shrink a little (that's ok), but the scrolling effect is such that the top 
 line
 of the scrolled window remains in place, and the bottom lines are now scrolled
 out of the viewport. When this happens, I want to automatically, scroll down 
 to
 the last line of the view port.
 
 Any idea as to how might I achieve this ?
 
 I have looked at the gtk_scrolled_window page for some methods of controlling
 the viewport position and/or the scrollbar and didn't see anything that looked
 like what I wanted. I also followed up with looking at the scrollbar routines,
 to see if there was anything there, and nothing jumped out at me and looked 
 like
 what i was looking for.

gtk_scrolled_window_get_[hv]adjustment() return the
adjustments.  Set them to the desired positions.  See the
description of GtkScrolledWindow for how it uses them
(paragraph 5: The position of the scrollbars is
controlled...).

Yeti

--
http://gwyddion.net/
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Editing in GtkTreeView - Automatic Edit and Unwanted Edit Box?

2007-08-19 Thread Yeti
On Sun, Aug 19, 2007 at 05:16:49PM +0100, Tony Cowderoy wrote:
 
 First question - is there any (preferably easy) way with a GtkTreeView 
 to make any editable cell that is selected automatically enter edit mode 
 and automatically commit the changes when focus moves elsewhere?

IIRC this is tricky to get right, so easy probably no.
Hopefuly someone who has a working example will post it...

 Second - in the application that I'm trying to develop I have a 
 GtkTreeview with data in a GtkListStore and some, but not all, of the 
 cells editable.  If I have a cell selected, but not opened for editing 
 (this includes non-editable cells) and I then start typing, an editable 
 box appears in the bottom right-hand corner of the GtkTreeView, which 
 displays what I'm typing.  If I press enter, it goes away and the text 
 of the selected cell is not updated.  Does anyone know why this odd 
 behaviour is happening and what I can do to stop it?

I suppose it's the search box.  In such case:

  gtk_tree_view_set_enable_search(treeview, FALSE);

(or set the corresponding property).

Yeti

--
http://gwyddion.net/
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Ok to redirect http://developer.gnome.org/doc/API/2.0/ to GNOME Library?

2007-08-15 Thread Yeti
On Tue, Aug 14, 2007 at 11:26:03PM +0200, Frederic Peters wrote:
 David Nečas (Yeti) wrote:
  
  What is the unversioned link to the latest available API
  reference of a library?
 
 http://library.gnome.org/developers/gtk/ is a page listing available
 versions of the documentation;

But this does not allow to construct links, because

  
http://library.gnome.org/developers/gobject/gobject-The-Base-Object-Type.html#GObject

does not exist, only versioned URLs such as

  
http://library.gnome.org/developers/gobject/2.10/gobject-The-Base-Object-Type.html#GObject

I want to fix a particular cross-library link, for instance

  
/home/mclasen/gnome-2.18/install/share/gtk-doc/html/gobject/gobject-The-Base-Object-Type.html#GObject

in Gtk+ API reference to something equivalent to

  
http://developer.gnome.org/doc/API/2.0/gobject/gobject-The-Base-Object-Type.html#GObject

So, if only versioned URLs were available, the links would
have to point to a random version of GObject, determined by
what the guy making dists had installed.

 do you believe a latest symlink would
 be useful ?  As well as a stable symlink ?

A stable or latest alias would be definitely useful, but...
Let me explain: The conclusion on gtk-doc was that it is not
feasible to keep the on-line location of everything in
gtk-doc, instead libraries should advertise their on-line
reference base URLs (if there is any) and a mechanisms for
this and for base URL switching/correction have been already
implemented.

This would work well with the current state when each
library has one on-line location (containing the latest
version).  The new scheme leaves me wondering what to do
when one just wants to link to GObject (gboolean, whatever)
documentation.  What is the canonical link?  Is there any?

Also, the possibility to use relative links such as

  ../gobject/gobject-The-Base-Object-Type.html#GObject

that would work both on-line and in the typical off-line
installation has been lost as the new URLs are one directory
level more separated, though this is not a big problem.

Yeti

--
http://gwyddion.net/
___
gtk-devel-list mailing list
gtk-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-devel-list


Re: configure_event for eventbox

2007-08-15 Thread Yeti
On Wed, Aug 15, 2007 at 12:17:00PM -0700, Darren Hart wrote:
 I'm trying to create a widget that lists checkbuttons with labels in a
 tabular format that will adjust it's layout as the window is resized.  I am
 currently using a table widget and have a working resize() method.
 Unfortunately, I haven't been able to capture any kind of a resize event
 other than size_allocate() which unfortunately caused an endless loop since
 my resize()ing the table caused another size_allocate() call apparently.

But it should converge, innit?  If it doesn't converge, you
have probably a deeper problem.  Also don't resize the table
if you don't want to actually resize it (i.e. the new sizes
would be the same), this might help.  Look at Gimp's toolbox
widget which does something similar.

 Reading the docs suggest that what I want to use is a configure_event
 handler

Only windows get configure events.  (And GtkDrawingArea for
some obscure reason, but it gets it only because it
synthetizes it and sends to itself.)

Yeti

--
http://gwyddion.net/
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: How to use GtkPrint

2007-08-14 Thread Yeti
On Tue, Aug 14, 2007 at 11:55:33AM +0400, Alexander S.Kresin wrote:
  Does this GtkPrint exist at all :) ?
  I had trying to compile that printing.c, but have found that
  appropriate header files ( gtkprintcontext.h, gtkprintoperation.h,
  ... ) doesn't present in my system, through gtk2-devel-2.8.8 is
  installed ...

http://www.gtk.org/gtk-2.10-announcement.html

See namely `What is new in GTK+ 2.10'.  Also

http://developer.gnome.org/doc/API/2.0/gtk/gtk-High-level-Printing-API.html

is full of `Since 2.10' and `Printing support was added in
GTK+ 2.10.'  So where exactly you checked if it exists in
your version of Gtk+?

Yeti

--
http://gwyddion.net/
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Ok to redirect http://developer.gnome.org/doc/API/2.0/ to GNOME Library?

2007-08-14 Thread Yeti
On Tue, Aug 14, 2007 at 10:31:52PM +0200, Olav Vitters wrote:
 GTK+ is the main user of the developer API reference with links from:
   http://www.gtk.org/api/
 
 I want to redirect:
   http://developer.gnome.org/doc/API/2.0/
 to:
   http://library.gnome.org/developer/
 
 See for instance the GTK+ API reference on:
   http://library.gnome.org/developers/gtk/2.11/

What is the unversioned link to the latest available API
reference of a library?

Will old documentation versions be kept there?

What is the Right Way to reference on-line documentation
of other libraries when there are version numbers now?
Do I have to pick a particular version?

Work is currently under way in gtk-doc to neutralize the
cross-references to other libraries to on-line locations
when making dists -- and to fix them in `make install' to
local files if the corresponding local documentation is
found (without having to perform the dreadful HTML rebuild).
In most cases this means people will get working cross-links
instead of random hrefs such as
/home/mclasen/gnome-2.18/install/share/gtk-doc/html/glib
However, if they are left with the on-line cross-links,
these links should be functional.

Yeti

--
http://gwyddion.net/
___
gtk-devel-list mailing list
gtk-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-devel-list


Re: Problems Re-populating GtkTreeView

2007-08-12 Thread Yeti
On Sun, Aug 12, 2007 at 03:16:45PM -0400, Andrew Rowland wrote:
 I've been working at this for several days now and I'm hoping someone
 can guide me down the right path (although I'm not opposed to just being
 given the answer).  Let me say TIA now and I apologize if I've included
 too much code, error messages, etc.

You are the first after a long time who bothered to use
a debugger himself before posting to the list and included
the actual code, the actual error messages and noted the
place where it crashes (sort of) in the post.

This is not a reason for an apology, but for opening
a bottle of champagne...

BTW, ever heard of libgda/gnome-db?

 ...
 
 The following is thrown in the terminal.
 
 (reliafree:32523): Gtk-CRITICAL **: gtk_tree_model_get_iter: assertion
 `GTK_IS_TREE_MODEL (tree_model)' failed
 ...

Evidently, the tree model does not exist any more here (the
other likely possibility would be passing a wrong
pointer as the model, but I just happen to know).  And
that's because here

 g_object_unref( part_model );

you release your reference to it.  The only remaining
reference is that owned by the treeview, which is released
when the treeview is closed (destroyed) and then the model
goes poof because it is not used by anything (more
precisely, nothing claims any use of it -- you still think
you use it, but since you do not own any reference, nothing
knows you want to use it).

Keep your reference until you are done with the model (and
don't release references more times than you took them).
Unreferencing the model immediately after
gtk_tree_view_set_model() is convenient when you want the
model to be destroyed together with the view and/or when
a different model is set -- but that's the opposite of what
you want.

Also, clearing the model and filling it with something
completely different will not save much.  Creating a new
model, filling it, calling gtk_tree_view_set_model() and
unreferencing the new model can be even more efficient.

Yeti

--
http://gwyddion.net/
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: gtk_tree_model_iter_next works, what should I do about prev]

2007-08-10 Thread Yeti
 = gtk_cell_renderer_text_new();
g_object_set(G_OBJECT(renderer), xalign, 1.0, NULL);
column = gtk_tree_view_column_new_with_attributes(Size, renderer,
  text, COLUMN_SIZE,
  NULL);
gtk_tree_view_append_column(GTK_TREE_VIEW(view), column);

renderer = gtk_cell_renderer_text_new();
column = gtk_tree_view_column_new_with_attributes(Date, renderer,
  NULL);
gtk_tree_view_column_set_cell_data_func(column, renderer,
render_date, NULL, NULL);
gtk_tree_view_append_column(GTK_TREE_VIEW(view), column);

selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(view));
gtk_tree_selection_set_mode(selection, GTK_SELECTION_BROWSE);
g_signal_connect(selection, changed,
 G_CALLBACK(selection_changed), NULL);

gtk_widget_show_all(window);
gtk_main();

return 0;
}


Yeti

--
http://gwyddion.net/
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: How to make GtkTreeview columns invisible

2007-08-10 Thread Yeti
On Fri, Aug 10, 2007 at 05:47:07PM +0530, Prasanna Kumar K wrote:
 I don't want any columns of GtkTreeView visible in my application. I want 
 only rows to be shown.
 is it possible?

It was answered when you asked the first time:

  http://mail.gnome.org/archives/gtk-list/2007-August/msg00042.html

 This message (including any attachment) is confidential and may be legally 
 privileged.  Access to this message by anyone other than the intended 
 recipient(s) listed above is unauthorized.  If you are not the intended 
 recipient you are hereby notified that any disclosure, copying, or 
 distribution of the message, or any action taken or omission of action by you 
 in reliance upon it, is prohibited and may be unlawful.  Please immediately 
 notify the sender by reply e-mail and permanently delete all copies of the 
 message if you have received this message in error.

The author of this dislaimer is hereby notified that I will
continue to disclose, copy and distribute anything I receive
from a public mailing list.  If he/she/it does not want this
disclaimer to lose any threatening weight (it does not have
any legal weight anyway), he/she/it will have to sue me.

Yeti

--
http://gwyddion.net/
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: patch-review

2007-08-10 Thread Yeti
On Fri, Aug 10, 2007 at 10:03:05PM +0300, Stefan Kost wrote:
 
 The issue is that probably lots of libs need to call some foreign init. If I
 e.g. don't do that for gst_init (gstreamer) that all my gstreamer subclassed
 types would show up as gobjects.

I think we found a way to get the code there, although it
is a bit ugly.

However, I am still curious why automatic parent type
registration and resolution does not work for you. Try the
attached program (it does not call gst_init() or anything)
and tell me where it gets the types wrong -- or explain what
`would show up as gobjects' means, they are GObject based,
aren't they?

(It prints a thread-initialization error, but that's another
matter.)

Yeti

--
http://gwyddion.net/


=[ Makefile ]===
DEPS = gstreamer-base-0.10 gstreamer-net-0.10 gstreamer-controller-0.10 
gstreamer-dataprotocol-0.10 gmodule-2.0
LIBTOOL = libtool --tag=CC
PKG_CONFIG = pkg-config
CC = gcc
CFLAGS := -Wall -W -O -ggdb $(shell $(PKG_CONFIG) --cflags $(DEPS))
LDFLAGS := $(shell $(PKG_CONFIG) --libs $(DEPS))

gsttypes: gsttypes.c
$(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c -o gsttypes.o gsttypes.c
$(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -export-dynamic -o gsttypes 
gsttypes.o

clean:
rm -f gsttypes gsttypes.o gsttypes.lo
rm -rf .libs
=[ gsttypes.c ]=
#include stdlib.h
#include gmodule.h
#include glib-object.h

static const char *typenames[] = {
activate_mode, adapter, alloc_trace_flags, assoc_flags,
base_sink, base_src, base_transform, bin_flags, bin,
buffer_flag, buffer, bus_flags, bus, bus_sync_reply,
caps_flags, caps, child_proxy, clock_entry_type, clock_flags,
clock, clock_return, collect_pads, controller, core_error,
data_queue, date, debug_color_flags, debug_level, double_range,
dp_version, element_factory, element_flags, element, event,
event_type_flags, event_type, flow_return, format, fourcc,
fraction, fraction_range, g_error, ghost_pad,
implements_interface, index_certainty, index_entry,
index_entry_type, index_factory, index_flags, index,
index_lookup_method, index_resolver_method, int_range,
iterator_item, iterator_result, library_error, message,
message_type, mini_object_flags, mini_object, net_client_clock,
net_time_provider, object_flags, object, pad_direction,
pad_flags, pad, pad_link_return, pad_presence,
pad_template_flags, pad_template, parse_error, pipeline_flags,
pipeline, plugin_error, plugin_feature, plugin_flags, plugin,
push_src, query, query_type, rank, registry, resource_error,
seek_flags, seek_type, segment, state_change,
state_change_return, state, static_caps, static_pad_template,
stream_error, structure, system_clock, tag_flag, tag_list,
tag_merge_mode, tag_setter, task, task_state, type_find_factory,
type_find, type_find_probability, uri_handler, uri_type,
value_array, value_list, xml,
};

typedef GType (*TypeRegistrar)(void);

static void
dump_type(GType type)
{
guint i, j, nids, *ids;

i = 0;
do {
g_print(%s%s, i ?  -  : , g_type_name(type));
if (!i  (G_TYPE_IS_INSTANTIATABLE(type)
   || G_TYPE_IS_INTERFACE(type))) {
ids = g_signal_list_ids(type, nids);
for (j = 0; j  nids; j++) {
g_print([%s], g_signal_name(ids[j]));
}
g_free(ids);
}
i++;
} while ((type = g_type_parent(type)));
g_print(\n);
}

int
main(void)
{
TypeRegistrar typefunc;
GString *symbolstr;
GType type;
GModule *handle;
GArray *types;
guint i;

g_type_init();

handle = g_module_open(NULL, G_MODULE_BIND_LAZY);
if (!handle) {
g_printerr(Cannot open self: %s\n, g_module_error());
return EXIT_FAILURE;
}

symbolstr = g_string_new(NULL);
types = g_array_new(FALSE, FALSE, sizeof(GType));
for (i = 0; i  G_N_ELEMENTS(typenames); i++) {
g_string_assign(symbolstr, gst_);
g_string_append(symbolstr, typenames[i]);
g_string_append(symbolstr, _get_type);
if (!g_module_symbol(handle, symbolstr-str, (gpointer*)typefunc)) {
g_printerr(Cannot get %s: %s\n, symbolstr-str, g_module_error());
continue;
}
type = typefunc();
if (!type) {
g_printerr(%s returns 0\n, symbolstr-str);
continue;
}
g_array_append_val(types, type);
if (G_TYPE_IS_CLASSED(type))
g_type_class_ref(type);
if (G_TYPE_IS_INTERFACE(type))
g_type_default_interface_ref(type);
}
g_string_free(symbolstr, TRUE);

g_print( INSTANTIABLE \n);
for (i = 0; i  types-len; i++) {
type = g_array_index(types, GType, i);
if (G_TYPE_IS_INSTANTIATABLE(type)  !G_TYPE_IS_ABSTRACT(type))
dump_type(type);
}
g_print

Re: color of vscrollbar

2007-08-08 Thread Yeti
On Wed, Aug 08, 2007 at 12:24:11PM +0200, Jonathan Winterflood wrote:
 Fair enough, but for work-related stuff, we should (and should be able
 to) use the work adress, it's much easier than having to check 2 email
 adresses, one of which would probably have to be a webmail.
 And quite frankly, how hard is it to just ignore the message, knowing that
 you're on a public list?
 
 I personally subscribe to 2 lists for personal use w/ my gmail @, and 3
 work-related with my corporate @
 On the work-related one, many ppl have these messages appended, but no one
 really minds.

Hereby I inform you I do really mind.

Actually, rejecting all messages with this confidental
bullshit is a perfectly legally safe thing to do and mailing
list software should do it automatically.

Yes, the goal is really to cause negative effect to those
companies in the long term, by reducing employee
productivity or other means.  I am even thinking about
reporting all e-mail with this confidental bullshit (which
is usually significantly longer than the message itself)
as spam.

Yeti

--
http://gwyddion.net/
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Font width in gtk 2.x

2007-08-07 Thread Yeti
On Tue, Aug 07, 2007 at 05:08:17PM +0200, [EMAIL PROTECTED] wrote:
 Iam porting my application from gtk 1.x to gtk 2.x
 what is th eqivalent api for
 
 gdk_string_width(widget-style-font,m)  in gtk 1.x
 
 in gtk 2.x
 I want to dynamicly set the size for Entry Widgets the
 lenghts of the selected Font of the application.

gtk_entry_set_width_chars() cannot be used?

Yeti

--
http://gwyddion.net/
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Who to replace deprecated functions

2007-08-07 Thread Yeti
On Fri, Aug 03, 2007 at 06:13:08PM +0200, Joerg Anders wrote:
 
 2.) How can I replace gtk_menu_append()? In concrete case I want
  to add and remove some GtkMenuItems dynamically. After a long
  search I found that a combination of:
 
gtk_action_group_add_action(...)
gtk_ui_manager_add_ui_from_string(...)
 
  can append a new menu item. But how can I remove a menu item?

This one is easy: gtk_ui_manager_add_ui_from_string()
returns a merge id.  And that's what you pass to
gtk_ui_manager_remove_ui() remove it again.

Yeti

--
http://gwyddion.net/
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Concept behind GtkTreeView

2007-08-07 Thread Yeti
On Tue, Aug 07, 2007 at 04:00:48PM +0530, Prasanna Kumar K wrote:
 is it necessary that I should have column headers/name in my tree.
 I want only set of labels and a vertical scroll bar attached to my tree.

If you want (or don't want) column headers, use
gtk_tree_view_set_headers_visible().

 This message (including any attachment) is confidential and may be legally
 privileged.  Access to this message by anyone other than the intended
 recipient(s) listed above is unauthorized.  If you are not the intended
 recipient you are hereby notified that any disclosure, copying, or 
 distribution
 of the message, or any action taken or omission of action by you in reliance
 upon it, is prohibited and may be unlawful.  Please immediately notify the
 sender by reply e-mail and permanently delete all copies of the message if you
 have received this message in error.

I'm replying to a public mailing list.  Sue me.

Yeti

--
http://gwyddion.net/
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: problem about SIGSEGV and backtrace

2007-08-06 Thread Yeti
On Mon, Aug 06, 2007 at 11:10:46AM +0800, [EMAIL PROTECTED] wrote:
 I want to use SIGSEGV and backtrace  to debug my programme. But I do not 
 know how to use them. I'm running GTK 2.6.4 and Glib 2.6.4 on a Debian woody.
 
 Could you please guide me and tell where to find what I am looking for?

Compile with -ggdb flag.

  ulimit -c unlimitied

Let it crash.

  gdb PROGRAM_EXECUTABLE CORE_FILE
  bt

Details: http://sourceware.org/gdb/current/onlinedocs/gdb_toc.html

However, to see the stack trace dump on bad memory accesses,
it is easier to just run the program under valgrind, an
addition you will see also those that do not cause an
immediate segmentation fault.

Yeti

--
http://gwyddion.net/
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: Xlib: unexpected async reply (sequence #####)!

2007-08-04 Thread Yeti
On Sat, Aug 04, 2007 at 09:38:25PM +0800, Gregory Hosler wrote:
 I have a threaded gtk application. The threads create some gui (gtk
 widgets/windows). and most of the time (maybe 80%) everything works as 
 expected.
 Occassionally I will get the message on stdout
 
   Xlib: unexpected async reply (sequence #)!
 
 the ### is an x event sequence number
 
 I am suspecting that this is because of the x calls from 2 different threads.
 
 Is this a known problem?
 
 Any way around this ? (I thought gtk was supposed to be thread ok :)

The answer depends on your defintions of `OK', `known' and
`problem':
- Gtk+ is thread-aware
- Gtk+ is not thread-safe

If you operate on the GUI from multiple threads:
- you are responsible for the locking on Unix/X
- it will just not work on MS Windows

See

  http://developer.gnome.org/doc/API/2.0/gdk/gdk-Threads.html

People typically operate on the GUI only from the main
thread (i.e. running gtk_main()) and pass work requests to
it via g_idle_add() or some other queue mechanism.

This topic is discussed here every other week, see the list
archives.

Yeti

--
http://gwyddion.net/
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: problem with status bar

2007-08-04 Thread Yeti
Luiz Rafael Culik Guimaraes wrote:
 so the pack should be in this order

 vbox = gtk_vbox_new (FALSE, 0);
   gtk_container_add (GTK_CONTAINER(hWnd), vbox);
   if (bStatus)
   {
   statusbar = gtk_statusbar_new();
  box = (GtkFixed*)gtk_fixed_new();

 gtk_box_pack_start( GTK_BOX (vbox), (GtkWidget*)statusbar, TRUE, TRUE, 0);

   gtk_box_reorder_child(GTK_BOX(vbox) statusbar,);
   gtk_box_pack_end( GTK_BOX(vbox), (GtkWidget*)box, TRUE, TRUE, 0 );

   }
   else
   {
  box = (GtkFixed*)gtk_fixed_new();
   gtk_box_pack_end( GTK_BOX(vbox), (GtkWidget*)box, TRUE, TRUE, 0 );
 }

This probably achieves the desired goal, but it's not what
I meant.

  if (should_have_statusbar) {
  statusbar = create statusbar;
  gtk_box_pack_end(vbox, statusbar, ...);
  }
  gtk_box_pack_end(vbox, box, ...);

That's all.

In addition, box does not look like something logically
stacked from the bottom.  So unlike the statusbar which
should be packed with gtk_box_pack_end(), box should not
be packed with gtk_box_pack_end().

If you pack box with gtk_box_pack_start(), then the order in
which you add the widgets does not matter at all.  One is
packed from top, the other from bottom so they always end up
in the desired positions.  That's incidentally what your
original code does, except it does it *upside down*.

Why you attempt to pack the statusbar that belong to the
bottom with gtk_box_pack_start() and the box that is stacked
from the top with gtk_box_pack_end()?

Yeti

--
http://gwyddion.net/
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


  1   2   3   4   5   6   7   8   9   >