コード例 #1
0
ファイル: spellcheck-callbacks.c プロジェクト: kyoushuu/gwaei
G_MODULE_EXPORT void
gw_spellcheck_sync_dictionary_cb (GSettings *settings, gchar *key, gpointer data)
{
    GwSpellcheck *spellcheck;

    spellcheck = GW_SPELLCHECK (data);

    gw_spellcheck_load_dictionary (spellcheck);
    gw_spellcheck_queue (spellcheck);
}
コード例 #2
0
ファイル: spellcheck-callbacks.c プロジェクト: kyoushuu/gwaei
G_MODULE_EXPORT void 
gw_spellcheck_queue_cb (GtkEditable *editable, gpointer data)
{
    //Declarations
    GwSpellcheck *spellcheck;

    //Initializations
    spellcheck = GW_SPELLCHECK (data);

    gw_spellcheck_queue (spellcheck);
}
コード例 #3
0
ファイル: spellcheck-callbacks.c プロジェクト: kyoushuu/gwaei
void
gw_spellcheck_add_menuitem_activated_cb (GtkWidget *widget, gpointer data)
{
    GwSpellcheck *spellcheck;
    GwSpellcheckPrivate *priv;
    gchar *word;

    spellcheck = GW_SPELLCHECK (data);
    priv = spellcheck->priv;
    word = (gchar*) g_object_get_data (G_OBJECT (widget), "word");

    if (priv->handle == NULL) return;

    Hunspell_add (priv->handle, word);
    gw_spellcheck_queue (spellcheck);
}
コード例 #4
0
ファイル: spellcheck.c プロジェクト: zakkudo/gwaei
void
gw_spellcheck_set_entry (GwSpellcheck *spellcheck, GtkEntry *entry)
{

    GwSpellcheckPrivate *priv;
    LwPreferences *preferences;

    priv = spellcheck->priv;
    preferences = gw_application_get_preferences (priv->application);

    //Remove the old signals
    if (priv->entry != NULL)
    {

      if (priv->signalid[GW_SPELLCHECK_SIGNALID_DRAW] != 0)
        g_signal_handler_disconnect (G_OBJECT (priv->entry), priv->signalid[GW_SPELLCHECK_SIGNALID_DRAW]);

      if (priv->signalid[GW_SPELLCHECK_SIGNALID_CHANGED] != 0)
        g_signal_handler_disconnect (G_OBJECT (priv->entry), priv->signalid[GW_SPELLCHECK_SIGNALID_CHANGED]);

      if (priv->signalid[GW_SPELLCHECK_SIGNALID_POPULATE_POPUP] != 0)
        g_signal_handler_disconnect (G_OBJECT (priv->entry), priv->signalid[GW_SPELLCHECK_SIGNALID_POPULATE_POPUP]);

      if (priv->signalid[GW_SPELLCHECK_SIGNALID_DESTROY] != 0)
        g_signal_handler_disconnect (G_OBJECT (priv->entry), priv->signalid[GW_SPELLCHECK_SIGNALID_DESTROY]);

      g_object_remove_weak_pointer (G_OBJECT (priv->entry), (gpointer*) (&(priv->entry)));
    }

    //Set the entry pointer
    priv->entry = entry;

    if (entry == NULL) return;

    g_object_add_weak_pointer (G_OBJECT (priv->entry), (gpointer*) (&(priv->entry)));

    //set the new signals
    priv->signalid[GW_SPELLCHECK_SIGNALID_DICTIONARY] = lw_preferences_add_change_listener_by_schema (
        preferences,
        LW_SCHEMA_BASE,
        LW_KEY_SPELLCHECK_DICTIONARY,
        gw_spellcheck_sync_dictionary_cb,
        spellcheck
    );
    priv->signalid[GW_SPELLCHECK_SIGNALID_RK_CONV] = lw_preferences_add_change_listener_by_schema (
        preferences,
        LW_SCHEMA_BASE,
        LW_KEY_ROMAJI_TO_FURIGANA,
        gw_spellcheck_sync_rk_conv_cb,
        spellcheck
    );
    priv->signalid[GW_SPELLCHECK_SIGNALID_DRAW] = g_signal_connect_after (
        G_OBJECT (entry), 
        "draw", 
        G_CALLBACK (gw_spellcheck_draw_underline_cb), 
        spellcheck
    );
    priv->signalid[GW_SPELLCHECK_SIGNALID_CHANGED] = g_signal_connect (
        G_OBJECT (entry), 
        "changed", 
        G_CALLBACK (gw_spellcheck_queue_cb), 
        spellcheck
    );

    priv->signalid[GW_SPELLCHECK_SIGNALID_BUTTON_PRESS_EVENT] = g_signal_connect (
        G_OBJECT (entry), 
        "button-press-event", 
        G_CALLBACK (gw_spellcheck_button_press_event_cb), 
        spellcheck
    );

    priv->signalid[GW_SPELLCHECK_SIGNALID_POPULATE_POPUP] = g_signal_connect (
        G_OBJECT (entry), 
        "populate-popup", 
        G_CALLBACK (gw_spellcheck_populate_popup_cb), 
        spellcheck
    );

    priv->signalid[GW_SPELLCHECK_SIGNALID_DESTROY] = g_signal_connect_swapped (
        G_OBJECT (entry), 
        "destroy", 
        G_CALLBACK (gw_spellcheck_remove_signals), 
        spellcheck
    );

    gw_spellcheck_queue (spellcheck);
}