weiß schon jemand, wie man die Integration in das Launcher-Dock programmiert? Mich interessieren besonders:
- Wie kann ich die "Zahlen-Blasen" zeichnen? (Wie Liferea oder Evolution zur Angabe der ungelesenen Elemente haben)
- Wie kann ich Einträge ins Rechts-Klick-Menü erstellen?
- Wie löse ich einen "Urgent"-Event aus, damit das Icon wackelt?
Viele Grüße, Meister0815
PS: Habe gerade noch ein C-Programm gefunden, dass die Zahlen-Blasen zeichnen kann. Leider kann ich kein C und es deshalb nicht für Lazarus verwenden. Vielleicht kann mir jemand helfen? Das Programm geht so:
Code: Alles auswählen
/*
Copyright (C) 2011 jeanfi@gmail.com
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
#include "config.h"
#include <getopt.h>
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <locale.h>
#include <glib/gi18n.h>
#include <unity.h>
#include <gtk/gtk.h>
#include <dbus/dbus-glib.h>
#define LIFEREA_BUS "org.gnome.feed.Reader"
#define READER_PATH "/org/gnome/feed/Reader"
#define READER_IFACE "org.gnome.feed.Reader"
static const char *program_name;
static UnityLauncherEntry *entry;
void print_version()
{
printf("liferea-unity-count %s\n", VERSION);
printf(_("Copyright (C) %s jeanfi@gmail.com\n\
License GPLv2: GNU GPL version 2 or later \
<http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>\n\
This is free software: you are free to change and redistribute it.\n\
There is NO WARRANTY, to the extent permitted by law.\n"),
"2010-2011");
}
void print_help()
{
printf(_("Usage: %s [OPTION]...\n"), program_name);
puts(_("liferea-unity-count is a daemon which displays the number "
"of unread items of Liferea in its Unity Launcher entry."));
puts("");
puts("Options:");
puts(_("\
-h, --help display this help and exit\n\
-v, --version display version information and exit"));
puts("");
printf(_("Report bugs to: %s\n"), PACKAGE_BUGREPORT);
puts("");
printf(_("%s home page: <%s>\n"), PACKAGE_NAME, PACKAGE_URL);
}
void update_launcher_entry(int count)
{
if (!entry) {
entry = unity_launcher_entry_get_for_desktop_file
("liferea.desktop");
if (!entry)
return ;
unity_launcher_entry_set_count_visible(entry, TRUE);
}
unity_launcher_entry_set_count(entry, count);
g_main_context_iteration(NULL, FALSE);
}
int
get_unread_items_count(DBusGProxy *proxy, int *count)
{
GError *error = NULL;
if (!dbus_g_proxy_call(proxy, "GetUnreadItems", &error,
G_TYPE_INVALID,
G_TYPE_INT, count,
G_TYPE_INVALID)) {
if (error->domain == DBUS_GERROR &&
error->code == DBUS_GERROR_REMOTE_EXCEPTION) {
g_printerr(_("Caught remote method exception %s: %s"),
dbus_g_error_get_name(error),
error->message);
} else {
g_printerr(_("Error: %s\n"), error->message);
}
g_error_free(error);
return 0;
}
return 1;
}
static struct option long_options[] = {
{"version", no_argument, 0, 'v'},
{"help", no_argument, 0, 'h'},
{0, 0, 0, 0}
};
int
main(int argc, char **argv)
{
DBusGConnection *connection;
DBusGProxy *proxy;
GError *error;
int count;
int optc, cmdok;
program_name = argv[0];
setlocale(LC_ALL, "");
#if ENABLE_NLS
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
#endif
cmdok = 1;
while ((optc = getopt_long(argc, argv, "vh", long_options,
NULL)) != -1) {
switch (optc) {
case 'h':
print_help();
exit(EXIT_SUCCESS);
case 'v':
print_version();
exit(EXIT_SUCCESS);
default:
cmdok = 0;
break;
}
}
if (!cmdok || optind != argc) {
fprintf(stderr, _("Try `%s --help' for more information.\n"),
program_name);
exit(EXIT_FAILURE);
}
g_type_init();
error = NULL;
connection = dbus_g_bus_get(DBUS_BUS_SESSION,
&error);
if (!connection) {
g_printerr(_("Failed to open connection to bus: %s\n"),
error->message);
g_error_free(error);
exit(EXIT_FAILURE);
}
proxy = dbus_g_proxy_new_for_name(connection,
LIFEREA_BUS,
READER_PATH,
READER_IFACE);
while (1) {
if (get_unread_items_count(proxy, &count))
update_launcher_entry(count);
sleep(10);
}
g_object_unref(proxy);
}