File: unikey_setup.cpp

package info (click to toggle)
scim-unikey 0.3.1%2Bdebian-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 2,508 kB
  • sloc: sh: 10,650; cpp: 7,490; makefile: 126; sed: 16
file content (49 lines) | stat: -rw-r--r-- 1,241 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#include <libintl.h>
#include <locale.h>
#include <gtk/gtk.h>

#include "dlg_main_setup.h"
#include "config_utils.h"
#include "scim_unikey_const.h"

int main(int argc, char** argv)
{
    setlocale(LC_ALL, "");
    bindtextdomain(PACKAGE_NAME, LOCALEDIR);
    textdomain(PACKAGE_NAME);

    gtk_init(&argc, &argv);

    gtk_window_set_default_icon_from_file(SCIM_ICONDIR SCIM_UNIKEY_ICON_MAIN, NULL);

    GtkWidget* main_dlg = unikey_main_setup_dialog_new(); // create main dlg
    gtk_window_set_title(GTK_WINDOW(main_dlg), "Scim-Unikey setup v" PACKAGE_VERSION);

    g_signal_connect(G_OBJECT(main_dlg), "destroy", gtk_main_quit, NULL); // connect with signal

    UnikeyMainSetupOptions opt; // create option
    set_default_config(&opt); // create default option

    read_config(&opt); // read config

    unikey_main_setup_set_values(GTK_DIALOG(main_dlg), &opt); // set config for dialog

    int ret = gtk_dialog_run(GTK_DIALOG(main_dlg));

    if (ret == GTK_RESPONSE_OK) // if pressed OK
    {
        unikey_main_setup_get_values(GTK_DIALOG(main_dlg), &opt); // get config from dialog

        write_config(&opt);

        force_engine_to_reload_config();
    }

    return 0;
}