Re: Maximize on Windows 7 seems broken.

2011-05-10 Thread Matteo Landi
Is it maybe a problem with the window manager? I had problem trying to
raise a window up if covered.
Just guessing...

Regards,
Matteo

On Wed, May 11, 2011 at 12:07 AM, James Steward
jamesstew...@optusnet.com.au wrote:
 Hi,

 I'm developing on Windows 7, 64 bit, using MinGW/MSYS for familiarity
 with a Posix type system.

 I have installed gtk+-bundle_2.22.1-20101227_win32.zip, and building a 32bit
 app for compatibility.

 My application calls gtk_window_maximize(GTK_WINDOW(window)); but the
 resulting window is not maximized properly. It sits below the top of
 the screen, and is cut off at the bottom of the screen.

 Also, restoring the window, then dragging to the top of the screen to
 allow Bill to maximize it results in the same.

 Running on an XP machine, the maximize works fine, as it does on Linux.

 Is this a known Windows 7 (possibly also Vista) problem with GTK+ apps?
 Is there a fix?

 I've googled around, but not hit on any solutions yet.

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




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


Re: Forgot user id and password

2010-12-29 Thread Matteo Landi
You can use mailman interface in order to get a password reminder:
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Regards.


On Wed, Dec 29, 2010 at 11:02 AM, Lourembam Lenin lenin...@gmail.com wrote:
 Hi Team,

  I have forgot my user id and password, can you please  get me that
 information to me.

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




-- 
Matteo Landi
http://www.matteolandi.net/
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Snow effect over a GtkWindow

2010-08-22 Thread Matteo Landi
Hi guys,
I'm here to share with you the script I created in order to achieve
the falling snow effect: I hope you enjoy it.

#!/usr/bin/python
# -*- coding: utf-8 -*-

Show of how to create a full-screen transparent window used to reproduce
the effect of objects falling over your desktop.


from __future__ import division
import sys
from math import sin
from random import random

import cairo
import gobject
import gtk
from gtk import gdk


class OverlayWindow(object):
Full-screen transparent window.


def __init__(self, symbol, color, nelem):
Constructor.

Other than create a window to draw things, we have to generate a list
of objects (3d-coordinates).

Keywords:
symbol symbol displayed on screen.
color color of the symbol.
nelem number of elements to display.

self.symbol = symbol
self.color = map(lambda v: int(v, 16) / 255,
 [color[:2], color[2:4], color[4:6]])
self.bin = [[3 * random() - 1.5, 2 * random() - 1, 2 * random()]
for _ in xrange(nelem)]
self.time = 0L

screen = gdk.screen_get_default()

# Create off-screen contexts.
width, height = screen.get_width(), screen.get_height()
ratio = width / height
self.surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, width, height)
self.context = cairo.Context(self.surface)
self.context.scale(width * 0.5 / ratio, height / 2)
self.context.translate(ratio, 1)

# Create a full-screen window specifying we are entirely responsible
# for drawing the background of the widget.
win = gtk.Window()
win.set_app_paintable(True)
#win.fullscreen()

# Let's try to use a colormap supporting transparency
colormap = screen.get_rgba_colormap()
if colormap:
win.set_colormap(colormap)

win.connect('delete-event', gtk.main_quit)
win.connect('expose-event', self.expose_cb)
win.show()

gobject.timeout_add(66, self.refresh, win)

def expose_cb(self, widget, event):
Output the content of the ImageSurface on the window context.

context = widget.window.cairo_create()

# clip the context in order to display only the exposed area
context.rectangle(event.area.x, event.area.y,
  event.area.width, event.area.height)
context.clip()

# make the background transparent
context.set_operator(cairo.OPERATOR_SOURCE)
context.set_source_rgba(0, 0, 0, 0)

# paint the content of the off-screen surface
#context.set_source_surface(self.surface)
context.paint()

return False

def refresh(self, widget):
Draw things over the off-screen context, and queue a redraw.

width, height = widget.window.get_size()
self.draw(self.context)
widget.queue_draw()

return True

def draw(self, context):
Draw the objects over the window.

The movement of each objects follows a sinusoidal behavior based on the
time variable.

Keywords:
context context used to draw.

symbol = self.symbol
time = self.time

context.set_operator(cairo.OPERATOR_SOURCE)
context.set_source_rgba(0, 0, 0, 0)
context.paint()

context.set_operator(cairo.OPERATOR_OVER)

for (i, item) in enumerate(self.bin):
x, y, z = item

x1 = (x + .1 * sin(time + i / 10)) / z
y1 = y / z
font_size = .05 / z

x_bearing, y_bearing, width, height = \
context.text_extents(symbol)[:4]
context.move_to(x1 - width / 2 - x_bearing,
y1 - height / 2 - y_bearing)

r, g, b = map(lambda v: v / (z + 1), self.color)
context.set_source_rgb(r, g, b)
context.set_font_size(font_size)
context.save()
context.rotate(time + i / 10)
context.show_text(symbol)
context.restore()

y = -1 if y1  1 else y + 0.005
item[1] = y

self.time += 0.05


def main():
overlay = OverlayWindow('❄', '99CCFF', 200)
gtk.main()


if __name__ == '__main__':
main()


Regards,
Matteo

On Sun, Dec 27, 2009 at 8:10 PM, Matteo Landi landima...@gmail.com wrote:
 Thanks for the hint.

 On Sun, Dec 27, 2009 at 6:41 PM, Liam R E Quin l...@holoweb.net wrote:
 On Sun, 2009-12-27 at 16:27 +0100, Matteo Landi wrote:
 Hi all,
 for fun I'm trying to reproduce snowflakes falling down on my
 fullscreen gtk app.

 I'd say look at xsnow if it's still around.

 Liam


 --
 Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/
 Pictures from old books: http://fromoldbooks.org/
 Ankh: irc.sorcery.net irc.gnome.org www.advogato.org





 --
 Matteo Landi
 http

Drawing from multiple threads

2010-07-26 Thread Matteo Landi
Hi all,
these days I'm trying create a very simple spectrum analyzer using gtk
and gstreamer.

Basically there is a method invoked from the outside (gstreamer
thread) notifying me about the presence of a new audio buffer.
Inside this method, I create a new thread which: compute the fft of
the signal, create a Surface, draw the results on it and at the end
queues a redraw of the widget.
Let's see some snippet of code:

class MyWindow():
  def __init__(self):
...
darea = DrawingArea()
darea.connect('configure', self.configure_cb)
darea.connect('expose', self.expose_cb)
...

  def configure_cb():
 self.surface = ..

  def expose_cb():
 # copy self.surface

  def new_audio_buffer_helper(self, buffer):
Thread(target=self.new_audio_buffer, args=(buffer,))

  def new_audio_buffer(self, buffer):
fft = ..
surface = ..
# drawing actions
gobject.idle_add(self.refresh, surface)

  def refresh(self, surface):
self.surface = surface
self.queue_draw()

Is this the right way to code in this scenario? Should I protect the
private variable 'surface' even though only the main thread access to
it? Should I need to skip any redrawing actions in order to prevent
potential delay between audio and video?

Thanks in advance.

-- 
Matteo Landi
http://www.matteolandi.net/
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Bug inside GtkBuilder w/ GtkAdjustment

2010-02-28 Thread Matteo Landi
Today working with glade, I noticed a strange behaviour while working
with GtkAdjustment.

import gtk

str_gui = 
?xml version=1.0?
interface
  requires lib=gtk+ version=2.16/
  !-- interface-naming-policy project-wide --
  object class=GtkAdjustment id=foo
property name=value10/property
property name=lower1/property
property name=upper100/property
property name=step_increment1/property
  /object
/interface


builder = gtk.Builder()
builder.add_from_string(str_gui)
print builder.get_object('foo').get_value()

The output is 0.0 and not 10 as espected. Is this something already known?
Thanks in advance.

-- 
Matteo Landi
http://www.matteolandi.net/
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Bug inside GtkBuilder w/ GtkAdjustment

2010-02-28 Thread Matteo Landi
Thank you so much. I solved editing the .xml by hand!

On Sun, Feb 28, 2010 at 9:53 PM, Tadej Borovšak tadeb...@gmail.com wrote:
 Hello

 Today working with glade, I noticed a strange behaviour while working
 with GtkAdjustment.

 import gtk

 str_gui = 
 ?xml version=1.0?
 interface
  requires lib=gtk+ version=2.16/
  !-- interface-naming-policy project-wide --
  object class=GtkAdjustment id=foo
    property name=value10/property
    property name=lower1/property
    property name=upper100/property
    property name=step_increment1/property
  /object
 /interface
 

 builder = gtk.Builder()
 builder.add_from_string(str_gui)
 print builder.get_object('foo').get_value()

 The output is 0.0 and not 10 as espected. Is this something already known?

 This is a known problem and I think it is already fixed in git master.
 Basically, I boils down to the fact that properties need to be
 specified in right order for GtkBuilder to work properly. See this bug
 report for more info:
 https://bugzilla.gnome.org/show_bug.cgi?id=594372

 Tadej

 --
 Tadej Borovšak
 tadeboro.blogspot.com
 tadeb...@gmail.com
 tadej.borov...@gmail.com




-- 
Matteo Landi
http://www.matteolandi.net/
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Snow effect over a GtkWindow

2009-12-27 Thread Matteo Landi
Hi all,
for fun I'm trying to reproduce snowflakes falling down on my
fullscreen gtk app. What would the best way to achieve this? I was
thinking about another semi-transparent fullscreen window, with the
snowflackes; are there any other solutions (performance analysis are
welcome).
Best regards


-- 
Matteo Landi
http://www.matteolandi.net/
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Snow effect over a GtkWindow

2009-12-27 Thread Matteo Landi
Thanks for the hint.

On Sun, Dec 27, 2009 at 6:41 PM, Liam R E Quin l...@holoweb.net wrote:
 On Sun, 2009-12-27 at 16:27 +0100, Matteo Landi wrote:
 Hi all,
 for fun I'm trying to reproduce snowflakes falling down on my
 fullscreen gtk app.

 I'd say look at xsnow if it's still around.

 Liam


 --
 Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/
 Pictures from old books: http://fromoldbooks.org/
 Ankh: irc.sorcery.net irc.gnome.org www.advogato.org





-- 
Matteo Landi
http://www.matteolandi.net/
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Fwd: Simulate button press events

2009-12-26 Thread Matteo Landi
Sorry but the discussion was accidentally become private.

-- Forwarded message --
From: Matteo Landi landima...@gmail.com
Date: Sat, Dec 26, 2009 at 4:51 PM
Subject: Re: Simulate button press events
To: Michael Libby michael.c.li...@gmail.com


On Sat, Dec 26, 2009 at 3:22 PM, Michael Libby
michael.c.li...@gmail.com wrote:
 On Thu, Dec 24, 2009 at 6:39 PM, Matteo Landi landima...@gmail.com wrote:

 as the subject says, I'm trying to synthesize mouse clicks over the
 focused window (which is now owned by my application). Looking around
 it seems that gtk offers only a way to move the cursor
 (gdk_display_warp_pointer) but there is anything related to button
 press. For the moment I'm using xlib for such a purpose, but I was
 wondering if I could accompish my task only making use of gtk.

 For testing? There might be less fragile ways to interact with your UI
 for testing purposes. Setting specific x,y coordinates in your test
 code for mouse clicks may break if the layout of the UI changes.

 Simulating user interaction visually? Still fragile, but more worth
 the effort since you will already be computing the path the mouse
 needs to travel.

Well I'am creating to create a game sovler. Once my window is placed
over the grid of the game, the application starts to take shots of the
display, and move the mouse and clicks over the grid depending on the
content of the shot.


 In any case: Did you look at gdk_display_put_event () with a
 GdkEventButton? This has the ability to send type of mouse click,
 modifier keys, and x,y coords.

I'm reading its documentation right now, but it seems not work even
tought it's possible I'm using it wrong. Indeed when I create an event
I should insert the window which is going to receive the event: what
is it in my particular case? is the gdk_display_put_event going to
override this field inside my event object? Here is the code I'm
trying (python):

 def fake_button_press_event(self, x, y):
   event = gdk.Event(gdk.BUTTON_PRESS)
   event.x = 500.
   event.y = 500.
   event.button = 1

   gtk.gdk.display_get_default().put_event(event)


Thanks in advance.

 --
 Michael C. Libby
 www.mikelibby.com




--
Matteo Landi
http://www.matteolandi.net/



-- 
Matteo Landi
http://www.matteolandi.net/
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Deadlock/Freeze

2009-10-29 Thread Matteo Landi
It is sad to say, but the issue described above, seemed to be generated by
an human dumb error (as always).

I have set two refresh times: one in the case of full connectivity
(about an hour), and the other, smaller (1 minute), in the case of
lack of communication. In order
to implement this i did:

def callback():
  data = parse()
  if not data:
gobject.timeout_add(1m, callback)
  else:
   gobject.timeout_add(1h, callback)
  return True

As you can notice by yourselves, I forgotten to remove the return
True, so it ended
not in a so called deadlock, but in a sort of dos, because of the
amount of thenumber
of callbacks being wainiting in the main loop.

So I changed return True, with a return False, and it seems to work
properly (at least for the testing till now : ).

Now it lasts the question about placing a threads_enter/leave in each
callback. Is
this really needed? I think that when the gstreamer threads wants to
write on the screen, it insert an expose event from the main_loop, so
the whole drawing is right
handled from the main loop. These are just suppositions.


On Thu, Oct 29, 2009 at 7:08 PM, Michael Torrie torr...@gmail.com wrote:
 Michael Torrie wrote:
 Matteo Landi wrote:
 From the FAQ entry [1] it seems I need to enter/leave threads inside each
 timeout callback. Could the procedure described be a valid solution
 for my problem?

 Yes I believe you need to call enter/leave around calls to any gtk or
 gdk call inside the callback.

 Not sure if this has to be done in the main thread or just the
 callbacks, though...
 ___
 gtk-app-devel-list mailing list
 gtk-app-devel-list@gnome.org
 http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list




-- 
Matteo Landi
http://www.matteolandi.net/
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Deadlock/Freeze

2009-10-28 Thread Matteo Landi
Hi all,
I'm working on an application used for displaying news (taken
from internet) and spot-movies (using gstreamer).

In the short term usage, everything is ok, but when I leave the
application running for several hours, it ends freezing.

How is it possible to create deadlock? In theory everything should
be serialized in the gtk main loop, so there would not be any
concurrency at all.

The only thing that leaves me in doubts, is the interaction with gstreamer,
even thought I called gobject.threads_init() before the gtk.main_loop()
callback.

From the FAQ entry [1] it seems I need to enter/leave threads inside each
timeout callback. Could the procedure described be a valid solution
for my problem?

Thanks in advance.

[1] http://faq.pygtk.org/index.py?req=editfile=faq20.015.htp

-- 
Matteo Landi
http://www.matteolandi.net/
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Please help me unsubscribe from this list

2009-10-17 Thread Matteo Landi
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Look at the bottom of the page for a unsubscribe button.

On Sat, Oct 17, 2009 at 8:17 PM, Adeel Malik adeelmali...@yahoo.com wrote:
 Please help me un-subscribe from this list

 thanks



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




-- 
Matteo Landi
http://www.matteolandi.net/
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: GtkBuilder and GtkHScale

2009-07-10 Thread Matteo Landi
On Thu, Jul 2, 2009 at 7:54 PM, Tadej Borovšaktadeb...@gmail.com wrote:
 Hello.

 hi all,
 i'm trying to develope a small application with the help of glade. Is it a
 normal behaviour that when i set the upper limit of a GtkHscale, i need tu 
 use
 a value bigger than the needed one by 10 units? (if i need the upper bound to
 be 10, i need to set it to 20). I tought about a problem of glade, but the
 generated glade file contains the value used in the gui. I imagine it should 
 be
 a problem of gtkbuilder. What do you think about this?

 My guess would be that you forgot to set page size property of scale
 to 0. Default page size is 10, and this is where the offset you
 experience comes.

Exactly! I forgot to set that value!
Thanks for the help!

 --
 Tadej Borovšak
 tadeboro.blogspot.com
 tadeb...@gmail.com
 tadej.borov...@gmail.com




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

GtkBuilder and GtkHScale

2009-07-02 Thread Matteo Landi
hi all,
i'm trying to develope a small application with the help of glade. Is it a
normal behaviour that when i set the upper limit of a GtkHscale, i need tu use
a value bigger than the needed one by 10 units? (if i need the upper bound to
be 10, i need to set it to 20). I tought about a problem of glade, but the
generated glade file contains the value used in the gui. I imagine it should be
a problem of gtkbuilder. What do you think about this?
Thanks in advance


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


Re: Fwd: gnome applet w/ bash

2007-11-10 Thread Matteo Landi
Just another question..
what is the right way to fix the functions for closing the applet? i
noticed that if i shutdown the cpu and i've got the applet running, it
freezes waiting for killing remaining process; after that i gotta shut
it down manually using the front button..
what is the close function i gotta call for closing applet rised up with
bonobo?
tnx again
M@

On Wed, 2007-11-07 at 01:07 +0100, Matteo Landi wrote:
 well
 thank you so much for the help you gave me
 i created my first gnome applet (there is also a cpu graph) and it looks
 very good!
 M@
 
 On Mon, 2007-11-05 at 23:50 +1100, Michael Lamothe wrote:
  Oh dear,
  
  #include sys/utsname.h
  
  struct utsname name;
  uname(name);
  printf(%s\n, name.sysname);
  printf(%s\n, name.nodename);
  printf(%s\n, name.release);
  printf(%s\n, name.version);
  printf(%s\n, name.machine);
  
  Thanks,
  
  Michael
  
  
  On 05/11/2007, Matteo Landi [EMAIL PROTECTED] wrote:
  
   On Mon, 2007-11-05 at 22:55 +1100, Michael Lamothe wrote:
Hi Matteo,
   
I'm not following.  What box?  A GtkBox?  What row?
  
   they are just examples
  
Have you thought of using Glade to do your UI work?
  
   the fact is that i've started working with gtk two days ago because i
   was interested in make a gnome panel monitor, and in the tutorial i've
   found, i create a panel with the bonobo inititialization..
   i dont know if i can do this even with glade..
  
   Talking about the spawn, i think the problem is due to the command
   itself (uname) that at the end print a \n; So i gotta throw away that
   char from the string to obtaine a one line label, isn't it?
  
   M@
  
Thanks,
   
Michael
   
On 05/11/2007, Matteo Landi [EMAIL PROTECTED] wrote:
 ok ok that worked, but the output is the same as before...

 just try to create a box with two labels inside:

 one createt with label = gtk_label_new (foo);
 and the other created with label = gtk_label_new (std_output);

 i got the foo one middle aligned and the second placed on the top of 
 the
 row.. am i wrong?

 M@

 On Mon, 2007-11-05 at 22:06 +1100, Michael Lamothe wrote:
  Your pseudo makes no sense, how can you pass a char * into 
  parameter 2
  of g_spawn_command_line_sync() when its a gchar**.  This worked for
  me,
 
 
gchar* std_output = NULL;
g_spawn_command_line_sync(ls -al, std_output, NULL, NULL, 
  NULL);
printf(std_output);
 
  Thanks,
 
  Michael
 
 
  On 05/11/2007, Matteo Landi [EMAIL PROTECTED] wrote:
   Tnx i think that the first one is the function i'm in need of; by 
   the
   way i cant' make it work, and my gnome panel crashs everytime i 
   run the
   applet, so i think there is some problems with memory:
   well, i've got:
   const char* data (as argoment of a function)
   char *std_out (created in the function)
  
   g_spawn_command_line_sync(data, std_out, NULL, NULL, NULL);
  
   is this call right? i think not...but why??
  
   tnx again
   M@
  
   On Mon, 2007-11-05 at 15:21 +1100, Michael Lamothe wrote:
Hi Matteo,
   
There's a few ways to do this, two of which I'll tell you now.
Hopefully, you can change your application to use these 
functions
instead.
   
Firstly, there's the g_spawn_ set of APIs designed for this.  I 
think
that something like g_spawn_command_line_sync() will do exactly 
what
you want.  Basically, GLib calculates and allocates the space
required.  The documentation mentions nothing about freeing the
allocated strings afterwards but I imagine you will have to 
free the
standard_output and standard_error parameters with g_free().
   
Secondly, if the spawned program is meant to run asynchronously 
in the
background then you'll need to use something like
g_spawn_async_with_pipes().  I don't think that this is what 
you want
because you were talking about having to allocate the length of 
the
output.
   
Thanks,
   
Michael
   
On 05/11/2007, Matteo Landi [EMAIL PROTECTED] wrote:
 thank you very much, that solved one of my problems.
 here is the second:
 i'm using a pipe to catch the output of a specific command 
 and store it
 as a label in the panel; the problem is that if the array 
 containing the
 output is smaller than the output itself, the line is cut, 
 and the
 applet is show all middle aligned; if the output is bigger, i 
 get the
 label splitted in two lines: the first one containing the 
 entire output,
 and the second one is empty.
 How could i solve

Re: Fwd: gnome applet w/ bash

2007-11-07 Thread Matteo Landi
well
thank you so much for the help you gave me
i created my first gnome applet (there is also a cpu graph) and it looks
very good!
M@

On Mon, 2007-11-05 at 23:50 +1100, Michael Lamothe wrote:
 Oh dear,
 
 #include sys/utsname.h
 
   struct utsname name;
   uname(name);
   printf(%s\n, name.sysname);
   printf(%s\n, name.nodename);
   printf(%s\n, name.release);
   printf(%s\n, name.version);
   printf(%s\n, name.machine);
 
 Thanks,
 
 Michael
 
 
 On 05/11/2007, Matteo Landi [EMAIL PROTECTED] wrote:
 
  On Mon, 2007-11-05 at 22:55 +1100, Michael Lamothe wrote:
   Hi Matteo,
  
   I'm not following.  What box?  A GtkBox?  What row?
 
  they are just examples
 
   Have you thought of using Glade to do your UI work?
 
  the fact is that i've started working with gtk two days ago because i
  was interested in make a gnome panel monitor, and in the tutorial i've
  found, i create a panel with the bonobo inititialization..
  i dont know if i can do this even with glade..
 
  Talking about the spawn, i think the problem is due to the command
  itself (uname) that at the end print a \n; So i gotta throw away that
  char from the string to obtaine a one line label, isn't it?
 
  M@
 
   Thanks,
  
   Michael
  
   On 05/11/2007, Matteo Landi [EMAIL PROTECTED] wrote:
ok ok that worked, but the output is the same as before...
   
just try to create a box with two labels inside:
   
one createt with label = gtk_label_new (foo);
and the other created with label = gtk_label_new (std_output);
   
i got the foo one middle aligned and the second placed on the top of the
row.. am i wrong?
   
M@
   
On Mon, 2007-11-05 at 22:06 +1100, Michael Lamothe wrote:
 Your pseudo makes no sense, how can you pass a char * into parameter 2
 of g_spawn_command_line_sync() when its a gchar**.  This worked for
 me,


   gchar* std_output = NULL;
   g_spawn_command_line_sync(ls -al, std_output, NULL, NULL, 
 NULL);
   printf(std_output);

 Thanks,

 Michael


 On 05/11/2007, Matteo Landi [EMAIL PROTECTED] wrote:
  Tnx i think that the first one is the function i'm in need of; by 
  the
  way i cant' make it work, and my gnome panel crashs everytime i run 
  the
  applet, so i think there is some problems with memory:
  well, i've got:
  const char* data (as argoment of a function)
  char *std_out (created in the function)
 
  g_spawn_command_line_sync(data, std_out, NULL, NULL, NULL);
 
  is this call right? i think not...but why??
 
  tnx again
  M@
 
  On Mon, 2007-11-05 at 15:21 +1100, Michael Lamothe wrote:
   Hi Matteo,
  
   There's a few ways to do this, two of which I'll tell you now.
   Hopefully, you can change your application to use these functions
   instead.
  
   Firstly, there's the g_spawn_ set of APIs designed for this.  I 
   think
   that something like g_spawn_command_line_sync() will do exactly 
   what
   you want.  Basically, GLib calculates and allocates the space
   required.  The documentation mentions nothing about freeing the
   allocated strings afterwards but I imagine you will have to free 
   the
   standard_output and standard_error parameters with g_free().
  
   Secondly, if the spawned program is meant to run asynchronously 
   in the
   background then you'll need to use something like
   g_spawn_async_with_pipes().  I don't think that this is what you 
   want
   because you were talking about having to allocate the length of 
   the
   output.
  
   Thanks,
  
   Michael
  
   On 05/11/2007, Matteo Landi [EMAIL PROTECTED] wrote:
thank you very much, that solved one of my problems.
here is the second:
i'm using a pipe to catch the output of a specific command and 
store it
as a label in the panel; the problem is that if the array 
containing the
output is smaller than the output itself, the line is cut, and 
the
applet is show all middle aligned; if the output is bigger, i 
get the
label splitted in two lines: the first one containing the 
entire output,
and the second one is empty.
How could i solve this? maybe with dynamic allocation of 
memory, but in
order to know the output width size, i gotta insert a while that
overload the applet isn't it?
tnx in advance for the help
   
M@
   
   
On Sun, 2007-11-04 at 13:33 +1100, Michael Lamothe wrote:
 Hi Matteo,

 Look at g_timeout_add() or the new gdk_threads_add_timeout().

 Thanks,

 Michael


 On 04/11/2007, Matteo Landi [EMAIL PROTECTED] wrote:
  hi all
  i'm

Re: Fwd: gnome applet w/ bash

2007-11-07 Thread Matteo Landi
Tnx i think that the first one is the function i'm in need of; by the
way i cant' make it work, and my gnome panel crashs everytime i run the
applet, so i think there is some problems with memory:
well, i've got:
const char* data (as argoment of a function)
char *std_out (created in the function)

g_spawn_command_line_sync(data, std_out, NULL, NULL, NULL);

is this call right? i think not...but why??

tnx again
M@

On Mon, 2007-11-05 at 15:21 +1100, Michael Lamothe wrote:
 Hi Matteo,
 
 There's a few ways to do this, two of which I'll tell you now.
 Hopefully, you can change your application to use these functions
 instead.
 
 Firstly, there's the g_spawn_ set of APIs designed for this.  I think
 that something like g_spawn_command_line_sync() will do exactly what
 you want.  Basically, GLib calculates and allocates the space
 required.  The documentation mentions nothing about freeing the
 allocated strings afterwards but I imagine you will have to free the
 standard_output and standard_error parameters with g_free().
 
 Secondly, if the spawned program is meant to run asynchronously in the
 background then you'll need to use something like
 g_spawn_async_with_pipes().  I don't think that this is what you want
 because you were talking about having to allocate the length of the
 output.
 
 Thanks,
 
 Michael
 
 On 05/11/2007, Matteo Landi [EMAIL PROTECTED] wrote:
  thank you very much, that solved one of my problems.
  here is the second:
  i'm using a pipe to catch the output of a specific command and store it
  as a label in the panel; the problem is that if the array containing the
  output is smaller than the output itself, the line is cut, and the
  applet is show all middle aligned; if the output is bigger, i get the
  label splitted in two lines: the first one containing the entire output,
  and the second one is empty.
  How could i solve this? maybe with dynamic allocation of memory, but in
  order to know the output width size, i gotta insert a while that
  overload the applet isn't it?
  tnx in advance for the help
 
  M@
 
 
  On Sun, 2007-11-04 at 13:33 +1100, Michael Lamothe wrote:
   Hi Matteo,
  
   Look at g_timeout_add() or the new gdk_threads_add_timeout().
  
   Thanks,
  
   Michael
  
  
   On 04/11/2007, Matteo Landi [EMAIL PROTECTED] wrote:
hi all
i'm a complete newbie in developing with gtk, but yesterday i had an
idea about develope a gnome panel which could substitute conky..
In fact i'm in need of a panel that simply display the output of a bash
script..
well, after have googled a bit, i found a guide for implementing gnome
applet and here is the result
   
#include string.h
#include panel-applet.h
#include gtk/gtklabel.h
#include stdio.h
   
static gboolean on_button_press (GtkWidget *event_box, GdkEventButton
*event, GtkWidget* label){
if (event-button != 1)
return FALSE;
else {
FILE* fp;
char line[160];
fp = popen(~/scripts/allin1, r);
fgets( line, sizeof line, fp);
pclose(fp);
gtk_label_set_text (label,(const char*) line);
}
return TRUE;
}
   
static gboolean my_applet_fill (PanelApplet *applet, const gchar *iid,
gpointer data){
FILE* fp;
int pid;
char line[160];
GtkWidget *label;
   
fp = popen(~/scripts/allin1, r);
fgets( line, sizeof line, fp);
pclose(fp);
   
label = gtk_label_new (line);
gtk_container_add (GTK_CONTAINER (applet), label);
   
g_signal_connect (G_OBJECT(applet), button_press_event, 
G_CALLBACK
(on_button_press), label);
   
gtk_widget_show_all (GTK_WIDGET (applet));
   
   
return TRUE;
}
   
PANEL_APPLET_BONOBO_FACTORY (OAFIID:my_applet_Factory,
PANEL_TYPE_APPLET, Conky Porting, 0, my_applet_fill, NULL);
   
what i'm asking for is how could i refresh the label of the applet after
a fixed period of time... (now the applets refresh when mouse-clicked)
tnx in advance
   
M@
   
___
gtk-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-list
   
 
 

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