Re: Porting UIs to GtkBuilder

2009-04-15 Thread Zeeshan Ali (Khattak)
Hi,

On Wed, Apr 15, 2009 at 1:35 AM, Tristan Van Berkom t...@gnome.org wrote:
 On Tue, Apr 14, 2009 at 4:50 PM, Zeeshan Ali (Khattak) zee...@gmail.com 
 wrote:
 Hi,
   Reading through planet gnome and related mailing-lists recently, I
 got the impression that this would be a good time to port my UIs from
 libglade usage to GtkBuilder. So following the guidelines on this
 page:

 http://library.gnome.org/devel/gtk/stable/gtk-migrating-GtkBuilder.html

   I tried to do so:
 http://gitorious.org/projects/gupnp-tools/repos/mainline/commits/e8bb5436aa22009b5b312da5a459324382e889c5

 Errr, try converting with Glade 3.6 instead of the conversion script ?

   I just tried glade3 from trunk[1]. One of the three UIs just work
fine now but two others don't. One of them hits a fatal on startup:

console
$ gupnp-universal-cp
Gtk-Message: Failed to load module atk-bridge: libatk-bridge.so:
cannot open shared object file: No such file or directory

** (gupnp-universal-cp:12727): CRITICAL **: Unable to load the GUI
file /opt/gnome2/share/gupnp-tools/gupnp-universal-cp.ui: Unknown
internal child: image
/console

   The other one has some minor issues that i might be able to figure on my own:

console
(gupnp-av-cp:13063): Gtk-WARNING **: Cannot add an object of type
GtkMenu to a container of type GtkMenuItem

(gupnp-av-cp:13063): Gtk-WARNING **: Cannot add an object of type
GtkMenu to a container of type GtkMenuItem

(gupnp-av-cp:13063): Gtk-WARNING **: No object called:

(gupnp-av-cp:13063): Gtk-WARNING **: No object called:
/console

-- 
Regards,

Zeeshan Ali (Khattak)
FSF member#5124

[1] git://git-mirror.gnome.org/git/glade3
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: Porting UIs to GtkBuilder

2009-04-15 Thread Zeeshan Ali (Khattak)
Hi Tristan,

On Wed, Apr 15, 2009 at 7:43 PM, Tristan Van Berkom t...@gnome.org wrote:
 It looks like either
  a.) You did not convert the old Glade file using Glade
 and or

   Somehow that was the case. Don't ask me how but now that i rebooted
the machine, the glade3 inside my jhbuild does the conversion nicely
and my UIs work more or less out of the box. Thanks a lot for your
replies.

 I am extra curious about how you ended up with an
 internal image in a GtkImageMenuItem (if I'm guessing
 your Glade file correctly), those are supposed to be
 internal only in libglade format and referenced (by object
 type property) in GtkBuilder format.

  That is gone too now with a fresh conversion using glade3 so I am
afraid, we might never find out. :) Thanks again.

-- 
Regards,

Zeeshan Ali (Khattak)
FSF member#5124
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Porting UIs to GtkBuilder

2009-04-14 Thread Zeeshan Ali (Khattak)
Hi,
   Reading through planet gnome and related mailing-lists recently, I
got the impression that this would be a good time to port my UIs from
libglade usage to GtkBuilder. So following the guidelines on this
page:

http://library.gnome.org/devel/gtk/stable/gtk-migrating-GtkBuilder.html

   I tried to do so:
http://gitorious.org/projects/gupnp-tools/repos/mainline/commits/e8bb5436aa22009b5b312da5a459324382e889c5

   With this change, everything builds but I get this error from two
of my UIs on startup:

Gtk:ERROR:gtkbuilder.c:541:_gtk_builder_add: assertion failed:
(GTK_IS_BUILDABLE (parent))
Aborted

  The error from the third UI says a bit more so i think i can debug
that on my own, but what is this supposed to mean?

-- 
Regards,

Zeeshan Ali (Khattak)
FSF member#5124
___
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 replace a child of a GtkBox ?

2007-12-30 Thread Zeeshan Ali Khattak
Hi Gregory!

 - How do I remove the old object from the GtkBox ?

 - How do I free up the old object (image/pixbuf) ? Do I
   simply unref it ?

   You don't have to do any of these. As a general rule of thumb in
the gobject world, each object keeps it's own reference of the objects
it needs. So when you set a new child on a GtkBox object, the GtkBox
must unref the old child widget.

-- 
Regards,

Zeeshan Ali Khattak
FSF member#5124
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


GdkPixbuf object from stock icons

2007-09-23 Thread Zeeshan Ali
Hi!
   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.
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?

-- 
Regards,

Zeeshan Ali
FSF member#5124
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


GdkPixbuf object from stock icons

2007-09-22 Thread Zeeshan Ali
Hi!
  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.
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?

-- 
Regards,

Zeeshan Ali
FSF member#5124
___
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 Zeeshan Ali
Hi!

 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.

   I know that and that is why i only using the stock icons where the
change of actual icon image doesn't make any difference to the user of
my app. i-e use GTK_STOCK_DIRECTORY to represent a directory.

 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()

   I thought icon theme is different from stock icons?

-- 
Regards,

Zeeshan Ali
FSF member#5124
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: How does one pipe output from process to text buffer?

2006-12-27 Thread Zeeshan Ali
On 12/27/06, Tony Freeman [EMAIL PROTECTED] wrote:
 Hello,

   Hi!

 I need some example code or a tutorial for how to pipe output from a
 process to a GtkTextBuffer.

 The idea of this program is to spawn off 6 or more ssh commands and have
 the output go to it's own textbuffer in it's assigned notebook page.

Just a thought: Wouldn't it be a better idea to use a library
instead of a command when one is available: libssh
(http://www.0xbadc0de.be/libssh:libssh).

-- 
Regards,

Zeeshan Ali
Design Engineer, SW
Open Source Software Operations
Nokia Multimedia
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: How does one pipe output from process to text buffer?

2006-12-27 Thread Zeeshan Ali
Hello Tomas!

  Just a thought: Wouldn't it be a better idea to use a library
  instead of a command when one is available: libssh
  (http://www.0xbadc0de.be/libssh:libssh).

 Thanks. Didn't know about that. Just from a cursory glance at the doc:

  * what I like
clean, abstract interface

Yes! me too.

  * what I don't
namespace pollution (besides the prefix ssh_ they use options_
channel_ and what not).

I agree but keep in mind that:

1. The developer is a very friendly guy and takes user feedback very
seriously so you can suggest this to him and he'll do whatever seems
appropriate to change things for good.

2. The API is a bit different in the upcoming release: 0.2.

 In Tony's case, he might have to extract the fd from the SSH_SESSION
 object (is there an interface for that?) to be able to stuff it into a
 GIOChannel (not very difficult. I've done it with a database socket). On
 the plus side, Tony would just have *one* socket to watch (read and
 write side), and errors would (assumedly) come through call results or
 whatever.

   I have already thought of implementing a GIOChannel based on the
libssh's CHANNEL object and i already discussed the possbility of
having that in the libssh itself with the developer but he wasn't
particularly interested in glib's mainloop integration so i have put
it in the TODO list of my project. It would be doing that now if there
were some documentation on how to implement your own GIOChannel but
the glib docs seems to even abstract the GIOChannel structure even so
i'll have to get into the sources.

-- 
Regards,

Zeeshan Ali
Design Engineer, SW
Open Source Software Operations
Nokia Multimedia
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: How does one pipe output from process to text buffer?

2006-12-27 Thread Zeeshan Ali
Hi again!

On 12/27/06, Zeeshan Ali [EMAIL PROTECTED] wrote:
  In Tony's case, he might have to extract the fd from the SSH_SESSION
  object (is there an interface for that?) to be able to stuff it into a
  GIOChannel (not very difficult. I've done it with a database socket). On
  the plus side, Tony would just have *one* socket to watch (read and
  write side), and errors would (assumedly) come through call results or
  whatever.

   And regarding the use of fds, keep in mind that they are unix
specific so libssh might not provide an interface to the fd being used
by the CHANNEL. Even if it does, it might not be a good idea to use
that if you intend to keep/make your application very portable (one of
the primary reasons to use glib).

-- 
Regards,

Zeeshan Ali
Design Engineer, SW
Open Source Software Operations
Nokia Multimedia
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Passing data from a data collection window back to a main

2006-11-26 Thread Zeeshan Ali
Hi!
   The best and simplest way to get rid of global varriables would be
to define a structure that would contain all the data you need and
then you can keep passing it's pointer around in the callbacks using
the 'user_data' argument. If you want to use g_object_set/get_data()
instead, thats also possible and very easy (you don't even have to
define a new structure, since you can assign different string keys for
different kinds of data). IMHO, the g_object_set/get_data() API
reference (1) is good enough and there doesn't need to be an example
code for all possible scenerios in the tutorials/docs.

1. 
http://developer.gnome.org/doc/API/2.0/gobject/gobject-The-Base-Object-Type.html#g-object-set-data

On 11/26/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 This is my global variable version:

#include gtk/gtk.h

#include callbacks.h
#include interface.h
#include support.h

GtkWidget *window2, *window1, *label1, *entry1;

void
on_button1_clicked (GtkButton   *button,
 gpointer user_data)
{
 window1 = lookup_widget(button,window1);
 window2=create_window2();
 gtk_widget_show(window2);
 gtk_grab_add(window2);
}


void
on_button2_clicked (GtkButton   *button,
gpointer user_data)
{
 label1 = lookup_widget(window1,label1);
 entry1 = lookup_widget(window2,entry1);
 gtk_label_set_text(label1,gtk_entry_get_text(entry1));
 gtk_grab_remove(window1);
 gtk_widget_destroy(window2);
}

 Thanks,
 Kim
  [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
  Hi,
 
  I am about to start a new app, and would like to improve my programming 
  style. I have been using global variables to pass data from popup windows 
  back to a main window. I have seen discussion about using 
  g_object_set_data, but have not progressed to being able to use it 
  confidently.
 
  Does anyone know of a simple example using g_object_set_data. The sort of 
  thing I am thinking about is a main window with a label and button, that 
  pops up a child window with an entry and a button. Clicking the child 
  windows button returns the string in the entry back to the main windows 
  label.
 
  This sort of example would be very useful in the tutorial.
 
  Thanks,
  Kim
  ___
  gtk-app-devel-list mailing list
  gtk-app-devel-list@gnome.org
  http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

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



-- 
Regards,

Zeeshan Ali,
Software Design Engineer,
Open Source Software Operations,
Nokia,
Helsinki, Finland.
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: gtk and opnengl

2005-10-15 Thread Zeeshan Ali
Hello,

On 10/15/05, flood [EMAIL PROTECTED] wrote:
 Can anyone explain to me how to setup opengl and gtk together? I know there
 is a widget called gtk_gl_area but I have no idea how to use it.

   GtkGLExt (http://gtkglext.sourceforge.net/) is the latest and
recommended way of doing this kind of stuff (AFAIK). You can find the
docs. on the website and also their mailing-lists.

--
Regards,

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


Re: Query- Cross compile Gtk application for ARM..problem using scratchbox

2005-08-01 Thread Zeeshan Ali
Hello,
   First of all, i think you'll have a better chance of getting helped
at the scratchbox mailing-lists or IRC channel for all queries
regarding scratchbox.

On 8/1/05, Hasmeet Bedi [EMAIL PROTECTED] wrote:
 Hi Everybody
 
 I want to Cross compile Gtk application for ARM..
 i m trying scratchbox..i have installed scratchbox on
 my host (redhat9 linux)

I would be surprised to know if sb supports such an old platform.

 but as i tried to compile simple gui based hello world
 program it gives error that no gtk packages found..

   That might be so because there is no gtk+ installed on your target. ;)
 
 how to proceed..smbody given me idea of installing
 rootstrap with GTk+
 Actually i didn't  how to install rootstrap with
 GTK+ ..if any one know that pls let me know..
  or can anyone tell me how to build GTK+ (and its
  dependencies) from source.
 

   If you have the debian devkit installed and selected for your
target, you can simply get gtk+ (libraries and headers) installed by
using this simple command: fakeroot apt-get install libgtk2.0-dev

-- 
Regards,

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


Re: Window Visibility Signal

2005-07-25 Thread Zeeshan Ali
Hello,

 Expose is no problem, but what about when it is hid? basically I want 
 to know
 when the window is hid, so I don't draw to it.

   If you only want to check if a widget is visible or not at a
particular time, you'll need to check for the 'visible' property of
the widget. Moreover, 'expose' signal is called for both the cases
(show and hide). If you choose to go the 'expose' way then connect
your handler using g_signal_connect_after().

-- 
Regards,

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


Re: Window Visibility Signal

2005-07-25 Thread Zeeshan Ali
Hello,

 Nice tip, but unfortunately the expose event does not signal when the object
 is covered up. Only when revealed. I even hooked event and event-after
 and nothing was emitted when I covered up the window. Only events were
 triggered when I moved the mouse into the window and out of it and clicks.

Try visibility-notify-event and try all the other (likely)
signals of GtkWidget documented in the gtk+ reference manual please if
this doens't work either.

Regards,

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


Re: Glade C code a bad thing? (was: root windows)

2005-06-01 Thread Zeeshan Ali
Hello guys,
I think Gus forgot to CC his email to the list, so i am forwarding  it here.

-- Forwarded message --
From: Gus Koppel [EMAIL PROTECTED]
Date: Jun 1, 2005 9:40 AM
Subject: Re: Glade C code a bad thing? (was: root windows)
To: Zeeshan Ali [EMAIL PROTECTED]

Zeeshan Ali wrote:

BTW, i think this seperation of glade into two utilities would
 result in much greater freedom than now (quite contrary to the fear of
 some people on this list) since it open's up a new possiblity: you'll
 then be able to write your GUI in XML and getting it transformed into
 the source-code without using any GUI utility. :)

The freedom of designing a GUI without using a GUI while doing so? What
else? Writing C programs without using a C compiler during development?
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Glade C code a bad thing? (was: root windows)

2005-05-31 Thread Zeeshan Ali
Hello everyone,
   I strongly agree with the opinion that source-code generation
should be removed from glade itself. OTOH I very strongly advice the
glade developers to write a nice command-line utility to convert a
glade file to it's equivalent source code in C/C++, before they drop
this support.

   Since the glade file is XML, I think the tranformation to
source-code could also be better done using XSL, right? If someone
wan't to write it as a script without using any XML libs. i'll advice
him/her to use scheme/lisp instead of perl/python as lisp is AFAIK the
best language to deal with XML. Another option would be to write such
a utility in C, which shouldn't be that hard if we borrow the same
code from Glade that is to be removed. :)

   BTW, i think this seperation of glade into two utilities would
result in much greater freedom than now (quite contrary to the fear of
some people on this list) since it open's up a new possiblity: you'll
then be able to write your GUI in XML and getting it transformed into
the source-code without using any GUI utility. :)

-- 
Regards,

Zeeshan Ali
___
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 clear the pixmap window

2005-05-19 Thread Zeeshan Ali
Hello,

 You can use g_object_unref(), to destroy this widget,
 so that the window refreshes itself, or paint the
 pixmap with one of the gdk_drawable_* API to fill the
 pixmap with some color, you call as refreshing.

  destroy the widget to refresh it's window? Are you serious?
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


GNOME Indentation Style

2005-04-29 Thread Zeeshan Ali
Hello everyone,
   According to the article GNOME Programming Guidelines, the gnome
hackers prefer the Linux kernel indentation style: For core GNOME
code we prefer the Linux kernel indentation style. But comparing the
gtk+ sources with that of the kernel, i see some major differences,
e.g placement of braces on newline and keeping a space between the
function/macro name and the opening bracket following it. Can anyone
explain the the actual situation to me?
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: A bug in Gtk+? (+ OT suff)

2005-02-23 Thread Zeeshan Ali
Hello,

 Please, forgive my OT question, but I'm going to start a gtk+ project
 involving the use of a smart card reader and I'd very happy to know your
 suggestions about linux supported hardware.

Welcome to the gang! Sorry to dissappoint you but I too am very
new to all this. So far i've only interfaced only one card-reader
(ICT3K5 by Custom) device and one printer (VKP80 from Custom again).
If you need help on these devices or want to know how i am doing the
gtk+ part, we can continue our conversation about it in private :)
Bye.
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: A bug in Gtk+?

2005-02-22 Thread Zeeshan Ali
Hello,
   Hmm.. I thought that email with attachments goes through the
moderation. Anyway,  I have uploaded it here:
http://www.geocities.com/zeelists/thread-problem.c . Kindly have a
look at it. Thanks.
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: A bug in Gtk+?

2005-02-22 Thread Zeeshan Ali
Hello,
   
On Tue, 22 Feb 2005 15:22:50 +0100, Stefan Kost [EMAIL PROTECTED] wrote:
 Are you sure?

   Yeah I am sure and thats why i suspect that it may be pointing to a
bug in gtk+. Why don't you try it youself? Shouldn't  take  15 mins.
:)
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


A bug in Gtk+?

2005-02-20 Thread Zeeshan Ali
Hello,
   In a gtk+ app of mine, i was facing strange dead-locks problems. I
was astonished to see that just removing the call to gdk_threads_init,
the problems vanished. I am attaching a sample test program that
re-produces the same problem. It seems more like a bug in the gtk+
rather than my logic. Please have a look at it and tell me it that's
the case so I can file it as a bug. I just dont want to file another
'NOT A BUG' :)
___
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 set cursor color in GtkEntry?

2005-02-11 Thread Zeeshan Ali
Hello,
   I used to do such a thing and my way of doing such stuff was using
gtkrc files (which is what i still use). There are two arrays that you
need to set here: text and fg. Set them both to black for all possible
indexes and I think you'll get the behavior you want. Here is a how
the relevent part in you rc file would look like:

fg[NORMAL] = black
fg[ACTIVE] = dark slate grey
fg[PRELIGHT] = black
fg[SELECTED] = black
fg[INSENSITIVE] = black

text[NORMAL] = black
text[ACTIVE] = dark slate grey
text[PRELIGHT] = black
text[SELECTED] = black
text[INSENSITIVE] = black

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