GtkInfoBar - How do you set "button-spacing" style property.

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

GtkInfoBar - How do you set "button-spacing" style property.

David C. Rankin
All,

  I've pulled my hair out trying to find any easy way to set the GtkInfoBar
"button-spacing" style properly. This seems like something that should be so
simply, but it looks damn near impossible. I've been though the gtk_reference
manual, the gobject_reference manual and the best I can do is get the
property, e.g.

    GtkWidget *infobar;             /* the infobar widget */
    infobar = gtk_info_bar_new ();  /* create new infobar */
    gint spacing;
    ...
    gtk_widget_style_get (infobar, "button-spacing", &spacing, NULL);
    g_print ("spacing: %d\n", spacing);


Which then confirms that the default "button-spacing" is 6, but how the heck
do I set it?

  I have an infobar to handle File->Quit from an editor which checks
gtk_text_buffer_get_modified and then provides 3 buttons in the action_area:

"Do you want to save the changes you have made?"

    "_Yes"    - save if filename or call file-save-as dialog

    "_No"     - tidy up and gtk_main_quit ();

    "_Cancel" - close infobar and go back to editor


  The problem is the 6px spacing is way to big and the info bar takes up too
much space. I want to set the "button-spacing" style property to 2 (or 1) to
cut down the vertical height.

  How do I set the "button-spacing" style property?

(it's these little, seemingly simple things, that are the most frustrating)


--
David C. Rankin, J.D.,P.E.
_______________________________________________
gtk-app-devel-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Reply | Threaded
Open this post in threaded view
|

Re: GtkInfoBar - How do you set "button-spacing" style property.

David C. Rankin
On 08/27/2017 04:53 AM, David C. Rankin wrote:

>
>   The problem is the 6px spacing is way to big and the info bar takes up too
> much space. I want to set the "button-spacing" style property to 2 (or 1) to
> cut down the vertical height.
>
>   How do I set the "button-spacing" style property?
>
> (it's these little, seemingly simple things, that are the most frustrating)
>
>

Well,

  I can't find an easy way to do it. I stumbled around and created an rcfile
entry that will do it. Here is what I cam up with:

style "infobar-button-spacing"
{
   GtkInfoBar::button-spacing = 2
}
widget_class "*.GtkInfoBar" style "infobar-button-spacing"

  Is there a better way to do it? Is there a better way to limit application
and search time to only apply to infobars?

How do you package this snippet of any rcfile and have it read by your
application -- in addition to the default theme in use? (Gtk+2)?

--
David C. Rankin, J.D.,P.E.
_______________________________________________
gtk-app-devel-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Reply | Threaded
Open this post in threaded view
|

Re: GtkInfoBar - How do you set "button-spacing" style property.

David C. Rankin
On 08/29/2017 11:48 PM, David C. Rankin wrote:

> How do you package this snippet of any rcfile and have it read by your
> application -- in addition to the default theme in use? (Gtk+2)?
>

Got it -- gtk_rc_parse (filename);

--
David C. Rankin, J.D.,P.E.
_______________________________________________
gtk-app-devel-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list