[gnome-applets/wip/invest/port-to-c] invest-applet: port to c



commit 63cdad9034c985d673205b0421982ae7aa546774
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Sat Jul 30 12:46:04 2016 +0300

    invest-applet: port to c

 configure.ac                                       |   14 -
 invest-applet/data/Makefile.am                     |   25 +--
 ...g.gnome.applets.InvestApplet.panel-applet.in.in |    3 +-
 ...ome.panel.applet.InvestAppletFactory.service.in |    3 -
 invest-applet/invest/Makefile.am                   |   85 +++----
 invest-applet/invest/__init__.py                   |   45 ----
 invest-applet/invest/about.py                      |   35 ---
 invest-applet/invest/applet.py                     |   72 ------
 invest-applet/invest/defs.py.in                    |   10 -
 invest-applet/invest/help.py                       |    8 -
 invest-applet/invest/invest-applet.c               |  252 ++++++++++++++++++++
 invest-applet/invest/invest-applet.h               |   46 ++++
 invest-applet/invest/invest-applet.py              |   82 -------
 invest-applet/invest/preferences.py                |    2 +-
 invest-applet/invest/test.py                       |   30 ---
 15 files changed, 339 insertions(+), 373 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 905a18d..0e0d72c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -88,7 +88,6 @@ AC_PROG_CC
 AC_ISC_POSIX
 AC_STDC_HEADERS
 AC_PATH_XTRA
-AM_PATH_PYTHON(3)
 
 X_LIBS="$X_LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS"
 AC_SUBST(X_LIBS)
@@ -598,19 +597,6 @@ if test "$gtk_ok" = "yes"; then
             [Define if _NL_MEASUREMENT_MEASUREMENT is available])
 fi
 
-dnl ***************************************************************************
-dnl *** Set install directories                                             ***
-dnl ***************************************************************************
-AC_ARG_WITH([pythondir],
-       AS_HELP_STRING([--with-pythondir=DIR], [installation path for private Python modules @<:@auto@:>@]),
-       [ac_with_pythondir=$withval], [ac_with_pythondir=""])
-if test "$ac_with_pythondir" != ""; then
-       pythondir=${ac_with_pythondir}
-fi
-
-AC_MSG_NOTICE([installing private Python modules in $pythondir])
-AC_SUBST(pythondir)
-
 dnl **************************************************************************
 dnl Process .in files
 dnl **************************************************************************
diff --git a/invest-applet/data/Makefile.am b/invest-applet/data/Makefile.am
index af13377..a9398ce 100644
--- a/invest-applet/data/Makefile.am
+++ b/invest-applet/data/Makefile.am
@@ -3,31 +3,25 @@ SUBDIRS = art
 # ******************************************************************************
 # Panel Applet stuff
 # ******************************************************************************
-servicedir       = $(datadir)/dbus-1/services
-service_in_files = org.gnome.panel.applet.InvestAppletFactory.service.in
-service_DATA     = $(service_in_files:.service.in=.service)
-
-org.gnome.panel.applet.InvestAppletFactory.service: $(service_in_files)
-       $(AM_V_GEN)sed \
-            -e "s|\@LIBEXECDIR\@|$(libexecdir)|" \
-            $< > $@
 
 appletdir       = $(LIBPANEL_APPLET_DIR)
 applet_in_files = org.gnome.applets.InvestApplet.panel-applet.in
 applet_DATA     = $(applet_in_files:.panel-applet.in=.panel-applet)
 
+LOCATION=$(pkglibdir)/$(LIBPANEL_APPLET_API_VERSION)/libinvest-applet.so
+
 $(applet_in_files): $(applet_in_files).in Makefile
        $(AM_V_GEN)sed \
-            -e "s|\@LIBEXECDIR\@|$(libexecdir)|" \
+            -e "s|\@LOCATION\@|$(LOCATION)|" \
             -e "s|\@VERSION\@|$(PACKAGE_VERSION)|" \
             $< > $@
 
 %.panel-applet: %.panel-applet.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*po) ; $(INTLTOOL_MERGE) 
$(top_srcdir)/po $< $@ -d -u -c $(top_builddir)/po/.intltool-merge-cache
 
-
 # ******************************************************************************
 # Misc data
 # ******************************************************************************
+
 uidir = $(pkgdatadir)/ui
 ui_DATA = \
        invest-applet-menu.xml
@@ -42,20 +36,13 @@ investbindir = $(libdir)/invest-applet
 # ******************************************************************************
 # Build rules
 # ******************************************************************************
-@INTLTOOL_SERVER_RULE@
-@INTLTOOL_SCHEMAS_RULE@
-
 
+@INTLTOOL_SCHEMAS_RULE@
 
-CLEANFILES = $(applet_DATA) $(applet_DATA).in $(service_DATA)
-
-DISTCLEANFILES = \
-       $(server_in_files) \
-       $(server_in_files:.server.in=.server)
+CLEANFILES = $(applet_DATA) $(applet_DATA).in
 
 EXTRA_DIST = \
        org.gnome.applets.InvestApplet.panel-applet.in.in \
-       $(service_in_files) \
        $(ui_DATA) \
        $(builder_DATA)
 
diff --git a/invest-applet/data/org.gnome.applets.InvestApplet.panel-applet.in.in 
b/invest-applet/data/org.gnome.applets.InvestApplet.panel-applet.in.in
index afedcdb..7116c40 100644
--- a/invest-applet/data/org.gnome.applets.InvestApplet.panel-applet.in.in
+++ b/invest-applet/data/org.gnome.applets.InvestApplet.panel-applet.in.in
@@ -1,6 +1,7 @@
 [Applet Factory]
 Id=InvestAppletFactory
-Location=@LIBEXECDIR@/invest-applet
+InProcess=true
+Location=@LOCATION@
 _Name=Invest Applet Factory
 _Description=Factory for creating the invest applet.
 
diff --git a/invest-applet/invest/Makefile.am b/invest-applet/invest/Makefile.am
index 4b0d656..c1b71ff 100644
--- a/invest-applet/invest/Makefile.am
+++ b/invest-applet/invest/Makefile.am
@@ -1,55 +1,34 @@
-invest-applet: invest-applet.py
-       sed -e "s|\@PYTHONDIR\@|$(pythondir)/|" $< > $@
-
-defs.py: defs.py.in
-       sed \
-               -e "s|\@DATADIR\@|$(datadir)|" \
-               -e "s|\@LIBDIR\@|$(libdir)|" \
-               -e "s|\@VERSION\@|$(VERSION)|" \
-               -e "s|\@PACKAGE\@|$(PACKAGE)|" \
-               -e "s|\@PKGDATADIR\@|$(pkgdatadir)|" \
-               -e "s|\@PYTHONDIR\@|$(pythondir)|" \
-               -e "s|\@GETTEXT_PACKAGE\@|$(GETTEXT_PACKAGE)|" \
-               -e "s|\@GNOMELOCALEDIR\@|$(localedir)|" \
-               -e "s|\@BUILDERDIR\@|$(pkgdatadir)/builder|" \
-               -e "s|\@LIBPANEL_APPLET_API_VERSION\@|$(LIBPANEL_APPLET_API_VERSION)|" \
-               $< > $@
-
-bin_SCRIPTS = invest-chart
-
-libexec_SCRIPTS = invest-applet
-
-investdir = $(pythondir)/invest
-invest_PYTHON = \
-       __init__.py \
-       about.py \
-       help.py \
-       applet.py \
-       chart.py \
-       currencies.py \
-       widgets.py \
-       quotes.py \
-       networkmanager.py \
-       preferences.py
-nodist_invest_PYTHON = \
-       defs.py
-
-BUILT_SOURCES = \
-       invest-applet
-
-CLEANFILES = \
-       $(BUILT_SOURCES)
-
-DISTCLEANFILES = \
-       defs.py \
-       $(CLEANFILES)
-
-EXTRA_DIST = \
-       defs.py.in \
-       invest-applet.py \
-       invest-chart \
-       test.py
-
-#TESTS = test.py
+NULL =
+
+invest_applet_libdir = $(pkglibdir)/$(LIBPANEL_APPLET_API_VERSION)
+invest_applet_lib_LTLIBRARIES = libinvest-applet.la
+
+libinvest_applet_la_SOURCES = \
+       invest-applet.c \
+       invest-applet.h \
+       $(NULL)
+
+libinvest_applet_la_CPPFLAGS = \
+       -DARTDIR=\""$(pkgdatadir)/invest-applet"\" \
+       -DBUILDERDIR=\""$(pkgdatadir)/builder"\" \
+       -DGNOMELOCALEDIR=\""$(localedir)"\" \
+       -DUIDIR=\""$(pkgdatadir)/ui"\" \
+       $(NULL)
+
+libinvest_applet_la_CFLAGS = \
+       $(GNOME_APPLETS_CFLAGS) \
+       $(WARN_CFLAGS) \
+       $(AM_CFLAGS) \
+       $(NULL)
+
+libinvest_applet_la_LIBADD = \
+       $(GNOME_APPLETS_LIBS) \
+       $(NULL)
+
+libinvest_applet_la_LDFLAGS = \
+       -module -avoid-version \
+       $(WARN_LDFLAGS) \
+       $(AM_LDFLAGS) \
+       $(NULL)
 
 -include $(top_srcdir)/git.mk
diff --git a/invest-applet/invest/__init__.py b/invest-applet/invest/__init__.py
index 0ee8899..e347d50 100644
--- a/invest-applet/invest/__init__.py
+++ b/invest-applet/invest/__init__.py
@@ -6,51 +6,6 @@ import pickle
 from urllib.request import ProxyHandler, build_opener, install_opener
 from . import networkmanager
 
-# Autotools set the actual data_dir in defs.py
-from .defs import DATA_DIR, BUILDERDIR
-
-DEBUGGING = False
-
-# central debugging and error method
-def debug(msg):
-       if DEBUGGING:
-               print("%s: %s" % (datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S.%f"), msg))
-
-def error(msg):
-       print("%s: ERROR: %s" % (datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S.%f"), msg))
-
-
-def exceptionhandler(t, value, tb):
-       error("%s occurred: %s" % (t.__name__, value))
-       for elem in traceback.extract_tb(tb):
-               error("\t%s:%d in %s: %s" % (elem[0], elem[1], elem[2], elem[3]))
-
-# redirect uncaught exceptions to this exception handler
-debug("Installing default exception handler")
-sys.excepthook = exceptionhandler
-
-
-
-# Allow to use uninstalled invest ---------------------------------------------
-UNINSTALLED_INVEST = False
-def _check(path):
-       return exists(path) and isdir(path) and isfile(path+"/Makefile.am")
-
-name = join(dirname(__file__), '..')
-if _check(name):
-       UNINSTALLED_INVEST = True
-
-# Sets SHARED_DATA_DIR to local copy, or the system location
-# Shared data dir is most the time /usr/share/invest-applet
-if UNINSTALLED_INVEST:
-       SHARED_DATA_DIR = abspath(join(dirname(__file__), '..', 'data'))
-       BUILDER_DATA_DIR = SHARED_DATA_DIR
-       ART_DATA_DIR = join(SHARED_DATA_DIR, 'art')
-else:
-       SHARED_DATA_DIR = join(DATA_DIR, "gnome-applets", "invest-applet")
-       BUILDER_DATA_DIR = BUILDERDIR
-       ART_DATA_DIR = SHARED_DATA_DIR
-
 USER_INVEST_DIR = expanduser("~/.config/gnome-applets/invest-applet")
 if not exists(USER_INVEST_DIR):
        try:
diff --git a/invest-applet/invest/applet.py b/invest-applet/invest/applet.py
index 7210658..e691f0a 100644
--- a/invest-applet/invest/applet.py
+++ b/invest-applet/invest/applet.py
@@ -1,57 +1,7 @@
-from os.path import join
-
-from gi.repository import GObject, Gio, Gtk, Gdk, GdkPixbuf, PanelApplet
-GObject.threads_init()
-
-from gettext import gettext as _
-
-import invest, invest.about, invest.chart, invest.preferences, invest.defs
-from invest.quotes import QuoteUpdater
-from invest.widgets import InvestWidget
-
-Gtk.Window.set_default_icon_from_file(join(invest.ART_DATA_DIR, "invest_neutral.svg"))
-
 WidgetBorderWidth = 4
 WidgetPaddingSpace = 10
 
 class InvestApplet(PanelApplet.Applet):
-       def __init__(self, applet):
-               invest.debug("init applet");
-               self.applet = applet
-
-               actiongroup = Gio.SimpleActionGroup.new()
-
-               action = Gio.SimpleAction.new("about", None)
-               action.connect("activate", self.on_about)
-               actiongroup.add_action(action)
-
-               action = Gio.SimpleAction.new("help", None)
-               action.connect("activate", self.on_help)
-               actiongroup.add_action(action)
-
-               action = Gio.SimpleAction.new("preferences", None)
-               action.connect("activate", self.on_preferences)
-               actiongroup.add_action(action)
-
-               action = Gio.SimpleAction.new("refresh", None)
-               action.connect("activate", self.on_refresh)
-               actiongroup.add_action(action)
-
-               self.applet.setup_menu_from_file (join(invest.defs.PKGDATADIR, "ui/invest-applet-menu.xml"),
-                                                 actiongroup, invest.defs.GETTEXT_PACKAGE);
-
-               self.applet.insert_action_group ("invest", actiongroup);
-
-               evbox = Gtk.HBox()
-               self.applet_icon = Gtk.Image()
-               self.set_applet_icon(0)
-               self.applet_icon.show()
-               evbox.add(self.applet_icon)
-               self.applet.add(evbox)
-               self.applet.connect("button-press-event", self.button_clicked)
-               self.applet.show_all()
-               self.new_ilw()
-
        def new_ilw(self):
                self.quotes_updater = QuoteUpdater(self.set_applet_icon,
                                                   self.set_applet_tooltip)
@@ -79,29 +29,7 @@ class InvestApplet(PanelApplet.Applet):
                        else:
                                # c) Everything is normal: pop-up the window
                                self.ilw.toggle_show()
-       
-       def on_about(self, action, parameter):
-               invest.about.show_about()
-       
-       def on_help(self, action, parameter):
-               invest.help.show_help()
-
-       def on_preferences(self, action, parameter):
-               invest.preferences.show_preferences(self)
-               self.reload_ilw()
-       
-       def on_refresh(self, action, parameter):
-               self.quotes_updater.refresh()
-
-       def set_applet_icon(self, change):
-               if change == 1:
-                       pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_size(join(invest.ART_DATA_DIR, 
"invest-22_up.png"), -1,-1)
-               elif change == 0:
-                       pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_size(join(invest.ART_DATA_DIR, 
"invest-22_neutral.png"), -1,-1)
-               else:
-                       pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_size(join(invest.ART_DATA_DIR, 
"invest-22_down.png"), -1,-1)
-               self.applet_icon.set_from_pixbuf(pixbuf)
-       
+
        def set_applet_tooltip(self, text):
                self.applet_icon.set_tooltip_text(text)
 
diff --git a/invest-applet/invest/invest-applet.c b/invest-applet/invest/invest-applet.c
new file mode 100644
index 0000000..a45d51a
--- /dev/null
+++ b/invest-applet/invest/invest-applet.c
@@ -0,0 +1,252 @@
+/*
+ * Copyright (C) 2004-2005 Raphael Slinckx
+ * Copyright (C) 2009-2011 Enrico Minack
+ * Copyright (C) 2016 Alberts Muktupāvels
+ *
+ * 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, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ *     Alberts Muktupāvels <alberts muktupavels gmail com>
+ *     Enrico Minack <enrico-minack gmx de>
+ *     Raphael Slinckx <raphael slinckx net>
+ */
+
+#include "config.h"
+
+#include <glib/gi18n.h>
+
+#include "invest-applet.h"
+
+struct _InvestApplet
+{
+  PanelApplet  parent;
+
+  GtkWidget   *icon;
+};
+
+struct _InvestAppletClass
+{
+  PanelAppletClass parent_class;
+};
+
+G_DEFINE_TYPE (InvestApplet, invest_applet, PANEL_TYPE_APPLET)
+
+static void
+new_ilw (InvestApplet *applet)
+{
+  // FIXME: self.new_ilw()
+}
+
+static void
+reload_ilw (InvestApplet *applet)
+{
+  // FIXME: self.reload_ilw()
+}
+
+static void
+set_icon (InvestApplet *applet,
+          gint          change)
+{
+  GError *error;
+  GdkPixbuf *pixbuf;
+
+  error = NULL;
+
+  if (change == 1)
+    {
+      pixbuf = gdk_pixbuf_new_from_file_at_size (ARTDIR "/invest-22_up.png",
+                                                 -1, -1, &error);
+    }
+  else if (change == 0)
+    {
+      pixbuf = gdk_pixbuf_new_from_file_at_size (ARTDIR "/invest-22_neutral.png",
+                                                 -1, -1, &error);
+    }
+  else
+    {
+      pixbuf = gdk_pixbuf_new_from_file_at_size (ARTDIR "/invest-22_down.png",
+                                                 -1, -1, &error);
+    }
+
+  if (error)
+    {
+      g_warning ("%s", error->message);
+      g_error_free (error);
+    }
+
+  gtk_image_set_from_pixbuf (GTK_IMAGE (applet->icon), pixbuf);
+  g_clear_object (&pixbuf);
+}
+
+static gboolean
+invest_applet_button_press_event (GtkWidget      *widget,
+                                  GdkEventButton *event)
+{
+  gboolean ret;
+
+  ret = GTK_WIDGET_CLASS (invest_applet_parent_class)->button_press_event (widget, event);
+
+  if (event->button != 1)
+    return ret;
+
+  // FIXME: self.button_clicked
+
+  return ret;
+}
+
+static void
+setup_applet (InvestApplet *applet)
+{
+  GtkWidget *hbox;
+
+  hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
+  gtk_container_add (GTK_CONTAINER (applet), hbox);
+
+  applet->icon = gtk_image_new ();
+  gtk_container_add (GTK_CONTAINER (hbox), applet->icon);
+  gtk_widget_show (applet->icon);
+
+  set_icon (applet, 0);
+}
+
+static void
+refresh_cb (GSimpleAction *action,
+            GVariant      *parameter,
+            gpointer       user_data)
+{
+  // FIXME: self.quotes_updater.refresh()
+}
+
+static void
+preferences_cb (GSimpleAction *action,
+                GVariant      *parameter,
+                gpointer       user_data)
+{
+  InvestApplet *applet;
+
+  applet = INVEST_APPLET (user_data);
+
+  // FIXME: invest.preferences.show_preferences(self)
+
+  reload_ilw (applet);
+}
+
+static void
+help_cb (GSimpleAction *action,
+         GVariant      *parameter,
+         gpointer       user_data)
+{
+  GdkScreen *screen;
+
+  screen = gdk_screen_get_default ();
+
+  gtk_show_uri (screen, "help:invest-applet", GDK_CURRENT_TIME, NULL);
+}
+
+static const gchar *authors[] = {
+  "Raphael Slinckx <raphael slinckx net>",
+  "Enrico Minack <enrico-minack gmx de>",
+  NULL
+};
+
+static void
+about_cb (GSimpleAction *action,
+          GVariant      *parameter,
+          gpointer       user_data)
+{
+  const gchar *copyright;
+  GdkPixbuf *logo;
+
+  copyright = "Copyright © 2004-2005 Raphael Slinckx.\nCopyright © 2009-2011 Enrico Minack.";
+  logo = gdk_pixbuf_new_from_file_at_size (ARTDIR "/invest_neutral.svg", 96, 96, NULL);
+
+  gtk_show_about_dialog (NULL,
+                         "authors", authors,
+                         "comments", _("Track your invested money."),
+                         "copyright", copyright,
+                         "logo", logo,
+                         "program-name", _("Invest"),
+                         "version", VERSION,
+                         "translator-credits", _("translator-credits"),
+                         NULL);
+}
+
+static const GActionEntry menu_actions[] = {
+  { "refresh",     refresh_cb },
+  { "preferences", preferences_cb },
+  { "help",        help_cb },
+  { "about",       about_cb }
+};
+
+static void
+setup_menu (PanelApplet *applet)
+{
+  GSimpleActionGroup *action_group;
+  const gchar *file;
+
+  action_group = g_simple_action_group_new ();
+  file = UIDIR "/invest-applet-menu.xml";
+
+  g_action_map_add_action_entries (G_ACTION_MAP (action_group), menu_actions,
+                                   G_N_ELEMENTS (menu_actions), applet);
+
+  panel_applet_setup_menu_from_file (applet, file, action_group,
+                                     GETTEXT_PACKAGE);
+
+  gtk_widget_insert_action_group (GTK_WIDGET (applet), "invest",
+                                  G_ACTION_GROUP (action_group));
+
+  g_object_unref (action_group);
+}
+
+static void
+invest_applet_class_init (InvestAppletClass *applet_class)
+{
+  GtkWidgetClass *widget_class;
+
+  widget_class = GTK_WIDGET_CLASS (applet_class);
+
+  widget_class->button_press_event = invest_applet_button_press_event;
+}
+
+static void
+invest_applet_init (InvestApplet *applet)
+{
+  PanelApplet *papplet;
+
+  papplet = PANEL_APPLET (applet);
+
+  setup_applet (applet);
+  setup_menu (papplet);
+
+  new_ilw (applet);
+}
+
+static gboolean
+invest_applet_factory (PanelApplet *applet,
+                       const gchar *iid,
+                       gpointer     data)
+{
+  if (g_strcmp0 (iid, "InvestApplet") != 0)
+    return FALSE;
+
+  gtk_widget_show_all (GTK_WIDGET (applet));
+
+  return TRUE;
+}
+
+PANEL_APPLET_IN_PROCESS_FACTORY ("InvestAppletFactory",
+                                 INVEST_TYPE_APPLET,
+                                 invest_applet_factory,
+                                 NULL)
diff --git a/invest-applet/invest/invest-applet.h b/invest-applet/invest/invest-applet.h
new file mode 100644
index 0000000..b2fe06e
--- /dev/null
+++ b/invest-applet/invest/invest-applet.h
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2004-2005 Raphael Slinckx
+ * Copyright (C) 2009-2011 Enrico Minack
+ * Copyright (C) 2016 Alberts Muktupāvels
+ *
+ * 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, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ *     Alberts Muktupāvels <alberts muktupavels gmail com>
+ *     Enrico Minack <enrico-minack gmx de>
+ *     Raphael Slinckx <raphael slinckx net>
+ */
+
+#ifndef INVEST_APPLET_H
+#define INVEST_APPLET_H
+
+#include <panel-applet.h>
+
+G_BEGIN_DECLS
+
+#define INVEST_TYPE_APPLET         (invest_applet_get_type ())
+#define INVEST_APPLET(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), INVEST_TYPE_APPLET, InvestApplet))
+#define INVEST_APPLET_CLASS(c)     (G_TYPE_CHECK_CLASS_CAST ((c),    INVEST_TYPE_APPLET, InvestAppletClass))
+#define INVEST_IS_APPLET(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), INVEST_TYPE_APPLET))
+#define INVEST_IS_APPLET_CLASS(c)  (G_TYPE_CHECK_CLASS_TYPE ((c),    INVEST_TYPE_APPLET))
+#define INVEST_APPLET_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o),   INVEST_TYPE_APPLET, InvestAppletClass))
+
+typedef struct _InvestApplet      InvestApplet;
+typedef struct _InvestAppletClass InvestAppletClass;
+
+GType invest_applet_get_type (void) G_GNUC_CONST;
+
+G_END_DECLS
+
+#endif
diff --git a/invest-applet/invest/preferences.py b/invest-applet/invest/preferences.py
index ac46fce..b8792a0 100644
--- a/invest-applet/invest/preferences.py
+++ b/invest-applet/invest/preferences.py
@@ -287,7 +287,7 @@ class PrefsDialog:
                        model.remove(iter)
 
        def on_help(self, w):
-               invest.help.show_help_section("invest-applet-usage")
+         Gtk.show_uri(None, "help:invest-applet/invest-applet-usage" % id, Gdk.CURRENT_TIME)
 
        def on_tree_keypress(self, w, event):
                if event.keyval == 65535:


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]