Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move away from GtkStatusIcon? #81

Open
hasufell opened this issue Jun 26, 2015 · 19 comments
Open

Move away from GtkStatusIcon? #81

hasufell opened this issue Jun 26, 2015 · 19 comments

Comments

@hasufell
Copy link
Collaborator

Gtk3 is starting to throw deprecation warnings about it. With -Werror I get:

main.c:235:12: error: 'gtk_status_icon_get_size' is deprecated
      [-Werror,-Wdeprecated-declarations]
    return gtk_status_icon_get_size(tray_icon);
           ^
/usr/include/gtk-3.0/gtk/deprecated/gtkstatusicon.h:125:23: note: 
      'gtk_status_icon_get_size' has been explicitly marked deprecated here
gint                  gtk_status_icon_get_size           (GtkStatusIco...
                      ^
main.c:262:15: error: 'gtk_status_icon_new' is deprecated
      [-Werror,-Wdeprecated-declarations]
  tray_icon = gtk_status_icon_new();
              ^
/usr/include/gtk-3.0/gtk/deprecated/gtkstatusicon.h:84:23: note: 
      'gtk_status_icon_new' has been explicitly marked deprecated here
GtkStatusIcon        *gtk_status_icon_new                (void);
                      ^
main.c:268:3: error: 'gtk_status_icon_set_visible' is deprecated
      [-Werror,-Wdeprecated-declarations]
  gtk_status_icon_set_visible(tray_icon, TRUE);
  ^
/usr/include/gtk-3.0/gtk/deprecated/gtkstatusicon.h:151:23: note: 
      'gtk_status_icon_set_visible' has been explicitly marked deprecated here
void                  gtk_status_icon_set_visible        (GtkStatusIco...
                      ^
main.c:328:4: error: 'gtk_status_icon_position_menu' is deprecated
      [-Werror,-Wdeprecated-declarations]
                 gtk_status_icon_position_menu,
                 ^
/usr/include/gtk-3.0/gtk/deprecated/gtkstatusicon.h:160:23: note: 
      'gtk_status_icon_position_menu' has been explicitly marked deprecated
      here
void                  gtk_status_icon_position_menu      (GtkMen...
                      ^
main.c:477:7: error: 'gtk_status_icon_set_from_pixbuf' is deprecated
      [-Werror,-Wdeprecated-declarations]
      gtk_status_icon_set_from_pixbuf(tray_icon, icon_copy);
      ^
/usr/include/gtk-3.0/gtk/deprecated/gtkstatusicon.h:97:23: note: 
      'gtk_status_icon_set_from_pixbuf' has been explicitly marked deprecated
      here
void                  gtk_status_icon_set_from_pixbuf    (GtkStatusIco...
                      ^
main.c:479:7: error: 'gtk_status_icon_set_from_pixbuf' is deprecated
      [-Werror,-Wdeprecated-declarations]
      gtk_status_icon_set_from_pixbuf(tray_icon, icon);
      ^
/usr/include/gtk-3.0/gtk/deprecated/gtkstatusicon.h:97:23: note: 
      'gtk_status_icon_set_from_pixbuf' has been explicitly marked deprecated
      here
void                  gtk_status_icon_set_from_pixbuf    (GtkStatusIco...
                      ^
main.c:483:5: error: 'gtk_status_icon_set_from_pixbuf' is deprecated
      [-Werror,-Wdeprecated-declarations]
    gtk_status_icon_set_from_pixbuf(tray_icon, status_icons[0]);
    ^
/usr/include/gtk-3.0/gtk/deprecated/gtkstatusicon.h:97:23: note: 
      'gtk_status_icon_set_from_pixbuf' has been explicitly marked deprecated
      here
void                  gtk_status_icon_set_from_pixbuf    (GtkStatusIco...
                      ^
main.c:486:3: error: 'gtk_status_icon_set_tooltip_text' is deprecated
      [-Werror,-Wdeprecated-declarations]
  gtk_status_icon_set_tooltip_text(tray_icon, tooltip);
  ^
/usr/include/gtk-3.0/gtk/deprecated/gtkstatusicon.h:137:23: note: 
      'gtk_status_icon_set_tooltip_text' has been explicitly marked deprecated
      here
void                  gtk_status_icon_set_tooltip_text   (GtkStatusIco...

Also see https://bugzilla.gnome.org/show_bug.cgi?id=734826

Does libnotify allow us to do tray icons? https://developer.gnome.org/libnotify/

@hasufell hasufell added this to the 0.7 milestone Aug 10, 2015
@hasufell
Copy link
Collaborator Author

I really have no idea of an alternative. It seems gtk upstream is ignorant enough to completely drop this feature?

@elboulangero
Copy link
Collaborator

I looked a little bit into that, read a few posts... Some projects drop GtkStatusIcon in favour of Libappindicator, a library made primarily by Ubuntu guys, for their desktop. Apparently it's also used in KDE. But Gnome people don't like it, so they won't use it. As a consequence, when libappindicator is used in an environment where it's not supported (aka outside of Ubuntu and KDE), it falls back to... GtkStatusIcon !

Here is what I bookmarked some time ago:

@elboulangero
Copy link
Collaborator

On my system (Debian unstable), I have two apps that switched to libappindicator: gpodder and transmission-gtk.

@hasufell
Copy link
Collaborator Author

it falls back to... GtkStatusIcon !

The question now is if it provides it's own implementation/symbols instead of the gtk one. Otherwise it's the same story for us.

@elboulangero
Copy link
Collaborator

It just uses the deprecated stuff from Gtk3. So it's doesn't solve the problem, just hides it.

@hasufell
Copy link
Collaborator Author

Sounds like someone will have to copy-paste/fork the gtk code that has GtkStatusIcon support into a separate library.

@nicklan
Copy link
Owner

nicklan commented Nov 13, 2015

Yeah, I looked into this a little as well. One other big issue is that interaction with libappindicator icons is very limited. Basically you can only show a menu, so pnmixer would be completely crippled. I think the options are to stay with GtkStatusIcon, or write our own implementation compliant with the XDG spec (http://standards.freedesktop.org/systemtray-spec/systemtray-spec-0.3.html), unless someone else has written a stand-alone library.

@hasufell
Copy link
Collaborator Author

While trying to fix a few deprecation warnings (GtkImageMenuItem is now more or less deprecated), I got sick of this gtk+ politics crap again. You now have to use a GtkBox inside a GtkMenuItem and stuff label and image into it. But glade does not allow you to do that, so you end up manually editing the xml file and every time you use glade, it might break it again.

There is an alternative, called efl which is the library behind enlightenment, but seems to be a generic GUI library. I haven't had a deep enough look on it yet to say whether it would be a good idea to use it. It would ofc involve a major rewrite.

@elboulangero
Copy link
Collaborator

But glade does not allow you to do that, so you end up manually editing the xml file and every time you use glade, it might break it again.

Well Glade will probably catch up with the changes in Gtk+, sooner or later. I like to think that Gtk helps me to improve my self-control, my ability to keep cool.... This is how I take it, and it's not only true with Gtk, most of the open-source world challenges my coolness everyday 😆

@hasufell
Copy link
Collaborator Author

Well Glade will probably catch up with the changes in Gtk+, sooner or later.

I doubt it. They said that the glade IDE will not support all possible widget combinations. So to me it is broken.

@elboulangero elboulangero removed this from the 0.7 milestone Feb 8, 2016
@hasufell
Copy link
Collaborator Author

hasufell commented Mar 7, 2016

https://github.com/encharm/libsystemtray could be an alternative, but has no gtk+ backend yet

@elboulangero elboulangero changed the title move away from GtkStatusIcon? Move away from GtkStatusIcon? Sep 14, 2016
@hasufell
Copy link
Collaborator Author

just tested pnmixer on gtk+-4... GtkStatusIcon is removed ...so, have fun

@SilverRainZ
Copy link
Contributor

@hasufell Is GTK+-4 released?

@elboulangero
Copy link
Collaborator

It's coming quickly. From now on they will release major versions much more often than before. Take a look here:

https://blogs.gnome.org/desrt/2016/06/13/gtk-4-0-is-not-gtk-4/

It's no surprise that everything marked deprecated disappear in the new major version. But as it's said on this article, if we don't need new features, there's no need to switch to a new major version.

@hasufell
Copy link
Collaborator Author

I suggest that we seriously consider to rewrite (lol, again) pnmixer for a different GUI framework.

@elboulangero
Copy link
Collaborator

:) Yeah I think I understand how you feel.

I personally don't mind so much anymore. As long as we stick to Gtk+3, we keep on using the GtkStatusIcon. I can live with that, and I think a lot of people will stick to Gtk+3 for a while anyway. So there's no rush.

Plus, I don't have free time anymore...

@SilverRainZ
Copy link
Contributor

:-) CFLAGS += -Wno-deprecated-declarations

@hasufell
Copy link
Collaborator Author

:-) CFLAGS += -Wno-deprecated-declarations

Those functions are removed now, not deprecated.

@hasufell
Copy link
Collaborator Author

hasufell commented Nov 25, 2016

Plus, I don't have free time anymore...

Yeah, me neither. And I think, if I find the free time, I'd not write it in C anyway, so it might as well be a "fork".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants