/**
 * gdict_source_chooser_set_loader:
 * @chooser: a #GdictSourceChooser
 * @loader: a #GdictSourceLoader or %NULL to unset it
 *
 * Sets the #GdictSourceLoader to be used by the source chooser
 * widget.
 *
 * Since: 0.12
 */
void
gdict_source_chooser_set_loader (GdictSourceChooser *chooser,
                                 GdictSourceLoader  *loader)
{
  GdictSourceChooserPrivate *priv;

  g_return_if_fail (GDICT_IS_SOURCE_CHOOSER (chooser));
  g_return_if_fail (loader == NULL || GDICT_IS_SOURCE_LOADER (loader));

  priv = chooser->priv;

  if (priv->loader != loader)
    {
      if (priv->loader)
        g_object_unref (priv->loader);

      if (loader)
        {
          priv->loader = g_object_ref (loader);
          gdict_source_chooser_refresh (chooser);
        }

      g_object_notify (G_OBJECT (chooser), "loader");
    }
}
Beispiel #2
0
static void
sidebar_page_changed_cb (GdictSidebar * sidebar, GtrDictPanel * panel)
{
  GtrDictPanelPrivate *priv = panel->priv;
  const gchar *page_id;
  const gchar *message;

  page_id = gdict_sidebar_current_page (sidebar);

  switch (page_id[0])
    {
    case 's':
      {
        switch (page_id[1])
          {
          case 'p':            /* speller */
            message = _("Double-click on the word to look up");
            if (priv->word)
              gdict_speller_match (GDICT_SPELLER (priv->speller), priv->word);
            break;
          case 't':            /* strat-chooser */
            message = _("Double-click on the matching strategy to use");

            gdict_strategy_chooser_refresh (GDICT_STRATEGY_CHOOSER
                                            (priv->strat_chooser));
            break;
          case 'o':            /* source-chooser */
            message = _("Double-click on the source to use");
            gdict_source_chooser_refresh (GDICT_SOURCE_CHOOSER
                                          (priv->source_chooser));
            break;
          default:
            message = NULL;
          }
      }
      break;
    case 'd':                  /* db-chooser */
      message = _("Double-click on the database to use");

      gdict_database_chooser_refresh (GDICT_DATABASE_CHOOSER
                                      (priv->db_chooser));
      break;
    default:
      message = NULL;
      break;
    }

  if (message && priv->status)
    gtr_statusbar_flash_message (panel->priv->status, 0, "%s", message);
}
static void
refresh_button_clicked_cb (GtkButton *button,
                           gpointer   data)
{
  gdict_source_chooser_refresh (GDICT_SOURCE_CHOOSER (data));
}