custom widget theme change problem

2012-06-21 Thread James Morris
Hi,

I have a custom GTK widget which renders using Cairo. In the expose
callback gtk_widget_get_style is called to obtain colours to render
the widget with some theme consistency.

When a theme is changed (ie using gtk-chtheme) any of my custom
widgets that are visible are not updated. However, after switching to
a different notebook tab, I can see previously hidden instances of the
custom widget have been updated (switching notebook tabs back again
does not trigger update).

Can anyone give any pointers as to what might be happening?

Thanks,
James.

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


Re: Accelmap value

2012-06-21 Thread drkmkzs
I'm not sure, at least in my system, because in my keyboard mapping
(french) AltGr is used for special characters. These characters works
well in Gtk::TextView or Gtk::Entry, which mean correct value is
passed by Gtk, which means correct modifier is identified by Gtk.

It seems either the problem appears only with accelerators, either I
don't use the correct work key in accelmap file... (I tried AltGr,
AltGraph, Mod1...Mod5)

2012/6/20, Emmanuel Thomas-Maurin manutm...@gmail.com:
 I may be wrong but it seems AltGr is not included in gdkkeysyms.h
 so it's probably ignored by GTK.


 On 06/20/2012 02:59 PM, drkmkzs wrote:
 You mean the altgr key is interpreted as alt key ?

 In my tests, the Alt key is well recognized.

 -in my accelMap file I put
 AltM
 -in my Gtk menu, I can see next to the action
 AltM

 But altgr is not

 -in my accelMap :
 AltGrM (I tried AltGraph but behaves the same)
 -in my Gtk menu, I can see
 M (the modificator has been removed)

 It seems AltGr, as the Windows key, can be sometimes skipped or ignore
 depending on OS (i'm on Suse 10.3) or locale
 Maybe better to ignore these keys ;)

 2012/6/20, Olivier Sessink oliviersess...@gmail.com:
 after a bit of testing, it seems to me that the altgr key advertises
 itself just as alt to gtk...

 Olivier

 2012/6/19 drkmkzs drkm...@gmail.com:
 Hi,

 I'm using a gtk application with an accelmap file. All shortcuts with
 Control, Shift, or Alt are currently available.

 But if I want to add some shortcuts with AltGr key (key on the right
 of the spacebar) it doesn't work (I think i'm not using the good
 syntax in the accelmap because in the application menu, the modifier
 is skipped)

 For control, it's Controlp
 For alt, it's Altp

 So I try AltGrp, but it doesn't work.

 Somebody could tell me which keyword I have to use in my Accelmap for
 a shortcut using AltGr key ?

 Thanks a lot,
 Jean
 ___
 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


 --
 Emmanuel Thomas-Maurin  manutm...@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: multiple GTKentry inside a GTKnotebook

2012-06-21 Thread Mariano Gaudix
How is the program you want to do? Can you explain?

2012/6/21 Rudra Banerjee bnrj.ru...@yahoo.com

 Thanks, but its not solving the main problem.
 
 /
 
  2012/6/20 Rudra Banerjee bnrj.ru...@yahoo.com
  Olivier,
  Thanks for your interest.
  Pasted just below is the complete code.
 
  What I want to do with that is, as a raw commented snip by
  line number
  106-116 that according to my selection of Book/Article in
  combobox, some
  entry will be hidden.
 
  But, for that, I need to get the data from the combo box,
  which I have
  tried in line number 53-54.
 
  Please help.
 
  NB. Olivier, I got your reply in CC as well as a group post.
  So, I am
  replying you also(reply to all). Please don't get offended if
  it was not
  your intention.
  /***THE CODE/
  #include gtk/gtk.h
  #include stdio.h
  #include string.h
  #include gdk/gdk.h
  GtkWidget *window;
  GtkWidget *vbox, *hbox, *combo;
 
  GtkWidget *vbox1, *hbox1, *combo1;
  GtkWidget *entry1;
  GtkWidget *entryAuth;
  GtkWidget *entryEditor;
  GtkWidget *entryTitle;
  GtkWidget *window;
 
 
  int main(int argc,
 char *argv[]) {
 GtkWidget *window;
 GtkWidget *button;
 GtkWidget *table;
 GtkWidget *frame;
 GtkWidget *notebook;
 GtkWidget *label;
 GtkWidget *checkbutton;
 
 GtkWidget *widget;
 int i;
 char bufferf[32];
 char bufferl[32];
 
 //char bibtype;
 
 gtk_init(argc, argv);
 
 window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
 gtk_window_set_title(GTK_WINDOW(window), BibMk);
 gtk_container_set_border_width(GTK_CONTAINER(window), 20);
 g_signal_connect(window, delete-event,
 G_CALLBACK(gtk_main_quit), NULL);
 
 //gtk_window_set_default_size(GTK_WINDOW(window), 200,
  150);
 
 
 vbox = gtk_vbox_new(FALSE, 0);
 hbox = gtk_hbox_new(FALSE, 0);
 gtk_container_add(GTK_CONTAINER(window), hbox);
 gtk_box_pack_start(GTK_BOX(hbox), vbox, FALSE, FALSE, 0);
 frame = gtk_frame_new(Properties);
 
 
 
 combo = gtk_combo_box_text_new();
 gtk_combo_box_append_text(GTK_COMBO_BOX(combo), Book);
 gtk_combo_box_append_text(GTK_COMBO_BOX(combo), Article);
 gtk_box_pack_start(GTK_BOX(vbox), combo, TRUE, TRUE, 0);
 gtk_widget_show(combo);
 
 
  gchar *bibtype =
  gtk_combo_box_get_active_text(GTK_COMBO_BOX(combo));
  printf(%s,
  gtk_combo_box_get_active_text(GTK_COMBO_BOX(combo)));
 
 entry1 = gtk_entry_new();
 gtk_entry_set_text(GTK_ENTRY(entry1), bibKey);
 gtk_box_pack_start(GTK_BOX(hbox), entry1, TRUE, TRUE, 0);
 gtk_widget_show(entry1);
 
 
 /*
  * CREATE THE NOTEBOOK PAN
  */
 
 table = gtk_table_new(3, 6, FALSE);
 
 /* Create a new notebook, place the position of the tabs */
 notebook = gtk_notebook_new();
 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(notebook),
  GTK_POS_TOP);
 gtk_table_attach_defaults(GTK_TABLE(table), notebook, 0, 6,
  0, 1);
 gtk_widget_show(notebook);
 
 
  /*
  * CREATE BASIC NOTEBOOK
  */
 /*
  * Authors Tab
  */
 frame = gtk_frame_new(Authors);
 
 gtk_widget_set_usize(frame, 400, 175);
 
 vbox1 = gtk_vbox_new(FALSE, 0);
 hbox1 = gtk_hbox_new(FALSE, 0);
 gtk_container_add(GTK_CONTAINER(frame), vbox1);
 
 entryAuth = gtk_entry_new();
 gtk_entry_set_text(GTK_ENTRY(entryAuth), Author);
 
 gtk_container_add (GTK_CONTAINER (vbox1), entryAuth);
 gtk_widget_show(entryAuth);
 
 entryEditor = gtk_entry_new();
 gtk_entry_set_text(GTK_ENTRY(entryEditor), Editor);
 gtk_container_add (GTK_CONTAINER (vbox1), entryEditor);
 gtk_widget_show(entryEditor);
 
 entryTitle = gtk_entry_new();
 gtk_entry_set_text(GTK_ENTRY(entryTitle), Title);
 gtk_container_add (GTK_CONTAINER (vbox1), entryTitle);
 gtk_widget_show(entryTitle);
 
 label = gtk_label_new(Authors/Title);
 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), frame,
  label);
 
  /*switch (bibtype) {
 case book:
 

GTK 3.0 inactive buttons (Buttons : maximize , minimize , close )

2012-06-21 Thread Mariano Gaudix
Hello How I can make the buttons   are inactive  ,  the buttons  of
the window  (Buttons : maximize , minimize , close )  or without focus when
the pointer  isover  them ? 

I need to get the effect .   Caso 2 . View image


http://fotos.subefotos.com/607c3fb8e19de4ed18357b85a33b3ab5o.png
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: custom widget theme change problem

2012-06-21 Thread James Morris
Hello again,

Seems to be a habit of mine here, I ask a question, don't get an
immediate response and then look further into it and find some sort of
solution...

On 21 June 2012 10:42, James Morris jwm.art@gmail.com wrote:
 Hi,

 I have a custom GTK widget which renders using Cairo. In the expose
 callback gtk_widget_get_style is called to obtain colours to render
 the widget with some theme consistency.

 When a theme is changed (ie using gtk-chtheme) any of my custom
 widgets that are visible are not updated. However, after switching to
 a different notebook tab, I can see previously hidden instances of the
 custom widget have been updated (switching notebook tabs back again
 does not trigger update).

 Can anyone give any pointers as to what might be happening?

I've found the culprit, or put another way, I've found what to comment
out to fix the problem.

In my custom_widget_realize callback it has the following code which
if I comment out the last three lines of, the problem resolves:

window = gtk_widget_get_parent_window (widget);
gtk_widget_set_window(widget, window);
g_object_ref (window);

style = gtk_widget_get_style(widget);
style = gtk_style_attach(style, window);
gtk_widget_set_style(widget, style);

It is code I updated from this old code (which won't compile with
GTK_DISABLE_DEPRECATED etc):

widget-window = gtk_widget_get_parent_window (widget);
g_object_ref (widget-window);
widget-style = gtk_style_attach (widget-style, widget-window);

This old code (which uses GDK rather than Cairo) doesn't have any
problem with theme changes... but without it the widgets aren't
updated after theme changes.

Scratching head..
James.


 Thanks,
 James.

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


Re: custom widget theme change problem

2012-06-21 Thread James Morris
On 22 June 2012 01:50, James Morris jwm.art@gmail.com wrote:
 Can anyone give any pointers as to what might be happening?

 I've found the culprit, or put another way, I've found what to comment
 out to fix the problem.

 In my custom_widget_realize callback it has the following code which
 if I comment out the last three lines of, the problem resolves:

    window = gtk_widget_get_parent_window (widget);
    gtk_widget_set_window(widget, window);
    g_object_ref (window);

    style = gtk_widget_get_style(widget);
    style = gtk_style_attach(style, window);
    gtk_widget_set_style(widget, style);

Ok I discovered that solution to cause an alternative problem:
 Gtk-CRITICAL **: IA__gtk_style_detach: assertion `style-attach_count
 0' failed

Which caused me to the first two of the last three lines (ie without
gtk_widget_set_style).

The docs for gtk_style_attach say:
Since this function may return a new object, you have to use it in
the following way: style = gtk_style_attach (style, window)

So what am I meant to do with it?

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


Re: multiple GTKentry inside a GTKnotebook

2012-06-21 Thread Rudra Banerjee
By this code, what I want to achieve is that:
After choosing book/loco/lardon etc as done by you, this will print the
active_data in combobox and Entries in a file.

So, if the combo entry is Book and 
entryAuth is MyAuthor
entryEditor is MyEditor
entryTitle is MyTitle
and
bibkey is Mybib

then according to file selected(new/old) it will write there
@book{MyBib
Author=MyAuthor
Title=MyTitle
}

ofcourse the formatting can be done later. My current problem in hand is
to get those text like Book, MyAuthor, Mybib etc as a variable to use.

I googled and found some example but not working.
Last but not the least, thanks  Mariano for exporting it to GTK3. its
really looks nice.

On Thu, 2012-06-21 at 11:03 -0300, Mariano Gaudix wrote:
 How is the program you want to do? Can you explain?
 
 2012/6/21 Rudra Banerjee bnrj.ru...@yahoo.com
 Thanks, but its not solving the main problem. 
  
 /
 
  2012/6/20 Rudra Banerjee bnrj.ru...@yahoo.com
  Olivier,
  Thanks for your interest.
  Pasted just below is the complete code.
 
  What I want to do with that is, as a raw commented
 snip by
  line number
  106-116 that according to my selection of
 Book/Article in
  combobox, some
  entry will be hidden.
 
  But, for that, I need to get the data from the combo
 box,
  which I have
  tried in line number 53-54.
 
  Please help.
 
  NB. Olivier, I got your reply in CC as well as a
 group post.
  So, I am
  replying you also(reply to all). Please don't get
 offended if
  it was not
  your intention.
  /***THE CODE/
  #include gtk/gtk.h
  #include stdio.h
  #include string.h
  #include gdk/gdk.h
  GtkWidget *window;
  GtkWidget *vbox, *hbox, *combo;
 
  GtkWidget *vbox1, *hbox1, *combo1;
  GtkWidget *entry1;
  GtkWidget *entryAuth;
  GtkWidget *entryEditor;
  GtkWidget *entryTitle;
  GtkWidget *window;
 
 
  int main(int argc,
 char *argv[]) {
 GtkWidget *window;
 GtkWidget *button;
 GtkWidget *table;
 GtkWidget *frame;
 GtkWidget *notebook;
 GtkWidget *label;
 GtkWidget *checkbutton;
 
 GtkWidget *widget;
 int i;
 char bufferf[32];
 char bufferl[32];
 
 //char bibtype;
 
 gtk_init(argc, argv);
 
 window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
 gtk_window_set_title(GTK_WINDOW(window),
 BibMk);
 
  gtk_container_set_border_width(GTK_CONTAINER(window), 20);
 g_signal_connect(window, delete-event,
 G_CALLBACK(gtk_main_quit), NULL);
 
 //
  gtk_window_set_default_size(GTK_WINDOW(window), 200,
  150);
 
 
 vbox = gtk_vbox_new(FALSE, 0);
 hbox = gtk_hbox_new(FALSE, 0);
 gtk_container_add(GTK_CONTAINER(window), hbox);
 gtk_box_pack_start(GTK_BOX(hbox), vbox, FALSE,
 FALSE, 0);
 frame = gtk_frame_new(Properties);
 
 
 
 combo = gtk_combo_box_text_new();
 gtk_combo_box_append_text(GTK_COMBO_BOX(combo),
 Book);
 gtk_combo_box_append_text(GTK_COMBO_BOX(combo),
 Article);
 gtk_box_pack_start(GTK_BOX(vbox), combo, TRUE,
 TRUE, 0);
 gtk_widget_show(combo);
 
 
  gchar *bibtype =
  gtk_combo_box_get_active_text(GTK_COMBO_BOX(combo));
  printf(%s,
 
 gtk_combo_box_get_active_text(GTK_COMBO_BOX(combo)));
 
 entry1 = gtk_entry_new();
 gtk_entry_set_text(GTK_ENTRY(entry1), bibKey);
 gtk_box_pack_start(GTK_BOX(hbox), entry1, TRUE,
 TRUE, 0);
 gtk_widget_show(entry1);
 
 
 /*
  * CREATE THE NOTEBOOK PAN
  */
 
 table =