Search This Blog

Thursday, May 20, 2010

Solid, ModemManager and Plasma Applet

I talked to Sebas yesterday and we finally got plasma applet running on my notebook. I have discontinued my patch for monolithic knm and today I have finished to port my changes to plasma applet, here is the result:


I removed the "Access Technology" combox from my old patch because I need to find a better place to add it. I have also fixed some bugs in plasma applet since yesterday:


  • in my notebook the window did not resize to accomodate the traffic graph when I clicked on interface details, now it does.
  • the mac address were only shown for wired and wireless connections, now it works for any kind of connections which have MAC address (ppp0 for instance does not have).
  • if someone selects "Show more" and plasma-desktop closes (crash or restart), next time plasma-desktop run (without logging out), it would show all wireless AP around, which is not the initial state for the widget on the right side. The initial state shows manually added or activated connections only. Now it works as expected if plasma-desktop restarts.


I plan to add separated tabs for each connection type (wired, wireless, gsm, etc), like monolithic knm does. In plasma applet there is only one details tab, which is filled with connection information as needed. If some information is not relevant (operator name for wired connection for instance) or is not available it will take space in the details window and cause plasma applet's window size to increase unnecessarily.

Another thing I want to implement is notifications. Monolithic knm already have notifications working, but it seems plasma applet does not implement them.

8 comments:

Andreas Demmer said...

Great work, much appreciated! :)

Zayed said...

Great, and thank you. For screenshot, is it just me, who think it is too much crowded?

Lamarque said...

@Zayed, I think that too. Using multiple tabs like in monolithic knm will help. Some information are redundant (type appears twice in the screen), some can be agrupped in one line (type and system name for instance), others are just useless in my opinion (driver, connection speed for 3G is meaningless).

I can only remove things like connection speed after implementing multiple tabs and I already have many things to do with ModemManager and notification suppport.

I have also spent all this night awake trying to fix one bug in plasma nm: it partially loose contact with NM if NM restarts. The only solution so far is restarting plasma-desktop (killall plasma-desktop; sleep 1; plasma-deskop), but that is overkill. I tried several things but none was 100% successfull or stable as plasma-desktop restart.

sebas said...

- Instead of killing plasma using killall, you should use "kquitapp plasma-desktop" which quites it nicely without leading to use of dirty config data that haven't hit disk yet

- instead of creating multiple tabs in the details widget, we should make that thing smarter. Implementing what to show per interface type is not that hard, and in order to not fill it up too much, we need to decide what to actually show. I don't think we should put a tab interface in there, since that leads to too many levels of nesting and makes the interesting information harder to find. If the widget becomes too complex (which is likely with the current "one Plasma::Label per info item - one label), we could replace it with a plasma-themed Plasma::WebView and use an HTML table to display the information, making it much easier to manage and update. We'll have to delete the widget then when it's hidden though to save the memory webkit uses, but I think it's the most flexible and clean way forward.

- Connection type being in there twice is actually not true, the header is the name of the interface, the Type is the type of the interface, so those two are distinct. (I agree that it looks redundant, and we could remove it if those two are the same, but they might not be (try wifi for example, header says "WLAN Interface", type says "Wireless 802.11g" here, wired is also different.

-- sebas

coxande said...

How can use this ?

Congratulations nice work.

Anonymous said...

@ sebas

If quitting plasma-desktop using (Linux psmisc package, I understand solaris has a quite different killall) killall, which defaults to signal 15, SIGTERM, isn't saving data, it's entirely plasma-desktop's fault for not responding to SIGTERM appropriately.

SIGTERM is sent to the app, allowing it to respond gracefully, closing files and releasing resources before it closes, or even to ignore the SIGTERM signal entirely, tho that risks system or user wrath and use of the SIGKILL signal (9), which is kernel enforced and not interceptable.

kquitapp may be a kde appropriate way to kill an app, but it's no replacement for properly responding to the decades old SIGTERM, and if any part of kde is failing to do so, that part is simply broken, no other way to define it, at least on a Unix-like platform.

Luckily, plasma-desktop does appear to do the right thing with SIGTERM. Leastwise, I've not observed a problem with it here, and I too use killall with its SIGTERM default routinely to cause plasma-desktop to stop, saving settings as it does so. Likewise, if there's an app that I know will save settings I don't want if given a chance for normal termination, I'll often SIGKILL (9) it, so it doesn't get that chance.

Duncan

Lamarque said...

@Sebas and anonymous (Duncan), ok about kquitapp, I have just forgotten about it. Closing plasma-desktop with killall is just for testing, no big detail it is not the right KDE way of closing an application. I will use this in my tests then :-)

kquitapp plasma-desktop;sleep 1;/usr/bin/qdbus org.kde.klauncher /KLauncher exec_blind plasma-desktop '(' ')'

I like the idea of using Plasma::WebView. As far as I know tooltips in Qt/KDE programs can be a QString containing a xml file embedded into a QLabel. Is Plasma::Label capable of doing that too (render xml files)? If so I think that would be lighter then using Plasma::WebView.

Here the header and type are always the same, being it either wired, wireless or mobile broadband.

@coxande, you need to apply both patches in the reviewboard:

http://reviewboard.kde.org/r/3769/
http://reviewboard.kde.org/r/3778/

The first is for solid (kdebase-workspace package), the second is for plasma network management, you have to recompile both after applying the patches. There is no easy way to use this without recompiling solid and plasma nm. This is a working in progress, there will be changes that will force anyone using this to recompile both packages in the future.

I am almost finishing a hack to make plasma nm work with NM restarts. By what I have found, solid maintains device and connections lists internally, filled with information from NM passed through dbus. When NM appears in the dbus bus solid returns empty device and connection lists even tough dbus returns contents for those lists. That was not supposed to happen and by what I see in the source code solid is doing the right thing, I just do not know why the returned lists are empty. If I print the lists right after NM restarts they are ok, but when plasma nm call the function to retrieve the lists they are empty, very wierd.

I am forcing solid to get the lists from NM when they are empty, which almost works here. When I suspend my notebook to disk (using tuxonice) the wireless device at plasma nm left panel got disabled although I was connected to the Internet :-( It being difficult to catch all failure points.

Lamarque said...

Answering my own question, Plasma::Label can render xml files :-) Great.