Re: GList strange behavior

2012-08-16 Thread Tadej Borovšak
Hi.

Not sure what is troubling you here. GList is represented by pointer
to first element or NULL if list is empty. And when you append items
to the list, the address of the list stays the same, since first
element of the list is unchanged (exception to this is when append
first element to an empty list).

Some code to explain some things:

GList *list = NULL /* Empty list */
list = g_list_append (list, GINT_TO_POINTER (1)); /* Add first
element, list points to some ADDR1 */
list = g_list_append (list, GINT_TO_POINTER (2)); /* Add second
element, list still points to ADDR1 */
...

Cheers,
Tadej

-- 
Tadej Borovšak
blog.borovsak.si
tadeb...@gmail.com
tadej.borov...@gmail.com
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

getting the icon pixbuf for a file

2012-08-16 Thread Andreas Rönnquist
Hey

I am trying to get the icon bitmap for a file and insert it into a
TreeView widget - That is the pixbuf for the mime-type of a file. Is
there any examples of doing this in plain C using GTK/GLib?

I am satisfied with an example that work in Linux - Win32 isn't equally
important to me.

Help would be very much appreciated.

/Andreas
mailingli...@gusnan.se
gus...@gusnan.se
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: getting the icon pixbuf for a file

2012-08-16 Thread Just Fill Bugs

于 08/16/2012 07:58 PM, Andreas Rönnquist 写道:

Hey

I am trying to get the icon bitmap for a file and insert it into a
TreeView widget - That is the pixbuf for the mime-type of a file. Is
there any examples of doing this in plain C using GTK/GLib?

I am satisfied with an example that work in Linux - Win32 isn't equally
important to me.



http://developer.gnome.org/gdk-pixbuf/unstable/gdk-pixbuf-File-Loading.html

#include gdk-pixbuf/gdk-pixbuf.h

...
GdkPixbuf *pix;
pix = gdk_pixbuf_new_from_file (fname, None);
if (!pix) return;

...


boom! cannot be easier than that!

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

Re: GList strange behavior

2012-08-16 Thread Vlasov Vitaly
Thank you! I almost understand bahavior of GList.

I need to save newly created list poiner. So, i need to use g_list_last() to 
save it? Is there another method to save created list pointer?

В сообщении от Четверг 16 августа 2012 15:51:22 вы написали:
 Hi.
 
 Not sure what is troubling you here. GList is represented by pointer
 to first element or NULL if list is empty. And when you append items
 to the list, the address of the list stays the same, since first
 element of the list is unchanged (exception to this is when append
 first element to an empty list).
 
 Some code to explain some things:
 
 GList *list = NULL /* Empty list */
 list = g_list_append (list, GINT_TO_POINTER (1)); /* Add first
 element, list points to some ADDR1 */
 list = g_list_append (list, GINT_TO_POINTER (2)); /* Add second
 element, list still points to ADDR1 */
 ...
 
 Cheers,
 Tadej
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: getting the icon pixbuf for a file

2012-08-16 Thread Tadej Borovšak
Hi.

 I am trying to get the icon bitmap for a file and insert it into a
 TreeView widget - That is the pixbuf for the mime-type of a file. Is
 there any examples of doing this in plain C using GTK/GLib?

I think you'll want gtk_widget_render_icon() function [1]. This will
use current theme settings to load proper icon and render it. For icon
names, you can consult gtk-demo application that features icon
browser.

Cheers,
Tadej


[1] http://developer.gnome.org/gtk3/stable/GtkWidget.html#gtk-widget-render-icon

-- 
Tadej Borovšak
blog.borovsak.si
tadeb...@gmail.com
tadej.borov...@gmail.com
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: GList strange behavior

2012-08-16 Thread David Nečas
On Thu, Aug 16, 2012 at 06:49:25PM +0400, Vlasov Vitaly wrote:
 I need to save newly created list poiner.

No.

Many operations change the list head (by adding, removing, reordering,
..., elements).  In general, if an operation returns the new list head
you *must* save and use that in subsequent operations.

  So, i need to use g_list_last() to 
 save it? Is there another method to save created list pointer?

*Every* operation that may change the list head returns the new list
head.  That's the pointer to use.

Yeti

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


Re: getting the icon pixbuf for a file

2012-08-16 Thread Andreas Rönnquist
On Thu, 16 Aug 2012 22:41:28 +0800
Just Fill Bugs mozbug...@yahoo.com.au wrote:

 于 08/16/2012 07:58 PM, Andreas Rönnquist 写道:
  Hey
 
  I am trying to get the icon bitmap for a file and insert it into a
  TreeView widget - That is the pixbuf for the mime-type of a file. Is
  there any examples of doing this in plain C using GTK/GLib?
 
  I am satisfied with an example that work in Linux - Win32 isn't
  equally important to me.
 
 
 http://developer.gnome.org/gdk-pixbuf/unstable/gdk-pixbuf-File-Loading.html
 
 #include gdk-pixbuf/gdk-pixbuf.h
 
 ...
 GdkPixbuf *pix;
 pix = gdk_pixbuf_new_from_file (fname, None);
 if (!pix) return;
 
 boom! cannot be easier than that!

Sorry, I mean loading the Pixbuf of the file-type / mime-type of a
file - Not simply loading a file into a pixbuf. That is a bit more
complicated getting...

Sorry for not being more precise.

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

Re: getting the icon pixbuf for a file

2012-08-16 Thread Just Fill Bugs

于 08/16/2012 11:24 PM, Andreas Rönnquist 写道:


Sorry, I mean loading the Pixbuf of the file-type / mime-type of a
file - Not simply loading a file into a pixbuf. That is a bit more
complicated getting...



Maybe this: 
http://git.gnome.org/browse/gedit/tree/plugins/filebrowser/gedit-file-browser-utils.c



GIcon *g_file_info_get_icon(GFileInfo *info);




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

Re: getting the icon pixbuf for a file

2012-08-16 Thread Frank Cox
On Thu, 16 Aug 2012 17:24:02 +0200
Andreas Rönnquist wrote:

 Sorry, I mean loading the Pixbuf of the file-type / mime-type of a
 file - Not simply loading a file into a pixbuf. That is a bit more
 complicated getting...

Do you mean something like this?

GtkWidget *icon;
GdkPixbuf *pixbuf;
pixbuf=gdk_pixbuf_new_from_file_at_scale(filename.png,500,-1,TRUE,NULL); 
icon=gtk_image_new_from_pixbuf(pixbuf);
gtk_box_pack_start(GTK_BOX(mainmenuwidgets.action), icon, FALSE, FALSE, 30);

-- 
MELVILLE THEATRE ~ Real D 3D Digital Cinema ~ www.melvilletheatre.com
www.creekfm.com - FIFTY THOUSAND WATTS of POW WOW POWER!
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: getting the icon pixbuf for a file

2012-08-16 Thread Andreas Rönnquist
On Fri, 17 Aug 2012 00:01:08 +0800
Just Fill Bugs mozbug...@yahoo.com.au wrote:

 于 08/16/2012 11:24 PM, Andreas Rönnquist 写道:
 
  Sorry, I mean loading the Pixbuf of the file-type / mime-type of a
  file - Not simply loading a file into a pixbuf. That is a bit more
  complicated getting...
 
 
 Maybe this: 
 http://git.gnome.org/browse/gedit/tree/plugins/filebrowser/gedit-file-browser-utils.c
 
 
 GIcon *g_file_info_get_icon(GFileInfo *info);
 


Ah! That link indeed looks quite useful! Thanks!

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

Re: getting the icon pixbuf for a file

2012-08-16 Thread Andreas Rönnquist
On Fri, 17 Aug 2012 00:01:08 +0800
Just Fill Bugs mozbug...@yahoo.com.au wrote:

 于 08/16/2012 11:24 PM, Andreas Rönnquist 写道:
 
  Sorry, I mean loading the Pixbuf of the file-type / mime-type of a
  file - Not simply loading a file into a pixbuf. That is a bit more
  complicated getting...
 
 
 Maybe this: 
 http://git.gnome.org/browse/gedit/tree/plugins/filebrowser/gedit-file-browser-utils.c
 
 
 GIcon *g_file_info_get_icon(GFileInfo *info);
 

That indeed did the trick! (See attached file for the functions I used.)

Thanks guys! 

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

Re: getting the icon pixbuf for a file

2012-08-16 Thread Andreas Rönnquist
On Thu, 16 Aug 2012 19:43:26 +0200
Andreas Rönnquist mailingli...@gusnan.se wrote:

 On Fri, 17 Aug 2012 00:01:08 +0800
 Just Fill Bugs mozbug...@yahoo.com.au wrote:
 
  于 08/16/2012 11:24 PM, Andreas Rönnquist 写道:
  
   Sorry, I mean loading the Pixbuf of the file-type / mime-type of a
   file - Not simply loading a file into a pixbuf. That is a bit more
   complicated getting...
  
  
  Maybe this: 
  http://git.gnome.org/browse/gedit/tree/plugins/filebrowser/gedit-file-browser-utils.c
  
  
  GIcon *g_file_info_get_icon(GFileInfo *info);
  
 
 That indeed did the trick! (See attached file for the functions I
 used.)
 

Oh, the attachment didn't get to the list - This is how I did it:


/**
 *
 */
GdkPixbuf *get_pixbuf_from_icon(GIcon *icon, GtkIconSize size)
{
GdkPixbuf *result=NULL;
GtkIconTheme *theme;
GtkIconInfo *info;
gint width;

if (!icon)
return NULL;

theme=gtk_icon_theme_get_default();
gtk_icon_size_lookup(size,width,NULL);

info=gtk_icon_theme_lookup_by_gicon(theme,
icon,
width,
GTK_ICON_LOOKUP_USE_BUILTIN);

if (!info)
return NULL;

result=gtk_icon_info_load_icon(info,NULL);
gtk_icon_info_free(info);

return result;
}


/**
 *
 */
GdkPixbuf *get_pixbuf_from_file(GFile *file, GtkIconSize size)
{
GIcon *icon;
GFileInfo *info;

GdkPixbuf *result=NULL;

info=g_file_query_info(file,
   G_FILE_ATTRIBUTE_STANDARD_ICON,
   G_FILE_QUERY_INFO_NONE,
   NULL,
   NULL);

if (!info)
return NULL;

icon=g_file_info_get_icon(info);

if (icon!=NULL) {
result=get_pixbuf_from_icon(icon,size);
}

g_object_unref(info);

return result;
}


Again - thanks guys!

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

gi._glib.GError: Invalid object type `VteTerminal'

2012-08-16 Thread Kip Warner
Hey list,

I've created a window through Glade 3.12.1 which contains a VTE widget
within one of its sizers. It looks fine in Glade, but when I attempt to
call the builder's add_from_file(Gooey.glade), I get the following
error at runtime:

$ ./Main.py
Traceback (most recent call last):
  File ./Main.py, line 194, in module
navigator = NavigatorApp()
  File ./Main.py, line 48, in __init__
self.builder.add_from_file(../Gooey/Launcher.glade)
  File /usr/lib/python3/dist-packages/gi/types.py, line 43, in
function
return info.invoke(*args, **kwargs)
gi._glib.GError: Invalid object type `VteTerminal'

I am using Python 3.2.3 with binding for Gtk+ version 3.4.2. This is
strange because I am pretty sure I am importing the necessary modules
prior to loading with builder via the following:

from gi.repository import Gtk, Gdk, GObject
from gi.repository import Vte, GLib

Any help is appreciated. I'm finding the documentation on programming
Gtk+ 3 via Python 3 scant. Not to mention distros compounding the
difficulty frequently with old packages / bindings. Something that might
help would be a simple minimal that instantiates a Glade defined VTE
widget using Python 3 / Gtk+ 3.

Thanks for any help,

-- 
Kip Warner -- Software Engineer
OpenPGP encrypted/signed mail preferred
http://www.thevertigo.com

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

widget_destroy() question

2012-08-16 Thread Vlasov Vitaly
Hello list.

For example, i got frame in which packed vbox. In vbox packed in five 
buttons.
If i call gtk_widget_destroy(), all packed widget's will be destroyed? or only 
frame?
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: widget_destroy() question

2012-08-16 Thread Michael Cronenworth

On 08/16/2012 09:03 PM, Vlasov Vitaly wrote:

For example, i got frame in which packed vbox. In vbox packed in five
buttons.
If i call gtk_widget_destroy(), all packed widget's will be destroyed? or only
frame?


Calling widget_destroy will automatically destroy child widgets. If you 
want all widgets destroyed at one time you should destroy the vbox. If 
you want only one button destroyed you should call destroy on only that 
one button.

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


Re: GList strange behavior

2012-08-16 Thread Ardhan Madras
Hi,

Seem you did not read my reply clearly. I told you the behaviour of
g_list_append() and g_list_last() there.
Okay, so your question is (

So, why g_list_append() dont' return me newly created list???

If you pass NULL pointer to first arg of g_list_append() it will
returns a newly created list for you, save the address to the return
pointer. If you pass non NULL pointer (already created list) to first
arg of g_list_append() it will ALWAYS return the HEAD of the list and
will not create a new list.

It's better for you to read GList implementation source code.
(glist.c) to fully understand how it work.

Regards.


On Thu, Aug 16, 2012 at 2:08 AM, Vlasov Vitaly vnig...@gmail.com wrote:
 Hello
 Thanks for answer.

  Did you mean Last list element: 0x832c610 is differ from INIT list
 prt: 0x830f080?
  No.

 Lest's see...
 i got function do_work with:
 1. new Glist init with random data
 2. callback definition of button click: button_click(, GList 
 *list)
 let init list poiner = 0xfe
 button was clicked!
 Here button_click(GList *list)
 list in agrs = 0xfe
 new data record memory allocation.
 !!! g_list_append(data, list) !!!
 In my example it returns init list value (0xfe), but should returns 
 value
 of newly created list (0x832c610 in example).

 In example:
 INIT list prt: 0x830f080 - this is init list, which passed to
 button_callback
 In button callback:
 Created: 0x830f080, arg: 0x830f080 - first ptr is returned 
 list from
 g_list_append(), but it equal to init list. WTF??? HOW?? I need newly created
 list here...
 And i check added value with g_list_last(). It's equal 
 0x832c610 and
 correct.

 So, why g_list_append() dont' return me newly created list???

 В сообщении от Среда 15 августа 2012 09:33:04 вы написали:
 Hi,

  In button_cb()...

 Did you mean Last list element: 0x832c610 is differ from INIT list
 prt: 0x830f080?

 It's clear because  0x830f080 was the location of first list and
 0x832c610 is the last appended list.
 g_list_prepend() return to the start of the list, g_list_last() return
 the last of the list (address).

  in test_glist()

 First you call temp = g_list_insert(test, ...), test = NULL, save the
 list to temp pointer to GList,
 second, you call temp = g_list_append(test, ...), nothing wrong with
 that code! BUT if you suppose to insert 2nd list here, then you are
 wrong. Because, test is STILL NULL. It returns the newly allocated
 list again, that's why it's differ. You should call call temp =
 g_list_append(temp,...) or to insert the next list.

  In real program, i need to get newly created list pointer in function
  like button_cb(), but don't know how to do it.

 Just pass it through callback's argument or declare it as global variable.

 On Wed, Aug 15, 2012 at 8:04 AM, Vlasov Vitaly vnig...@gmail.com wrote:
  Hi, list.
 
  I can't understand, why g_list_append return different values in
  my
 
  callback's(please read source). In first case i got same list, which was
  obtained from arguments. In second case g_list_append returns newly
  created list.
  Why result's is are not the same?
 
  In real program, i need to get newly created list pointer in function
  like button_cb(), but don't know how to do it.
 
  source: http://pastebin.com/4gMREKwd
 
  output on my laptop:
  INIT list prt: 0x830f080
  Created: 0x830f080, arg: 0x830f080
  Last list element: 0x832c610
  Init list ptr: 0x832c5c0
  Second list ptr: 0x830f120
  End
  ___
  gtk-app-devel-list mailing list
  gtk-app-devel-list@gnome.org
  https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Python3 + gtk3 on windows

2012-08-16 Thread Jared Henley

Hi,

I really need python3 + gtk3 working on Windows.  I don't
expect my needing it to make thing happen, however.

I've finally turned up some useful information in the archive
for this list.  I've downloaded the gtk+ and pygobject binaries
from

http://optionexplicit.be/projects/gnome-windows/GTK+3/

and also installed python 3.2 using the msi installer on the
Python site.  But I don't know where to copy the gtk+ and
pygobject files to the right places to make it all work.

Can someone tell me what to do?

Also, what still needs to be done before the win32 build
is considered stable and will be made available through
gtk.org?  I'm quite happy to help with bug reports/testing.
___
gtk-devel-list mailing list
gtk-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-devel-list


Re: Python3 + gtk3 on windows

2012-08-16 Thread Dieter Verfaillie

On Thu, 16 Aug 2012 17:12:23 +1000, Jared Henley wrote:

I've finally turned up some useful information in the archive
for this list.  I've downloaded the gtk+ and pygobject binaries
from

http://optionexplicit.be/projects/gnome-windows/GTK+3/

and also installed python 3.2 using the msi installer on the
Python site.  But I don't know where to copy the gtk+ and
pygobject files to the right places to make it all work.

Can someone tell me what to do?


1) those pygobject binaries (and the bundle in gtk+/git/) are
   linked against 32 bit Python 2.7, so you'd need to install
   that first
2) make sure Python27/Lib/site-packages/pygtk.pth is renamed
   to something else as the Gtk3 bundle does not agree with
   the PyGTK aio installer's way of ensuring PATH is set to
   something sane)
3) get the bundle from
   http://optionexplicit.be/projects/gnome-windows/GTK+3/gtk+/git
   and extract it to C:\Gtk3
4) create a C:\Gtk3\bin\pygi.cmd file containing the following:

8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8
@echo off
set PATH=C:\Gtk3\bin;C:\Python27\;%PATH%
set PYTHONPATH=C:\Gtk3\lib\site-packages
set GI_TYPELIB_PATH=C:\Gtk3\lib\girepository-1.0
C:\Python27\python.exe %*

8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8


Adjust paths to match your installation directories but note
you should avoid spaces in paths completely for both the location
of the bundle and the installation location of Python.

If you want to test pygobject's demos/gtk-demo/gtk-demo.py,
you'll need to patch is like this:

8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8
from gi.repository import GLib, GObject, Gio, Pango, GdkPixbuf, Gtk

#ugly win32 hack
GLib.file_test = GLib.file_test_utf8
GLib.file_get_contents = GLib.file_get_contents_utf8
GdkPixbuf.Pixbuf.new_from_file = GdkPixbuf.Pixbuf.new_from_file_utf8
#end ugly hack

DEMOROOTDIR = os.path.abspath(os.path.dirname(__file__))

8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8


Note that these binaries:
- are not intended to be used in production systems
- are built with debug symbols (mingw.org's gdb works well)
- are built from the experimental windows branches of various
  forks on my github page, which are in various stages of not
  yet ready or good enough for upstream
- do not come with any warranty whatsoever, etc

mvg,
Dieter

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


Re: next steps for touch support in GTK+

2012-08-16 Thread Matthias Clasen
On Sat, Aug 4, 2012 at 3:43 PM, Matthias Clasen
matthias.cla...@gmail.com wrote:

 === 6. OSK widget context provider (e.g. search vs open vs go...) ===
 Matthias said there was a patch floating around for that. I looked in the
 bugs with patches attached in bugzilla but could not find it. If someone
 knows where it is would be great.


 https://bugzilla.gnome.org/show_bug.cgi?id=651244 is the bug I had in mind.

I've now updated that bug with what I intend to commit for 3.6 soon.
Comments still appreciated.
___
gtk-devel-list mailing list
gtk-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-devel-list


Re: Exposing masked strings for password fields to accessibility

2012-08-16 Thread Stef Walter
On 08/10/2012 12:43 PM, Mario Sanchez Prada wrote:
 However, I understand some might see the fact of exposing the number of
 masked characters as a security issue, so that's why I'm asking for
 feedback here now.

If an application exposes the number of characters to be rendered on the
screen, then I don't think it's a problem for accessibility tools to
'see' the number of characters too.

There are approaches for security sensitive applications to hide the
number of characters in their password. But then the application should
be using that approach for the GtkEntry anyway.

Cheers,

Stef
___
gtk-devel-list mailing list
gtk-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-devel-list