コード例 #1
0
ファイル: gtk.c プロジェクト: NgoHuy/uim
int
main(int argc, char *argv[])
{
  setlocale(LC_ALL, "");
  bindtextdomain(PACKAGE, LOCALEDIR);
  textdomain(PACKAGE);
  bind_textdomain_codeset(PACKAGE, "UTF-8");

  gtk_init(&argc, &argv);

  if (uim_init() < 0) {
    fprintf(stderr, "uim_init() failed.\n");
    return -1;
  }

  if (uim_custom_enable()) {
    GtkWidget *pref;

    im_uim_init_modifier_keys();
    g_idle_add((GSourceFunc) check_dot_uim_file, NULL);
    pref = create_pref_window();
    gtk_widget_show_all(pref);

    gtk_main();
  } else {
    fprintf(stderr, "uim_custom_enable() failed.\n");
    uim_quit();
    return -1;
  }

  uim_quit();
  return 0;
}
コード例 #2
0
ファイル: uim-custom-dump.c プロジェクト: TheSLinux-forks/uim
int
main(int argc, char *argv[])
{
  if (uim_init() < 0) {
    fprintf(stderr, "uim_init() failed.\n");
    return -1;
  }

  if (uim_custom_enable()) {
    char **primary_groups, **grp;

    primary_groups = uim_custom_primary_groups();
    for (grp = primary_groups; *grp; grp++) {
      dump_group(*grp);
    }
    uim_custom_symbol_list_free(primary_groups);
  } else {
    fprintf(stderr, "uim_custom_enable() failed.\n");
    uim_quit();
    return -1;
  }

  uim_quit();

  return 0;
}
コード例 #3
0
ファイル: uim-custom-update.c プロジェクト: NgoHuy/uim
int
main(int argc, char *argv[])
{
  if (uim_init() < 0) {
    fprintf(stderr, "uim_init() failed.\n");
    return -1;
  }

  if (uim_custom_enable()) {
    /* save custom variables into ~/.uim.d/customs/custom-*.scm */
    uim_custom_save();

    /*
      broadcast updated custom variables to every uim client processes
      via uim-helper-server
    */
  } else {
    fprintf(stderr, "uim_custom_enable() failed.\n");
    uim_quit();
    return -1;
  }

  uim_quit();

  return 0;
}
コード例 #4
0
ファイル: common-gtk.c プロジェクト: na4zagin3/uim
static GtkWidget *
toolbar_new(gint type)
{
    GtkWidget *button;
    GtkWidget *hbox;
    GList *prop_buttons = NULL;
    GtkSizeGroup *sg;

    /*
     * Set uim-toolbar-save-default-im? #t in ~/.uim enable this if you'd like to
     * save default IM into ~/.uim.d/custom/custom-global.scm upon system global
     * IM switch.  However, using uim-custom consumes quite amount of memory, and
     * requires additional startup time.
     */
    if (uim_scm_symbol_value_bool("uim-toolbar-save-default-im?"))
        custom_enabled = (gboolean)uim_custom_enable();

    helper_toolbar_check_custom();
    init_icon();

    /* create widgets */
#if GTK_CHECK_VERSION(3, 2, 0)
    hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
#else
    hbox = gtk_hbox_new(FALSE, 0);
#endif

    im_menu = gtk_menu_new();
    prop_menu = gtk_menu_new();
    right_click_menu = right_click_menu_create();
    sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);

    /* prop menu button */
    button = button_create(hbox, sg, "uim-icon", " x", type);

    gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);

    prop_buttons = g_list_append(prop_buttons, button);

    g_object_set_data(G_OBJECT(hbox), OBJECT_DATA_PROP_BUTTONS, prop_buttons);
    g_object_set_data(G_OBJECT(hbox), OBJECT_DATA_SIZE_GROUP, sg);
    g_object_set_data(G_OBJECT(hbox), OBJECT_DATA_TOOLBAR_TYPE,
                      GINT_TO_POINTER(type));

    uim_fd = -1;

    if (type != TYPE_ICON) {
        /* delay initialization until getting "embedded" signal */
        uim_toolbar_check_helper_connection(hbox);
        uim_helper_client_get_prop_list();
        uim_toolbar_get_im_list();
    }

    return hbox;
}
コード例 #5
0
int
main(int argc, char *argv[])
{
  if (uim_init() < 0) {
    fprintf(stderr, "uim_init() failed.\n");
    return -1;
  }

  if (uim_custom_enable()) {
    uim_bool succeeded;
    struct uim_custom *custom;

    custom = uim_custom_get("anthy-candidate-op-count");
    if (custom) {
      inspect_custom(custom);

      printf("\ntrying that modify the custom value to 100\n");
      custom->value->as_int = 100;  /* out of range */
      succeeded = uim_custom_set(custom);
      printf("succeeded = %s\n", succeeded ? "true" : "false");

      printf("\ncurrent status of struct uim_custom *custom\n");
      inspect_custom(custom);  /* shows 100 as value */
      uim_custom_free(custom);

      printf("\ncurrent status of real custom value\n");
      custom = uim_custom_get("anthy-candidate-op-count");
      inspect_custom(custom);  /* shows real value */

      printf("\ntrying that modify the custom value to 5\n");
      custom->value->as_int = 5;  /* valid */
      succeeded = uim_custom_set(custom);
      printf("succeeded = %s\n\n", succeeded ? "true" : "false");
      inspect_custom(custom);

      uim_custom_free(custom);
    }

    uim_custom_save();  /* save updated custom value into ~/.uim.d/customs/ */
  } else {
    fprintf(stderr, "uim_custom_enable() failed.\n");
    uim_quit();
    return -1;
  }

  uim_quit();

  return 0;
}
コード例 #6
0
ファイル: qt4.cpp プロジェクト: m8a/uim
UimPrefDialog::UimPrefDialog( QWidget *parent )
    : QDialog( parent ),
      m_isValueChanged( false )
{
    uim_counted_init();
    if (uim_custom_enable()) {
        checkDotUimFile();        
        setupWidgets();
    } else {
#if defined(ENABLE_DEBUG)
        qDebug("uim_custom_enable() failed.");
#endif
        uim_counted_quit();
        QApplication::exit( -1 );
    }

    setWindowTitle( "uim-pref-qt4" );
}
コード例 #7
0
ファイル: qt4.cpp プロジェクト: DirtYiCE/uim
UimImSwitcher::UimImSwitcher( QWidget *parent )
        : QDialog( parent )
{
    /* connect to uim helper message bus */
    uim_fd = -1;
    checkHelperConnection();

    /* to check if another uim-im-switcher exists */
    uim_helper_send_message( uim_fd, "im_switcher_start\n" );

    /* to load input method list */
    uim_helper_send_message( uim_fd, "im_list_get\n" );

    uim_init();
    customEnabled = uim_custom_enable();

    /* create GUI */
    createGUI();
}