gtk+3 and the user's homedir .gtkrc-3.0
The gtk3 reference on resource files, gtk+-3.0.2/docs/reference/gtk/html/gtk3-Resource-Files.html,states that, although deprecated, certain files will be read at the end of gtk_init(). Unless modified, the files looked for will be SYSCONFDIR/gtk-2.0/gtkrc and .gtkrc-3.0 in the users home directory. My experience with the ~/.gtkrc-3.0 file when running my application compiled against gtk+-3.0.2is that it has no effect at all. Specifically, I have a file named both gtkrc-2.0 and gtkrc-3.0 (both hard-linked to same content which I show below) When I compile my app against gtk-2 and run it, I see the expected result,with the HighContrast theme applied to borders etc and the text of my GtkEntry entryBox in Binner Gothic font. When I compile the same app against gtk-3 and run it in the same way (without any XDG_CONFIG_HOME or any use of any new gtk-3 settings features such as a settings.ini, css styles etc,i.e. trying to simulate a simple migration with only re-bulding the app),I see plain old Raleigh and the Sans 10 font for the text in the entrybox. Am I doing something wrong or is this a bug ? (in the documentation or in the code?) By the way, yes, I did verify that my gtk3 build is in effect in my gtk3 scenario -I set up a settings.ini and css stylesheet as another variation, and triedwith a new-to-gtk3 widget (lightswitch) and then get my settings applied and thelight-switch works as expected. (BTW-1 - I tried to search the mailing list for hits on .gtkrc-3.0 and got Oops! This link appears to be broken.The requested URL /mailman/search was not found on this server BTW-2 I hope this is the correct list for this question - if not please advise) Cheers John Lumby content of ~/.gtkrc-2.0 and ~/.gtkrc-3.0 # When turned on, this option causes gtk to select the contents of an entry field when it becomes focused.gtk-entry-select-on-focus = 1 # Controls the keybindings that gtk uses for text entry/editing/etc# The emacs theme turns on things like:# ctrl-a == move to beginning of line, ctrl-e == move to end of line, etc.gtk-key-theme-name = Emacsgtk-theme-name = HighContrast # The following section allows you to change the style of the entry boxstyle garish{ font_name = Binner Gothic bg[NORMAL] = #FF0B0B fg[NORMAL] = #00CDFF bg[ACTIVE] = #00FF0B fg[ACTIVE] = #CD00FF bg[PRELIGHT] = #FF0B0B fg[PRELIGHT] = #11 bg[SELECTED] = #FF0B0B fg[SELECTED] = #11F2F2}# Set the widget style for the conversation entry boxwidget *entrybox style garishwidget_class GtkEntry style garishclass GtkEntry style garish ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
RE: gtk+3 and the user's homedir .gtkrc-3.0
Apologies for the awful formatting of that posting - let me try again : The gtk3 reference on resource files, gtk+-3.0.2/docs/reference/gtk/html/gtk3-Resource-Files.html, states that, although deprecated, certain files will be read at the end of gtk_init(). Unless modified, the files looked for will be SYSCONFDIR/gtk-2.0/gtkrc and .gtkrc-3.0 in the users home directory. My experience with the ~/.gtkrc-3.0 file when running my application compiled against gtk+-3.0.2 is that it has no effect at all. Specifically, I have a file named both gtkrc-2.0 and gtkrc-3.0 (both hard-linked to same content which I show below) When I compile my app against gtk-2 and run it, I see the expected result, with the HighContrast theme applied to borders etc and the text of my GtkEntry entryBox in Binner Gothic font. When I compile the same app against gtk-3 and run it in the same way (without any XDG_CONFIG_HOME or any use of any new gtk-3 settings features such as a settings.ini, css styles etc, i.e. trying to simulate a simple migration with only re-bulding the app), I see plain old Raleigh and the Sans 10 font for the text in the entrybox. Am I doing something wrong or is this a bug ? (in the documentation or in the code?) By the way, yes, I did verify that my gtk3 build is in effect in my gtk3 scenario - I set up a settings.ini and css stylesheet as another variation, and tried with a new-to-gtk3 widget (lightswitch) and then get my settings applied and the light-switch works as expected. (BTW-1 - I tried to search the mailing list for hits on .gtkrc-3.0 and got Oops! This link appears to be broken. The requested URL /mailman/search was not found on this server BTW-2 I hope this is the correct list for this question - if not please advise) Cheers John Lumby content of ~/.gtkrc-2.0 and ~/.gtkrc-3.0 # When turned on, this option causes gtk to select the contents of an entry field when it becomes focused. gtk-entry-select-on-focus = 1 # Controls the keybindings that gtk uses for text entry/editing/etc # The emacs theme turns on things like: # ctrl-a == move to beginning of line, ctrl-e == move to end of line, etc. gtk-key-theme-name = Emacs gtk-theme-name = HighContrast # The following section allows you to change the style of the entry box style garish { font_name = Binner Gothic bg[NORMAL] = #FF0B0B fg[NORMAL] = #00CDFF bg[ACTIVE] = #00FF0B fg[ACTIVE] = #CD00FF bg[PRELIGHT] = #FF0B0B fg[PRELIGHT] = #11 bg[SELECTED] = #FF0B0B fg[SELECTED] = #11F2F2 } # Set the widget style for the conversation entry box widget *entrybox style garish widget_class GtkEntry style garish class GtkEntry style garish ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
gtk3 - correct application logic to get value of a setting from a GtkSettings object
Inside my gtk application, I'd like to get (i.e. discover) the name of the current theme,which I believe is the gtk-theme-name property of the current window's GtkSettings. I see how to retrieve the GtkSettings object , using gtk_settings_get_default () or gtk_settings_get_for_screen (),but how do I extract the value of one element such as gtk-theme-name. I see an api gtk_settings_set_property_value () which has no description but from its name sounds likethe write equivalent or a read of the property(???) - so I would want something like gtk_settings_get_property_value () -but there is no such api. Cheers,John Lumby ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
RE: GtkSwitch — lack of specific signal
Colomban wrote : I suppose this is all described somewhere - where?(I am new to gtk application programming). Check the documentation [1] ;) For example, for GtkWidget's signals see [2] or for GtkWindow see [3]... and so on. Cheers, Colomban [1] http://library.gnome.org/devel/gtk/stable/ [2] http://library.gnome.org/devel/gtk/stable/GtkWidget.html#GtkWidget.signal-details [3] http://library.gnome.org/devel/gtk/stable/GtkWindow.html#GtkWindow.signal-details I checked. notify::active is not mentioned anywhere in any of those! (I used my browser's find - can you find it mentioned somewhere?) Cheers, John Lumby ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
GtkSwitch — lack of specific signal
I have been playing with a small application using the new (in gtk3) GtkSwitch (light switch style) widget. The reference manual does not mention any signal specific to this widget, and I think it would be nice to have one. I want a signal for when the state is toggled, e.g. switched. I eventually (after a lot of trial and error) found I could almost do what I needed by using the event-after signal, (snippet below), but with that signal, I found that the data pointer is null (zero) on entry to my callback. I don't know if that is because it is not really valid to use a signal with this widget at all? or some obscure bug? or just maybe that gtk3 is a bit new? By the way, the trial-and-error part is that although I found many different signal types which were delivered to my cb, the event-after was the only one that was delivered exactly once and once only, after the user toggled the switch. GtkWidget *do_light_switch (GtkWidget *do_widget){ [...] GtkSwitch *light_switch_widg; GtkImage *light_on_image; g_signal_connect_object ( GTK_WIDGET (light_switch_widg), event-after, G_CALLBACK (turn_light_on_off) , GTK_WIDGET (light_on_image) , G_CONNECT_AFTER); In my callback, the data pointer is 0 (confirmed with gdb) yet the pointer is set correctly in the above g_signal_connect_object .I eventually resorted to storing the value of the light_on_image in a static savearea and referencing it from there in the cb : save_light_on_image_ptr = GTK_WIDGET (light_on_image); (which worked and also confirmed that the pointer was set correctly at the time of the g_signal_connect_object). Or can someone spot something I did wrong? John Lumby ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
RE: GtkSwitch — lack of specific signal
A! Thank you Tadej.No, mine had only two parameters, the obj ptr and the data ptr.I added the paramspec in between and now all works perfectly. By the way - this seems a bit unpleasant, that some callbacks have a prototype of (objptr, dataptr) and others have (objptr, paramspec, dataptr).How would I know which one to use? Is it that some are in the gtk layer (2 params) but other like notify::active are in the gdk layer (3 params)?And I kind of feel something should have alerted me although I don't know what - I guess the compiler doesn't know. I suppose this is all described somewhere - where?(I am new to gtk application programming). Cheers, John Subject: RE: GtkSwitch — lack of specific signal From: tadeb...@gmail.com To: johnlu...@hotmail.com CC: gtk-app-devel-list@gnome.org Date: Sat, 5 Mar 2011 02:50:05 +0100 Hello. Thanks both. I tried notify::active and it works as well as event-after but still the data pointer argument is bad on entry to the callback(it's not zero but not a valid GTK_WIDGET either). I don't know why - maybe something related to GtkSwitch or maybe a mistake in my code somewhere. Cheers, John Lumby Are you sure your functions has the right prototype? GObject::notify signal handlers should have callbacks defined like this: void notify_callback (GObject*obj, GParamSpec *pspec, gpointer *data) { /* La la la */ } Cheers, Tadej -- Tadej Borovšak tadeboro.blogspot.com tadeb...@gmail.com tadej.borov...@gmail.com ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list