Detect dark or light theme from an application

2018-11-06 Thread Yuri Khan via gtk-app-devel-list
Hello everybody,

I know in the GTK+3 theming engine a theme can define a light variant
and a dark variant. Is it possible, in an application, to know which
variant is currently used, and/or specify which widget in the
application uses which variant?

Here’s the wider context: Mozilla Firefox uses GTK+3 for some of its
widgets. However, lately, there is a push for custom widgets, on the
grounds that GTK widgets cause problems for the users.

A couple examples:

* The user has a dark theme, which means normal input boxes use light
text on dark background. Suppose that input box is used on a web page
developed by an ignorant person who has never seen a dark theme, and
has specified a dark text color for the input box, without also
specifying a background. Now the user cannot see the text. One
workaround often suggested in the bug tracker is to always run Firefox
with a light theme variant, but a better solution would be to force
light theme inputs in web pages, at least until much of the Web
catches on to dark themes.

* Firefox has Developer Tools, which allow the user to choose a light
or a dark theme. This poses a problem: If the user has a light GTK
theme but selects the dark DevTools theme, the GTK scrollbar would
clash with the overall DevTools UI. Same thing happens in the reverse
situation. Here is an example:
https://bug1471163.bmoattachments.org/attachment.cgi?id=901
[disclaimer: I do not know what that theme is.] This has led Firefox
to develop a substitute scroll bar, which is inferior to the GTK
scroll bar in every way except the ability to control its colors from
the application. In the 64 Nightly version, in place of a scrollbar,
Firefox DevTools display a flat rectangular gray thumb in a flat
rectangular other-shade-of-gray trough.

What would be the Correct Way to solve these problems, from a GTK
developer’s point of view? (Except the obvious “Use GTK widgets as
much as possible, and never allow web content to override GTK widgets’
colors”; that’s not gonna fly for political reasons.)
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: GTK3 + gnuplot

2018-10-02 Thread Yuri Khan via gtk-app-devel-list
On Wed, Sep 19, 2018 at 12:19 AM Allin Cottrell  wrote:

> > The question now is: "How to embed a gnuplot graphic in gtk3?
> > Could you say, please, where to find a simple example, just to undestand
> > how it is possible to do that?
>
> Get gnuplot to produce a PNG file, load the PNG into a GdkPixbuf, then
> stick the GdkPixbuf onto a cairo surface.

Do not do that. With high probability, an application using PNG as an
intermediate plot format will get HiDPI wrong and things will look
either blurry or tiny.

Plot to SVG, then render that.
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: How can I change the font of a text field using non-deprecated way?

2018-10-02 Thread Yuri Khan via gtk-app-devel-list
On Sat, Sep 22, 2018 at 3:11 PM Радомир Хаџић via gtk-app-devel-list
 wrote:

> I'm trying to make a small application in C using GTK+3 (the latest
> stable). The application is going to have a text field implemented using
> GtkTextView where a user can write text. I also font a user to be able to
> change font, so I've added a font chooser using GtkFontChooserDialog.
>
> The problem is that I don't know how to actually set the font of a text
> field to the one that a user chose using font chooser. Well, at least not
> using an up-to-date method. I know I can use gtk_widget_override_font(),
> and though it works perfectly, I'd rather not use it since it's deprecated
> function so it's not meant to be used anymore.

The functionality you are describing is present in pretty much every
GTK+3-based text editor, so look at the source of any one of them.

Gedit (as of 3.18.3 as packaged in Ubuntu 16.04) uses
gtk_widget_override_font, and so does Mousepad (as of 0.4.0), and
what’s good for the stock text editors of GNOME and Xfce, is probably
good for you, too.
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: Cancel a Drag & Drop for some specific items in a Gtk.TreeView

2018-10-02 Thread Yuri Khan via gtk-app-devel-list
On Tue, Sep 11, 2018 at 4:27 AM c.buhtz--- via gtk-app-devel-list
 wrote:

> I have a Gtk.TreeView here. Most but not all of the items should be
> able to be dragged & dropped. For example the first item should not be
> able to be dragged & dropped but it should be selectable.
>
> How can I realize this? Maybe I have to use the drag-begin signal and
> stop the drag in there. But I don't know how.

Reading the “GtkTreeView drag-and-drop”[1] page, I get the impression
that you’d need to implement a wrapper around GtkTreeStore, or
possibly a class derived from GtkTreeStore, that also overrides the
row_draggable method so that it returns False for non-draggable rows.
I have not tried implementing it that way in Python.

[1]: https://developer.gnome.org/gtk3/stable/gtk3-GtkTreeView-drag-and-drop.html
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: Copywrite protection and source-code distribution

2018-08-02 Thread Yuri Khan via gtk-app-devel-list
On Thu, Aug 2, 2018 at 8:31 AM Roger Matthews via gtk-app-devel-list
 wrote:
>
> I have developed an application using GTK+3.10. What copy-write protection 
> can you (GTK+) provide for me. I have been told that copywrite is free and 
> automatic and that to protect the software from piracy I need sufficient 
> money to prove prior usage in a court of law.  I don't see how the 
> requirement of including my source code in the package will allow for 
> successful commercialisation when someone can just simply copy the 
> source-code.  I have no problems about acknowledging GTK+ for providing the 
> GUI development platform and for helping with problems in coding, etcetera. 
> Without adequate protection this requirement (including the source-code) 
> renders GTK+ useless as far as any kind of commercialisation is concerned, 
> please enlighten me on this matter.

First, do not rely on any legal advice you receive from a mailing list
on the Internet. Get a real lawyer.

Second, it’s “copyright”, not “copywrite”.

Third, GTK+ is licensed under Lesser GPL. You are under no obligation
to disclose your application source code if you are not so inclined,
as long as you keep it possible for the end user to re-link your
application with a modified version of GTK+.

And finally, get a real lawyer.
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list