Exemplo n.º 1
0
static void
indicator_workrave_init(IndicatorWorkrave *self)
{
  self->priv = INDICATOR_WORKRAVE_GET_PRIVATE(self);
  IndicatorWorkravePrivate *priv = INDICATOR_WORKRAVE_GET_PRIVATE(self);

  priv->label = NULL;
  priv->image = NULL;
  // self->priv->sm = NULL;
  priv->menu = NULL;
  priv->workrave_proxy = NULL;
  priv->workrave_proxy_cancel = NULL;
  priv->owner_id = 0;
  priv->watch_id = 0;
  priv->alive = FALSE;
  priv->timer = 0;
  priv->timerbox = NULL;
  priv->update_count = 0;

  // self->priv->sm = indicator_service_manager_new_version(WORKRAVE_INDICATOR_SERVICE_NAME, WORKRAVE_INDICATOR_SERVICE_VERSION);
  priv->menu = dbusmenu_gtkmenu_new(WORKRAVE_INDICATOR_MENU_NAME, WORKRAVE_INDICATOR_MENU_OBJ);
  priv->timerbox = g_object_new(WORKRAVE_TYPE_TIMERBOX, NULL);

  priv->workrave_proxy_cancel = g_cancellable_new();
  g_dbus_proxy_new_for_bus(G_BUS_TYPE_SESSION,
                           G_DBUS_PROXY_FLAGS_NONE,
                           NULL,
                           WORKRAVE_INDICATOR_SERVICE_NAME,
                           WORKRAVE_INDICATOR_SERVICE_OBJ,
                           WORKRAVE_INDICATOR_SERVICE_IFACE,
                           priv->workrave_proxy_cancel,
                           on_dbus_ready,
                           self);
}
static void _cd_indicator_make_menu (CDAppletIndicator *pIndicator)
{
    if (pIndicator->pMenu == NULL)
    {
        pIndicator->pMenu = dbusmenu_gtkmenu_new ((gchar*)pIndicator->cBusName, (gchar*)pIndicator->cMenuObject);  // the cast is unorthodox, but the function definition is clumsy (it should require 2 const gchar*, since it actually duplicates the strings).
        if (pIndicator->pMenu != NULL)
        {
            g_object_ref_sink (G_OBJECT (pIndicator->pMenu));  // the object is floating -> take the reference
            g_object_weak_ref (G_OBJECT (pIndicator->pMenu),
                               (GWeakNotify)_on_menu_destroyed,
                               pIndicator);
            gldi_menu_init (GTK_WIDGET(pIndicator->pMenu), myIcon);

            DbusmenuGtkClient * client = dbusmenu_gtkmenu_get_client (pIndicator->pMenu);
            if (pIndicator->add_menu_handler)
                pIndicator->add_menu_handler (client);
        }
    }
}
Exemplo n.º 3
0
static void
indicator_workrave_init(IndicatorWorkrave *self)
{
  self->priv = INDICATOR_WORKRAVE_GET_PRIVATE(self);
  IndicatorWorkravePrivate *priv = INDICATOR_WORKRAVE_GET_PRIVATE(self);

  priv->label = NULL;
  priv->image = NULL;
  priv->menu = NULL;
  priv->workrave_ui_proxy = NULL;
  priv->workrave_ui_proxy_cancel = NULL;
  priv->workrave_core_proxy = NULL;
  priv->workrave_core_proxy_cancel = NULL;
  priv->owner_id = 0;
  priv->watch_id = 0;
  priv->workrave_running = FALSE;
  priv->alive = FALSE;
  priv->force_icon = FALSE;
  priv->timer = 0;
  priv->startup_timer = 0;
  priv->startup_count = 0;
  priv->timerbox = NULL;
  priv->update_count = 0;

  priv->menu = dbusmenu_gtkmenu_new(WORKRAVE_INDICATOR_MENU_NAME, WORKRAVE_INDICATOR_MENU_OBJ);
  priv->timerbox = g_object_new(WORKRAVE_TYPE_TIMERBOX, NULL);

  indicator_workrave_create_dbus(self);

  priv->watch_id = g_bus_watch_name(G_BUS_TYPE_SESSION,
                                    "org.workrave.Workrave",
                                    G_BUS_NAME_WATCHER_FLAGS_NONE,
                                    on_workrave_appeared,
                                    on_workrave_vanished,
                                    self,
                                    NULL);
}