Re: Aligning label baselines

2007-04-19 Thread Yeti
On Thu, Apr 19, 2007 at 04:28:42PM -0600, Kevin DeKorte wrote:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
> 
> David Nečas (Yeti) wrote:
> 
> > for (i = 0; i < G_N_ELEMENTS(labels); i++)
> > gtk_table_attach(GTK_TABLE(table),
> >  g_object_new(GTK_TYPE_LABEL,
> >   "label", labels[i], "use-markup", 
> > TRUE,
> >   "xalign", 0.0,
>   "yalign", 1.0,
> >   NULL),
> >  i % 2, i % 2 + 1, i/2, i/2 + 1,
> 
> Try that "yalign" and see if that works.

Thanks, it does not work, perhaps I should have listed
things that do not help:

- yalign: to align baselines, labels with superscripts,
  labels with subscripts, labels with both and labels with
  neither have to be aligned differently; the only possible
  use of yalign could be to measure the layout (after any
  text change), emulate the GtkLabel's calculation of text
  placement and calculate such yalign that it gets the
  baseline to a particular position.

- size requests and groups: the label is misaligned inside
  the request, for example the labels in the middle row
  often request the same size.

- single-line mode: it indeed makes all the labels equally
  high, but the height is smaller than the height of a line
  with subscripts and superscripts therefore they start to
  overlap and are misaligned anyway.

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 eating tab hotkey

2007-04-19 Thread Dan McMahill
Liam R E Quin wrote:
> On Thu, 2007-04-19 at 20:45 -0400, Dan McMahill wrote:
> 
>>I've created a main menubar with a handful of menus using the UI 
>>manager.  All of my hotkeys work except for the menuitem which uses 
>>"Tab" as the hotkey.  The problem is that gtk eats the tab and uses it 
>>to move the focus around my different buttons and and other widgets on 
>>the screen.  Then the menus never get triggered by a "Tab" press.
> 
> 
> Please don't fight the accessibility support :-)  Tab is used to
> help mouseless operation.
> 
> Can't you find an alternative within your program?  Users are
> likely to discover tab in other programs and want yours to
> work the same way.

The hot keys are completely configurable by the user.  In particular, 
this particular program has both motif and gtk GUI's and the file which 
specifies the menus and associated hot keys are supposed to be 
compatible (i.e., if someone wants the gtk version to look and feel like 
the motif version they can). Tab has had a particular meaning for some time.

Besides, this particular program is fairly useless without a mouse anyway.

Perhaps it should be considered a bug then in gtk that it will let you 
specify Tab as the hotkey and have it even show up in the menus if it 
won't actually work.  I guess what I can do in the short term is have my 
program remove the Tab from the hotkeys and issue a warning to the user 
that Tab's aren't allowed.

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


Re: gtk eating tab hotkey

2007-04-19 Thread Liam R E Quin
On Thu, 2007-04-19 at 20:45 -0400, Dan McMahill wrote:
> I've created a main menubar with a handful of menus using the UI 
> manager.  All of my hotkeys work except for the menuitem which uses 
> "Tab" as the hotkey.  The problem is that gtk eats the tab and uses it 
> to move the focus around my different buttons and and other widgets on 
> the screen.  Then the menus never get triggered by a "Tab" press.

Please don't fight the accessibility support :-)  Tab is used to
help mouseless operation.

Can't you find an alternative within your program?  Users are
likely to discover tab in other programs and want yours to
work the same way.

Best,

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

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


gtk eating tab hotkey

2007-04-19 Thread Dan McMahill
I've created a main menubar with a handful of menus using the UI 
manager.  All of my hotkeys work except for the menuitem which uses 
"Tab" as the hotkey.  The problem is that gtk eats the tab and uses it 
to move the focus around my different buttons and and other widgets on 
the screen.  Then the menus never get triggered by a "Tab" press.

Is there a way to tell Gtk to not eat keys like Tab and Tab so 
that I can use them as hotkeys?  Or do I have to capture the keypress 
event and wire it back into the menus myself?  That seems like a pain!

Thanks
-Dan

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


GTK cell renderer for button?

2007-04-19 Thread Jan-Oliver Wagner
Hello,

I need a cell renderer that simply displays a button to trigger
a function related to the respective column.

I wonder why there is no such in GTK+ yet. Is there a particular
reason or did it just happen no one had the time/budget for this?

I've followed a recent hint on this list and looked at libgnome-db 2.99.
There are some cell renderers, but AFAIKS none for a button.

Any other hints where such a cell renderer might already have been
implemented?

All the best

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


Re: Aligning label baselines

2007-04-19 Thread Kevin DeKorte
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

David Nečas (Yeti) wrote:

> for (i = 0; i < G_N_ELEMENTS(labels); i++)
> gtk_table_attach(GTK_TABLE(table),
>  g_object_new(GTK_TYPE_LABEL,
>   "label", labels[i], "use-markup", TRUE,
>   "xalign", 0.0,
"yalign", 1.0,
>   NULL),
>  i % 2, i % 2 + 1, i/2, i/2 + 1,

David,

Try that "yalign" and see if that works.

Kevin
- --
Get my public GnuPG key from
http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x7D0BD5D1
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.7 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org

iD8DBQFGJ+0a6w2kMH0L1dERAiznAJ9mPtidTSMPQA2TX5xHGnkUm928uQCggCoS
yQ/fCQLdMakPu2tEcILYV6Q=
=UevC
-END PGP SIGNATURE-
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Aligning label baselines

2007-04-19 Thread Yeti

Hello, does anyone know how to align the baselines of
GtkLabels?  Without reimplementing most of GtkLabel, if
possible.

Assume a table such as this one:


include 

int
main(int argc, char *argv[])
{
static const gchar *labels[] = {
"Tag1:", "bloody",
"Tag2:", "106",
"Value:",   "10-2",
};
GtkWidget *window, *table;
guint i;

gtk_init(&argc, &argv);
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
g_signal_connect(window, "destroy", G_CALLBACK(gtk_main_quit), NULL);

table = g_object_new(GTK_TYPE_TABLE,
 "n-rows", G_N_ELEMENTS(labels)/2, "n-columns", 2,
 "row-spacing", 2, "column-spacing", 6,
 "border-width", 6,
 NULL);
gtk_container_add(GTK_CONTAINER(window), table);

for (i = 0; i < G_N_ELEMENTS(labels); i++)
gtk_table_attach(GTK_TABLE(table),
 g_object_new(GTK_TYPE_LABEL,
  "label", labels[i], "use-markup", TRUE,
  "xalign", 0.0,
  NULL),
 i % 2, i % 2 + 1, i/2, i/2 + 1,
 GTK_FILL, GTK_FILL, 0, 0);

gtk_widget_show_all(window);
gtk_main();

return 0;
}


The baselines of the labels are clearly misaligned due to
the presence of subscripts and superscripts.

Pango of course can calculate the ascent, descent and
baseline position of a layout, however I cannot see how to
use them to get aligned labels (except for some ugly hacks
and implementation of a new label widget).

Insertion of some strut with the height and depth of a text
with both subscripts and superscripts to each label involved
would correct the alignment too, but I do not know how to do
this either.

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


Displaying contents of a folder in gtk_tree_view

2007-04-19 Thread Tom
Hi!

I'm writing a program which uses "gtk_tree_view" to display the contents 
of a folder. This folder is selected by the user through a 
"gtk_file_chooser_dialog". Now while I can get my app to display the 
files of any folder I want when I tell it which folder to scan by 
'hardcoding' in the path, I can't figure out how to call the appropriate 
functions when 'user-selecting' this path. To clarify:

static GtkTreeModel *create_and_fill_model (void)
{
GtkListStore*store;
...
scanFiles(folder);
 printf("Files found: %d\n",count);
 for (cnt = 0; cnt < count; ++cnt)
 {
 file = files[cnt]->d_name;
 printf ("%s\n",file);
 gtk_list_store_append (store, &iter);
 gtk_list_store_set (store, &iter,COL_TYPE, 
 
"none",COL_NAME, file,-1);
 }
return GTK_TREE_MODEL (store);
}
static GtkWidget *create_view_and_model (void)
{
GtkWidget   *view;
GtkTreeModel*model;
...
model = create_and_fill_model ();
...
return view;
}
static void openDialog( GtkWidget *widget,GtkWidget *window)
{
GtkWidget *dialogOPEN;
...
 folder = gtk_file_chooser_get_current_folder(...)
 create_view_and_model();
 ...
 }
}
int main( int argc,char *argv[] )
{
GtkWidget *list;
GtkWidget *buttonOPEN;  
...
list = create_view_and_model();
buttonOPEN = gtk_button_new_from_stock (GTK_STOCK_OPEN);
g_signal_connect (G_OBJECT 
(buttonOPEN),"clicked",G_CALLBACK   
(openDialog),(gpointer) window);
...
}

This is the basic structure of my program. I'm guessing that because I 
am 'recalling' "create_view_and_model" from within "openDIALOG" the list 
is not getting drawn inside the widget. I know that the 
'data'(filenames) is getting to my function, as I can dump them with 
printf();
How do I solve this?

Sorry for the long post...
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


getting instance - help

2007-04-19 Thread Alexander Miro

Hi, first of all sorry about my English mistakes.

I've made a shared object (DLL) which is loaded by Mozilla Browser.
When I try to call a gtk_message_dialog_new() from this dll class instance
a SIGSEGV comes up.

I have a suspicion that there is a conflict with Mozilla GTK instance even
after a successful gtk_init_check() calling, indeed  this same code has
been successfully executed by a stand alone application (don't use GTK
functions).

Bellow is the snippet from the dll:

...
DlgSenha::DlgSenha()
{
int argc = 0;
char** argv = 0;

if (gtk_init_check(&argc, &argv))
GtkWidget* dialog = gtk_message_dialog_new (NULL,
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_CLOSE,
"Dummy message for test");
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
gtk_main();
}
}


And this the error:

GLib-GObject-CRITICAL **: gtype.c:2240: initialization assertion failed,
use g_type_init() prior to this function

GLib-GObject-CRITICAL **: gtype.c:2240: initialization assertion failed,
use g_type_init() prior to this function

GLib-GObject-CRITICAL **: gtype.c:2240: initialization assertion failed,
use g_type_init() prior to this function

GLib-GObject-CRITICAL **: gtype.c:2240: initialization assertion failed,
use g_type_init() prior to this function

GLib-GObject-CRITICAL **: g_type_add_interface_static: assertion
`G_TYPE_IS_INSTANTIATABLE (instance_type)' failed

GLib-GObject-CRITICAL **: gtype.c:2240: initialization assertion failed,
use g_type_init() prior to this function

GLib-GObject-CRITICAL **: gtype.c:2240: initialization assertion failed,
use g_type_init() prior to this function

GLib-GObject-CRITICAL **: gtype.c:2240: initialization assertion failed,
use g_type_init() prior to this function

GLib-GObject-CRITICAL **: gtype.c:2240: initialization assertion failed,
use g_type_init() prior to this function

GLib-GObject-CRITICAL **: gtype.c:2240: initialization assertion failed,
use g_type_init() prior to this function

GLib-GObject-CRITICAL **: g_object_new: assertion `G_TYPE_IS_OBJECT
(object_type)' failed

Program received signal SIGSEGV, Segmentation fault.
0xb76e4df1 in gtk_message_dialog_new () from
/opt/gnome/lib/libgtk-x11-2.0.so.0



BACKTRACE :
(gdb) bt
#0  0xb76e4df1 in gtk_message_dialog_new () from
/opt/gnome/lib/libgtk-x11-2.0.so.0
#1  0xb7f86c04 in DlgSenha (this=0xb6b78834, [EMAIL PROTECTED],
[EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED],
[EMAIL PROTECTED]) at DlgSenha.cpp:365
#2  0xb7fa5319 in P11PrivateKey::MostrarDlgCapturaSenhaP8
(this=0xb2a063c8, [EMAIL PROTECTED]) at P11PrivateKey.cpp:186
#3  0xb7fa5819 in P11PrivateKey::ValidarSenha (this=0xb2a063c8) at
P11PrivateKey.cpp:134
#4  0xb7fb167b in P11Token::Sign (this=0xb7fd1780,
[EMAIL PROTECTED], [EMAIL PROTECTED], pData=0xb6b78da0 "o\032
#5  0xb7fa8019 in P11Session::Sign (this=0xb2a3d8f4, pData=0xb6b78da0 "o\032
#6  0xb7f9b3c9 in P11Ctrl::C_Sign (this=0xb7fd15e0,
[EMAIL PROTECTED], pData=0xb6b78da0 "o\032
#7  0xb7f88069 in C_Sign (hSession=2, pData=0xb6b78da0 "o\032
#8  0xb2ce65c7 in PK11_Sign (key=0x85bfda0, sig=0xb6b78dd0,
hash=0xb6b78d40) at pk11obj.c:765
#9  0xb2c13336 in ssl3_SignHashes (hash=0xb6b78da0, key=0x85bfda0,
buf=0xb6b78dd0, isTLS=1) at ssl3con.c:823
#10 0xb2c1ac18 in ssl3_SendCertificateVerify (ss=0xb2a0da10) at
ssl3con.c:4365
#11 0xb2c1c6fc in ssl3_HandleServerHelloDone (ss=0xb2a0da10) at
ssl3con.c:5220
#12 0xb2c21633 in ssl3_HandleHandshakeMessage (ss=0xb2a0da10, b=0xb2a14fbc "
#13 0xb2c218f9 in ssl3_HandleHandshake (ss=0xb2a0da10,
origBuf=0xb2a0dc6c) at ssl3con.c:7791
#14 0xb2c221cc in ssl3_HandleRecord (ss=0xb2a0da10, cText=0xb6b78fb0,
databuf=0xb2a0dc6c) at ssl3con.c:8054
#15 0xb2c233bb in ssl3_GatherCompleteHandshake (ss=0xb2a0da10, flags=0)
at ssl3gthr.c:206
#16 0xb2c25d67 in ssl_GatherRecord1stHandshake (ss=0xb2a0da10) at
sslcon.c:1258
#17 0xb2c2d561 in ssl_Do1stHandshake (ss=0xb2a0da10) at sslsecur.c:149
#18 0xb2c2f47e in ssl_SecureSend (ss=0xb2a0da10, buf=0xb2a0d210 "GET /
HTTP/1.1\r\nHost: localhost:8443\r\nUser-Agent: Mozilla/5.0 (X11; U;
Linux i686; en-US; rv:1.7.13) Gecko/20060417\r\nAccept:
text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q"...,
len=381, flags=0) at sslsecur.c:1090
#19 0xb2c2f5e8 in ssl_SecureWrite (ss=0xb2a0da10, buf=0xb2a0d210 "GET /
HTTP/1.1\r\nHost: localhost:8443\r\nUser-Agent: Mozilla/5.0 (X11; U;
Linux i686; en-US; rv:1.7.13) Gecko/20060417\r\nAccept:
text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q"...,
len=381) at sslsecur.c:1128
#20 0xb2c352b0 in ssl_Write (fd=0xb47e87f0, buf=0xb2a0d210, len=381) at
sslsock.c:1454
#21 0xb2bcc0d3 in strcpy () from
/home/atm/bin/mozilla/components/libpipnss.so
#22 0xb47e87f0 in ?? ()
#23 0xb2a0d210 in ?? ()
#24 0x017d in ?? ()
#25 0x0005 in ?? ()
#26 0xb7e7e78c in __pthread_mutex_unlock_usercnt () from
/lib/libpthread.so.0
#27 0xb7ec13d1 in