maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Applications (https://talk.maemo.org/forumdisplay.php?f=41)
-   -   [Announce] Shortcut Stash Home Screen Widget (https://talk.maemo.org/showthread.php?t=65137)

rooster13 2010-11-14 17:09

Re: [Pre Announce] Shortcut Stash
 
I am about to release a new version of Shortcut Stash
including fixes for reading bookmarks.

Now when a bookmark is in a folder it gets added to the list.
Directory listing shows the number of folders and files in the folder.

I am also trying to get the description of an application to show in the app list.

Anybody has an idea how to read the application description like shown in the App Manager?

I'd really like to have that fixed too before releasing a new version. So if someone could help with this I'd really appreciate it.

rooster13 2010-11-15 07:08

Re: [Pre Announce] Shortcut Stash
 
Ok, couldn't wait to post the new deb since I got the scalable icons fixed.
Also added descriptions for folders. Now it is showing the number of folders and files in that directory.

For the applications descriptions I still haven't found a way so I am printing the comment field for those apps which have a proper comment.
If someone knows how to get the proper descriptions please let me know.

The bookmark in a folder issue is also fixed.

Please test and post bug reports.

pelago 2010-11-15 09:57

Re: [Pre Announce] Shortcut Stash
 
Finding the application description as displayed in Application Manager won't be straightforward. That comes from the list of packages, which won't match one-to-one with the .desktop launcher icons.

rooster13 2010-11-15 12:43

Re: [Pre Announce] Shortcut Stash
 
Quote:

Originally Posted by pelago (Post 873823)
Finding the application description as displayed in Application Manager won't be straightforward. That comes from the list of packages, which won't match one-to-one with the .desktop launcher icons.

Thanks, that's what I thought too.

I have experimented with dpkg -l packagename but haven't come up with a desired result. I will continue searching for a solution...

rooster13 2010-11-15 20:56

Re: [Pre Announce] Shortcut Stash
 
Quote:

Originally Posted by pelago (Post 873823)
Finding the application description as displayed in Application Manager won't be straightforward. That comes from the list of packages, which won't match one-to-one with the .desktop launcher icons.

What about the Comment -field in the desktop file?
In most cases there is a gettext msgid in it, like for the browser it is: weba_ap_web_browser_thumb. I've been searching the correct bindtextdomain for it for ages.

So if someone knows what it is and where the .mo -file is located would be most helpful. I thought it was maemo-af-desktop but it wasn't.

nicolai 2010-11-15 22:17

Re: [Pre Announce] Shortcut Stash
 
HI rooster13,

I do use maemo-af-desktop in my application search widget to
read the application comment, as long as there isn't a
X-Text-Domain
entry in the .desktop file.
If there is a X-Text-Domain entry in the desktop file, I use this
as the domain name with dgettext.
hope this helps.

Nicolai

rooster13 2010-11-15 22:36

Re: [Pre Announce] Shortcut Stash
 
Hi Nicolai,

I think I tried that approach but I have to check this out once more.
Maybe there was something wrong with my code.

Thank u for this. U don't happen to have small sample code for me to examine?

nicolai 2010-11-15 23:05

Re: [Pre Announce] Shortcut Stash
 
Sure, this is what I use in my app-search-widget
(feel free to look at the whole source code and steal
what you need :-))

Code:

#define DESKTOP_ENTRY_CONFIG_GROUP "Desktop Entry"
#define TEXTDOMAIN_KEY "X-Text-Domain"
#define NAME_KEY "Name"
#define COMMENT_KEY "Comment"
static
gchar*
_retrieve_app_comment(GKeyFile* key_file)
{
  if(g_key_file_has_key(key_file, DESKTOP_ENTRY_CONFIG_GROUP, TEXTDOMAIN_KEY, NULL) &&
    g_key_file_has_key(key_file, DESKTOP_ENTRY_CONFIG_GROUP, COMMENT_KEY, NULL))
  {
    gchar* text_domain = g_key_file_get_string(key_file, DESKTOP_ENTRY_CONFIG_GROUP, TEXTDOMAIN_KEY, NULL);
    gchar* app_comment_key = g_key_file_get_string(key_file, DESKTOP_ENTRY_CONFIG_GROUP, COMMENT_KEY, NULL);
    gchar* app_comment = g_strdup(dgettext(text_domain, app_comment_key));
    g_free(text_domain);
    if(g_strcmp0(app_comment, app_comment_key) == 0)
    {
      g_free(app_comment);
      app_comment = NULL;
    }
    g_free(app_comment_key);
    return app_comment;
  }
  else if(g_key_file_has_key(key_file, DESKTOP_ENTRY_CONFIG_GROUP, COMMENT_KEY, NULL))
  {
    gchar* app_comment = g_key_file_get_string(key_file, DESKTOP_ENTRY_CONFIG_GROUP, COMMENT_KEY, NULL);
    gchar* comment = g_strdup(dgettext(GETTEXT_PACKAGE, app_comment));
    g_free(app_comment);
    return comment;
  }
  return NULL;
}

You are using QT for your application, right?
I hope this helps anyway, feel free to ask if you have any
questions

Nicolai

rooster13 2010-11-16 07:49

Re: [Pre Announce] Shortcut Stash
 
Thanks Nicolai!

I will check that.
I am using Qt but am sure this piece of code will help.

One question I have is, where are the domains for gettext defined? The maemo-af-desktop etc.

nicolai 2010-11-16 08:56

Re: [Pre Announce] Shortcut Stash
 
Quote:

Originally Posted by rooster13 (Post 874772)
One question I have is, where are the domains for gettext defined? The maemo-af-desktop etc.

I don't remember :-)
I found this one in some example code or in the maemo developer
guide.

Nicolai


All times are GMT. The time now is 09:41.

vBulletin® Version 3.8.8