Re: GTK Drag Filename Drop from other Windows

2008-08-07 Thread Enrico Tröger
On Wed, 6 Aug 2008 14:36:53 +0200, Norbert Schultz
[EMAIL PROTECTED] wrote:

Hi,
 
 when I enable a Widget to receive Drops using drag_dest_set with
 target entries STRING, text/plain, text/html,
 application/x-rootwin-drop (just copied them from an example) I can
 copy  paste text snippets into my widget, from the same Widget and
 from others and receive them using the signal_data_received signal.
 But what I really want is the possibility to drag in filenames, like
 e.g. Gimp does. Currently filenames from Konqueror or the Gnome
 FileBrowser are denied. Anyone a tip?

Try adding text/uri-list to the target entries.

Regards,
Enrico

-- 
Get my GPG key from http://www.uvena.de/pub.key
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

GChecksum assertion failed

2008-08-07 Thread Luka Napotnik
Hello.

I have this small example where I create a GChecksum and apply some
data. The problem is when I request the digest, the program prints out
the following error:

(process:8422): GLib-CRITICAL **: g_checksum_get_digest: assertion
`*digest_len = len' failed

My GChecksum code is:

char data[] = Hello, World;
int len;
GChecksum *checksum;
guint8 *b_digest;
gsize b_digest_len;
 
checksum = g_checksum_new(G_CHECKSUM_MD5);
len = strlen(data) + 1;
b_digest_len = len;
g_checksum_update(checksum, data, len);
g_checksum_get_digest(checksum, b_digest, b_digest_len);


I initialize the digest len with the length of data. Am I doing
something wrong? Please help.

Greets,
Luka

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


Re: GChecksum assertion failed

2008-08-07 Thread Emmanuele Bassi
On Thu, 2008-08-07 at 11:08 +0200, Luka Napotnik wrote:
 Hello.
 
 I have this small example where I create a GChecksum and apply some
 data. The problem is when I request the digest, the program prints out
 the following error:
 
 (process:8422): GLib-CRITICAL **: g_checksum_get_digest: assertion
 `*digest_len = len' failed
 
 My GChecksum code is:
 
 char data[] = Hello, World;
 int len;
 GChecksum *checksum;
 guint8 *b_digest;
 gsize b_digest_len;
  
 checksum = g_checksum_new(G_CHECKSUM_MD5);
 len = strlen(data) + 1;
 b_digest_len = len;
 g_checksum_update(checksum, data, len);
 g_checksum_get_digest(checksum, b_digest, b_digest_len);
 
 
 I initialize the digest len with the length of data. Am I doing
 something wrong?

yes, you're not reading the documentation:

  @digest_len:

  The caller initializes it to the size of @buffer. After the call it
  contains the length of the digest.

the buffer is a pointer to an array of bytes, since
g_checksum_get_digest() doesn't handle the string you pass to
g_checksum_update(). as GChecksum handles different hashing algorithms,
the array size must be at least big enough to fit the actual size of the
digest. the size of the digest for a particular checksum algorithm is
obtained using:

  gsize digest_len = g_checksum_type_get_length (G_CHECKSUM_MD5);

which can then be used to allocate an array of bytes:

  guint8 *digest = g_new (guint8, digest_len);

and then you can get the digest:

  g_checksum_get_digest (checksum, digest, digest_len);

you then obviously need to free the digest when you're done using it:

  g_free (digest);

this obviously implies you want the digest as a raw binary vector. if
you want the hexadecimal version in string you're much better off using
g_compute_checksum_for_string() instead.

ciao,
 Emmanuele.

-- 
Emmanuele Bassi,
W: http://www.emmanuelebassi.net
B: http://log.emmanuelebassi.net

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


gtk_file_chooser_button_new unexplicabile warnings

2008-08-07 Thread gigiBecali

Hello. I am developing an application in Mandriva OS and I've got this
strange problem in my program : I'm using gtk_file_chooser_button_new
function to create a choose folder button from which i can choose a
directory where to save some files for example. It works but when I run the
application as root it gives me 2 identical warnings : no such file or
directory. If I run the app as user then i won't receive this warnings. It
could be problem with permissions somewhere? Or what could be the problem
because I've tried a lot of methods to solve this problem but nothing good.
-- 
View this message in context: 
http://www.nabble.com/gtk_file_chooser_button_new-unexplicabile-warnings-tp18826746p18826746.html
Sent from the Gtk+ - Apps Dev mailing list archive at Nabble.com.

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


How to convert GtkWidget into GdkPixbuf

2008-08-07 Thread Samuel Rabadán
Hi, I don’t really know if I should send this e-mail to that address but
I do need help!! that I’m trying to print a report that comes from an
application built in GtkHTML which has a bug that makes printing not to
be like they are showed in the application. I found some code but it
doesn’t work with scrolled bars. I’ve tested nearly everything to make
it work with no results, obviously :-), and my last idea is converting
all to an image and work from there.
 
Please try to help me if you have some relevant information, I’m driving
crazy myself trying to solve it.
Sorry for my English, I hope you can understand all I’m trying to tell
you :-).
 
Thanks in advance.
Samuel Rabadán.
 
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Finding a widget in a Glade interface

2008-08-07 Thread dhk

Nicola Fontana wrote:

On Sun, 03 Aug 2008 19:10:37 +
dhk [EMAIL PROTECTED] wrote:
Is gtk_container_get_children() suppose to return a list of all children 
including children of children down to the last leaf or just the 
immediate children?  I only seem to get the immediate children.  Will 
gtk_container_foreach() or gtk_container_forall() go down all levels to 
the last leaf or just the next level?


Both work on immediate children. You must call them recursively,
something like that:

void
action(GtkWidget *widget)
{
  /* Do something */
}

void
callback(GtkWidget *widget)
{
  action(widget);
  if (GTK_IS_CONTAINER(widget))
  gtk_container_foreach(GTK_CONTAINER(widget),
callback, NULL);

}

gtk_container_foreach() is the way: the forall() version
traverses also internal stuff I think you don't care about.

Ciao


Almost there.  I wrote a function, findWidget() below, to find a widget
by name.  This was needed because I'm adding objects to the interface
after Glade has built the interface. It works, but I'm sure it's laeking
memory like a sieve.  Whenever I try to free the memory I have problems.
 How and where should the memory get freed?  Can I get a code review?

/* Recursivly find a widget by name and return it's reference. */
GtkWidget * findWidget(GtkWidget *p, const char *str) {
  GList *children=NULL;
  GList *child=NULL;
  GtkWidget *w=NULL;

  children=gtk_container_get_children(GTK_CONTAINER(p));
  child=children;

  while(child) {

w=GTK_WIDGET(child-data);
if(w!=NULL  w-name!=NULL) {
  g_debug(Name is {%s}\n, w-name);
}

if(w!=NULL  GTK_IS_CONTAINER(w)  w-name!=NULL  strcmp((char
*)w-name, str)!=0) {
  w=findWidget(w, str);
  if(w!=NULL  w-name!=NULL  strcmp((char *)w-name, str)==0) {
break;
  } else {
child=g_list_next(child);
  }
} else {
  break;
}

  } /* end of while() */
  child=g_list_next(child);

  // PROBLEMS freeing memory
  //g_list_foreach(children, (GFunc)freeGList, NULL); // ERROR: double
free or corruption
  //g_list_foreach(children, (GFunc)g_free, children-data); // ERROR
  //g_list_free(children); // ERROR

  return w;
}

/* Callback for freeing memory in a GList. */
void freeGList(gpointer *data, gpointer *user_data) {
  GList *gl=(GList *)data;

  g_free(gl-data);
  gl-data=NULL;
}

Thanks,

Dave



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


Re: Can't install gtkmm (package manager won't install libgtkmm-2.4-dev)

2008-08-07 Thread Garth's KidStuff
 This is unusual on a stable Ubuntu release. Anyway, Ubuntu's launchpad
 is the best place to get help about it, I guess.

Thanks Murry,

I re-installed Ubuntu 8.04 from the CD, and then installed gtkmm BEFORE
allowing the Ubuntu updates to install.  I've submitted a bug in the proper
Ubuntu place.

On Mon, 2008-08-04 at 16:12 -0700, Garth's KidStuff wrote:
 Hi All,

 Help!  I'm trying to install a build environment on a machine I just
 installed Ubuntu 8.04.1 on and the package manager won't install
 libgtkmm-2.4-dev.  It gives the following message:

 libgtkmm-2.4-dev:
  Depends: libatk1.0-dev but it is not going to be installed
  Depends: libcairomm-1.0-dev but it is not going to be installed
  Depends: libglibmm-2.4-dev but it is not going to be installed
  Depends: libgtk2.0-dev but it is not going to be installed

 If I try to install some of the dependencies, I get this message:
 libglib2.0-dev:
   Depends: libglib2.0-0 (=2.16.3-1ubuntu2) but 2.16.4-0ubuntu2 is to be
 installed

 This used to work -- I installed this build environment on a machine just
a
 couple of months ago and know I'm, not doing anything different.  Anyone
 have any ideas?

 Thanks tons in advance -- this is seriously killing my productivity!


--
[EMAIL PROTECTED]
www.murrayc.com
www.openismus.com


-- 
Garth Upshaw
Garth's KidStuff
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


RE: GTK Drag Filename Drop from other Windows

2008-08-07 Thread Norbert Schultz
Enrico Tröger:
 
 Hi,
  
  [.. Dropping from other clients doesn't work ..]
 
 Try adding text/uri-list to the target entries.
 
 Regards,
 Enrico
 

Ah, merci that works :)

Greetings,
Norbert 

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