├── .gitignore ├── CMakeLists.txt ├── COPYING ├── INSTALL ├── README ├── cmake ├── fcitx-extract-glade.sh └── gresource.cmake ├── config.h.in ├── gtk ├── CMakeLists.txt ├── common.h ├── config_widget.c ├── config_widget.h ├── configdesc.c ├── configdesc.h ├── gdm-languages.c ├── gdm-languages.h ├── im.c ├── im.h ├── im_widget.c ├── im_widget.h ├── keygrab.c ├── keygrab.h ├── locarchive.h ├── main.c ├── main_window.c ├── main_window.h ├── sub_config_parser.c ├── sub_config_parser.h ├── sub_config_widget.c └── sub_config_widget.h ├── gtk3 ├── CMakeLists.txt ├── common.c ├── common.h ├── config_widget.c ├── config_widget.h ├── configdesc.c ├── configdesc.h ├── dummy_config.c ├── dummy_config.h ├── fcitx-config-gtk3.gresource.xml ├── gdm-languages.c ├── gdm-languages.h ├── im_config_dialog.c ├── im_config_dialog.h ├── im_dialog.c ├── im_dialog.h ├── im_dialog.ui ├── im_widget.c ├── im_widget.h ├── im_widget.ui ├── keygrab.c ├── keygrab.h ├── locarchive.h ├── main.c ├── main_window.c ├── main_window.h ├── sub_config_parser.c ├── sub_config_parser.h ├── sub_config_widget.c ├── sub_config_widget.h ├── ui_widget.c └── ui_widget.h └── po ├── CMakeLists.txt ├── ca.po ├── da.po ├── de.po ├── fcitx-configtool.pot ├── ja.po ├── ko.po ├── ru.po ├── tr.po ├── zh_CN.po └── zh_TW.po /.gitignore: -------------------------------------------------------------------------------- 1 | *~ 2 | build*/ 3 | .* 4 | !.git* 5 | .git/ 6 | *.tar.* 7 | *.kdev4 8 | *.kate-swp 9 | *.orig 10 | tags 11 | astyle.sh 12 | cscope.* 13 | *.part 14 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.1) 2 | 3 | project(fcitx-configtool) 4 | 5 | set(CMAKE_C_STANDARD_REQUIRED TRUE) 6 | set(CMAKE_C_STANDARD 99) 7 | 8 | option(ENABLE_GTK2 "Enable GTK2 Version" Off) 9 | option(ENABLE_GTK3 "Enable GTK3 Version" On) 10 | 11 | set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH}) 12 | 13 | find_package(PkgConfig REQUIRED) 14 | 15 | if(ENABLE_GTK3) 16 | pkg_check_modules(FCITX_GCLIENT "fcitx-gclient>=4.2.9" REQUIRED) 17 | pkg_check_modules(GTK3 "gtk+-3.0>=3.20" REQUIRED) 18 | endif() 19 | 20 | if(ENABLE_GTK2) 21 | pkg_check_modules(GTK2 "gtk+-2.0>=2.22" REQUIRED) 22 | endif() 23 | 24 | pkg_check_modules(ISO_CODES "iso-codes" REQUIRED) 25 | _pkgconfig_invoke("iso-codes" ISO_CODES PREFIX "" "--variable=prefix") 26 | 27 | find_package(Fcitx 4.2.8 REQUIRED) 28 | _fcitx_add_uninstall_target() 29 | _fcitx_translate_add_handler( 30 | "${PROJECT_SOURCE_DIR}/cmake/fcitx-extract-glade.sh" glade) 31 | 32 | add_definitions("-D_GNU_SOURCE") 33 | set(CMAKE_C_FLAGS "-Wall -Wextra -Wno-sign-compare -Wno-unused-local-typedefs -Wno-unused-parameter -fvisibility=hidden ${CMAKE_C_FLAGS}") 34 | set(CMAKE_CXX_FLAGS "-Wall -Wextra -Wno-sign-compare -Wno-unused-local-typedefs -Wno-unused-parameter -fvisibility=hidden ${CMAKE_CXX_FLAGS}") 35 | set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-undefined,--as-needed ${CMAKE_SHARED_LINKER_FLAGS}") 36 | set(CMAKE_MODULE_LINKER_FLAGS "-Wl,--no-undefined,--as-needed ${CMAKE_MODULE_LINKER_FLAGS}") 37 | 38 | string(REGEX REPLACE "^([0-9]+)\\.[0-9]+\\.[0-9]+.*" "\\1" FCITX4_MAJOR_VERSION "${FCITX4_VERSION}") 39 | string(REGEX REPLACE "^[0-9]+\\.([0-9]+)\\.[0-9]+.*" "\\1" FCITX4_MINOR_VERSION "${FCITX4_VERSION}") 40 | string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" FCITX4_PATCH_VERSION "${FCITX4_VERSION}") 41 | 42 | set(datadir ${CMAKE_INSTALL_PREFIX}/share) 43 | set(localedir ${CMAKE_INSTALL_PREFIX}/share/locale) 44 | set(exec_prefix "${CMAKE_INSTALL_PREFIX}") 45 | set(liblocaledir ${CMAKE_INSTALL_PREFIX}/lib/locale) 46 | 47 | configure_file(config.h.in config.h) 48 | include_directories(${CMAKE_CURRENT_BINARY_DIR}) 49 | 50 | add_subdirectory(po) 51 | add_subdirectory(gtk3) 52 | add_subdirectory(gtk) 53 | -------------------------------------------------------------------------------- /INSTALL: -------------------------------------------------------------------------------- 1 | fcitx-configtool install instructions 2 | ================================================= 3 | 4 | To compile and install, go in the source directory and type: 5 | mkdir build; cd build 6 | cmake .. 7 | (If you want to install in a different path, use instead: 8 | cmake .. -DCMAKE_INSTALL_PREFIX=/install/path) 9 | make 10 | 11 | To install, become root if required: 12 | 13 | make install 14 | 15 | Once installed, you can restart fcitx and it will be enabled by default. 16 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | A gtk based configurae tool for fcitx. -------------------------------------------------------------------------------- /cmake/fcitx-extract-glade.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Copyright (C) 2012~2012 by Yichao Yu 3 | # yyc1992@gmail.com 4 | # 5 | # This program is free software; you can redistribute it and/or modify 6 | # it under the terms of the GNU General Public License as published by 7 | # the Free Software Foundation, either version 2 of the License, or 8 | # (at your option) any later version. 9 | # 10 | # This program is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | # GNU General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with this program. If not, see . 17 | 18 | action="$1" 19 | 20 | shift 1 || exit 1 21 | 22 | . "${_FCITX_MACRO_CMAKE_DIR}/fcitx-write-po.sh" 23 | 24 | case "${action}" in 25 | -c) 26 | exit 1 27 | ;; 28 | -w) 29 | out_file="${1}" 30 | shift || exit 1 31 | [[ -z "$*" ]] && exit 1 32 | echo "Extracting po string from glade sources." 33 | xgettext --from-code=UTF-8 -LGlade "$@" -o "${out_file}" 34 | exit 0 35 | ;; 36 | esac 37 | -------------------------------------------------------------------------------- /cmake/gresource.cmake: -------------------------------------------------------------------------------- 1 | # Used for GResource. 2 | # 3 | # resource_dir: Directory where the .gresource.xml is located. 4 | # resource_file: Filename of the .gresource.xml file (just the 5 | # filename, not the complete path). 6 | # output_dir: Directory where the C output file is written. 7 | # output_file: This variable will be set with the complete path of the 8 | # output C file. 9 | 10 | function (gresource resource_dir resource_file output_dir output_source output_header) 11 | 12 | _pkgconfig_invoke("glib-2.0" GLIB2 PREFIX 13 | "" "--variable=prefix") 14 | find_program(GLIB_COMPILE_RESOURCES 15 | NAMES glib-compile-resources 16 | HINTS ${GLIB2_PREFIX}) 17 | 18 | if (NOT GLIB_COMPILE_RESOURCES) 19 | message(FATAL "Could not find glib-compile-resources") 20 | endif() 21 | 22 | # Get the output file path 23 | get_filename_component (resource_name ${resource_file} NAME_WE) 24 | set (output_c "${output_dir}/${resource_name}-resources.c") 25 | set (output_h "${output_dir}/${resource_name}-resources.h") 26 | set (${output_source} ${output_c} PARENT_SCOPE) 27 | set (${output_header} ${output_h} PARENT_SCOPE) 28 | 29 | # Get the dependencies of the gresource 30 | execute_process ( 31 | OUTPUT_VARIABLE _files 32 | WORKING_DIRECTORY ${resource_dir} 33 | COMMAND ${GLIB_COMPILE_RESOURCES} --generate-dependencies ${resource_file} 34 | ) 35 | 36 | string (REPLACE "\n" ";" files ${_files}) 37 | 38 | set (depends "") 39 | foreach (cur_file ${files}) 40 | list (APPEND depends "${resource_dir}/${cur_file}") 41 | endforeach () 42 | 43 | # Command to compile the resources 44 | add_custom_command ( 45 | OUTPUT ${output_c} 46 | DEPENDS "${resource_dir}/${resource_file}" ${depends} 47 | WORKING_DIRECTORY ${resource_dir} 48 | COMMAND ${GLIB_COMPILE_RESOURCES} --generate-source --manual-register --target=${output_c} ${resource_file} 49 | ) 50 | 51 | # Command to compile the resources 52 | add_custom_command ( 53 | OUTPUT ${output_h} 54 | DEPENDS "${resource_dir}/${resource_file}" ${depends} 55 | WORKING_DIRECTORY ${resource_dir} 56 | COMMAND ${GLIB_COMPILE_RESOURCES} --generate-header --manual-register --target=${output_h} ${resource_file} 57 | ) 58 | endfunction () 59 | -------------------------------------------------------------------------------- /config.h.in: -------------------------------------------------------------------------------- 1 | #define VERSION_STRING_FULL "@VERSION_STRING_FULL@" 2 | #define DATADIR "@datadir@" 3 | #define LOCALEDIR "@localedir@" 4 | #define EXEC_PREFIX "@exec_prefix@" 5 | #define PACKAGE "@FCITX4_PACKAGE_NAME@" 6 | #define LIBLOCALEDIR "@liblocaledir@" 7 | #define ISO_CODES_PREFIX "@ISO_CODES_PREFIX@" 8 | #define GETTEXT_PACKAGE "fcitx-configtool" 9 | #define FCITX4_MAJOR_VERSION @FCITX4_MAJOR_VERSION@ 10 | #define FCITX4_MINOR_VERSION @FCITX4_MINOR_VERSION@ 11 | #define FCITX4_PATCH_VERSION @FCITX4_PATCH_VERSION@ 12 | 13 | #define FCITX_CHECK_VERSION(major,minor,micro) \ 14 | (FCITX4_MAJOR_VERSION > (major) || \ 15 | (FCITX4_MAJOR_VERSION == (major) && FCITX4_MINOR_VERSION > (minor)) || \ 16 | (FCITX4_MAJOR_VERSION == (major) && FCITX4_MINOR_VERSION == (minor) && \ 17 | FCITX4_PATCH_VERSION >= (micro))) 18 | -------------------------------------------------------------------------------- /gtk/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(fcitx_config_gtk_sources 2 | sub_config_parser.c 3 | sub_config_widget.c 4 | config_widget.c 5 | configdesc.c 6 | keygrab.c 7 | main.c 8 | main_window.c 9 | im_widget.c 10 | im.c 11 | gdm-languages.c 12 | ) 13 | set(fcitx_config_gtk_headers 14 | common.h 15 | configdesc.h 16 | config_widget.h 17 | gdm-languages.h 18 | im.h 19 | im_widget.h 20 | keygrab.h 21 | locarchive.h 22 | main_window.h 23 | sub_config_parser.h 24 | sub_config_widget.h 25 | ) 26 | 27 | fcitx_translate_add_sources(${fcitx_config_gtk_sources} 28 | ${fcitx_config_gtk_headers}) 29 | 30 | if(NOT ENABLE_GTK2) 31 | return() 32 | endif() 33 | 34 | PKG_CHECK_MODULES (DBUS_GLIB "dbus-glib-1" REQUIRED) 35 | PKG_CHECK_MODULES (UNIQUE "unique-1.0") 36 | 37 | include_directories ( 38 | ${GTK2_INCLUDE_DIRS} 39 | ${GLIB2_INCLUDE_DIRS} 40 | ${FCITX4_FCITX_INCLUDE_DIRS} 41 | ${FCITX4_FCITX_UTILS_INCLUDE_DIRS} 42 | ${FCITX4_FCITX_CONFIG_INCLUDE_DIRS} 43 | ${DBUS_GLIB_INCLUDE_DIRS} 44 | ) 45 | 46 | link_directories ( 47 | ${GTK2_LIBRARY_DIRS} 48 | ${GLIB2_LIBRARY_DIRS} 49 | ${FCITX4_FCITX_LIBRARY_DIRS} 50 | ${FCITX4_FCITX_UTILS_LIBRARY_DIRS} 51 | ${FCITX4_FCITX_CONFIG_LIBRARY_DIRS} 52 | ${DBUS_GLIB_LIBRARY_DIRS} 53 | ) 54 | if(UNIQUE_FOUND) 55 | include_directories (${UNIQUE_INCLUDE_DIRS}) 56 | link_directories (${UNIQUE_LIBRARY_DIRS}) 57 | endif() 58 | 59 | add_executable(fcitx-config-gtk ${fcitx_config_gtk_sources}) 60 | 61 | install(TARGETS fcitx-config-gtk RUNTIME DESTINATION bin) 62 | 63 | target_link_libraries (fcitx-config-gtk 64 | ${GTK2_LIBRARIES} 65 | ${FCITX4_FCITX_UTILS_LIBRARIES} 66 | ${FCITX4_FCITX_CONFIG_LIBRARIES} 67 | ${FCITX4_FCITX_LIBRARIES} 68 | ${GLIB2_LIBRARIES} 69 | ${DBUS_GLIB_LIBRARIES} 70 | ) 71 | 72 | if(UNIQUE_FOUND) 73 | target_link_libraries (fcitx-config-gtk ${UNIQUE_LIBRARIES}) 74 | endif() 75 | -------------------------------------------------------------------------------- /gtk/common.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright (C) 2010~2012 by CSSlayer * 3 | * * 4 | * This program is free software; you can redistribute it and/or modify * 5 | * it under the terms of the GNU General Public License as published by * 6 | * the Free Software Foundation; either version 2 of the License, or * 7 | * (at your option) any later version. * 8 | * * 9 | * This program is distributed in the hope that it will be useful, * 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 12 | * GNU General Public License for more details. * 13 | * * 14 | * You should have received a copy of the GNU General Public License * 15 | * along with this program; if not, write to the * 16 | * Free Software Foundation, Inc., * 17 | * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * 18 | ***************************************************************************/ 19 | 20 | #ifndef COMMON_H 21 | #define COMMON_H 22 | 23 | #include 24 | 25 | #define _(x) gettext(x) 26 | 27 | #endif -------------------------------------------------------------------------------- /gtk/config_widget.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright (C) 2010~2012 by CSSlayer * 3 | * * 4 | * This program is free software; you can redistribute it and/or modify * 5 | * it under the terms of the GNU General Public License as published by * 6 | * the Free Software Foundation; either version 2 of the License, or * 7 | * (at your option) any later version. * 8 | * * 9 | * This program is distributed in the hope that it will be useful, * 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 12 | * GNU General Public License for more details. * 13 | * * 14 | * You should have received a copy of the GNU General Public License * 15 | * along with this program; if not, write to the * 16 | * Free Software Foundation, Inc., * 17 | * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * 18 | ***************************************************************************/ 19 | 20 | /* fcitx-config-widget.h */ 21 | 22 | #ifndef _FCITX_CONFIG_WIDGET 23 | #define _FCITX_CONFIG_WIDGET 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include "sub_config_parser.h" 30 | 31 | G_BEGIN_DECLS 32 | 33 | #define FCITX_TYPE_CONFIG_WIDGET fcitx_config_widget_get_type() 34 | 35 | #define FCITX_CONFIG_WIDGET(obj) \ 36 | (G_TYPE_CHECK_INSTANCE_CAST ((obj), FCITX_TYPE_CONFIG_WIDGET, FcitxConfigWidget)) 37 | 38 | #define FCITX_CONFIG_WIDGET_CLASS(klass) \ 39 | (G_TYPE_CHECK_CLASS_CAST ((klass), FCITX_TYPE_CONFIG_WIDGET, FcitxConfigWidgetClass)) 40 | 41 | #define FCITX_IS_CONFIG_WIDGET(obj) \ 42 | (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FCITX_TYPE_CONFIG_WIDGET)) 43 | 44 | #define FCITX_IS_CONFIG_WIDGET_CLASS(klass) \ 45 | (G_TYPE_CHECK_CLASS_TYPE ((klass), FCITX_TYPE_CONFIG_WIDGET)) 46 | 47 | #define FCITX_CONFIG_WIDGET_GET_CLASS(obj) \ 48 | (G_TYPE_INSTANCE_GET_CLASS ((obj), FCITX_TYPE_CONFIG_WIDGET, FcitxConfigWidgetClass)) 49 | 50 | typedef struct { 51 | GtkVBox parent; 52 | FcitxConfigFileDesc* cfdesc; 53 | gchar* prefix; 54 | gchar* name; 55 | FcitxSubConfigParser* parser; 56 | FcitxGenericConfig gconfig; 57 | } FcitxConfigWidget; 58 | 59 | typedef struct { 60 | GtkVBoxClass parent_class; 61 | } FcitxConfigWidgetClass; 62 | 63 | typedef enum { 64 | CONFIG_WIDGET_SAVE, 65 | CONFIG_WIDGET_CANCEL, 66 | CONFIG_WIDGET_DEFAULT 67 | } ConfigWidgetAction; 68 | 69 | GType fcitx_config_widget_get_type(void); 70 | 71 | FcitxConfigWidget* fcitx_config_widget_new(FcitxConfigFileDesc* cfdesc, const gchar* prefix, const gchar* name, const char* subconfig); 72 | 73 | void fcitx_config_widget_response(FcitxConfigWidget* config_widget, ConfigWidgetAction action); 74 | 75 | gboolean fcitx_config_widget_response_cb(GtkDialog *dialog, 76 | gint response, 77 | gpointer user_data); 78 | 79 | GtkWidget* fcitx_config_dialog_new(FcitxAddon* addon, GtkWindow* parent); 80 | 81 | 82 | G_END_DECLS 83 | 84 | #endif /* _FCITX_CONFIG_WIDGET */ 85 | -------------------------------------------------------------------------------- /gtk/configdesc.c: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright (C) 2010~2012 by CSSlayer * 3 | * * 4 | * This program is free software; you can redistribute it and/or modify * 5 | * it under the terms of the GNU General Public License as published by * 6 | * the Free Software Foundation; either version 2 of the License, or * 7 | * (at your option) any later version. * 8 | * * 9 | * This program is distributed in the hope that it will be useful, * 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 12 | * GNU General Public License for more details. * 13 | * * 14 | * You should have received a copy of the GNU General Public License * 15 | * along with this program; if not, write to the * 16 | * Free Software Foundation, Inc., * 17 | * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * 18 | ***************************************************************************/ 19 | 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | 26 | #include "configdesc.h" 27 | 28 | typedef struct ConfigDescSet { 29 | char *filename; 30 | FcitxConfigFileDesc *cfdesc; 31 | UT_hash_handle hh; 32 | } ConfigDescSet; 33 | 34 | static ConfigDescSet* cdset = NULL; 35 | 36 | FcitxConfigFileDesc *get_config_desc(char *filename) 37 | { 38 | ConfigDescSet *desc = NULL; 39 | HASH_FIND_STR(cdset, filename, desc); 40 | if (!desc) { 41 | FILE * tmpfp = FcitxXDGGetFileWithPrefix("configdesc", filename, "r", NULL); 42 | if (tmpfp) { 43 | desc = malloc(sizeof(ConfigDescSet)); 44 | memset(desc, 0 , sizeof(ConfigDescSet)); 45 | desc->filename = strdup(filename); 46 | desc->cfdesc = FcitxConfigParseConfigFileDescFp(tmpfp); 47 | fclose(tmpfp); 48 | 49 | HASH_ADD_KEYPTR(hh, cdset, desc->filename, strlen(desc->filename), desc); 50 | } else 51 | return NULL; 52 | } 53 | 54 | return desc->cfdesc; 55 | } 56 | -------------------------------------------------------------------------------- /gtk/configdesc.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright (C) 2010~2012 by CSSlayer * 3 | * * 4 | * This program is free software; you can redistribute it and/or modify * 5 | * it under the terms of the GNU General Public License as published by * 6 | * the Free Software Foundation; either version 2 of the License, or * 7 | * (at your option) any later version. * 8 | * * 9 | * This program is distributed in the hope that it will be useful, * 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 12 | * GNU General Public License for more details. * 13 | * * 14 | * You should have received a copy of the GNU General Public License * 15 | * along with this program; if not, write to the * 16 | * Free Software Foundation, Inc., * 17 | * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * 18 | ***************************************************************************/ 19 | 20 | #ifndef CONFIG_DESC_H 21 | #define CONFIG_DESC_H 22 | 23 | #include 24 | 25 | FcitxConfigFileDesc *get_config_desc(char *filename); 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /gtk/gdm-languages.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- 2 | * 3 | * Copyright 2008 Red Hat, Inc. 4 | * Copyright 2007 William Jon McCann 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. 19 | * 20 | * Written by: Ray Strode 21 | * William Jon McCann 22 | */ 23 | 24 | #ifndef __GDM_LANGUAGES_H 25 | #define __GDM_LANGUAGES_H 26 | 27 | G_BEGIN_DECLS 28 | 29 | char * gdm_get_language_from_name(const char *name, 30 | const char *locale); 31 | char ** gdm_get_all_language_names(void); 32 | void gdm_parse_language_name(const char *name, 33 | char **language_codep, 34 | char **territory_codep, 35 | char **codesetp, 36 | char **modifierp); 37 | char * gdm_normalize_language_name(const char *name); 38 | 39 | G_END_DECLS 40 | 41 | #endif /* __GDM_LANGUAGE_CHOOSER_WIDGET_H */ 42 | -------------------------------------------------------------------------------- /gtk/im.c: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright (C) 2010~2012 by CSSlayer * 3 | * * 4 | * This program is free software; you can redistribute it and/or modify * 5 | * it under the terms of the GNU General Public License as published by * 6 | * the Free Software Foundation; either version 2 of the License, or * 7 | * (at your option) any later version. * 8 | * * 9 | * This program is distributed in the hope that it will be useful, * 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 12 | * GNU General Public License for more details. * 13 | * * 14 | * You should have received a copy of the GNU General Public License * 15 | * along with this program; if not, write to the * 16 | * Free Software Foundation, Inc., * 17 | * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * 18 | ***************************************************************************/ 19 | 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include "im.h" 25 | 26 | #define TYPE_IM \ 27 | dbus_g_type_get_struct("GValueArray", G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_INVALID) 28 | 29 | #define TYPE_ARRAY_IM \ 30 | dbus_g_type_get_collection("GPtrArray", TYPE_IM) 31 | 32 | static void _fcitx_inputmethod_item_foreach_cb(gpointer data, 33 | gpointer user_data); 34 | 35 | static FcitxIMItem* 36 | _value_to_item (const GValue *value) 37 | { 38 | const gchar *name, *unique_name, *langcode; 39 | gboolean enable; 40 | GType type; 41 | 42 | type = G_VALUE_TYPE (value); 43 | g_assert(dbus_g_type_is_struct (type)); 44 | g_assert(4 == dbus_g_type_get_struct_size (type)); 45 | g_assert(G_TYPE_STRING == dbus_g_type_get_struct_member_type (type, 0)); 46 | g_assert(G_TYPE_STRING == dbus_g_type_get_struct_member_type (type, 1)); 47 | g_assert(G_TYPE_STRING == dbus_g_type_get_struct_member_type (type, 2)); 48 | g_assert(G_TYPE_BOOLEAN == dbus_g_type_get_struct_member_type (type, 3)); 49 | 50 | GValue cvalue; 51 | memset(&cvalue, 0, sizeof(GValue)); 52 | 53 | FcitxIMItem* item = g_malloc0(sizeof(FcitxIMItem)); 54 | 55 | g_value_init (&cvalue, dbus_g_type_get_struct_member_type (type, 0)); 56 | dbus_g_type_struct_get_member (value, 0, &cvalue); 57 | name = g_value_get_string(&cvalue); 58 | item->name = strdup(name); 59 | g_value_unset (&cvalue); 60 | 61 | g_value_init (&cvalue, dbus_g_type_get_struct_member_type (type, 1)); 62 | dbus_g_type_struct_get_member (value, 1, &cvalue); 63 | unique_name = g_value_get_string(&cvalue); 64 | item->unique_name = strdup(unique_name); 65 | g_value_unset (&cvalue); 66 | 67 | g_value_init (&cvalue, dbus_g_type_get_struct_member_type (type, 2)); 68 | dbus_g_type_struct_get_member (value, 2, &cvalue); 69 | langcode = g_value_get_string(&cvalue); 70 | item->langcode = strdup(langcode); 71 | g_value_unset (&cvalue); 72 | 73 | g_value_init (&cvalue, dbus_g_type_get_struct_member_type (type, 3)); 74 | dbus_g_type_struct_get_member (value, 3, &cvalue); 75 | enable = g_value_get_boolean(&cvalue); 76 | item->enable = enable; 77 | g_value_unset (&cvalue); 78 | return item; 79 | } 80 | 81 | static void 82 | _item_to_value (FcitxIMItem* item, GValue *value) 83 | { 84 | g_value_init (value, TYPE_IM); 85 | GValueArray *va = g_value_array_new (4); 86 | g_value_array_append (va, NULL); 87 | g_value_init(&va->values[0], G_TYPE_STRING); 88 | g_value_set_string(&va->values[0], item->name); 89 | g_value_array_append (va, NULL); 90 | g_value_init(&va->values[1], G_TYPE_STRING); 91 | g_value_set_string(&va->values[1], item->unique_name); 92 | g_value_array_append (va, NULL); 93 | g_value_init(&va->values[2], G_TYPE_STRING); 94 | g_value_set_string(&va->values[2], item->langcode); 95 | g_value_array_append (va, NULL); 96 | g_value_init(&va->values[3], G_TYPE_BOOLEAN); 97 | g_value_set_boolean(&va->values[3], item->enable); 98 | g_value_take_boxed (value, va); 99 | } 100 | 101 | static void 102 | _collection_iterator (const GValue *value, 103 | gpointer user_data) 104 | { 105 | GPtrArray *children = user_data; 106 | 107 | g_ptr_array_add (children, _value_to_item (value)); 108 | } 109 | 110 | void fcitx_inputmethod_set_imlist(DBusGProxy* proxy, GPtrArray* array) 111 | { 112 | GValue value; 113 | memset(&value, 0, sizeof(GValue)); 114 | g_value_init(&value, TYPE_ARRAY_IM); 115 | g_value_take_boxed (&value, dbus_g_type_specialized_construct ( 116 | G_VALUE_TYPE (&value))); 117 | DBusGTypeSpecializedAppendContext ctx; 118 | 119 | dbus_g_type_specialized_init_append (&value, &ctx); 120 | g_ptr_array_foreach(array, _fcitx_inputmethod_item_foreach_cb, &ctx); 121 | dbus_g_type_specialized_collection_end_append (&ctx); 122 | dbus_g_proxy_call_no_reply(proxy, "Set", G_TYPE_STRING, FCITX_IM_DBUS_INTERFACE, G_TYPE_STRING, "IMList", G_TYPE_VALUE, &value, G_TYPE_INVALID); 123 | g_value_unset(&value); 124 | } 125 | 126 | GPtrArray* fcitx_inputmethod_get_imlist(DBusGProxy* proxy) 127 | { 128 | GPtrArray *array = NULL; 129 | GValue value; 130 | memset(&value, 0, sizeof(GValue)); 131 | 132 | GError* error = NULL; 133 | dbus_g_proxy_call(proxy, "Get", &error, G_TYPE_STRING, FCITX_IM_DBUS_INTERFACE, G_TYPE_STRING, "IMList", G_TYPE_INVALID, G_TYPE_VALUE, &value, G_TYPE_INVALID); 134 | 135 | if (error) { 136 | g_warning("%s", error->message); 137 | g_error_free(error); 138 | return NULL; 139 | } 140 | 141 | array = g_ptr_array_new(); 142 | GType type = G_VALUE_TYPE (&value); 143 | 144 | if (dbus_g_type_is_collection (type)) 145 | { 146 | dbus_g_type_collection_value_iterate (&value, _collection_iterator, 147 | array); 148 | } 149 | g_value_unset(&value); 150 | 151 | return array; 152 | } 153 | 154 | void fcitx_inputmethod_item_free(gpointer data) 155 | { 156 | FcitxIMItem* item = data; 157 | g_free(item->name); 158 | g_free(item->unique_name); 159 | g_free(item->langcode); 160 | g_free(data); 161 | } 162 | 163 | void _fcitx_inputmethod_item_foreach_cb(gpointer data, 164 | gpointer user_data) 165 | { 166 | FcitxIMItem* item = data; 167 | DBusGTypeSpecializedAppendContext* ctx = user_data; 168 | 169 | GValue v; 170 | memset(&v, 0, sizeof(GValue)); 171 | _item_to_value(item, &v); 172 | dbus_g_type_specialized_collection_append (ctx, &v); 173 | } 174 | -------------------------------------------------------------------------------- /gtk/im.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright (C) 2010~2012 by CSSlayer * 3 | * * 4 | * This program is free software; you can redistribute it and/or modify * 5 | * it under the terms of the GNU General Public License as published by * 6 | * the Free Software Foundation; either version 2 of the License, or * 7 | * (at your option) any later version. * 8 | * * 9 | * This program is distributed in the hope that it will be useful, * 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 12 | * GNU General Public License for more details. * 13 | * * 14 | * You should have received a copy of the GNU General Public License * 15 | * along with this program; if not, write to the * 16 | * Free Software Foundation, Inc., * 17 | * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * 18 | ***************************************************************************/ 19 | 20 | #ifndef _IM_H_ 21 | #define _IM_H_ 22 | 23 | #include 24 | #include 25 | 26 | G_BEGIN_DECLS 27 | 28 | typedef struct _FcitxIMItem { 29 | gchar* name; 30 | gchar* unique_name; 31 | gchar* langcode; 32 | gboolean enable; 33 | } FcitxIMItem; 34 | 35 | void fcitx_inputmethod_set_imlist(DBusGProxy* proxy, GPtrArray* array); 36 | GPtrArray* fcitx_inputmethod_get_imlist(DBusGProxy* proxy); 37 | void fcitx_inputmethod_item_free(gpointer data); 38 | 39 | G_END_DECLS 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /gtk/im_widget.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright (C) 2010~2012 by CSSlayer * 3 | * * 4 | * This program is free software; you can redistribute it and/or modify * 5 | * it under the terms of the GNU General Public License as published by * 6 | * the Free Software Foundation; either version 2 of the License, or * 7 | * (at your option) any later version. * 8 | * * 9 | * This program is distributed in the hope that it will be useful, * 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 12 | * GNU General Public License for more details. * 13 | * * 14 | * You should have received a copy of the GNU General Public License * 15 | * along with this program; if not, write to the * 16 | * Free Software Foundation, Inc., * 17 | * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * 18 | ***************************************************************************/ 19 | 20 | #ifndef IM_WIDGET_H 21 | #define IM_WIDGET_H 22 | 23 | #include 24 | #include 25 | #include 26 | 27 | G_BEGIN_DECLS 28 | 29 | #define FCITX_TYPE_IM_WIDGET fcitx_im_widget_get_type() 30 | 31 | #define FCITX_IM_WIDGET(obj) \ 32 | (G_TYPE_CHECK_INSTANCE_CAST ((obj), FCITX_TYPE_IM_WIDGET, FcitxImWidget)) 33 | 34 | #define FCITX_IM_WIDGET_CLASS(klass) \ 35 | (G_TYPE_CHECK_CLASS_CAST ((klass), FCITX_TYPE_IM_WIDGET, FcitxImWidgetClass)) 36 | 37 | #define FCITX_IS_IM_WIDGET(obj) \ 38 | (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FCITX_TYPE_IM_WIDGET)) 39 | 40 | #define FCITX_IS_IM_WIDGET_CLASS(klass) \ 41 | (G_TYPE_CHECK_CLASS_TYPE ((klass), FCITX_TYPE_IM_WIDGET)) 42 | 43 | #define FCITX_IM_WIDGET_GET_CLASS(obj) \ 44 | (G_TYPE_INSTANCE_GET_CLASS ((obj), FCITX_TYPE_IM_WIDGET, FcitxImWidgetClass)) 45 | 46 | #define IC_NAME_MAX 64 47 | 48 | typedef struct { 49 | GtkVBox parent; 50 | GtkTreeStore* availimstore; 51 | GtkListStore* imstore; 52 | GtkWidget* availimview; 53 | GtkWidget* imview; 54 | GtkWidget* addimbutton; 55 | GtkWidget* delimbutton; 56 | GtkWidget* moveupbutton; 57 | GtkWidget* movedownbutton; 58 | char servicename[IC_NAME_MAX]; 59 | DBusGProxy* improxy; 60 | GPtrArray* array; 61 | GtkWidget* filterentry; 62 | GtkTreeModel* filtermodel; 63 | GtkWidget* onlycurlangcheckbox; 64 | GtkTreeModel* sortmodel; 65 | gchar* focus; 66 | DBusGConnection* conn; 67 | } FcitxImWidget; 68 | 69 | typedef struct { 70 | GtkVBoxClass parent_class; 71 | } FcitxImWidgetClass; 72 | 73 | GtkWidget* 74 | fcitx_im_widget_new(void); 75 | 76 | G_END_DECLS 77 | 78 | 79 | #endif -------------------------------------------------------------------------------- /gtk/keygrab.c: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright (C) 2010~2012 by CSSlayer * 3 | * * 4 | * This program is free software; you can redistribute it and/or modify * 5 | * it under the terms of the GNU General Public License as published by * 6 | * the Free Software Foundation; either version 2 of the License, or * 7 | * (at your option) any later version. * 8 | * * 9 | * This program is distributed in the hope that it will be useful, * 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 12 | * GNU General Public License for more details. * 13 | * * 14 | * You should have received a copy of the GNU General Public License * 15 | * along with this program; if not, write to the * 16 | * Free Software Foundation, Inc., * 17 | * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * 18 | ***************************************************************************/ 19 | 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include "keygrab.h" 28 | 29 | #define _(s) gettext(s) 30 | 31 | enum { 32 | KEYGRAB_BUTTON_CHANGED, 33 | LAST_SIGNAL 34 | }; 35 | static gint keygrab_button_signals[LAST_SIGNAL] = { 0 }; 36 | static void keygrab_button_init(KeyGrabButton *keygrab_button); 37 | static void keygrab_button_class_init(KeyGrabButtonClass *keygrabbuttonclass); 38 | static void begin_key_grab(KeyGrabButton* self, gpointer v); 39 | static void end_key_grab(KeyGrabButton *self); 40 | static GtkWidget* popup_new(GtkWidget* parent, const gchar* text, gboolean mouse); 41 | static void on_key_press_event(GtkWidget *self, GdkEventKey *event, gpointer v); 42 | 43 | G_DEFINE_TYPE(KeyGrabButton, keygrab_button, GTK_TYPE_BUTTON) 44 | 45 | static void keygrab_button_init(KeyGrabButton *keygrabbutton) 46 | { 47 | keygrab_button_set_key(keygrabbutton, 0, 0); 48 | gtk_widget_set_size_request(GTK_WIDGET(keygrabbutton), 100, -1); 49 | g_signal_connect(G_OBJECT(keygrabbutton), "clicked", (GCallback) begin_key_grab, NULL); 50 | } 51 | 52 | static void keygrab_button_class_init(KeyGrabButtonClass *keygrabbuttonclass) 53 | { 54 | GObjectClass *object_class; 55 | object_class = (GObjectClass*)keygrabbuttonclass; 56 | keygrab_button_signals[KEYGRAB_BUTTON_CHANGED] = g_signal_new("changed", 57 | G_TYPE_FROM_CLASS(object_class), 58 | G_SIGNAL_RUN_FIRST, 59 | G_STRUCT_OFFSET(KeyGrabButtonClass, changed), 60 | NULL, NULL, 61 | g_cclosure_marshal_VOID__VOID, 62 | G_TYPE_NONE, 0, NULL); 63 | } 64 | 65 | GtkWidget* keygrab_button_new(void) 66 | { 67 | return GTK_WIDGET(g_object_new(TYPE_KEYGRAB_BUTTON, NULL)); 68 | } 69 | 70 | 71 | void begin_key_grab(KeyGrabButton* self, gpointer v) 72 | { 73 | KeyGrabButton* b = KEYGRAB_BUTTON(self); 74 | b->popup = popup_new(GTK_WIDGET(self), _("Please press the new key combination"), FALSE); 75 | gtk_widget_add_events(GTK_WIDGET(b->popup), GDK_KEY_PRESS_MASK); 76 | gtk_widget_show_all(b->popup); 77 | gtk_window_present(GTK_WINDOW(b->popup)); 78 | b->handler = g_signal_connect(G_OBJECT(b->popup), "key-press-event", (GCallback)on_key_press_event, b); 79 | 80 | while (gdk_keyboard_grab(gtk_widget_get_window(GTK_WIDGET(b->popup)), FALSE, GDK_CURRENT_TIME) != GDK_GRAB_SUCCESS) 81 | usleep(100); 82 | } 83 | 84 | void end_key_grab(KeyGrabButton *self) 85 | { 86 | KeyGrabButton* b = KEYGRAB_BUTTON(self); 87 | gdk_keyboard_ungrab(gtk_get_current_event_time()); 88 | g_signal_handler_disconnect(b->popup, b->handler); 89 | gtk_widget_destroy(b->popup); 90 | } 91 | 92 | void on_key_press_event(GtkWidget *self, GdkEventKey *event, gpointer v) 93 | { 94 | KeyGrabButton* b = KEYGRAB_BUTTON(v); 95 | guint key; 96 | GdkModifierType mods = event->state & gtk_accelerator_get_default_mod_mask(); 97 | 98 | if ((event->keyval == FcitxKey_Escape 99 | || event->keyval == FcitxKey_Return) && !mods) { 100 | if (event->keyval == FcitxKey_Escape) 101 | g_signal_emit_by_name(G_OBJECT(b), "changed", b->key, b->mods); 102 | end_key_grab(b); 103 | keygrab_button_set_key(b, 0, 0); 104 | return; 105 | } 106 | 107 | key = gdk_keyval_to_upper(event->keyval); 108 | if (key == FcitxKey_ISO_Left_Tab) 109 | key = FcitxKey_Tab; 110 | 111 | if (gtk_accelerator_valid(key, mods) 112 | || (key == FcitxKey_Tab && mods)) { 113 | keygrab_button_set_key(b, key, mods); 114 | end_key_grab(b); 115 | b->key = key; 116 | b->mods = mods; 117 | g_signal_emit_by_name(G_OBJECT(b), "changed", b->key, b->mods); 118 | return; 119 | } 120 | 121 | keygrab_button_set_key(b, key, mods); 122 | } 123 | 124 | void keygrab_button_set_key(KeyGrabButton* self, guint key, GdkModifierType mods) 125 | { 126 | if (mods & GDK_SUPER_MASK) { 127 | mods &= ~GDK_SUPER_MASK; 128 | mods |= FcitxKeyState_Super; 129 | } 130 | KeyGrabButton* b = KEYGRAB_BUTTON(self); 131 | gchar *label; 132 | b->key = key; 133 | b->mods = mods; 134 | 135 | label = FcitxHotkeyGetKeyString(key, mods); 136 | 137 | if (label == NULL || strlen(label) == 0) { 138 | gtk_button_set_label(GTK_BUTTON(b), _("Empty")); 139 | } else { 140 | gchar* lb = label; 141 | gtk_button_set_label(GTK_BUTTON(b), lb); 142 | } 143 | 144 | if (label) 145 | free(label); 146 | } 147 | 148 | void keygrab_button_get_key(KeyGrabButton* self, guint* key, GdkModifierType* mods) 149 | { 150 | if (key) 151 | *key = self->key; 152 | if (mods) 153 | *mods = self->mods; 154 | } 155 | 156 | GtkWidget* popup_new(GtkWidget* parent, const gchar* text, gboolean mouse) 157 | { 158 | GtkWidget* w = gtk_window_new(GTK_WINDOW_TOPLEVEL); 159 | gtk_window_set_type_hint(GTK_WINDOW(w), GDK_WINDOW_TYPE_HINT_UTILITY); 160 | gtk_window_set_position(GTK_WINDOW(w), mouse ? GTK_WIN_POS_MOUSE : GTK_WIN_POS_CENTER_ALWAYS); 161 | if (parent) 162 | gtk_window_set_transient_for(GTK_WINDOW(w), GTK_WINDOW(gtk_widget_get_toplevel(parent))); 163 | gtk_window_set_modal(GTK_WINDOW(w), TRUE); 164 | gtk_window_set_decorated(GTK_WINDOW(w), TRUE); 165 | gtk_window_set_skip_taskbar_hint(GTK_WINDOW(w), TRUE); 166 | if (text) { 167 | GtkWidget* label = gtk_label_new(text); 168 | GtkWidget* align = gtk_alignment_new(0, 0, 1, 1); 169 | gtk_alignment_set_padding(GTK_ALIGNMENT(align), 20, 20, 20, 20); 170 | gtk_container_add(GTK_CONTAINER(align), label); 171 | gtk_container_add(GTK_CONTAINER(w), align); 172 | } 173 | 174 | return w; 175 | } 176 | -------------------------------------------------------------------------------- /gtk/keygrab.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright (C) 2010~2012 by CSSlayer * 3 | * * 4 | * This program is free software; you can redistribute it and/or modify * 5 | * it under the terms of the GNU General Public License as published by * 6 | * the Free Software Foundation; either version 2 of the License, or * 7 | * (at your option) any later version. * 8 | * * 9 | * This program is distributed in the hope that it will be useful, * 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 12 | * GNU General Public License for more details. * 13 | * * 14 | * You should have received a copy of the GNU General Public License * 15 | * along with this program; if not, write to the * 16 | * Free Software Foundation, Inc., * 17 | * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * 18 | ***************************************************************************/ 19 | 20 | #ifndef KEYGRAB_H 21 | #define KEYGRAB_H 22 | 23 | #include 24 | 25 | #define TYPE_KEYGRAB_BUTTON (keygrab_button_get_type()) 26 | #define KEYGRAB_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_CAST(obj,TYPE_KEYGRAB_BUTTON,KeyGrabButton)) 27 | 28 | typedef struct _KeyGrabButton KeyGrabButton; 29 | typedef struct _KeyGrabButtonClass KeyGrabButtonClass; 30 | struct _KeyGrabButton { 31 | GtkButton parent; 32 | GtkWidget* popup; 33 | gulong handler; 34 | guint key; 35 | GdkModifierType mods; 36 | }; 37 | struct _KeyGrabButtonClass { 38 | GtkButtonClass parent_class; 39 | void (*changed)(int, int); 40 | void (*current_changed)(int, int); 41 | }; 42 | 43 | GType keygrab_button_get_type(void); 44 | GtkWidget* keygrab_button_new(void); 45 | gchar *accelerator_to_fcitx_hotkey(const gchar* str); 46 | void keygrab_button_set_key(KeyGrabButton* self, guint key, GdkModifierType mods); 47 | void keygrab_button_get_key(KeyGrabButton* self, guint* key, GdkModifierType* mods); 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /gtk/locarchive.h: -------------------------------------------------------------------------------- 1 | /* Definitions for locale archive handling. 2 | Copyright (C) 2002 Free Software Foundation, Inc. 3 | This file is part of the GNU C Library. 4 | 5 | The GNU C Library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | The GNU C Library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with the GNU C Library; if not, write to the Free 17 | Software Foundation, Inc., 18 | 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | 21 | #ifndef _LOCARCHIVE_H 22 | #define _LOCARCHIVE_H 1 23 | 24 | #include 25 | 26 | #define AR_MAGIC 0xde020109 27 | 28 | struct locarhead { 29 | uint32_t magic; 30 | /* Serial number. */ 31 | uint32_t serial; 32 | /* Name hash table. */ 33 | uint32_t namehash_offset; 34 | uint32_t namehash_used; 35 | uint32_t namehash_size; 36 | /* String table. */ 37 | uint32_t string_offset; 38 | uint32_t string_used; 39 | uint32_t string_size; 40 | /* Table with locale records. */ 41 | uint32_t locrectab_offset; 42 | uint32_t locrectab_used; 43 | uint32_t locrectab_size; 44 | /* MD5 sum hash table. */ 45 | uint32_t sumhash_offset; 46 | uint32_t sumhash_used; 47 | uint32_t sumhash_size; 48 | }; 49 | 50 | 51 | struct namehashent { 52 | /* Hash value of the name. */ 53 | uint32_t hashval; 54 | /* Offset of the name in the string table. */ 55 | uint32_t name_offset; 56 | /* Offset of the locale record. */ 57 | uint32_t locrec_offset; 58 | }; 59 | 60 | 61 | struct sumhashent { 62 | /* MD5 sum. */ 63 | char sum[16]; 64 | /* Offset of the file in the archive. */ 65 | uint32_t file_offset; 66 | }; 67 | 68 | struct locrecent { 69 | uint32_t refs; /* # of namehashent records that point here */ 70 | struct { 71 | uint32_t offset; 72 | uint32_t len; 73 | } record[__LC_LAST]; 74 | }; 75 | 76 | 77 | struct locarhandle { 78 | int fd; 79 | void *addr; 80 | size_t len; 81 | }; 82 | 83 | 84 | /* In memory data for the locales with their checksums. */ 85 | typedef struct locale_category_data { 86 | off_t size; 87 | void *addr; 88 | char sum[16]; 89 | } locale_data_t[__LC_LAST]; 90 | 91 | #endif /* locarchive.h */ 92 | -------------------------------------------------------------------------------- /gtk/main.c: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright (C) 2010~2012 by CSSlayer * 3 | * * 4 | * This program is free software; you can redistribute it and/or modify * 5 | * it under the terms of the GNU General Public License as published by * 6 | * the Free Software Foundation; either version 2 of the License, or * 7 | * (at your option) any later version. * 8 | * * 9 | * This program is distributed in the hope that it will be useful, * 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 12 | * GNU General Public License for more details. * 13 | * * 14 | * You should have received a copy of the GNU General Public License * 15 | * along with this program; if not, write to the * 16 | * Free Software Foundation, Inc., * 17 | * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * 18 | ***************************************************************************/ 19 | 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include "config.h" 26 | #include "main_window.h" 27 | #include "configdesc.h" 28 | #include "config_widget.h" 29 | 30 | static GtkWidget *window = NULL; 31 | 32 | #ifdef HAVE_UNIQUE 33 | #include 34 | 35 | static UniqueResponse 36 | message_received_cb(UniqueApp *app, 37 | UniqueCommand command, 38 | UniqueMessageData *message, 39 | guint time_, 40 | gpointer user_data) 41 | { 42 | UniqueResponse res; 43 | switch (command) { 44 | case UNIQUE_ACTIVATE: 45 | gtk_window_set_screen(GTK_WINDOW(window), unique_message_data_get_screen(message)); 46 | gtk_window_present_with_time(GTK_WINDOW(window), time_); 47 | res = UNIQUE_RESPONSE_OK; 48 | break; 49 | default: 50 | res = UNIQUE_RESPONSE_OK; 51 | break; 52 | } 53 | return res; 54 | } 55 | #endif 56 | 57 | int 58 | main(int argc, char **argv) 59 | { 60 | gtk_init(&argc, &argv); 61 | 62 | #ifdef HAVE_UNIQUE 63 | UniqueApp *app; 64 | 65 | app = unique_app_new_with_commands("org.fcitx.fcitx-configtool", NULL, 66 | NULL, NULL); 67 | 68 | if (unique_app_is_running(app)) { 69 | UniqueResponse response = unique_app_send_message(app, UNIQUE_ACTIVATE, NULL); 70 | g_object_unref(app); 71 | if (response == UNIQUE_RESPONSE_OK) 72 | return 0; 73 | else 74 | return 1; 75 | } 76 | #endif 77 | 78 | setlocale(LC_ALL, ""); 79 | bindtextdomain("fcitx-configtool", LOCALEDIR); 80 | bind_textdomain_codeset("fcitx-configtool", "UTF-8"); 81 | bindtextdomain("fcitx", LOCALEDIR); 82 | bind_textdomain_codeset("fcitx", "UTF-8"); 83 | textdomain("fcitx-configtool"); 84 | 85 | gboolean loaded = FALSE; 86 | if (argc > 1) { 87 | UT_array* addons = NULL; 88 | const UT_icd addonicd = {sizeof(FcitxAddon), 0, 0, FcitxAddonFree}; 89 | utarray_new(addons, &addonicd); 90 | FcitxAddonsLoad(addons); 91 | 92 | do { 93 | FcitxAddon* addon = NULL; 94 | for (addon = (FcitxAddon *) utarray_front(addons); 95 | addon != NULL; 96 | addon = (FcitxAddon *) utarray_next(addons, addon)) { 97 | if (strcmp(addon->name, argv[1]) == 0) 98 | break; 99 | } 100 | if (!addon) 101 | break; 102 | 103 | GtkWidget* dialog = fcitx_config_dialog_new(addon, NULL); 104 | g_signal_connect_swapped(G_OBJECT(dialog), "destroy", G_CALLBACK(gtk_main_quit), NULL); 105 | 106 | gtk_widget_show_all(GTK_WIDGET(dialog)); 107 | loaded = TRUE; 108 | } while (0); 109 | utarray_free(addons); 110 | } 111 | 112 | if (!loaded) { 113 | window = fcitx_main_window_new(); 114 | 115 | #ifdef HAVE_UNIQUE 116 | unique_app_watch_window(app, GTK_WINDOW(window)); 117 | g_signal_connect(app, "message-received", G_CALLBACK(message_received_cb), NULL); 118 | #endif 119 | 120 | gtk_widget_show_all(window); 121 | } 122 | gtk_main(); 123 | 124 | #ifdef HAVE_UNIQUE 125 | g_object_unref(app); 126 | #endif 127 | 128 | return 0; 129 | } 130 | 131 | -------------------------------------------------------------------------------- /gtk/main_window.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright (C) 2010~2012 by CSSlayer * 3 | * * 4 | * This program is free software; you can redistribute it and/or modify * 5 | * it under the terms of the GNU General Public License as published by * 6 | * the Free Software Foundation; either version 2 of the License, or * 7 | * (at your option) any later version. * 8 | * * 9 | * This program is distributed in the hope that it will be useful, * 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 12 | * GNU General Public License for more details. * 13 | * * 14 | * You should have received a copy of the GNU General Public License * 15 | * along with this program; if not, write to the * 16 | * Free Software Foundation, Inc., * 17 | * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * 18 | ***************************************************************************/ 19 | 20 | #ifndef MAIN_WINDOW_H 21 | 22 | #define MAIN_WINDOW_H 23 | 24 | #include 25 | #include 26 | 27 | #include "common.h" 28 | 29 | G_BEGIN_DECLS 30 | 31 | #define FCITX_TYPE_MAIN_WINDOW fcitx_main_window_get_type() 32 | 33 | #define FCITX_MAIN_WINDOW(obj) \ 34 | (G_TYPE_CHECK_INSTANCE_CAST ((obj), FCITX_TYPE_MAIN_WINDOW, FcitxMainWindow)) 35 | 36 | #define FCITX_MAIN_WINDOW_CLASS(klass) \ 37 | (G_TYPE_CHECK_CLASS_CAST ((klass), FCITX_TYPE_MAIN_WINDOW, FcitxMainWindowClass)) 38 | 39 | #define FCITX_IS_MAIN_WINDOW(obj) \ 40 | (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FCITX_TYPE_MAIN_WINDOW)) 41 | 42 | #define FCITX_IS_MAIN_WINDOW_CLASS(klass) \ 43 | (G_TYPE_CHECK_CLASS_TYPE ((klass), FCITX_TYPE_MAIN_WINDOW)) 44 | 45 | #define FCITX_MAIN_WINDOW_GET_CLASS(obj) \ 46 | (G_TYPE_INSTANCE_GET_CLASS ((obj), FCITX_TYPE_MAIN_WINDOW, FcitxMainWindowClass)) 47 | 48 | typedef struct { 49 | GtkWidget* page; 50 | GtkTreeIter iter; 51 | } ConfigPage; 52 | 53 | typedef struct { 54 | GtkWindow parent; 55 | GtkWidget* pageview; 56 | GtkListStore *pagestore; 57 | GtkWidget* vbox; 58 | GtkWidget* pagelabel; 59 | ConfigPage* impage; 60 | ConfigPage* configpage; 61 | ConfigPage* lastpage; 62 | ConfigPage* addonpage; 63 | GtkWidget* button; 64 | GtkWidget* addonview; 65 | UT_array* addons; 66 | 67 | } FcitxMainWindow; 68 | 69 | typedef struct { 70 | GtkWindowClass parent_class; 71 | } FcitxMainWindowClass; 72 | 73 | GType fcitx_main_window_get_type(void); 74 | 75 | GtkWidget* fcitx_main_window_new(void); 76 | 77 | #endif 78 | -------------------------------------------------------------------------------- /gtk/sub_config_parser.c: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright (C) 2010~2012 by CSSlayer * 3 | * * 4 | * This program is free software; you can redistribute it and/or modify * 5 | * it under the terms of the GNU General Public License as published by * 6 | * the Free Software Foundation; either version 2 of the License, or * 7 | * (at your option) any later version. * 8 | * * 9 | * This program is distributed in the hope that it will be useful, * 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 12 | * GNU General Public License for more details. * 13 | * * 14 | * You should have received a copy of the GNU General Public License * 15 | * along with this program; if not, write to the * 16 | * Free Software Foundation, Inc., * 17 | * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * 18 | ***************************************************************************/ 19 | 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | 27 | #include 28 | #include 29 | 30 | #include "config.h" 31 | 32 | #include "sub_config_parser.h" 33 | 34 | static void sub_config_pattern_free(void* pattern); 35 | static GHashTable* sub_config_pattern_get_filelist(FcitxSubConfigPattern* pattern); 36 | static GList* get_files_by_pattern(const gchar* dirpath, FcitxSubConfigPattern* pattern, int index); 37 | static void sub_file_list_free(gpointer data, gpointer user_data); 38 | 39 | static SubConfigType parse_type(const gchar* str); 40 | 41 | static SubConfigType parse_type(const gchar* str) 42 | { 43 | if (strcmp(str, "native") == 0) { 44 | return SC_NativeFile; 45 | } 46 | if (strcmp(str, "configfile") == 0) { 47 | return SC_ConfigFile; 48 | } 49 | return SC_None; 50 | } 51 | 52 | FcitxSubConfigParser* sub_config_parser_new(const gchar* subconfig) 53 | { 54 | if (subconfig == NULL) 55 | return NULL; 56 | 57 | FcitxSubConfigParser* parser = g_malloc0(sizeof(FcitxSubConfigParser)); 58 | parser->subconfigs = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, sub_config_pattern_free); 59 | gchar** strv = g_strsplit(subconfig, ",", 0); 60 | 61 | gchar** str; 62 | for (str = &strv[0]; *str != NULL; str++) { 63 | if (strchr(*str, ':') == NULL) 64 | continue; 65 | 66 | gchar** items = g_strsplit(*str, ":", 0); 67 | 68 | if (g_strv_length(items) < 2) 69 | goto end; 70 | if (strlen(items[0]) == 0) 71 | goto end; 72 | 73 | if (strcmp(items[1], "domain") == 0) { 74 | parser->domain = g_strdup(items[0]); 75 | goto end; 76 | } 77 | 78 | SubConfigType type = parse_type(items[1]); 79 | if (type == SC_None) 80 | goto end; 81 | if (g_hash_table_lookup(parser->subconfigs, items[0]) != NULL) 82 | continue; 83 | 84 | if (type == SC_ConfigFile) { 85 | if (g_strv_length(items) != 4) 86 | goto end; 87 | if (strlen(items[2]) == 0 || items[2][0] == '/') 88 | goto end; 89 | } else if (type == SC_NativeFile) { 90 | if (g_strv_length(items) != 3) 91 | goto end; 92 | if (strchr(items[2], '*') != NULL) 93 | goto end; 94 | } 95 | 96 | gchar** paths = g_strsplit(items[2], "/", 0); 97 | if (paths[0] == 0) { 98 | g_strfreev(paths); 99 | goto end; 100 | } 101 | gchar** path; 102 | for (path = &paths[0]; *path != NULL; path++) { 103 | if (strlen(*path) == 0) 104 | break; 105 | if (strcmp(*path, ".") == 0) 106 | break; 107 | if (strcmp(*path, "..") == 0) 108 | break; 109 | } 110 | if (*path != NULL) { 111 | g_strfreev(paths); 112 | goto end; 113 | } 114 | FcitxSubConfigPattern* pattern = g_malloc0(sizeof(FcitxSubConfigPattern)); 115 | pattern->type = type; 116 | pattern->patternlist = paths; 117 | if (type == SC_ConfigFile) 118 | pattern->configdesc = g_strdup(items[3]); 119 | else if (type == SC_NativeFile) 120 | pattern->nativepath = g_strdup(items[2]); 121 | 122 | g_hash_table_insert(parser->subconfigs, g_strdup(items[0]), pattern); 123 | end: 124 | g_strfreev(items); 125 | } 126 | g_strfreev(strv); 127 | if (g_hash_table_size(parser->subconfigs) == 0 || parser->domain == NULL) { 128 | sub_config_parser_free(parser); 129 | parser = NULL; 130 | } 131 | 132 | return parser; 133 | } 134 | 135 | void sub_config_parser_free(FcitxSubConfigParser* parser) 136 | { 137 | if (parser == NULL) 138 | return; 139 | 140 | g_hash_table_destroy(parser->subconfigs); 141 | if (parser->domain) 142 | g_free(parser->domain); 143 | } 144 | 145 | void sub_config_pattern_free(void* data) 146 | { 147 | FcitxSubConfigPattern* pattern = data; 148 | if (pattern->patternlist) 149 | g_strfreev(pattern->patternlist); 150 | 151 | if (pattern->configdesc) 152 | g_free(pattern->configdesc); 153 | 154 | if (pattern->nativepath) 155 | g_free(pattern->nativepath); 156 | 157 | g_free(pattern); 158 | } 159 | 160 | FcitxSubConfig* sub_config_new(const gchar* name, FcitxSubConfigPattern* pattern) 161 | { 162 | if (pattern->type == SC_None) 163 | return NULL; 164 | 165 | FcitxSubConfig* subconfig = g_malloc0(sizeof(FcitxSubConfig)); 166 | subconfig->type = pattern->type; 167 | subconfig->configdesc = g_strdup(pattern->configdesc); 168 | subconfig->nativepath = g_strdup(pattern->nativepath); 169 | subconfig->name = g_strdup(name); 170 | subconfig->filelist = sub_config_pattern_get_filelist(pattern); 171 | 172 | return subconfig; 173 | } 174 | 175 | void sub_file_list_free(gpointer data, gpointer user_data) 176 | { 177 | g_free(data); 178 | } 179 | 180 | void sub_config_free(FcitxSubConfig* subconfig) 181 | { 182 | if (!subconfig) 183 | return; 184 | 185 | g_free(subconfig->configdesc); 186 | g_free(subconfig->nativepath); 187 | g_free(subconfig->name); 188 | g_hash_table_unref(subconfig->filelist); 189 | g_free(subconfig); 190 | } 191 | 192 | GHashTable* sub_config_pattern_get_filelist(FcitxSubConfigPattern* pattern) 193 | { 194 | size_t size, i; 195 | GHashTable* result = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL); 196 | #if FCITX_CHECK_VERSION(4,2,1) 197 | char** xdgpath = FcitxXDGGetPathWithPrefix(&size, ""); 198 | #else 199 | char** xdgpath = FcitxXDGGetPath(&size, "XDG_CONFIG_HOME", ".config" , PACKAGE , DATADIR, PACKAGE); 200 | #endif 201 | 202 | for (i = 0; i < size; i ++) { 203 | char* dirpath = realpath(xdgpath[i], NULL); 204 | 205 | if (!dirpath) 206 | continue; 207 | 208 | GList* list = get_files_by_pattern(dirpath, pattern, 0), *l; 209 | 210 | for (l = g_list_first(list); 211 | l != NULL; 212 | l = l->next) { 213 | if (strncmp(dirpath, (gchar*) l->data, strlen(dirpath)) == 0) { 214 | gchar* filename = (gchar*) l->data; 215 | 216 | gchar* name = filename + strlen(dirpath); 217 | while (name[0] == '/') 218 | name ++; 219 | if (!g_hash_table_lookup_extended(result, name, NULL, NULL)) { 220 | g_hash_table_insert(result, g_strdup(name), NULL); 221 | } 222 | } 223 | } 224 | g_list_foreach(list, sub_file_list_free, NULL); 225 | g_list_free(list); 226 | 227 | free(dirpath); 228 | } 229 | 230 | FcitxXDGFreePath(xdgpath); 231 | 232 | return result; 233 | } 234 | 235 | GList* get_files_by_pattern(const gchar* dirpath, FcitxSubConfigPattern* pattern, int index) 236 | { 237 | GList* result = NULL; 238 | 239 | DIR* dir = opendir(dirpath); 240 | if (!dir) 241 | return result; 242 | 243 | gchar* filter = pattern->patternlist[index]; 244 | 245 | struct dirent* drt; 246 | GPatternSpec * patternspec = g_pattern_spec_new(filter); 247 | while ((drt = readdir(dir)) != NULL) { 248 | if (strcmp(drt->d_name , ".") == 0 || strcmp(drt->d_name, "..") == 0) 249 | continue; 250 | 251 | if (!g_pattern_match_string(patternspec, drt->d_name)) 252 | continue; 253 | 254 | if (pattern->patternlist[index + 1] == 0) { 255 | char *path; 256 | asprintf(&path, "%s/%s", dirpath, drt->d_name); 257 | struct stat statbuf; 258 | if (stat(path, &statbuf) == 0) { 259 | result = g_list_append(result, realpath(path, NULL)); 260 | } 261 | free(path); 262 | } else { 263 | char *path; 264 | asprintf(&path, "%s/%s", dirpath, drt->d_name); 265 | GList* r = get_files_by_pattern(path, pattern, index + 1); 266 | result = g_list_concat(result, r); 267 | free(path); 268 | } 269 | } 270 | 271 | closedir(dir); 272 | g_pattern_spec_free(patternspec); 273 | return result; 274 | } 275 | -------------------------------------------------------------------------------- /gtk/sub_config_parser.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright (C) 2010~2012 by CSSlayer * 3 | * * 4 | * This program is free software; you can redistribute it and/or modify * 5 | * it under the terms of the GNU General Public License as published by * 6 | * the Free Software Foundation; either version 2 of the License, or * 7 | * (at your option) any later version. * 8 | * * 9 | * This program is distributed in the hope that it will be useful, * 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 12 | * GNU General Public License for more details. * 13 | * * 14 | * You should have received a copy of the GNU General Public License * 15 | * along with this program; if not, write to the * 16 | * Free Software Foundation, Inc., * 17 | * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * 18 | ***************************************************************************/ 19 | 20 | #ifndef _SUB_CONFIG_PARSER_H 21 | #define _SUB_CONFIG_PARSER_H 22 | #include 23 | 24 | typedef enum { 25 | SC_None, 26 | SC_ConfigFile, 27 | SC_NativeFile 28 | } SubConfigType; 29 | 30 | typedef struct { 31 | SubConfigType type; 32 | gchar* configdesc; 33 | gchar* nativepath; 34 | gchar** patternlist; 35 | } FcitxSubConfigPattern; 36 | 37 | typedef struct { 38 | gchar* name; 39 | SubConfigType type; 40 | GHashTable* filelist; 41 | gchar* nativepath; 42 | gchar* configdesc; 43 | } FcitxSubConfig; 44 | 45 | typedef struct { 46 | GHashTable* subconfigs; 47 | gchar* domain; 48 | } FcitxSubConfigParser; 49 | 50 | FcitxSubConfigParser* sub_config_parser_new(const gchar* subconfig); 51 | void sub_config_parser_free(FcitxSubConfigParser* parser); 52 | FcitxSubConfig* sub_config_new(const gchar* name, FcitxSubConfigPattern* pattern); 53 | void sub_config_free(FcitxSubConfig* subconfig); 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /gtk/sub_config_widget.c: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright (C) 2010~2012 by CSSlayer * 3 | * * 4 | * This program is free software; you can redistribute it and/or modify * 5 | * it under the terms of the GNU General Public License as published by * 6 | * the Free Software Foundation; either version 2 of the License, or * 7 | * (at your option) any later version. * 8 | * * 9 | * This program is distributed in the hope that it will be useful, * 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 12 | * GNU General Public License for more details. * 13 | * * 14 | * You should have received a copy of the GNU General Public License * 15 | * along with this program; if not, write to the * 16 | * Free Software Foundation, Inc., * 17 | * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * 18 | ***************************************************************************/ 19 | 20 | #include 21 | #include 22 | 23 | #include "sub_config_widget.h" 24 | #include "main_window.h" 25 | #include "configdesc.h" 26 | #include "config_widget.h" 27 | 28 | G_DEFINE_TYPE(FcitxSubConfigWidget, fcitx_sub_config_widget, GTK_TYPE_BOX) 29 | 30 | static void open_subconfig_file(GtkButton *button, gpointer user_data); 31 | static void open_native_file(GtkButton *button, gpointer user_data); 32 | static void push_into_store_cb(gpointer data, gpointer value, gpointer user_data); 33 | 34 | static void 35 | fcitx_sub_config_widget_get_property(GObject *object, guint property_id, 36 | GValue *value, GParamSpec *pspec) 37 | { 38 | switch (property_id) { 39 | default: 40 | G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec); 41 | } 42 | } 43 | 44 | static void 45 | fcitx_sub_config_widget_set_property(GObject *object, guint property_id, 46 | const GValue *value, GParamSpec *pspec) 47 | { 48 | switch (property_id) { 49 | default: 50 | G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec); 51 | } 52 | } 53 | 54 | static void 55 | fcitx_sub_config_widget_finalize(GObject *object) 56 | { 57 | FcitxSubConfigWidget* widget = FCITX_SUB_CONFIG_WIDGET(object); 58 | sub_config_free(widget->subconfig); 59 | G_OBJECT_CLASS(fcitx_sub_config_widget_parent_class)->finalize(object); 60 | } 61 | 62 | static void 63 | fcitx_sub_config_widget_class_init(FcitxSubConfigWidgetClass *klass) 64 | { 65 | GObjectClass *object_class = G_OBJECT_CLASS(klass); 66 | 67 | 68 | object_class->get_property = fcitx_sub_config_widget_get_property; 69 | object_class->set_property = fcitx_sub_config_widget_set_property; 70 | object_class->finalize = fcitx_sub_config_widget_finalize; 71 | } 72 | 73 | static void 74 | fcitx_sub_config_widget_init(FcitxSubConfigWidget *self) 75 | { 76 | } 77 | 78 | FcitxSubConfigWidget* 79 | fcitx_sub_config_widget_new(FcitxSubConfig* subconfig) 80 | { 81 | FcitxSubConfigWidget* widget = g_object_new(FCITX_TYPE_SUB_CONFIG_WIDGET, NULL); 82 | 83 | widget->subconfig = subconfig; 84 | switch (subconfig->type) { 85 | case SC_ConfigFile: { 86 | GtkWidget* view = gtk_tree_view_new(); 87 | gtk_box_pack_start(GTK_BOX(widget), view, FALSE, FALSE, 0); 88 | 89 | GtkCellRenderer* renderer = gtk_cell_renderer_text_new(); 90 | GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes("Name", renderer, "text", 0, NULL); 91 | gtk_tree_view_append_column(GTK_TREE_VIEW(view), column); 92 | GtkTreeSelection *selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(view)); 93 | gtk_tree_selection_set_mode(selection, GTK_SELECTION_SINGLE); 94 | 95 | GtkListStore* store = gtk_list_store_new(1, G_TYPE_STRING); 96 | 97 | gtk_tree_view_set_model(GTK_TREE_VIEW(view), 98 | GTK_TREE_MODEL(store)); 99 | 100 | g_hash_table_foreach(widget->subconfig->filelist, push_into_store_cb, store); 101 | 102 | GtkWidget* button = gtk_button_new(); 103 | gtk_button_set_image(GTK_BUTTON(button), gtk_image_new_from_stock(GTK_STOCK_PREFERENCES, GTK_ICON_SIZE_BUTTON)); 104 | g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(open_subconfig_file), widget); 105 | gtk_box_pack_start(GTK_BOX(widget), button, FALSE, FALSE, 0); 106 | widget->view = view; 107 | } 108 | break; 109 | case SC_NativeFile: { 110 | GtkWidget* button = gtk_button_new(); 111 | gtk_button_set_image(GTK_BUTTON(button), gtk_image_new_from_stock(GTK_STOCK_OPEN, GTK_ICON_SIZE_BUTTON)); 112 | g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(open_native_file), widget); 113 | gtk_box_pack_start(GTK_BOX(widget), button, FALSE, FALSE, 0); 114 | } 115 | break; 116 | default: 117 | break; 118 | } 119 | 120 | return widget; 121 | } 122 | 123 | void open_subconfig_file(GtkButton *button, 124 | gpointer user_data) 125 | { 126 | FcitxSubConfigWidget* widget = (FcitxSubConfigWidget*) user_data; 127 | GtkTreeView* view = GTK_TREE_VIEW(widget->view); 128 | GtkTreeSelection *selection = gtk_tree_view_get_selection(view); 129 | GtkTreeModel *model = gtk_tree_view_get_model(view); 130 | GtkTreeIter iter; 131 | gchar* configfile; 132 | if (gtk_tree_selection_get_selected(selection, &model, &iter)) { 133 | gtk_tree_model_get(model, &iter, 134 | 0, &configfile, 135 | -1); 136 | FcitxConfigFileDesc* cfdesc = get_config_desc(widget->subconfig->configdesc); 137 | if (cfdesc) { 138 | GtkWidget* dialog = gtk_dialog_new_with_buttons(configfile, 139 | GTK_WINDOW(gtk_widget_get_ancestor(GTK_WIDGET(widget), GTK_TYPE_WINDOW)), 140 | GTK_DIALOG_MODAL, 141 | GTK_STOCK_OK, 142 | GTK_RESPONSE_OK, 143 | GTK_STOCK_CANCEL, 144 | GTK_RESPONSE_CANCEL, 145 | NULL 146 | ); 147 | FcitxConfigWidget* config_widget = fcitx_config_widget_new(cfdesc, "", configfile, NULL); 148 | GtkWidget* content_area = gtk_dialog_get_content_area(GTK_DIALOG(dialog)); 149 | gtk_box_pack_start(GTK_BOX(content_area), GTK_WIDGET(config_widget), TRUE, TRUE, 0); 150 | gtk_widget_set_size_request(GTK_WIDGET(config_widget), -1, 400); 151 | 152 | g_signal_connect(dialog, "response", 153 | G_CALLBACK(fcitx_config_widget_response_cb), 154 | config_widget); 155 | 156 | gtk_widget_show_all(GTK_WIDGET(dialog)); 157 | } 158 | } 159 | } 160 | 161 | void open_native_file(GtkButton *button, 162 | gpointer user_data) 163 | { 164 | FcitxSubConfigWidget* widget = (FcitxSubConfigWidget*) user_data; 165 | char *newpath = NULL; 166 | char* qtguiwrapper = fcitx_utils_get_fcitx_path_with_filename ("libdir", "fcitx/libexec/fcitx-qt-gui-wrapper"); 167 | if (qtguiwrapper) { 168 | gchar* argv[4]; 169 | argv[0] = qtguiwrapper; 170 | argv[1] = "--test"; 171 | argv[2] = widget->subconfig->nativepath; 172 | argv[3] = 0; 173 | int exit_status = 1; 174 | g_spawn_sync(NULL, argv, NULL, 0, NULL, NULL, NULL, NULL, &exit_status, NULL); 175 | 176 | if (exit_status == 0) { 177 | gchar* argv2[3]; 178 | argv2[0] = qtguiwrapper; 179 | argv2[1] = widget->subconfig->nativepath; 180 | argv2[2] = 0; 181 | g_spawn_async(NULL, argv2, NULL, 0, NULL, NULL, NULL, NULL); 182 | free(newpath); 183 | } 184 | g_free(qtguiwrapper); 185 | 186 | if (exit_status == 0) { 187 | return; 188 | } 189 | } 190 | 191 | if (g_hash_table_size(widget->subconfig->filelist) > 0) { 192 | GHashTableIter iter; 193 | g_hash_table_iter_init(&iter, widget->subconfig->filelist); 194 | gpointer key; 195 | if (g_hash_table_iter_next(&iter, &key, NULL)) { 196 | FILE* fp = FcitxXDGGetFileWithPrefix("", key, "r", &newpath); 197 | if (fp) 198 | fclose(fp); 199 | } 200 | } else { 201 | FILE* fp = FcitxXDGGetFileUserWithPrefix("", widget->subconfig->nativepath, "w", &newpath); 202 | if (fp) { 203 | g_hash_table_insert(widget->subconfig->filelist, widget->subconfig->nativepath, NULL); 204 | fclose(fp); 205 | } 206 | } 207 | 208 | if (newpath) { 209 | gchar* filename = newpath; 210 | gchar* argv[3]; 211 | argv[0] = "xdg-open"; 212 | argv[1] = filename; 213 | argv[2] = 0; 214 | g_spawn_async(NULL, argv, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, NULL); 215 | free(newpath); 216 | } 217 | } 218 | 219 | 220 | void push_into_store_cb(gpointer data, 221 | gpointer value, 222 | gpointer user_data) 223 | { 224 | GtkListStore* store = user_data; 225 | 226 | GtkTreeIter iter; 227 | 228 | gtk_list_store_append(store, &iter); 229 | gtk_list_store_set(store, &iter, 230 | 0, data, 231 | -1); 232 | } 233 | -------------------------------------------------------------------------------- /gtk/sub_config_widget.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright (C) 2010~2012 by CSSlayer * 3 | * * 4 | * This program is free software; you can redistribute it and/or modify * 5 | * it under the terms of the GNU General Public License as published by * 6 | * the Free Software Foundation; either version 2 of the License, or * 7 | * (at your option) any later version. * 8 | * * 9 | * This program is distributed in the hope that it will be useful, * 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 12 | * GNU General Public License for more details. * 13 | * * 14 | * You should have received a copy of the GNU General Public License * 15 | * along with this program; if not, write to the * 16 | * Free Software Foundation, Inc., * 17 | * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * 18 | ***************************************************************************/ 19 | 20 | #ifndef _FCITX_SUB_CONFIG_WIDGET 21 | #define _FCITX_SUB_CONFIG_WIDGET 22 | 23 | #include 24 | #include "sub_config_parser.h" 25 | 26 | G_BEGIN_DECLS 27 | 28 | #define FCITX_TYPE_SUB_CONFIG_WIDGET fcitx_sub_config_widget_get_type() 29 | 30 | #define FCITX_SUB_CONFIG_WIDGET(obj) \ 31 | (G_TYPE_CHECK_INSTANCE_CAST ((obj), FCITX_TYPE_SUB_CONFIG_WIDGET, FcitxSubConfigWidget)) 32 | 33 | #define FCITX_SUB_CONFIG_WIDGET_CLASS(klass) \ 34 | (G_TYPE_CHECK_CLASS_CAST ((klass), FCITX_TYPE_SUB_CONFIG_WIDGET, FcitxSubConfigWidgetClass)) 35 | 36 | #define FCITX_IS_SUB_CONFIG_WIDGET(obj) \ 37 | (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FCITX_TYPE_SUB_CONFIG_WIDGET)) 38 | 39 | #define FCITX_IS_SUB_CONFIG_WIDGET_CLASS(klass) \ 40 | (G_TYPE_CHECK_CLASS_TYPE ((klass), FCITX_TYPE_SUB_CONFIG_WIDGET)) 41 | 42 | #define FCITX_SUB_CONFIG_WIDGET_GET_CLASS(obj) \ 43 | (G_TYPE_INSTANCE_GET_CLASS ((obj), FCITX_TYPE_SUB_CONFIG_WIDGET, FcitxSubConfigWidgetClass)) 44 | 45 | typedef struct { 46 | GtkVBox parent; 47 | FcitxSubConfig* subconfig; 48 | GtkWidget* view; 49 | } FcitxSubConfigWidget; 50 | 51 | typedef struct { 52 | GtkVBoxClass parent_class; 53 | } FcitxSubConfigWidgetClass; 54 | 55 | GType fcitx_sub_config_widget_get_type(void); 56 | 57 | FcitxSubConfigWidget* fcitx_sub_config_widget_new(FcitxSubConfig* subconfig); 58 | 59 | G_END_DECLS 60 | 61 | #endif /* _FCITX_SUB_CONFIG_WIDGET */ 62 | -------------------------------------------------------------------------------- /gtk3/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include(gresource) 2 | 3 | gresource(${CMAKE_CURRENT_SOURCE_DIR} fcitx-config-gtk3.gresource.xml 4 | ${CMAKE_CURRENT_BINARY_DIR} RESOURCE_FILE RESOURCE_HEADER) 5 | 6 | set(fcitx_config_gtk3_sources 7 | sub_config_parser.c 8 | sub_config_widget.c 9 | config_widget.c 10 | configdesc.c 11 | keygrab.c 12 | main.c 13 | main_window.c 14 | im_widget.c 15 | ui_widget.c 16 | gdm-languages.c 17 | im_dialog.c 18 | common.c 19 | im_config_dialog.c 20 | dummy_config.c 21 | ) 22 | set(fcitx_config_gtk3_headers 23 | common.h 24 | configdesc.h 25 | config_widget.h 26 | dummy_config.h 27 | gdm-languages.h 28 | im_config_dialog.h 29 | im_dialog.h 30 | ui_widget.h 31 | im_widget.h 32 | keygrab.h 33 | locarchive.h 34 | main_window.h 35 | sub_config_parser.h 36 | sub_config_widget.h 37 | ) 38 | 39 | fcitx_translate_add_sources(${fcitx_config_gtk3_sources} 40 | ${fcitx_config_gtk3_headers}) 41 | fcitx_translate_add_sources(EXTRACT_TYPE glade 42 | im_dialog.ui im_widget.ui) 43 | 44 | if(NOT ENABLE_GTK3) 45 | return() 46 | endif() 47 | 48 | include_directories ( 49 | ${GTK3_INCLUDE_DIRS} 50 | ${FCITX4_FCITX_INCLUDE_DIRS} 51 | ${FCITX4_FCITX_UTILS_INCLUDE_DIRS} 52 | ${FCITX4_FCITX_CONFIG_INCLUDE_DIRS} 53 | ${FCITX_GCLIENT_INCLUDE_DIRS} 54 | ${CMAKE_CURRENT_BINARY_DIR} 55 | ) 56 | 57 | link_directories ( 58 | ${GTK3_LIBRARY_DIRS} 59 | ${FCITX4_FCITX_LIBRARY_DIRS} 60 | ${FCITX4_FCITX_UTILS_LIBRARY_DIRS} 61 | ${FCITX4_FCITX_CONFIG_LIBRARY_DIRS} 62 | ${FCITX_GCLIENT_LIBRARY_DIRS} 63 | ) 64 | 65 | add_executable(fcitx-config-gtk3 ${fcitx_config_gtk3_sources} 66 | ${RESOURCE_FILE} 67 | ${RESOURCE_HEADER}) 68 | 69 | install(TARGETS fcitx-config-gtk3 RUNTIME DESTINATION bin) 70 | 71 | target_link_libraries (fcitx-config-gtk3 72 | ${GTK3_LIBRARIES} 73 | ${FCITX4_FCITX_UTILS_LIBRARIES} 74 | ${FCITX4_FCITX_CONFIG_LIBRARIES} 75 | ${FCITX4_FCITX_LIBRARIES} 76 | ${FCITX_GCLIENT_LIBRARIES} 77 | ) 78 | -------------------------------------------------------------------------------- /gtk3/common.c: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright (C) 2010~2012 by CSSlayer * 3 | * * 4 | * This program is free software; you can redistribute it and/or modify * 5 | * it under the terms of the GNU General Public License as published by * 6 | * the Free Software Foundation; either version 2 of the License, or * 7 | * (at your option) any later version. * 8 | * * 9 | * This program is distributed in the hope that it will be useful, * 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 12 | * GNU General Public License for more details. * 13 | * * 14 | * You should have received a copy of the GNU General Public License * 15 | * along with this program; if not, write to the * 16 | * Free Software Foundation, Inc., * 17 | * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * 18 | ***************************************************************************/ 19 | 20 | #include "common.h" 21 | 22 | FcitxAddon* find_addon_by_name(UT_array* array, const gchar* name) 23 | { 24 | FcitxAddon* addon = NULL; 25 | for (addon = (FcitxAddon *) utarray_front(array); 26 | addon != NULL; 27 | addon = (FcitxAddon *) utarray_next(array, addon)) { 28 | if (strcmp(addon->name, name) == 0) 29 | break; 30 | } 31 | return addon; 32 | } 33 | -------------------------------------------------------------------------------- /gtk3/common.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright (C) 2010~2012 by CSSlayer * 3 | * * 4 | * This program is free software; you can redistribute it and/or modify * 5 | * it under the terms of the GNU General Public License as published by * 6 | * the Free Software Foundation; either version 2 of the License, or * 7 | * (at your option) any later version. * 8 | * * 9 | * This program is distributed in the hope that it will be useful, * 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 12 | * GNU General Public License for more details. * 13 | * * 14 | * You should have received a copy of the GNU General Public License * 15 | * along with this program; if not, write to the * 16 | * Free Software Foundation, Inc., * 17 | * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * 18 | ***************************************************************************/ 19 | 20 | #ifndef FCITX_CONFIGTOOL_COMMON_H 21 | #define FCITX_CONFIGTOOL_COMMON_H 22 | 23 | #include 24 | #include 25 | #include 26 | #include "config.h" 27 | 28 | #define _(x) gettext(x) 29 | 30 | FcitxAddon* find_addon_by_name(UT_array* array, const gchar* name); 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /gtk3/config_widget.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright (C) 2010~2012 by CSSlayer * 3 | * * 4 | * This program is free software; you can redistribute it and/or modify * 5 | * it under the terms of the GNU General Public License as published by * 6 | * the Free Software Foundation; either version 2 of the License, or * 7 | * (at your option) any later version. * 8 | * * 9 | * This program is distributed in the hope that it will be useful, * 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 12 | * GNU General Public License for more details. * 13 | * * 14 | * You should have received a copy of the GNU General Public License * 15 | * along with this program; if not, write to the * 16 | * Free Software Foundation, Inc., * 17 | * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * 18 | ***************************************************************************/ 19 | 20 | /* fcitx-config-widget.h */ 21 | 22 | #ifndef _FCITX_CONFIG_WIDGET 23 | #define _FCITX_CONFIG_WIDGET 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include "sub_config_parser.h" 30 | #include "dummy_config.h" 31 | 32 | G_BEGIN_DECLS 33 | 34 | #define FCITX_TYPE_CONFIG_WIDGET fcitx_config_widget_get_type() 35 | 36 | #define FCITX_CONFIG_WIDGET(obj) \ 37 | (G_TYPE_CHECK_INSTANCE_CAST ((obj), FCITX_TYPE_CONFIG_WIDGET, FcitxConfigWidget)) 38 | 39 | #define FCITX_CONFIG_WIDGET_CLASS(klass) \ 40 | (G_TYPE_CHECK_CLASS_CAST ((klass), FCITX_TYPE_CONFIG_WIDGET, FcitxConfigWidgetClass)) 41 | 42 | #define FCITX_IS_CONFIG_WIDGET(obj) \ 43 | (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FCITX_TYPE_CONFIG_WIDGET)) 44 | 45 | #define FCITX_IS_CONFIG_WIDGET_CLASS(klass) \ 46 | (G_TYPE_CHECK_CLASS_TYPE ((klass), FCITX_TYPE_CONFIG_WIDGET)) 47 | 48 | #define FCITX_CONFIG_WIDGET_GET_CLASS(obj) \ 49 | (G_TYPE_INSTANCE_GET_CLASS ((obj), FCITX_TYPE_CONFIG_WIDGET, FcitxConfigWidgetClass)) 50 | 51 | 52 | enum UIType { 53 | CW_Simple = 0x1, 54 | CW_Full = 0x2, 55 | CW_NoShow = 0x0 56 | }; 57 | 58 | typedef struct { 59 | GtkGrid parent; 60 | FcitxConfigFileDesc* cfdesc; 61 | gchar* prefix; 62 | gchar* name; 63 | FcitxSubConfigParser* parser; 64 | GHashTable* argmap; 65 | enum UIType fullUiType; 66 | enum UIType simpleUiType; 67 | GtkWidget* simpleWidget; 68 | GtkWidget* fullWidget; 69 | GtkWidget* advanceCheckBox; 70 | DummyConfig* config; 71 | } FcitxConfigWidget; 72 | 73 | typedef struct { 74 | GtkGridClass parent_class; 75 | } FcitxConfigWidgetClass; 76 | 77 | typedef enum { 78 | CONFIG_WIDGET_SAVE, 79 | CONFIG_WIDGET_CANCEL, 80 | CONFIG_WIDGET_DEFAULT 81 | } ConfigWidgetAction; 82 | 83 | GType fcitx_config_widget_get_type(void); 84 | 85 | FcitxConfigWidget* fcitx_config_widget_new(FcitxConfigFileDesc* cfdesc, const gchar* prefix, const gchar* name, const gchar* subconfig); 86 | 87 | void fcitx_config_widget_response(FcitxConfigWidget* config_widget, ConfigWidgetAction action); 88 | 89 | gboolean fcitx_config_widget_response_cb(GtkDialog *dialog, 90 | gint response, 91 | gpointer user_data); 92 | 93 | GtkWidget* fcitx_config_dialog_new(FcitxAddon* addon, GtkWindow* parent); 94 | 95 | G_END_DECLS 96 | 97 | #endif /* _FCITX_CONFIG_WIDGET */ 98 | -------------------------------------------------------------------------------- /gtk3/configdesc.c: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright (C) 2010~2012 by CSSlayer * 3 | * * 4 | * This program is free software; you can redistribute it and/or modify * 5 | * it under the terms of the GNU General Public License as published by * 6 | * the Free Software Foundation; either version 2 of the License, or * 7 | * (at your option) any later version. * 8 | * * 9 | * This program is distributed in the hope that it will be useful, * 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 12 | * GNU General Public License for more details. * 13 | * * 14 | * You should have received a copy of the GNU General Public License * 15 | * along with this program; if not, write to the * 16 | * Free Software Foundation, Inc., * 17 | * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * 18 | ***************************************************************************/ 19 | 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | 26 | #include "configdesc.h" 27 | 28 | typedef struct ConfigDescSet { 29 | char *filename; 30 | FcitxConfigFileDesc *cfdesc; 31 | UT_hash_handle hh; 32 | } ConfigDescSet; 33 | 34 | static ConfigDescSet* cdset = NULL; 35 | 36 | FcitxConfigFileDesc *get_config_desc(char *filename) 37 | { 38 | ConfigDescSet *desc = NULL; 39 | HASH_FIND_STR(cdset, filename, desc); 40 | if (!desc) { 41 | FILE * tmpfp = FcitxXDGGetFileWithPrefix("configdesc", filename, "r", NULL); 42 | if (tmpfp) { 43 | desc = malloc(sizeof(ConfigDescSet)); 44 | memset(desc, 0 , sizeof(ConfigDescSet)); 45 | desc->filename = strdup(filename); 46 | desc->cfdesc = FcitxConfigParseConfigFileDescFp(tmpfp); 47 | fclose(tmpfp); 48 | 49 | HASH_ADD_KEYPTR(hh, cdset, desc->filename, strlen(desc->filename), desc); 50 | } else 51 | return NULL; 52 | } 53 | 54 | return desc->cfdesc; 55 | } 56 | -------------------------------------------------------------------------------- /gtk3/configdesc.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright (C) 2010~2012 by CSSlayer * 3 | * * 4 | * This program is free software; you can redistribute it and/or modify * 5 | * it under the terms of the GNU General Public License as published by * 6 | * the Free Software Foundation; either version 2 of the License, or * 7 | * (at your option) any later version. * 8 | * * 9 | * This program is distributed in the hope that it will be useful, * 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 12 | * GNU General Public License for more details. * 13 | * * 14 | * You should have received a copy of the GNU General Public License * 15 | * along with this program; if not, write to the * 16 | * Free Software Foundation, Inc., * 17 | * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * 18 | ***************************************************************************/ 19 | 20 | #ifndef CONFIG_DESC_H 21 | #define CONFIG_DESC_H 22 | 23 | #include 24 | 25 | FcitxConfigFileDesc *get_config_desc(char *filename); 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /gtk3/dummy_config.c: -------------------------------------------------------------------------------- 1 | #include "dummy_config.h" 2 | #include 3 | 4 | DummyConfig* dummy_config_new(FcitxConfigFileDesc* cfdesc) 5 | { 6 | DummyConfig* self = g_new0(DummyConfig, 1); 7 | self->cfdesc = cfdesc; 8 | self->config.configFile = NULL; 9 | self->dummy_value = g_hash_table_new_full(g_str_hash, g_str_equal, (GDestroyNotify) g_free, (GDestroyNotify) free); 10 | /* malloc necessary value */ 11 | HASH_FOREACH(cgdesc, self->cfdesc->groupsDesc, FcitxConfigGroupDesc) { 12 | HASH_FOREACH(codesc, cgdesc->optionsDesc, FcitxConfigOptionDesc) { 13 | gchar* name = g_strdup_printf("%s/%s", cgdesc->groupName, codesc->optionName); 14 | void* value = g_hash_table_lookup(self->dummy_value, name); 15 | if (value) { 16 | g_free(name); 17 | continue; 18 | } 19 | switch (codesc->type) 20 | { 21 | #define OPTION_TYPE_CASE(NAME, TYPE) \ 22 | case T_##NAME: \ 23 | value = fcitx_utils_new(TYPE); \ 24 | break; 25 | OPTION_TYPE_CASE(Integer, int); 26 | OPTION_TYPE_CASE(Boolean, boolean); 27 | OPTION_TYPE_CASE(Char, char); 28 | OPTION_TYPE_CASE(Color, FcitxConfigColor); 29 | OPTION_TYPE_CASE(Enum, int); 30 | OPTION_TYPE_CASE(File, char*); 31 | OPTION_TYPE_CASE(Font, char*); 32 | OPTION_TYPE_CASE(Hotkey, FcitxHotkeys); 33 | OPTION_TYPE_CASE(String, char*); 34 | OPTION_TYPE_CASE(I18NString, char*); 35 | default: 36 | break; 37 | } 38 | if (value) 39 | g_hash_table_insert(self->dummy_value, name, value); 40 | else 41 | g_free(name); 42 | } 43 | } 44 | return self; 45 | } 46 | 47 | 48 | void dummy_config_free(DummyConfig* self) 49 | { 50 | FcitxConfigFree(&self->config); 51 | g_hash_table_destroy(self->dummy_value); 52 | g_free(self); 53 | } 54 | 55 | void dummy_config_load(DummyConfig* self, FILE* fp) 56 | { 57 | if (!self->config.configFile) { 58 | self->config.configFile = FcitxConfigParseConfigFileFp(fp, self->cfdesc); 59 | 60 | HASH_FOREACH(cgdesc, self->cfdesc->groupsDesc, FcitxConfigGroupDesc) { 61 | HASH_FOREACH(codesc, cgdesc->optionsDesc, FcitxConfigOptionDesc) { 62 | gchar* name = g_strdup_printf("%s/%s", cgdesc->groupName, codesc->optionName); 63 | void* value = g_hash_table_lookup(self->dummy_value, name); 64 | g_free(name); 65 | if (!value) 66 | continue; 67 | // assert(self->dummyValue[name]); 68 | FcitxConfigBindValue(self->config.configFile, cgdesc->groupName, codesc->optionName, value, NULL, NULL); 69 | } 70 | } 71 | } 72 | else { 73 | self->config.configFile = FcitxConfigParseIniFp(fp, self->config.configFile); 74 | } 75 | 76 | } 77 | 78 | void dummy_config_sync(DummyConfig* self) 79 | { 80 | FcitxConfigBindSync(&self->config); 81 | } 82 | 83 | gboolean dummy_config_valid(DummyConfig* self) 84 | { 85 | return self->config.configFile != NULL; 86 | } 87 | 88 | void dummy_config_bind(DummyConfig* self, char* group, char* option, FcitxSyncFilter filter, void* arg) 89 | { 90 | if (!self->config.configFile) 91 | return; 92 | gchar* name = g_strdup_printf("%s/%s", group, option); 93 | void* value = g_hash_table_lookup(self->dummy_value, name); 94 | g_free(name); 95 | if (!value) 96 | return; 97 | 98 | // assert(self->dummyValue[name]); 99 | FcitxConfigBindValue(self->config.configFile, group, option, value, filter, arg); 100 | 101 | } -------------------------------------------------------------------------------- /gtk3/dummy_config.h: -------------------------------------------------------------------------------- 1 | #ifndef DUMMY_CONFIG_H 2 | #define DUMMY_CONFIG_H 3 | 4 | #include 5 | #include 6 | 7 | typedef struct _DummyConfig { 8 | GHashTable* dummy_value; 9 | FcitxGenericConfig config; 10 | FcitxConfigFile* cfile; 11 | FcitxConfigFileDesc* cfdesc; 12 | } DummyConfig; 13 | 14 | DummyConfig* dummy_config_new(FcitxConfigFileDesc* cfdesc); 15 | void dummy_config_free(DummyConfig* self); 16 | void dummy_config_load(DummyConfig* self, FILE* fp); 17 | void dummy_config_bind(DummyConfig* self, char* group, char* option, FcitxSyncFilter filter, void* arg); 18 | gboolean dummy_config_valid(DummyConfig* self); 19 | void dummy_config_sync(DummyConfig* self); 20 | 21 | 22 | #endif // DUMMY_CONFIG_H -------------------------------------------------------------------------------- /gtk3/fcitx-config-gtk3.gresource.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | im_widget.ui 5 | im_dialog.ui 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /gtk3/gdm-languages.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- 2 | * 3 | * Copyright 2008 Red Hat, Inc. 4 | * Copyright 2007 William Jon McCann 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. 19 | * 20 | * Written by: Ray Strode 21 | * William Jon McCann 22 | */ 23 | 24 | #ifndef __GDM_LANGUAGES_H 25 | #define __GDM_LANGUAGES_H 26 | 27 | G_BEGIN_DECLS 28 | 29 | char * gdm_get_language_from_name(const char *name, 30 | const char *locale); 31 | char ** gdm_get_all_language_names(void); 32 | void gdm_parse_language_name(const char *name, 33 | char **language_codep, 34 | char **territory_codep, 35 | char **codesetp, 36 | char **modifierp); 37 | char * gdm_normalize_language_name(const char *name); 38 | 39 | G_END_DECLS 40 | 41 | #endif /* __GDM_LANGUAGE_CHOOSER_WIDGET_H */ 42 | -------------------------------------------------------------------------------- /gtk3/im_config_dialog.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright (C) 2010~2012 by CSSlayer * 3 | * * 4 | * This program is free software; you can redistribute it and/or modify * 5 | * it under the terms of the GNU General Public License as published by * 6 | * the Free Software Foundation; either version 2 of the License, or * 7 | * (at your option) any later version. * 8 | * * 9 | * This program is distributed in the hope that it will be useful, * 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 12 | * GNU General Public License for more details. * 13 | * * 14 | * You should have received a copy of the GNU General Public License * 15 | * along with this program; if not, write to the * 16 | * Free Software Foundation, Inc., * 17 | * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * 18 | ***************************************************************************/ 19 | 20 | #ifndef IM_CONFIG_DIALOG_H 21 | #define IM_CONFIG_DIALOG_H 22 | 23 | #include 24 | #include 25 | #include 26 | #include "config_widget.h" 27 | 28 | G_BEGIN_DECLS 29 | 30 | #define FCITX_TYPE_IM_CONFIG_DIALOG fcitx_im_config_dialog_get_type() 31 | 32 | #define FCITX_IM_CONFIG_DIALOG(obj) \ 33 | (G_TYPE_CHECK_INSTANCE_CAST ((obj), FCITX_TYPE_IM_CONFIG_DIALOG, FcitxImConfigDialog)) 34 | 35 | #define FCITX_IM_CONFIG_DIALOG_CLASS(klass) \ 36 | (G_TYPE_CHECK_CLASS_CAST ((klass), FCITX_TYPE_IM_CONFIG_DIALOG, FcitxImConfigDialogClass)) 37 | 38 | #define FCITX_IS_IM_CONFIG_DIALOG(obj) \ 39 | (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FCITX_TYPE_IM_CONFIG_DIALOG)) 40 | 41 | #define FCITX_IS_IM_CONFIG_DIALOG_CLASS(klass) \ 42 | (G_TYPE_CHECK_CLASS_TYPE ((klass), FCITX_TYPE_IM_CONFIG_DIALOG)) 43 | 44 | #define FCITX_IM_CONFIG_DIALOG_GET_CLASS(obj) \ 45 | (G_TYPE_INSTANCE_GET_CLASS ((obj), FCITX_TYPE_IM_CONFIG_DIALOG, FcitxImConfigDialogClass)) 46 | 47 | typedef struct _FcitxImConfigDialog FcitxImConfigDialog; 48 | typedef struct _FcitxImConfigDialogClass FcitxImConfigDialogClass; 49 | 50 | struct _FcitxImConfigDialog { 51 | GtkDialog parent; 52 | FcitxConfigWidget* config_widget; 53 | FcitxKbd* kbd; 54 | GtkListStore* model; 55 | gchar* imname; 56 | GtkWidget* combobox; 57 | }; 58 | 59 | struct _FcitxImConfigDialogClass { 60 | GtkDialogClass parent_class; 61 | }; 62 | 63 | GtkWidget* 64 | fcitx_im_config_dialog_new(GtkWindow* parent, FcitxAddon* addon, gchar* imname); 65 | 66 | G_END_DECLS 67 | 68 | 69 | #endif -------------------------------------------------------------------------------- /gtk3/im_dialog.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright (C) 2010~2012 by CSSlayer * 3 | * * 4 | * This program is free software; you can redistribute it and/or modify * 5 | * it under the terms of the GNU General Public License as published by * 6 | * the Free Software Foundation; either version 2 of the License, or * 7 | * (at your option) any later version. * 8 | * * 9 | * This program is distributed in the hope that it will be useful, * 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 12 | * GNU General Public License for more details. * 13 | * * 14 | * You should have received a copy of the GNU General Public License * 15 | * along with this program; if not, write to the * 16 | * Free Software Foundation, Inc., * 17 | * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * 18 | ***************************************************************************/ 19 | 20 | #ifndef IM_DIALOG_H 21 | #define IM_DIALOG_H 22 | 23 | #include 24 | #include 25 | #include 26 | 27 | G_BEGIN_DECLS 28 | 29 | #define FCITX_TYPE_IM_DIALOG fcitx_im_dialog_get_type() 30 | 31 | #define FCITX_IM_DIALOG(obj) \ 32 | (G_TYPE_CHECK_INSTANCE_CAST ((obj), FCITX_TYPE_IM_DIALOG, FcitxImDialog)) 33 | 34 | #define FCITX_IM_DIALOG_CLASS(klass) \ 35 | (G_TYPE_CHECK_CLASS_CAST ((klass), FCITX_TYPE_IM_DIALOG, FcitxImDialogClass)) 36 | 37 | #define FCITX_IS_IM_DIALOG(obj) \ 38 | (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FCITX_TYPE_IM_DIALOG)) 39 | 40 | #define FCITX_IS_IM_DIALOG_CLASS(klass) \ 41 | (G_TYPE_CHECK_CLASS_TYPE ((klass), FCITX_TYPE_IM_DIALOG)) 42 | 43 | #define FCITX_IM_DIALOG_GET_CLASS(obj) \ 44 | (G_TYPE_INSTANCE_GET_CLASS ((obj), FCITX_TYPE_IM_DIALOG, FcitxImDialogClass)) 45 | 46 | typedef struct _FcitxImDialog FcitxImDialog; 47 | typedef struct _FcitxImDialogClass FcitxImDialogClass; 48 | 49 | struct _FcitxImDialog { 50 | GtkDialog parent; 51 | FcitxInputMethod* improxy; 52 | GPtrArray* array; 53 | GtkListStore* availimstore; 54 | GtkWidget* availimview; 55 | GtkWidget* filterentry; 56 | GtkTreeModel* filtermodel; 57 | GtkWidget* onlycurlangcheckbox; 58 | GtkTreeModel* sortmodel; 59 | GtkBuilder* builder; 60 | GHashTable* langset; 61 | gchar* language; 62 | }; 63 | 64 | struct _FcitxImDialogClass { 65 | GtkDialogClass parent_class; 66 | }; 67 | 68 | GtkWidget* 69 | fcitx_im_dialog_new(GtkWindow* parent); 70 | 71 | G_END_DECLS 72 | 73 | 74 | #endif 75 | -------------------------------------------------------------------------------- /gtk3/im_dialog.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | availimstore 16 | 17 | 18 | True 19 | False 20 | 5 21 | 5 22 | 5 23 | 5 24 | True 25 | True 26 | vertical 27 | 28 | 29 | True 30 | True 31 | 5 32 | 5 33 | never 34 | in 35 | 36 | 37 | True 38 | True 39 | sortmodel 40 | False 41 | 42 | 43 | 44 | 45 | 46 | Input Method 47 | True 48 | 49 | 50 | 51 | 0 52 | 53 | 54 | 55 | 56 | 57 | 58 | Language 59 | 60 | 61 | 62 | 2 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | True 72 | True 73 | 0 74 | 75 | 76 | 77 | 78 | Only Show Current Language 79 | False 80 | True 81 | True 82 | False 83 | 5 84 | 5 85 | False 86 | 0 87 | True 88 | True 89 | 90 | 91 | False 92 | True 93 | 1 94 | 95 | 96 | 97 | 98 | True 99 | True 100 | 5 101 | 5 102 | 103 | gtk-clear 104 | 105 | 106 | False 107 | True 108 | 2 109 | 110 | 111 | 112 | 113 | filtermodel 114 | 115 | 116 | -------------------------------------------------------------------------------- /gtk3/im_widget.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright (C) 2010~2012 by CSSlayer * 3 | * * 4 | * This program is free software; you can redistribute it and/or modify * 5 | * it under the terms of the GNU General Public License as published by * 6 | * the Free Software Foundation; either version 2 of the License, or * 7 | * (at your option) any later version. * 8 | * * 9 | * This program is distributed in the hope that it will be useful, * 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 12 | * GNU General Public License for more details. * 13 | * * 14 | * You should have received a copy of the GNU General Public License * 15 | * along with this program; if not, write to the * 16 | * Free Software Foundation, Inc., * 17 | * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * 18 | ***************************************************************************/ 19 | 20 | #ifndef IM_WIDGET_H 21 | #define IM_WIDGET_H 22 | 23 | #include 24 | #include 25 | #include "fcitx-gclient/fcitxinputmethod.h" 26 | 27 | G_BEGIN_DECLS 28 | 29 | #define FCITX_TYPE_IM_WIDGET fcitx_im_widget_get_type() 30 | 31 | #define FCITX_IM_WIDGET(obj) \ 32 | (G_TYPE_CHECK_INSTANCE_CAST ((obj), FCITX_TYPE_IM_WIDGET, FcitxImWidget)) 33 | 34 | #define FCITX_IM_WIDGET_CLASS(klass) \ 35 | (G_TYPE_CHECK_CLASS_CAST ((klass), FCITX_TYPE_IM_WIDGET, FcitxImWidgetClass)) 36 | 37 | #define FCITX_IS_IM_WIDGET(obj) \ 38 | (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FCITX_TYPE_IM_WIDGET)) 39 | 40 | #define FCITX_IS_IM_WIDGET_CLASS(klass) \ 41 | (G_TYPE_CHECK_CLASS_TYPE ((klass), FCITX_TYPE_IM_WIDGET)) 42 | 43 | #define FCITX_IM_WIDGET_GET_CLASS(obj) \ 44 | (G_TYPE_INSTANCE_GET_CLASS ((obj), FCITX_TYPE_IM_WIDGET, FcitxImWidgetClass)) 45 | 46 | typedef struct _FcitxImWidget FcitxImWidget; 47 | typedef struct _FcitxImWidgetClass FcitxImWidgetClass; 48 | 49 | struct _FcitxImWidget { 50 | GtkBox parent; 51 | GtkListStore* imstore; 52 | GtkWidget* imview; 53 | FcitxInputMethod* improxy; 54 | GPtrArray* array; 55 | gchar* focus; 56 | GtkWidget* addimbutton; 57 | GtkWidget* delimbutton; 58 | GtkWidget* moveupbutton; 59 | GtkWidget* movedownbutton; 60 | GtkWidget* configurebutton; 61 | GtkWidget* default_layout_button; 62 | GtkWidget* scrolledwindow; 63 | GtkWidget* toolbar; 64 | GtkBuilder* builder; 65 | }; 66 | 67 | struct _FcitxImWidgetClass { 68 | GtkBoxClass parent_class; 69 | }; 70 | 71 | GtkWidget* 72 | fcitx_im_widget_new(void); 73 | 74 | G_END_DECLS 75 | 76 | 77 | #endif 78 | -------------------------------------------------------------------------------- /gtk3/im_widget.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | True 6 | False 7 | 5 8 | 5 9 | 5 10 | 5 11 | True 12 | True 13 | vertical 14 | 15 | 16 | True 17 | True 18 | True 19 | True 20 | never 21 | in 22 | 23 | 24 | True 25 | True 26 | imstore 27 | False 28 | 29 | 30 | browse 31 | 32 | 33 | 34 | 35 | Input Method 36 | True 37 | 38 | 39 | 40 | 0 41 | 42 | 43 | 44 | 45 | 46 | 47 | Language 48 | 49 | 50 | 51 | 2 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | False 61 | True 62 | 0 63 | 64 | 65 | 66 | 67 | True 68 | False 69 | 70 | 71 | True 72 | False 73 | gtk-about 74 | 75 | 76 | 0 77 | 0 78 | 1 79 | 1 80 | 81 | 82 | 83 | 84 | True 85 | False 86 | True 87 | The first input method will be inactive state. Usually you need to put <b>Keyboard</b> or <b>Keyboard - <i>layout name</i></b> in the first place. 88 | True 89 | True 90 | 91 | 92 | 1 93 | 0 94 | 1 95 | 1 96 | 97 | 98 | 99 | 100 | False 101 | True 102 | 1 103 | 104 | 105 | 106 | 107 | True 108 | False 109 | icons 110 | 1 111 | 112 | 113 | False 114 | True 115 | False 116 | False 117 | True 118 | 119 | 120 | False 121 | True 122 | 123 | 124 | 125 | 126 | False 127 | True 128 | False 129 | False 130 | True 131 | 132 | 133 | False 134 | True 135 | 136 | 137 | 138 | 139 | False 140 | True 141 | False 142 | False 143 | True 144 | 145 | 146 | False 147 | True 148 | 149 | 150 | 151 | 152 | False 153 | True 154 | False 155 | False 156 | True 157 | 158 | 159 | False 160 | True 161 | 162 | 163 | 164 | 165 | False 166 | True 167 | False 168 | False 169 | False 170 | True 171 | 172 | 173 | False 174 | True 175 | 176 | 177 | 178 | 179 | False 180 | True 181 | False 182 | False 183 | True 184 | 185 | 186 | False 187 | True 188 | 189 | 190 | 191 | 192 | False 193 | True 194 | 2 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | -------------------------------------------------------------------------------- /gtk3/keygrab.c: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright (C) 2010~2012 by CSSlayer * 3 | * * 4 | * This program is free software; you can redistribute it and/or modify * 5 | * it under the terms of the GNU General Public License as published by * 6 | * the Free Software Foundation; either version 2 of the License, or * 7 | * (at your option) any later version. * 8 | * * 9 | * This program is distributed in the hope that it will be useful, * 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 12 | * GNU General Public License for more details. * 13 | * * 14 | * You should have received a copy of the GNU General Public License * 15 | * along with this program; if not, write to the * 16 | * Free Software Foundation, Inc., * 17 | * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * 18 | ***************************************************************************/ 19 | 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include "keygrab.h" 26 | #include 27 | 28 | #define _(s) gettext(s) 29 | 30 | enum { 31 | KEYGRAB_BUTTON_CHANGED, 32 | LAST_SIGNAL 33 | }; 34 | static gint keygrab_button_signals[LAST_SIGNAL] = { 0 }; 35 | static void keygrab_button_init(KeyGrabButton* self); 36 | static void keygrab_button_class_init(KeyGrabButtonClass *keygrabbuttonclass); 37 | static void begin_key_grab(KeyGrabButton* self, gpointer v); 38 | static void end_key_grab(KeyGrabButton *self); 39 | static GtkWidget* popup_new(GtkWidget* parent, const gchar* text, gboolean mouse); 40 | static void on_key_release_event(GtkWidget *self, GdkEventKey *event, gpointer v); 41 | 42 | G_DEFINE_TYPE(KeyGrabButton, keygrab_button, GTK_TYPE_BUTTON) 43 | 44 | static void keygrab_button_init(KeyGrabButton *self) 45 | { 46 | self->allow_modifier_only = FALSE; 47 | self->disallow_modifier_less = FALSE; 48 | } 49 | 50 | static void keygrab_button_class_init(KeyGrabButtonClass *keygrabbuttonclass) 51 | { 52 | GObjectClass *object_class; 53 | object_class = (GObjectClass*)keygrabbuttonclass; 54 | keygrab_button_signals[KEYGRAB_BUTTON_CHANGED] = g_signal_new("changed", 55 | G_TYPE_FROM_CLASS(object_class), 56 | G_SIGNAL_RUN_FIRST, 57 | 0, 58 | NULL, NULL, 59 | g_cclosure_marshal_VOID__VOID, 60 | G_TYPE_NONE, 0, NULL); 61 | } 62 | //创建新的自定义控件 63 | GtkWidget* keygrab_button_new(void) 64 | { 65 | KeyGrabButton *self = KEYGRAB_BUTTON(g_object_new(TYPE_KEYGRAB_BUTTON, 66 | "label", _("Empty"), 67 | NULL)); 68 | self->key = 0; 69 | self->mods = 0; 70 | gtk_widget_set_size_request(GTK_WIDGET(self), 150, -1); 71 | 72 | g_signal_connect(G_OBJECT(self), "clicked", (GCallback) begin_key_grab, NULL); 73 | return GTK_WIDGET(self); 74 | } 75 | 76 | 77 | void begin_key_grab(KeyGrabButton* self, gpointer v) 78 | { 79 | KeyGrabButton* b = KEYGRAB_BUTTON(self); 80 | b->popup = popup_new(GTK_WIDGET(self), _("Please press the new key combination"), FALSE); 81 | gtk_widget_add_events(GTK_WIDGET(b->popup), GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK); 82 | gtk_widget_show_all(b->popup); 83 | gtk_window_present(GTK_WINDOW(b->popup)); 84 | b->handler = g_signal_connect(G_OBJECT(b->popup), "key-release-event", (GCallback)on_key_release_event, b); 85 | 86 | GdkWindow* window = gtk_widget_get_window(GTK_WIDGET(b->popup)); 87 | GdkDisplay* display = gdk_window_get_display (window); 88 | GdkSeat* seat = gdk_display_get_default_seat (display); 89 | while (gdk_seat_grab (seat, window, 90 | GDK_SEAT_CAPABILITY_ALL, FALSE, 91 | NULL, NULL, NULL, NULL) != GDK_GRAB_SUCCESS) 92 | usleep(100); 93 | } 94 | 95 | void end_key_grab(KeyGrabButton *self) 96 | { 97 | KeyGrabButton* b = KEYGRAB_BUTTON(self); 98 | GdkWindow* window = gtk_widget_get_window(GTK_WIDGET(b->popup)); 99 | GdkDisplay* display = gdk_window_get_display (window); 100 | GdkSeat* seat = gdk_display_get_default_seat (display); 101 | gdk_seat_ungrab(seat); 102 | g_signal_handler_disconnect(b->popup, b->handler); 103 | gtk_widget_destroy(b->popup); 104 | } 105 | 106 | void on_key_release_event(GtkWidget *self, GdkEventKey *event, gpointer v) 107 | { 108 | KeyGrabButton* b = KEYGRAB_BUTTON(v); 109 | guint key; 110 | GdkModifierType mods = event->state & gtk_accelerator_get_default_mod_mask(); 111 | 112 | if ((event->keyval == GDK_KEY_Escape 113 | || event->keyval == GDK_KEY_Return) && !mods) { 114 | end_key_grab(b); 115 | keygrab_button_set_key(b, 0, 0); 116 | return; 117 | } 118 | 119 | key = gdk_keyval_to_upper(event->keyval); 120 | if (key == GDK_KEY_ISO_Left_Tab) 121 | key = GDK_KEY_Tab; 122 | 123 | if (b->disallow_modifier_less && mods == 0) { 124 | return; 125 | } 126 | 127 | if (!b->allow_modifier_only && 128 | (key == GDK_KEY_Shift_L 129 | || key == GDK_KEY_Shift_R 130 | || key == GDK_KEY_Control_L 131 | || key == GDK_KEY_Control_R 132 | || key == GDK_KEY_Alt_L 133 | || key == GDK_KEY_Alt_R 134 | || key == GDK_KEY_Super_L 135 | || key == GDK_KEY_Shift_R)) { 136 | return; 137 | } 138 | 139 | keygrab_button_set_key(b, key, mods); 140 | end_key_grab(b); 141 | } 142 | 143 | void keygrab_button_set_allow_modifier_only(KeyGrabButton* self, gboolean allow) 144 | { 145 | self->allow_modifier_only = allow; 146 | } 147 | 148 | void keygrab_button_set_disallow_modifier_less(KeyGrabButton* self, gboolean disallow) 149 | { 150 | self->disallow_modifier_less = disallow; 151 | } 152 | 153 | void keygrab_button_set_key(KeyGrabButton* self, guint key, GdkModifierType mods) 154 | { 155 | if (mods & GDK_SUPER_MASK) { 156 | mods &= ~GDK_SUPER_MASK; 157 | mods |= FcitxKeyState_Super; 158 | } 159 | gchar *label; 160 | if (self->key != key || self->mods != mods) { 161 | self->key = key; 162 | self->mods = mods; 163 | g_signal_emit(G_OBJECT(self), keygrab_button_signals[KEYGRAB_BUTTON_CHANGED], 0); 164 | } 165 | else { 166 | return; 167 | } 168 | 169 | label = FcitxHotkeyGetReadableKeyString(key, mods); 170 | 171 | if (label == NULL || strlen(label) == 0) { 172 | gtk_button_set_label(GTK_BUTTON(self), _("Empty")); 173 | } else { 174 | gtk_button_set_label(GTK_BUTTON(self), label); 175 | } 176 | 177 | if (label) 178 | free(label); 179 | } 180 | 181 | void keygrab_button_get_key(KeyGrabButton* self, guint* key, GdkModifierType* mods) 182 | { 183 | if (key) 184 | *key = self->key; 185 | if (mods) 186 | *mods = self->mods; 187 | } 188 | 189 | GtkWidget* popup_new(GtkWidget* parent, const gchar* text, gboolean mouse) 190 | { 191 | GtkWidget* w = gtk_window_new(GTK_WINDOW_TOPLEVEL); 192 | gtk_window_set_type_hint(GTK_WINDOW(w), GDK_WINDOW_TYPE_HINT_UTILITY); 193 | gtk_window_set_position(GTK_WINDOW(w), mouse ? GTK_WIN_POS_MOUSE : GTK_WIN_POS_CENTER_ALWAYS); 194 | if (parent) 195 | gtk_window_set_transient_for(GTK_WINDOW(w), GTK_WINDOW(gtk_widget_get_toplevel(parent))); 196 | gtk_window_set_modal(GTK_WINDOW(w), TRUE); 197 | gtk_window_set_decorated(GTK_WINDOW(w), TRUE); 198 | if (text) { 199 | GtkWidget* label = gtk_label_new(text); 200 | gtk_container_add(GTK_CONTAINER(w), label); 201 | } 202 | 203 | return w; 204 | } 205 | -------------------------------------------------------------------------------- /gtk3/keygrab.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright (C) 2010~2012 by CSSlayer * 3 | * * 4 | * This program is free software; you can redistribute it and/or modify * 5 | * it under the terms of the GNU General Public License as published by * 6 | * the Free Software Foundation; either version 2 of the License, or * 7 | * (at your option) any later version. * 8 | * * 9 | * This program is distributed in the hope that it will be useful, * 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 12 | * GNU General Public License for more details. * 13 | * * 14 | * You should have received a copy of the GNU General Public License * 15 | * along with this program; if not, write to the * 16 | * Free Software Foundation, Inc., * 17 | * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * 18 | ***************************************************************************/ 19 | 20 | #ifndef KEYGRAB_H 21 | #define KEYGRAB_H 22 | 23 | #include 24 | 25 | #define TYPE_KEYGRAB_BUTTON (keygrab_button_get_type()) 26 | #define KEYGRAB_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_CAST(obj,TYPE_KEYGRAB_BUTTON,KeyGrabButton)) 27 | 28 | typedef struct _KeyGrabButton KeyGrabButton; 29 | typedef struct _KeyGrabButtonClass KeyGrabButtonClass; 30 | struct _KeyGrabButton { 31 | GtkButton parent; 32 | GtkWidget* popup; 33 | gulong handler; 34 | guint key; 35 | GdkModifierType mods; 36 | gboolean disallow_modifier_less; 37 | gboolean allow_modifier_only; 38 | }; 39 | struct _KeyGrabButtonClass { 40 | GtkButtonClass parent_class; 41 | }; 42 | 43 | GType keygrab_button_get_type(void); 44 | GtkWidget* keygrab_button_new(void); 45 | void keygrab_button_set_allow_modifier_only(KeyGrabButton* self, gboolean allow); 46 | void keygrab_button_set_disallow_modifier_less(KeyGrabButton* self, gboolean disallow); 47 | gchar *accelerator_to_fcitx_hotkey(const gchar* str); 48 | void keygrab_button_set_key(KeyGrabButton* self, guint key, GdkModifierType mods); 49 | void keygrab_button_get_key(KeyGrabButton* self, guint* key, GdkModifierType* mods); 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /gtk3/locarchive.h: -------------------------------------------------------------------------------- 1 | /* Definitions for locale archive handling. 2 | Copyright (C) 2002 Free Software Foundation, Inc. 3 | This file is part of the GNU C Library. 4 | 5 | The GNU C Library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | The GNU C Library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with the GNU C Library; if not, write to the Free 17 | Software Foundation, Inc., 18 | 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | 21 | #ifndef _LOCARCHIVE_H 22 | #define _LOCARCHIVE_H 1 23 | 24 | #include 25 | 26 | #define AR_MAGIC 0xde020109 27 | 28 | struct locarhead { 29 | uint32_t magic; 30 | /* Serial number. */ 31 | uint32_t serial; 32 | /* Name hash table. */ 33 | uint32_t namehash_offset; 34 | uint32_t namehash_used; 35 | uint32_t namehash_size; 36 | /* String table. */ 37 | uint32_t string_offset; 38 | uint32_t string_used; 39 | uint32_t string_size; 40 | /* Table with locale records. */ 41 | uint32_t locrectab_offset; 42 | uint32_t locrectab_used; 43 | uint32_t locrectab_size; 44 | /* MD5 sum hash table. */ 45 | uint32_t sumhash_offset; 46 | uint32_t sumhash_used; 47 | uint32_t sumhash_size; 48 | }; 49 | 50 | 51 | struct namehashent { 52 | /* Hash value of the name. */ 53 | uint32_t hashval; 54 | /* Offset of the name in the string table. */ 55 | uint32_t name_offset; 56 | /* Offset of the locale record. */ 57 | uint32_t locrec_offset; 58 | }; 59 | 60 | 61 | struct sumhashent { 62 | /* MD5 sum. */ 63 | char sum[16]; 64 | /* Offset of the file in the archive. */ 65 | uint32_t file_offset; 66 | }; 67 | 68 | struct locrecent { 69 | uint32_t refs; /* # of namehashent records that point here */ 70 | struct { 71 | uint32_t offset; 72 | uint32_t len; 73 | } record[__LC_LAST]; 74 | }; 75 | 76 | 77 | struct locarhandle { 78 | int fd; 79 | void *addr; 80 | size_t len; 81 | }; 82 | 83 | 84 | /* In memory data for the locales with their checksums. */ 85 | typedef struct locale_category_data { 86 | off_t size; 87 | void *addr; 88 | char sum[16]; 89 | } locale_data_t[__LC_LAST]; 90 | 91 | #endif /* locarchive.h */ 92 | -------------------------------------------------------------------------------- /gtk3/main.c: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright (C) 2010~2012 by CSSlayer * 3 | * * 4 | * This program is free software; you can redistribute it and/or modify * 5 | * it under the terms of the GNU General Public License as published by * 6 | * the Free Software Foundation; either version 2 of the License, or * 7 | * (at your option) any later version. * 8 | * * 9 | * This program is distributed in the hope that it will be useful, * 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 12 | * GNU General Public License for more details. * 13 | * * 14 | * You should have received a copy of the GNU General Public License * 15 | * along with this program; if not, write to the * 16 | * Free Software Foundation, Inc., * 17 | * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * 18 | ***************************************************************************/ 19 | 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include "config.h" 25 | #include "main_window.h" 26 | #include "config_widget.h" 27 | #include "fcitx-config-gtk3-resources.h" 28 | 29 | static void 30 | fcitx_config_app_activate (GApplication *application) 31 | { 32 | GList* list = gtk_application_get_windows (GTK_APPLICATION(application)); 33 | if (list) 34 | { 35 | gtk_window_present (GTK_WINDOW (list->data)); 36 | } 37 | else { 38 | GtkWidget *window; 39 | window = fcitx_main_window_new(); 40 | gtk_application_add_window(GTK_APPLICATION(application), GTK_WINDOW(window)); 41 | gtk_widget_show_all (GTK_WIDGET (window)); 42 | } 43 | } 44 | 45 | typedef GtkApplication FcitxConfigApp; 46 | typedef GtkApplicationClass FcitxConfigAppClass; 47 | 48 | G_DEFINE_TYPE (FcitxConfigApp, fcitx_config_app, GTK_TYPE_APPLICATION) 49 | 50 | static void 51 | fcitx_config_app_finalize (GObject *object) 52 | { 53 | G_OBJECT_CLASS (fcitx_config_app_parent_class)->finalize (object); 54 | } 55 | 56 | static void 57 | fcitx_config_app_init (FcitxConfigApp *app) 58 | { 59 | fcitx_config_gtk3_register_resource(); 60 | g_resources_register (fcitx_config_gtk3_get_resource ()); 61 | } 62 | 63 | 64 | int fcitx_config_app_handle_command_line (GApplication *application, 65 | GApplicationCommandLine *command_line, 66 | gpointer user_data 67 | ) 68 | { 69 | int argc; 70 | gchar** argv = g_application_command_line_get_arguments(command_line, &argc); 71 | g_application_activate(G_APPLICATION (application)); 72 | GList* list = gtk_application_get_windows (GTK_APPLICATION(application)); 73 | if (list) { 74 | FcitxMainWindow* mainWindow = FCITX_MAIN_WINDOW (list->data); 75 | FcitxAddon* addon = NULL; 76 | if (argc >= 2 && argv[1]) 77 | addon = find_addon_by_name(mainWindow->addons, argv[1]); 78 | if (addon) { 79 | GtkWidget* dialog = fcitx_config_dialog_new(addon, GTK_WINDOW(mainWindow)); 80 | if (dialog) 81 | gtk_widget_show_all(GTK_WIDGET(dialog)); 82 | } 83 | } 84 | 85 | g_strfreev(argv); 86 | return 0; 87 | } 88 | 89 | static void 90 | fcitx_config_app_class_init (FcitxConfigAppClass *klass) 91 | { 92 | G_OBJECT_CLASS (klass)->finalize= fcitx_config_app_finalize; 93 | 94 | G_APPLICATION_CLASS (klass)->activate = fcitx_config_app_activate; 95 | } 96 | 97 | FcitxConfigApp * 98 | fcitx_config_app_new (void) 99 | { 100 | #if !GLIB_CHECK_VERSION(2, 35, 1) 101 | g_type_init(); 102 | #endif 103 | 104 | FcitxConfigApp* app = g_object_new (fcitx_config_app_get_type (), 105 | "application-id", "org.fcitx.FcitxConfigGtk3", 106 | "flags", G_APPLICATION_HANDLES_COMMAND_LINE, 107 | NULL); 108 | g_signal_connect(app, "command-line", (GCallback)fcitx_config_app_handle_command_line, NULL); 109 | return app; 110 | } 111 | 112 | int 113 | main(int argc, char **argv) 114 | { 115 | setlocale(LC_ALL, ""); 116 | bindtextdomain("fcitx-configtool", LOCALEDIR); 117 | bind_textdomain_codeset("fcitx-configtool", "UTF-8"); 118 | bindtextdomain("fcitx", LOCALEDIR); 119 | bind_textdomain_codeset("fcitx", "UTF-8"); 120 | textdomain("fcitx-configtool"); 121 | FcitxLogSetLevel(FCITX_NONE); 122 | 123 | GtkApplication* app = fcitx_config_app_new(); 124 | 125 | int status = 0; 126 | if (app) { 127 | GError* error = NULL; 128 | if (!g_application_register(G_APPLICATION(app), NULL, &error)) { 129 | g_warning("Cannot register %s", error->message); 130 | g_error_free(error); 131 | error = NULL; 132 | } 133 | if (g_application_get_is_registered(G_APPLICATION(app))) { 134 | if (g_application_get_is_remote(G_APPLICATION(app))) { 135 | g_message("fcitx-config-gtk3 is running."); 136 | } 137 | } 138 | } 139 | status = g_application_run (G_APPLICATION (app), argc, argv); 140 | 141 | g_object_unref (app); 142 | 143 | return status; 144 | } 145 | 146 | 147 | -------------------------------------------------------------------------------- /gtk3/main_window.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright (C) 2010~2012 by CSSlayer * 3 | * * 4 | * This program is free software; you can redistribute it and/or modify * 5 | * it under the terms of the GNU General Public License as published by * 6 | * the Free Software Foundation; either version 2 of the License, or * 7 | * (at your option) any later version. * 8 | * * 9 | * This program is distributed in the hope that it will be useful, * 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 12 | * GNU General Public License for more details. * 13 | * * 14 | * You should have received a copy of the GNU General Public License * 15 | * along with this program; if not, write to the * 16 | * Free Software Foundation, Inc., * 17 | * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * 18 | ***************************************************************************/ 19 | 20 | #ifndef MAIN_WINDOW_H 21 | 22 | #define MAIN_WINDOW_H 23 | 24 | #include 25 | #include 26 | 27 | #include "common.h" 28 | 29 | G_BEGIN_DECLS 30 | 31 | #define FCITX_TYPE_MAIN_WINDOW fcitx_main_window_get_type() 32 | 33 | #define FCITX_MAIN_WINDOW(obj) \ 34 | (G_TYPE_CHECK_INSTANCE_CAST ((obj), FCITX_TYPE_MAIN_WINDOW, FcitxMainWindow)) 35 | 36 | #define FCITX_MAIN_WINDOW_CLASS(klass) \ 37 | (G_TYPE_CHECK_CLASS_CAST ((klass), FCITX_TYPE_MAIN_WINDOW, FcitxMainWindowClass)) 38 | 39 | #define FCITX_IS_MAIN_WINDOW(obj) \ 40 | (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FCITX_TYPE_MAIN_WINDOW)) 41 | 42 | #define FCITX_IS_MAIN_WINDOW_CLASS(klass) \ 43 | (G_TYPE_CHECK_CLASS_TYPE ((klass), FCITX_TYPE_MAIN_WINDOW)) 44 | 45 | #define FCITX_MAIN_WINDOW_GET_CLASS(obj) \ 46 | (G_TYPE_INSTANCE_GET_CLASS ((obj), FCITX_TYPE_MAIN_WINDOW, FcitxMainWindowClass)) 47 | 48 | typedef struct { 49 | GtkWidget* page; 50 | GtkTreeIter iter; 51 | } ConfigPage; 52 | 53 | typedef struct { 54 | GtkWindow parent; 55 | GtkWidget* vbox; 56 | GtkWidget* pagelabel; 57 | GtkWidget* button; 58 | GtkWidget* addonview; 59 | UT_array* addons; 60 | GtkWidget* advancecheckbox; 61 | GtkTreeModel* filtermodel; 62 | GtkListStore* addonstore; 63 | GtkTreeViewColumn* checkboxcolumn; 64 | GtkCellRenderer* togglecell; 65 | GtkWidget* filterentry; 66 | GtkWidget* configNotebook; 67 | } FcitxMainWindow; 68 | 69 | typedef struct { 70 | GtkWindowClass parent_class; 71 | } FcitxMainWindowClass; 72 | 73 | GType fcitx_main_window_get_type(void); 74 | 75 | GtkWidget* fcitx_main_window_new(void); 76 | 77 | #endif 78 | -------------------------------------------------------------------------------- /gtk3/sub_config_parser.c: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright (C) 2010~2012 by CSSlayer * 3 | * * 4 | * This program is free software; you can redistribute it and/or modify * 5 | * it under the terms of the GNU General Public License as published by * 6 | * the Free Software Foundation; either version 2 of the License, or * 7 | * (at your option) any later version. * 8 | * * 9 | * This program is distributed in the hope that it will be useful, * 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 12 | * GNU General Public License for more details. * 13 | * * 14 | * You should have received a copy of the GNU General Public License * 15 | * along with this program; if not, write to the * 16 | * Free Software Foundation, Inc., * 17 | * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * 18 | ***************************************************************************/ 19 | 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | 27 | #include 28 | #include 29 | 30 | #include "config.h" 31 | 32 | #include "sub_config_parser.h" 33 | 34 | static void sub_config_pattern_free(void* pattern); 35 | static GHashTable* sub_config_pattern_get_filelist(FcitxSubConfigPattern* pattern); 36 | static GList* get_files_by_pattern(const gchar* dirpath, FcitxSubConfigPattern* pattern, int index); 37 | static void sub_file_list_free(gpointer data, gpointer user_data); 38 | 39 | static SubConfigType parse_type(const gchar* str); 40 | 41 | static SubConfigType parse_type(const gchar* str) 42 | { 43 | if (strcmp(str, "native") == 0) { 44 | return SC_NativeFile; 45 | } 46 | if (strcmp(str, "configfile") == 0) { 47 | return SC_ConfigFile; 48 | } 49 | if (strcmp(str, "program") == 0) { 50 | return SC_Program; 51 | } 52 | if (strcmp(str, "plugin") == 0) { 53 | return SC_Plugin; 54 | } 55 | return SC_None; 56 | } 57 | 58 | FcitxSubConfigParser* sub_config_parser_new(const gchar* subconfig) 59 | { 60 | if (subconfig == NULL) 61 | return NULL; 62 | 63 | FcitxSubConfigParser* parser = g_malloc0(sizeof(FcitxSubConfigParser)); 64 | parser->subconfigs = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, sub_config_pattern_free); 65 | gchar** strv = g_strsplit(subconfig, ",", 0); 66 | 67 | gchar** str; 68 | for (str = &strv[0]; *str != NULL; str++) { 69 | if (strchr(*str, ':') == NULL) 70 | continue; 71 | 72 | gchar** items = g_strsplit(*str, ":", 0); 73 | 74 | if (g_strv_length(items) < 2) 75 | goto end; 76 | if (strlen(items[0]) == 0) 77 | goto end; 78 | 79 | if (strcmp(items[1], "domain") == 0) { 80 | parser->domain = g_strdup(items[0]); 81 | goto end; 82 | } 83 | 84 | SubConfigType type = parse_type(items[1]); 85 | if (type == SC_None) 86 | goto end; 87 | if (g_hash_table_lookup(parser->subconfigs, items[0]) != NULL) 88 | continue; 89 | 90 | if (type == SC_ConfigFile) { 91 | if (g_strv_length(items) != 4) 92 | goto end; 93 | if (strlen(items[2]) == 0 || items[2][0] == '/') 94 | goto end; 95 | } else if (type == SC_NativeFile) { 96 | if (g_strv_length(items) < 3) 97 | goto end; 98 | if (strchr(items[2], '*') != NULL) 99 | goto end; 100 | } else if (type == SC_Program || type == SC_Plugin) { 101 | if (g_strv_length(items) != 3) 102 | goto end; 103 | if (strchr(items[2], '*') != NULL) 104 | goto end; 105 | } 106 | 107 | gchar** paths = g_strsplit(items[2], "/", 0); 108 | if (paths[0] == 0) { 109 | g_strfreev(paths); 110 | goto end; 111 | } 112 | gchar** path; 113 | for (path = &paths[0]; *path != NULL; path++) { 114 | if (strlen(*path) == 0) 115 | break; 116 | if (strcmp(*path, ".") == 0) 117 | break; 118 | if (strcmp(*path, "..") == 0) 119 | break; 120 | } 121 | if (*path != NULL) { 122 | g_strfreev(paths); 123 | goto end; 124 | } 125 | FcitxSubConfigPattern* pattern = g_malloc0(sizeof(FcitxSubConfigPattern)); 126 | pattern->type = type; 127 | pattern->patternlist = paths; 128 | if (type == SC_ConfigFile) 129 | pattern->configdesc = g_strdup(items[3]); 130 | else if (type == SC_NativeFile || type == SC_Plugin) 131 | pattern->nativepath = g_strdup(items[2]); 132 | else if (type == SC_Program) 133 | pattern->path = g_strdup(items[2]); 134 | 135 | g_hash_table_insert(parser->subconfigs, g_strdup(items[0]), pattern); 136 | end: 137 | g_strfreev(items); 138 | } 139 | g_strfreev(strv); 140 | if (g_hash_table_size(parser->subconfigs) == 0 || parser->domain == NULL) { 141 | sub_config_parser_free(parser); 142 | parser = NULL; 143 | } 144 | 145 | return parser; 146 | } 147 | 148 | void sub_config_parser_free(FcitxSubConfigParser* parser) 149 | { 150 | if (parser == NULL) 151 | return; 152 | 153 | g_hash_table_destroy(parser->subconfigs); 154 | if (parser->domain) 155 | g_free(parser->domain); 156 | } 157 | 158 | void sub_config_pattern_free(void* data) 159 | { 160 | FcitxSubConfigPattern* pattern = data; 161 | if (pattern->patternlist) 162 | g_strfreev(pattern->patternlist); 163 | 164 | g_free(pattern->configdesc); 165 | 166 | g_free(pattern->nativepath); 167 | g_free(pattern->path); 168 | 169 | g_free(pattern); 170 | } 171 | 172 | FcitxSubConfig* sub_config_new(const gchar* name, FcitxSubConfigPattern* pattern) 173 | { 174 | if (pattern->type == SC_None) 175 | return NULL; 176 | 177 | FcitxSubConfig* subconfig = g_malloc0(sizeof(FcitxSubConfig)); 178 | subconfig->type = pattern->type; 179 | subconfig->configdesc = g_strdup(pattern->configdesc); 180 | subconfig->nativepath = g_strdup(pattern->nativepath); 181 | subconfig->path = g_strdup(pattern->path); 182 | subconfig->name = g_strdup(name); 183 | subconfig->filelist = sub_config_pattern_get_filelist(pattern); 184 | 185 | return subconfig; 186 | } 187 | 188 | void sub_file_list_free(gpointer data, gpointer user_data) 189 | { 190 | g_free(data); 191 | } 192 | 193 | void sub_config_free(FcitxSubConfig* subconfig) 194 | { 195 | if (!subconfig) 196 | return; 197 | 198 | g_free(subconfig->configdesc); 199 | g_free(subconfig->nativepath); 200 | g_free(subconfig->name); 201 | g_hash_table_unref(subconfig->filelist); 202 | g_free(subconfig); 203 | } 204 | 205 | GHashTable* sub_config_pattern_get_filelist(FcitxSubConfigPattern* pattern) 206 | { 207 | size_t size, i; 208 | GHashTable* result = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL); 209 | char** xdgpath = FcitxXDGGetPathWithPrefix(&size, ""); 210 | 211 | for (i = 0; i < size; i ++) { 212 | char* dirpath = realpath(xdgpath[i], NULL); 213 | 214 | if (!dirpath) 215 | continue; 216 | 217 | GList* list = get_files_by_pattern(dirpath, pattern, 0), *l; 218 | 219 | for (l = g_list_first(list); 220 | l != NULL; 221 | l = l->next) { 222 | if (strncmp(dirpath, (gchar*) l->data, strlen(dirpath)) == 0) { 223 | gchar* filename = (gchar*) l->data; 224 | gchar* name = filename + strlen(dirpath); 225 | while (name[0] == '/') 226 | name ++; 227 | if (!g_hash_table_lookup_extended(result, name, NULL, NULL)) { 228 | g_hash_table_insert(result, g_strdup(name), NULL); 229 | } 230 | } 231 | } 232 | g_list_foreach(list, sub_file_list_free, NULL); 233 | g_list_free(list); 234 | 235 | free(dirpath); 236 | } 237 | 238 | FcitxXDGFreePath(xdgpath); 239 | 240 | return result; 241 | } 242 | 243 | GList* get_files_by_pattern(const gchar* dirpath, FcitxSubConfigPattern* pattern, int index) 244 | { 245 | GList* result = NULL; 246 | 247 | DIR* dir = opendir(dirpath); 248 | if (!dir) 249 | return result; 250 | 251 | gchar* filter = pattern->patternlist[index]; 252 | 253 | struct dirent* drt; 254 | GPatternSpec * patternspec = g_pattern_spec_new(filter); 255 | while ((drt = readdir(dir)) != NULL) { 256 | if (strcmp(drt->d_name , ".") == 0 || strcmp(drt->d_name, "..") == 0) 257 | continue; 258 | 259 | if (!g_pattern_match_string(patternspec, drt->d_name)) 260 | continue; 261 | 262 | if (pattern->patternlist[index + 1] == 0) { 263 | char *path; 264 | asprintf(&path, "%s/%s", dirpath, drt->d_name); 265 | struct stat statbuf; 266 | if (stat(path, &statbuf) == 0) { 267 | result = g_list_append(result, realpath(path, NULL)); 268 | } 269 | free(path); 270 | } else { 271 | char *path; 272 | asprintf(&path, "%s/%s", dirpath, drt->d_name); 273 | GList* r = get_files_by_pattern(path, pattern, index + 1); 274 | result = g_list_concat(result, r); 275 | free(path); 276 | } 277 | } 278 | 279 | closedir(dir); 280 | g_pattern_spec_free(patternspec); 281 | return result; 282 | } 283 | -------------------------------------------------------------------------------- /gtk3/sub_config_parser.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright (C) 2010~2012 by CSSlayer * 3 | * * 4 | * This program is free software; you can redistribute it and/or modify * 5 | * it under the terms of the GNU General Public License as published by * 6 | * the Free Software Foundation; either version 2 of the License, or * 7 | * (at your option) any later version. * 8 | * * 9 | * This program is distributed in the hope that it will be useful, * 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 12 | * GNU General Public License for more details. * 13 | * * 14 | * You should have received a copy of the GNU General Public License * 15 | * along with this program; if not, write to the * 16 | * Free Software Foundation, Inc., * 17 | * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * 18 | ***************************************************************************/ 19 | 20 | #ifndef _SUB_CONFIG_PARSER_H 21 | #define _SUB_CONFIG_PARSER_H 22 | #include 23 | 24 | typedef enum { 25 | SC_None, 26 | SC_ConfigFile, 27 | SC_Program, 28 | SC_NativeFile, 29 | SC_Plugin 30 | } SubConfigType; 31 | 32 | typedef struct { 33 | SubConfigType type; 34 | gchar* configdesc; 35 | gchar* nativepath; 36 | gchar** patternlist; 37 | gchar* path; 38 | } FcitxSubConfigPattern; 39 | 40 | typedef struct { 41 | gchar* name; 42 | SubConfigType type; 43 | GHashTable* filelist; 44 | gchar* nativepath; 45 | gchar* configdesc; 46 | gchar* path; 47 | } FcitxSubConfig; 48 | 49 | typedef struct { 50 | GHashTable* subconfigs; 51 | gchar* domain; 52 | } FcitxSubConfigParser; 53 | 54 | FcitxSubConfigParser* sub_config_parser_new(const gchar* subconfig); 55 | void sub_config_parser_free(FcitxSubConfigParser* parser); 56 | FcitxSubConfig* sub_config_new(const gchar* name, FcitxSubConfigPattern* pattern); 57 | void sub_config_free(FcitxSubConfig* subconfig); 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /gtk3/sub_config_widget.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright (C) 2010~2012 by CSSlayer * 3 | * * 4 | * This program is free software; you can redistribute it and/or modify * 5 | * it under the terms of the GNU General Public License as published by * 6 | * the Free Software Foundation; either version 2 of the License, or * 7 | * (at your option) any later version. * 8 | * * 9 | * This program is distributed in the hope that it will be useful, * 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 12 | * GNU General Public License for more details. * 13 | * * 14 | * You should have received a copy of the GNU General Public License * 15 | * along with this program; if not, write to the * 16 | * Free Software Foundation, Inc., * 17 | * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * 18 | ***************************************************************************/ 19 | 20 | #ifndef _FCITX_SUB_CONFIG_WIDGET 21 | #define _FCITX_SUB_CONFIG_WIDGET 22 | 23 | #include 24 | #include "sub_config_parser.h" 25 | 26 | G_BEGIN_DECLS 27 | 28 | #define FCITX_TYPE_SUB_CONFIG_WIDGET fcitx_sub_config_widget_get_type() 29 | 30 | #define FCITX_SUB_CONFIG_WIDGET(obj) \ 31 | (G_TYPE_CHECK_INSTANCE_CAST ((obj), FCITX_TYPE_SUB_CONFIG_WIDGET, FcitxSubConfigWidget)) 32 | 33 | #define FCITX_SUB_CONFIG_WIDGET_CLASS(klass) \ 34 | (G_TYPE_CHECK_CLASS_CAST ((klass), FCITX_TYPE_SUB_CONFIG_WIDGET, FcitxSubConfigWidgetClass)) 35 | 36 | #define FCITX_IS_SUB_CONFIG_WIDGET(obj) \ 37 | (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FCITX_TYPE_SUB_CONFIG_WIDGET)) 38 | 39 | #define FCITX_IS_SUB_CONFIG_WIDGET_CLASS(klass) \ 40 | (G_TYPE_CHECK_CLASS_TYPE ((klass), FCITX_TYPE_SUB_CONFIG_WIDGET)) 41 | 42 | #define FCITX_SUB_CONFIG_WIDGET_GET_CLASS(obj) \ 43 | (G_TYPE_INSTANCE_GET_CLASS ((obj), FCITX_TYPE_SUB_CONFIG_WIDGET, FcitxSubConfigWidgetClass)) 44 | 45 | typedef struct { 46 | GtkBox parent; 47 | FcitxSubConfig* subconfig; 48 | GtkWidget* view; 49 | } FcitxSubConfigWidget; 50 | 51 | typedef struct { 52 | GtkBoxClass parent_class; 53 | } FcitxSubConfigWidgetClass; 54 | 55 | GType fcitx_sub_config_widget_get_type(void); 56 | 57 | FcitxSubConfigWidget* fcitx_sub_config_widget_new(FcitxSubConfig* subconfig); 58 | 59 | G_END_DECLS 60 | 61 | #endif /* _FCITX_SUB_CONFIG_WIDGET */ 62 | -------------------------------------------------------------------------------- /gtk3/ui_widget.c: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright (C) 2010~2012 by CSSlayer * 3 | * * 4 | * This program is free software; you can redistribute it and/or modify * 5 | * it under the terms of the GNU General Public License as published by * 6 | * the Free Software Foundation; either version 2 of the License, or * 7 | * (at your option) any later version. * 8 | * * 9 | * This program is distributed in the hope that it will be useful, * 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 12 | * GNU General Public License for more details. * 13 | * * 14 | * You should have received a copy of the GNU General Public License * 15 | * along with this program; if not, write to the * 16 | * Free Software Foundation, Inc., * 17 | * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * 18 | ***************************************************************************/ 19 | 20 | #include 21 | #include 22 | #include 23 | 24 | #include "common.h" 25 | #include "ui_widget.h" 26 | #include "gdm-languages.h" 27 | #include "config_widget.h" 28 | #include "main_window.h" 29 | #include "configdesc.h" 30 | 31 | G_DEFINE_TYPE(FcitxUIWidget, fcitx_ui_widget, GTK_TYPE_BOX) 32 | 33 | static void fcitx_ui_widget_dispose(GObject* object); 34 | static void _fcitx_ui_widget_load(FcitxUIWidget* self, const gchar* uiname); 35 | static void _fcitx_ui_widget_config_widget_changed(FcitxConfigWidget* widget, gpointer user_data); 36 | 37 | static void 38 | fcitx_ui_widget_class_init(FcitxUIWidgetClass *klass) 39 | { 40 | GObjectClass *gobject_class = G_OBJECT_CLASS(klass); 41 | gobject_class->dispose = fcitx_ui_widget_dispose; 42 | } 43 | 44 | static void 45 | fcitx_ui_widget_init(FcitxUIWidget* self) 46 | { 47 | gtk_orientable_set_orientation(GTK_ORIENTABLE(self), GTK_ORIENTATION_VERTICAL); 48 | self->label = gtk_label_new(_("Cannot load currently used user interface info")); 49 | gtk_box_pack_start(GTK_BOX(self), self->label, TRUE, TRUE, 0); 50 | } 51 | 52 | GtkWidget* 53 | fcitx_ui_widget_new(void) 54 | { 55 | FcitxUIWidget* widget = 56 | g_object_new(FCITX_TYPE_UI_WIDGET, 57 | NULL); 58 | 59 | return GTK_WIDGET(widget); 60 | } 61 | 62 | void fcitx_ui_widget_dispose(GObject* object) 63 | { 64 | FcitxUIWidget* self = FCITX_UI_WIDGET(object); 65 | if (self->improxy) { 66 | g_object_unref(self->improxy); 67 | self->improxy = NULL; 68 | } 69 | 70 | G_OBJECT_CLASS (fcitx_ui_widget_parent_class)->dispose (object); 71 | } 72 | 73 | void fcitx_ui_widget_connect(FcitxUIWidget* self) 74 | { 75 | GError* error = NULL; 76 | self->improxy = fcitx_input_method_new(G_BUS_TYPE_SESSION, 77 | G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES, 78 | fcitx_utils_get_display_number(), 79 | NULL, 80 | &error 81 | ); 82 | if (self->improxy == NULL) { 83 | g_error_free(error); 84 | return; 85 | } 86 | 87 | gchar* uiname = fcitx_input_method_get_current_ui(self->improxy); 88 | if (uiname) { 89 | _fcitx_ui_widget_load(self, uiname); 90 | g_free(uiname); 91 | } 92 | } 93 | 94 | void _fcitx_ui_widget_load(FcitxUIWidget* self, const gchar* uiname) 95 | { 96 | FcitxMainWindow* mainwindow = FCITX_MAIN_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET(self))); 97 | FcitxAddon* addon = find_addon_by_name(mainwindow->addons, uiname); 98 | if (!addon) 99 | return; 100 | 101 | gchar* config_desc_name = g_strdup_printf("%s.desc", addon->name); 102 | FcitxConfigFileDesc* cfdesc = get_config_desc(config_desc_name); 103 | g_free(config_desc_name); 104 | gboolean configurable = (gboolean)(cfdesc != NULL || strlen(addon->subconfig) != 0); 105 | if (!configurable) { 106 | gchar* text = g_strdup_printf(_("No configuration option for %s."), addon->generalname); 107 | gtk_label_set_text(GTK_LABEL(self->label), text); 108 | g_free(text); 109 | } 110 | else { 111 | gtk_container_remove(GTK_CONTAINER(self), self->label); 112 | self->label = NULL; 113 | gchar* config_file_name = g_strdup_printf("%s.config", addon->name); 114 | FcitxConfigWidget* config_widget = fcitx_config_widget_new(cfdesc, "conf", config_file_name, addon->subconfig); 115 | g_free(config_file_name); 116 | gtk_box_pack_start(GTK_BOX(self), GTK_WIDGET(config_widget), TRUE, TRUE, 0); 117 | g_object_set(G_OBJECT(config_widget), "margin", 5, NULL); 118 | 119 | GtkWidget* hbuttonbox = gtk_button_box_new(GTK_ORIENTATION_HORIZONTAL); 120 | gtk_box_pack_start(GTK_BOX(self), hbuttonbox, FALSE, TRUE, 0); 121 | g_object_set(G_OBJECT(hbuttonbox), "margin", 5, NULL); 122 | 123 | g_signal_connect(config_widget, "changed", (GCallback) _fcitx_ui_widget_config_widget_changed, NULL); 124 | gtk_widget_show_all(GTK_WIDGET(self)); 125 | } 126 | } 127 | 128 | void _fcitx_ui_widget_config_widget_changed(FcitxConfigWidget* widget, gpointer user_data) 129 | { 130 | fcitx_config_widget_response(widget, CONFIG_WIDGET_SAVE); 131 | } 132 | -------------------------------------------------------------------------------- /gtk3/ui_widget.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright (C) 2010~2012 by CSSlayer * 3 | * * 4 | * This program is free software; you can redistribute it and/or modify * 5 | * it under the terms of the GNU General Public License as published by * 6 | * the Free Software Foundation; either version 2 of the License, or * 7 | * (at your option) any later version. * 8 | * * 9 | * This program is distributed in the hope that it will be useful, * 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 12 | * GNU General Public License for more details. * 13 | * * 14 | * You should have received a copy of the GNU General Public License * 15 | * along with this program; if not, write to the * 16 | * Free Software Foundation, Inc., * 17 | * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * 18 | ***************************************************************************/ 19 | 20 | #ifndef UI_WIDGET_H 21 | #define UI_WIDGET_H 22 | 23 | #include 24 | #include 25 | #include "fcitx-gclient/fcitxinputmethod.h" 26 | 27 | G_BEGIN_DECLS 28 | 29 | #define FCITX_TYPE_UI_WIDGET fcitx_ui_widget_get_type() 30 | 31 | #define FCITX_UI_WIDGET(obj) \ 32 | (G_TYPE_CHECK_INSTANCE_CAST ((obj), FCITX_TYPE_UI_WIDGET, FcitxUIWidget)) 33 | 34 | #define FCITX_UI_WIDGET_CLASS(klass) \ 35 | (G_TYPE_CHECK_CLASS_CAST ((klass), FCITX_TYPE_UI_WIDGET, FcitxUIWidgetClass)) 36 | 37 | #define FCITX_IS_UI_WIDGET(obj) \ 38 | (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FCITX_TYPE_UI_WIDGET)) 39 | 40 | #define FCITX_IS_UI_WIDGET_CLASS(klass) \ 41 | (G_TYPE_CHECK_CLASS_TYPE ((klass), FCITX_TYPE_UI_WIDGET)) 42 | 43 | #define FCITX_UI_WIDGET_GET_CLASS(obj) \ 44 | (G_TYPE_INSTANCE_GET_CLASS ((obj), FCITX_TYPE_UI_WIDGET, FcitxUIWidgetClass)) 45 | 46 | typedef struct _FcitxUIWidget FcitxUIWidget; 47 | typedef struct _FcitxUIWidgetClass FcitxUIWidgetClass; 48 | 49 | struct _FcitxUIWidget { 50 | GtkBox parent; 51 | FcitxInputMethod* improxy; 52 | GtkWidget* label; 53 | }; 54 | 55 | struct _FcitxUIWidgetClass { 56 | GtkBoxClass parent_class; 57 | }; 58 | 59 | GType fcitx_ui_widget_get_type(void) G_GNUC_CONST; 60 | 61 | GtkWidget* 62 | fcitx_ui_widget_new(void); 63 | 64 | void 65 | fcitx_ui_widget_connect(FcitxUIWidget* widget); 66 | 67 | G_END_DECLS 68 | 69 | 70 | #endif -------------------------------------------------------------------------------- /po/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB PO_FILES RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" *.po) 2 | 3 | foreach(po_file ${PO_FILES}) 4 | string(REPLACE ".po" "" po_lang "${po_file}") 5 | fcitx_translate_add_po_file("${po_lang}" "${po_file}") 6 | endforeach() 7 | fcitx_translate_set_pot_target(pot fcitx-configtool fcitx-configtool.pot) 8 | -------------------------------------------------------------------------------- /po/ca.po: -------------------------------------------------------------------------------- 1 | # SOME DESCRIPTIVE TITLE. 2 | # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER 3 | # This file is distributed under the same license as the PACKAGE package. 4 | # 5 | # Translators: 6 | # Robert Antoni Buj Gelonch , 2017 7 | # Walter Garcia-Fontes , 2016-2017 8 | msgid "" 9 | msgstr "" 10 | "Project-Id-Version: fcitx\n" 11 | "Report-Msgid-Bugs-To: fcitx-dev@googlegroups.com\n" 12 | "POT-Creation-Date: 2017-12-20 00:02-0800\n" 13 | "PO-Revision-Date: 2017-12-20 05:51+0000\n" 14 | "Last-Translator: Robert Antoni Buj Gelonch \n" 15 | "Language-Team: Catalan (http://www.transifex.com/fcitx/fcitx/language/ca/)\n" 16 | "Language: ca\n" 17 | "MIME-Version: 1.0\n" 18 | "Content-Type: text/plain; charset=UTF-8\n" 19 | "Content-Transfer-Encoding: 8bit\n" 20 | "Plural-Forms: nplurals=2; plural=(n != 1);\n" 21 | 22 | #: gtk3/im_dialog.c:124 23 | msgid "Add input method" 24 | msgstr "Afegeix un mètode d'entrada" 25 | 26 | #: gtk3/main_window.c:372 gtk/main_window.c:375 27 | msgid "Addon" 28 | msgstr "Complement" 29 | 30 | #: gtk3/main_window.c:283 31 | msgid "Advanced" 32 | msgstr "Avançat" 33 | 34 | #: gtk3/main_window.c:221 35 | msgid "Appearance" 36 | msgstr "Aparença" 37 | 38 | #: gtk/im_widget.c:92 39 | msgid "Available Input Method" 40 | msgstr "Mètode d'entrada disponible" 41 | 42 | #: gtk3/ui_widget.c:48 43 | msgid "Cannot load currently used user interface info" 44 | msgstr "" 45 | "No es pot carregar la informació de la interfície utilitzada actualment" 46 | 47 | #: gtk3/config_widget.c:239 gtk/config_widget.c:192 48 | msgid "Clear font setting" 49 | msgstr "Neteja l'establiment de la lletra" 50 | 51 | #: gtk3/main_window.c:355 gtk/main_window.c:360 52 | msgid "Configure" 53 | msgstr "Configura" 54 | 55 | #: gtk/im_widget.c:146 56 | msgid "Current Input Method" 57 | msgstr "Mètode d'entrada actual" 58 | 59 | #: gtk3/im_config_dialog.c:160 60 | msgid "Default" 61 | msgstr "Predeterminat" 62 | 63 | #: gtk3/im_config_dialog.c:128 64 | msgid "Default keyboard layout" 65 | msgstr "Disposició predeterminada de teclat" 66 | 67 | #: gtk3/sub_config_widget.c:311 68 | msgid "Didn't install related component." 69 | msgstr "No instal·lis el component relacionat" 70 | 71 | #: gtk3/keygrab.c:66 gtk3/keygrab.c:172 gtk/keygrab.c:138 72 | msgid "Empty" 73 | msgstr "Buit" 74 | 75 | #: gtk3/main_window.c:203 gtk/main_window.c:294 76 | msgid "Global Config" 77 | msgstr "Configuració global" 78 | 79 | #: gtk3/main_window.c:209 gtk/im_widget.c:102 gtk/im_widget.c:153 80 | #: gtk/main_window.c:300 gtk3/im_dialog.ui:46 gtk3/im_widget.ui:35 81 | msgid "Input Method" 82 | msgstr "Mètode d'entrada" 83 | 84 | #: gtk3/main_window.c:106 gtk/main_window.c:149 85 | msgid "Input Method Configuration" 86 | msgstr "Configuració del mètode d'entrada" 87 | 88 | #: gtk3/im_config_dialog.c:160 89 | msgid "Input Method Default" 90 | msgstr "Mètode d'entrada predeterminat" 91 | 92 | #: gtk3/im_config_dialog.c:205 93 | msgid "Input method settings:" 94 | msgstr "Configuració del mètode d'entrada:" 95 | 96 | #: gtk3/im_config_dialog.c:188 97 | msgid "Keyboard layout to use when no input window:" 98 | msgstr "" 99 | "Disposició de teclat que s'ha d'utilitzar quan no hi ha finestra d'entrada:" 100 | 101 | #: gtk3/im_config_dialog.c:188 102 | msgid "Keyboard layout:" 103 | msgstr "Disposició del teclat:" 104 | 105 | #: gtk3/im_dialog.ui:58 gtk3/im_widget.ui:47 106 | msgid "Language" 107 | msgstr "Llengua" 108 | 109 | #: gtk3/ui_widget.c:106 110 | #, c-format 111 | msgid "No configuration option for %s." 112 | msgstr "No hi ha cap opció de configuració per a %s." 113 | 114 | #: gtk/im_widget.c:115 gtk3/im_dialog.ui:78 115 | msgid "Only Show Current Language" 116 | msgstr "Mostra sols la llengua actual" 117 | 118 | #: gtk3/config_widget.c:432 gtk3/config_widget.c:529 gtk/config_widget.c:270 119 | msgid "Other" 120 | msgstr "Altres" 121 | 122 | #: gtk3/keygrab.c:80 gtk/keygrab.c:74 123 | msgid "Please press the new key combination" 124 | msgstr "Si us plau premeu la nova combinació de tecles" 125 | 126 | #: gtk3/main_window.c:293 127 | msgid "Search Addon" 128 | msgstr "Cerca un complement" 129 | 130 | #: gtk3/im_dialog.c:165 131 | msgid "Search Input Method" 132 | msgstr "Cerca un mètode d'entrada" 133 | 134 | #: gtk3/config_widget.c:614 135 | msgid "Show Advanced Options" 136 | msgstr "Mostra les opcions avançades" 137 | 138 | #: gtk/im_widget.c:192 gtk3/im_widget.ui:87 139 | msgid "" 140 | "The first input method will be inactive state. Usually you need to put " 141 | "Keyboard or Keyboard - layout name in the first place." 142 | msgstr "" 143 | "El primer mètode d'entrada estarà en estat inactiu. En general us cal posar " 144 | "Teclat o Teclat -nom de la disposició al primer lloc." 145 | 146 | #: gtk3/im_dialog.c:253 gtk3/im_dialog.c:255 gtk3/im_widget.c:259 147 | #: gtk3/im_widget.c:261 gtk/im_widget.c:314 gtk/im_widget.c:316 148 | msgid "Unknown" 149 | msgstr "Desconegut" 150 | 151 | #: gtk3/gdm-languages.c:697 gtk/gdm-languages.c:697 152 | msgid "Unspecified" 153 | msgstr "No especificat" 154 | 155 | #: gtk3/config_widget.c:929 gtk3/im_config_dialog.c:73 gtk3/im_dialog.c:128 156 | #: gtk3/sub_config_widget.c:169 157 | msgid "_Cancel" 158 | msgstr "_Cancel·la" 159 | 160 | #: gtk3/config_widget.c:931 gtk3/im_config_dialog.c:75 gtk3/im_dialog.c:130 161 | #: gtk3/sub_config_widget.c:171 162 | msgid "_OK" 163 | msgstr "D'ac_ord" 164 | -------------------------------------------------------------------------------- /po/da.po: -------------------------------------------------------------------------------- 1 | # SOME DESCRIPTIVE TITLE. 2 | # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER 3 | # This file is distributed under the same license as the PACKAGE package. 4 | # 5 | # Translators: 6 | # scootergrisen, 2017 7 | # scootergrisen, 2017 8 | msgid "" 9 | msgstr "" 10 | "Project-Id-Version: fcitx\n" 11 | "Report-Msgid-Bugs-To: fcitx-dev@googlegroups.com\n" 12 | "POT-Creation-Date: 2017-11-10 16:03-0800\n" 13 | "PO-Revision-Date: 2017-11-10 21:24+0000\n" 14 | "Last-Translator: scootergrisen\n" 15 | "Language-Team: Danish (http://www.transifex.com/fcitx/fcitx/language/da/)\n" 16 | "Language: da\n" 17 | "MIME-Version: 1.0\n" 18 | "Content-Type: text/plain; charset=UTF-8\n" 19 | "Content-Transfer-Encoding: 8bit\n" 20 | "Plural-Forms: nplurals=2; plural=(n != 1);\n" 21 | 22 | #: gtk3/im_dialog.c:124 23 | msgid "Add input method" 24 | msgstr "Tilføj inputmetode" 25 | 26 | #: gtk3/main_window.c:372 gtk/main_window.c:375 27 | msgid "Addon" 28 | msgstr "Tilføjelse" 29 | 30 | #: gtk3/main_window.c:283 31 | msgid "Advanced" 32 | msgstr "Avanceret" 33 | 34 | #: gtk3/main_window.c:221 35 | msgid "Appearance" 36 | msgstr "Udseende" 37 | 38 | #: gtk/im_widget.c:92 39 | msgid "Available Input Method" 40 | msgstr "Tilgængelig inputmetode" 41 | 42 | #: gtk3/ui_widget.c:48 43 | msgid "Cannot load currently used user interface info" 44 | msgstr "" 45 | "Kan ikke indlæse information om brugergrænseflade som bruges i øjeblikket" 46 | 47 | #: gtk3/config_widget.c:239 gtk/config_widget.c:192 48 | msgid "Clear font setting" 49 | msgstr "Ryd skrifttypeindstilling" 50 | 51 | #: gtk3/main_window.c:355 gtk/main_window.c:360 52 | msgid "Configure" 53 | msgstr "Konfigurer" 54 | 55 | #: gtk/im_widget.c:146 56 | msgid "Current Input Method" 57 | msgstr "Nuværende inputmetode" 58 | 59 | #: gtk3/im_config_dialog.c:160 60 | msgid "Default" 61 | msgstr "Standard" 62 | 63 | #: gtk3/im_config_dialog.c:128 64 | msgid "Default keyboard layout" 65 | msgstr "Standardtastaturlayout" 66 | 67 | #: gtk3/sub_config_widget.c:310 68 | msgid "Didn't install related component." 69 | msgstr "Installerede ikke relaterede komponent." 70 | 71 | #: gtk3/keygrab.c:66 gtk3/keygrab.c:172 gtk/keygrab.c:138 72 | msgid "Empty" 73 | msgstr "Tom" 74 | 75 | #: gtk3/main_window.c:203 gtk/main_window.c:294 76 | msgid "Global Config" 77 | msgstr "Global konfiguration" 78 | 79 | #: gtk3/main_window.c:209 gtk/im_widget.c:102 gtk/im_widget.c:153 80 | #: gtk/main_window.c:300 gtk3/im_dialog.ui:46 gtk3/im_widget.ui:35 81 | msgid "Input Method" 82 | msgstr "Inputmetode" 83 | 84 | #: gtk3/main_window.c:106 gtk/main_window.c:149 85 | msgid "Input Method Configuration" 86 | msgstr "Konfiguration af inputmetode" 87 | 88 | #: gtk3/im_config_dialog.c:160 89 | msgid "Input Method Default" 90 | msgstr "Standardinputmetode" 91 | 92 | #: gtk3/im_config_dialog.c:205 93 | msgid "Input method settings:" 94 | msgstr "Indstillinger for inputmetode:" 95 | 96 | #: gtk3/im_config_dialog.c:188 97 | msgid "Keyboard layout to use when no input window:" 98 | msgstr "Tastaturlayout som skal bruges når der ikke er noget inputvindue:" 99 | 100 | #: gtk3/im_config_dialog.c:188 101 | msgid "Keyboard layout:" 102 | msgstr "Tastaturlayout:" 103 | 104 | #: gtk3/im_dialog.ui:58 gtk3/im_widget.ui:47 105 | msgid "Language" 106 | msgstr "Sprog" 107 | 108 | #: gtk3/ui_widget.c:106 109 | #, c-format 110 | msgid "No configuration option for %s." 111 | msgstr "Ingen konfigurationsvalgmulighed for %s." 112 | 113 | #: gtk/im_widget.c:115 gtk3/im_dialog.ui:78 114 | msgid "Only Show Current Language" 115 | msgstr "Vis kun nuværende sprog" 116 | 117 | #: gtk3/config_widget.c:432 gtk3/config_widget.c:529 gtk/config_widget.c:270 118 | msgid "Other" 119 | msgstr "Andet" 120 | 121 | #: gtk3/keygrab.c:80 gtk/keygrab.c:74 122 | msgid "Please press the new key combination" 123 | msgstr "Tryk venligst den nye tastekombination" 124 | 125 | #: gtk3/main_window.c:293 126 | msgid "Search Addon" 127 | msgstr "Søg efter tilføjelse" 128 | 129 | #: gtk3/im_dialog.c:165 130 | msgid "Search Input Method" 131 | msgstr "Søg efter inputmetode" 132 | 133 | #: gtk3/config_widget.c:614 134 | msgid "Show Advanced Options" 135 | msgstr "Vis avancerede valgmuligheder" 136 | 137 | #: gtk/im_widget.c:192 gtk3/im_widget.ui:87 138 | msgid "" 139 | "The first input method will be inactive state. Usually you need to put " 140 | "Keyboard or Keyboard - layout name in the first place." 141 | msgstr "" 142 | "Den første inputmetode vil være i inaktiv tilstand. Typisk skal der først " 143 | "stå Tastatur eller Tastatur - layoutnavn." 144 | 145 | #: gtk3/im_dialog.c:253 gtk3/im_dialog.c:255 gtk3/im_widget.c:259 146 | #: gtk3/im_widget.c:261 gtk/im_widget.c:314 gtk/im_widget.c:316 147 | msgid "Unknown" 148 | msgstr "Ukendt" 149 | 150 | #: gtk3/gdm-languages.c:697 gtk/gdm-languages.c:697 151 | msgid "Unspecified" 152 | msgstr "Uspecificeret" 153 | 154 | #: gtk3/config_widget.c:929 gtk3/im_config_dialog.c:73 gtk3/im_dialog.c:128 155 | #: gtk3/sub_config_widget.c:168 156 | msgid "_Cancel" 157 | msgstr "_Annuller" 158 | 159 | #: gtk3/config_widget.c:931 gtk3/im_config_dialog.c:75 gtk3/im_dialog.c:130 160 | #: gtk3/sub_config_widget.c:170 161 | msgid "_OK" 162 | msgstr "_OK" 163 | -------------------------------------------------------------------------------- /po/de.po: -------------------------------------------------------------------------------- 1 | # SOME DESCRIPTIVE TITLE. 2 | # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER 3 | # This file is distributed under the same license as the PACKAGE package. 4 | # 5 | # Translators: 6 | # Lucius Annaeus Seneca, 2013 7 | # mar well , 2013-2014 8 | # mar well , 2014,2017 9 | # csslayer , 2013 10 | msgid "" 11 | msgstr "" 12 | "Project-Id-Version: fcitx\n" 13 | "Report-Msgid-Bugs-To: fcitx-dev@googlegroups.com\n" 14 | "POT-Creation-Date: 2017-07-28 06:02-0700\n" 15 | "PO-Revision-Date: 2017-07-28 12:36+0000\n" 16 | "Last-Translator: mar well \n" 17 | "Language-Team: German (http://www.transifex.com/fcitx/fcitx/language/de/)\n" 18 | "Language: de\n" 19 | "MIME-Version: 1.0\n" 20 | "Content-Type: text/plain; charset=UTF-8\n" 21 | "Content-Transfer-Encoding: 8bit\n" 22 | "Plural-Forms: nplurals=2; plural=(n != 1);\n" 23 | 24 | #: gtk3/im_dialog.c:124 25 | msgid "Add input method" 26 | msgstr "Eingabemethode hinzufügen" 27 | 28 | #: gtk3/main_window.c:372 gtk/main_window.c:375 29 | msgid "Addon" 30 | msgstr "Addon" 31 | 32 | #: gtk3/main_window.c:283 33 | msgid "Advanced" 34 | msgstr "Erweitert" 35 | 36 | #: gtk3/main_window.c:221 37 | msgid "Appearance" 38 | msgstr "Aussehen" 39 | 40 | #: gtk/im_widget.c:92 41 | msgid "Available Input Method" 42 | msgstr "Verfügbare Eingabemethoden" 43 | 44 | #: gtk3/ui_widget.c:48 45 | msgid "Cannot load currently used user interface info" 46 | msgstr "Die Info zur aktuellen Oberfläche kann nicht geladen werden" 47 | 48 | #: gtk3/config_widget.c:239 gtk/config_widget.c:192 49 | msgid "Clear font setting" 50 | msgstr "Font-Einstellungen zurücksetzen" 51 | 52 | #: gtk3/main_window.c:355 gtk/main_window.c:360 53 | msgid "Configure" 54 | msgstr "Konfigurieren" 55 | 56 | #: gtk/im_widget.c:146 57 | msgid "Current Input Method" 58 | msgstr "Aktive Eingabemethoden" 59 | 60 | #: gtk3/im_config_dialog.c:160 61 | msgid "Default" 62 | msgstr "Standard" 63 | 64 | #: gtk3/im_config_dialog.c:128 65 | msgid "Default keyboard layout" 66 | msgstr "Standard Tastaturlayout" 67 | 68 | #: gtk3/sub_config_widget.c:310 69 | msgid "Didn't install related component." 70 | msgstr "Die betreffende Komponente wurde nicht installiert." 71 | 72 | #: gtk3/keygrab.c:66 gtk3/keygrab.c:172 gtk/keygrab.c:138 73 | msgid "Empty" 74 | msgstr "Leer" 75 | 76 | #: gtk3/main_window.c:203 gtk/main_window.c:294 77 | msgid "Global Config" 78 | msgstr "Globale Einstellungen" 79 | 80 | #: gtk3/main_window.c:209 gtk/im_widget.c:102 gtk/im_widget.c:153 81 | #: gtk/main_window.c:300 gtk3/im_dialog.ui:46 gtk3/im_widget.ui:35 82 | msgid "Input Method" 83 | msgstr "Eingabemethode" 84 | 85 | #: gtk3/main_window.c:106 gtk/main_window.c:149 86 | msgid "Input Method Configuration" 87 | msgstr "Eingabemethode Konfiguration" 88 | 89 | #: gtk3/im_config_dialog.c:160 90 | msgid "Input Method Default" 91 | msgstr "Standard-Eingabemethode" 92 | 93 | #: gtk3/im_config_dialog.c:205 94 | msgid "Input method settings:" 95 | msgstr "Einstellungen Eingabemethode:" 96 | 97 | #: gtk3/im_config_dialog.c:188 98 | msgid "Keyboard layout to use when no input window:" 99 | msgstr "Ohne aktives Fenster verwendetes Tastaturlayout" 100 | 101 | #: gtk3/im_config_dialog.c:188 102 | msgid "Keyboard layout:" 103 | msgstr "Tastaturlayout:" 104 | 105 | #: gtk3/im_dialog.ui:58 gtk3/im_widget.ui:47 106 | msgid "Language" 107 | msgstr "Sprache" 108 | 109 | #: gtk3/ui_widget.c:106 110 | #, c-format 111 | msgid "No configuration option for %s." 112 | msgstr "Für %s sind keine Einstellmöglichkeiten vorhanden" 113 | 114 | #: gtk/im_widget.c:115 gtk3/im_dialog.ui:78 115 | msgid "Only Show Current Language" 116 | msgstr "Nur gegenwärtige Sprache anzeigen" 117 | 118 | #: gtk3/config_widget.c:432 gtk3/config_widget.c:529 gtk/config_widget.c:270 119 | msgid "Other" 120 | msgstr "Andere" 121 | 122 | #: gtk3/keygrab.c:80 gtk/keygrab.c:74 123 | msgid "Please press the new key combination" 124 | msgstr "Bitte die neue Tastenkombination drücken" 125 | 126 | #: gtk3/main_window.c:293 127 | msgid "Search Addon" 128 | msgstr "Addons suchen" 129 | 130 | #: gtk3/im_dialog.c:165 131 | msgid "Search Input Method" 132 | msgstr "Eingabemethode suchen" 133 | 134 | #: gtk3/config_widget.c:614 135 | msgid "Show Advanced Options" 136 | msgstr "Erweiterte Einstellungen zeigen" 137 | 138 | #: gtk/im_widget.c:192 gtk3/im_widget.ui:87 139 | msgid "" 140 | "The first input method will be inactive state. Usually you need to put " 141 | "Keyboard or Keyboard - layout name in the first place." 142 | msgstr "" 143 | "Die erste Eingabemethode wird von Fcitx im inaktiven Zustand verwendet. " 144 | "Normalerweise wird es nötig sein Tastatur oder Tastatur - " 145 | "Layout Name an der ersten Stelle einzufügen." 146 | 147 | #: gtk3/im_dialog.c:253 gtk3/im_dialog.c:255 gtk3/im_widget.c:259 148 | #: gtk3/im_widget.c:261 gtk/im_widget.c:314 gtk/im_widget.c:316 149 | msgid "Unknown" 150 | msgstr "Unbekannt" 151 | 152 | #: gtk3/gdm-languages.c:697 gtk/gdm-languages.c:697 153 | msgid "Unspecified" 154 | msgstr "Nicht angegeben" 155 | 156 | #: gtk3/config_widget.c:929 gtk3/im_config_dialog.c:73 gtk3/im_dialog.c:128 157 | #: gtk3/sub_config_widget.c:168 158 | msgid "_Cancel" 159 | msgstr "_Abbrechen" 160 | 161 | #: gtk3/config_widget.c:931 gtk3/im_config_dialog.c:75 gtk3/im_dialog.c:130 162 | #: gtk3/sub_config_widget.c:170 163 | msgid "_OK" 164 | msgstr "_OK" 165 | -------------------------------------------------------------------------------- /po/fcitx-configtool.pot: -------------------------------------------------------------------------------- 1 | # SOME DESCRIPTIVE TITLE. 2 | # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER 3 | # This file is distributed under the same license as the PACKAGE package. 4 | # FIRST AUTHOR , YEAR. 5 | # 6 | #, fuzzy 7 | msgid "" 8 | msgstr "" 9 | "Project-Id-Version: PACKAGE VERSION\n" 10 | "Report-Msgid-Bugs-To: fcitx-dev@googlegroups.com\n" 11 | "POT-Creation-Date: 2014-07-06 10:09+0200\n" 12 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 13 | "Last-Translator: FULL NAME \n" 14 | "Language-Team: LANGUAGE \n" 15 | "Language: LANG\n" 16 | "MIME-Version: 1.0\n" 17 | "Content-Type: text/plain; charset=utf-8\n" 18 | "Content-Transfer-Encoding: 8bit\n" 19 | 20 | #: gtk3/config_widget.c:239 gtk/config_widget.c:192 21 | msgid "Clear font setting" 22 | msgstr "" 23 | 24 | #: gtk3/config_widget.c:432 gtk3/config_widget.c:529 gtk/config_widget.c:270 25 | msgid "Other" 26 | msgstr "" 27 | 28 | #: gtk3/config_widget.c:614 29 | msgid "Show Advanced Options" 30 | msgstr "" 31 | 32 | #: gtk3/config_widget.c:937 gtk3/im_config_dialog.c:73 gtk3/im_dialog.c:127 33 | #: gtk3/sub_config_widget.c:168 34 | msgid "_Cancel" 35 | msgstr "" 36 | 37 | #: gtk3/config_widget.c:939 gtk3/im_config_dialog.c:75 gtk3/im_dialog.c:129 38 | #: gtk3/sub_config_widget.c:170 39 | msgid "_OK" 40 | msgstr "" 41 | 42 | #: gtk3/gdm-languages.c:697 gtk/gdm-languages.c:697 43 | msgid "Unspecified" 44 | msgstr "" 45 | 46 | #: gtk3/im_config_dialog.c:132 47 | msgid "Default keyboard layout" 48 | msgstr "" 49 | 50 | #: gtk3/im_config_dialog.c:164 51 | msgid "Input Method Default" 52 | msgstr "" 53 | 54 | #: gtk3/im_config_dialog.c:164 55 | msgid "Default" 56 | msgstr "" 57 | 58 | #: gtk3/im_config_dialog.c:192 59 | msgid "Keyboard layout:" 60 | msgstr "" 61 | 62 | #: gtk3/im_config_dialog.c:192 63 | msgid "Keyboard layout to use when no input window:" 64 | msgstr "" 65 | 66 | #: gtk3/im_config_dialog.c:209 67 | msgid "Input method settings:" 68 | msgstr "" 69 | 70 | #: gtk3/im_dialog.c:123 71 | msgid "Add input method" 72 | msgstr "" 73 | 74 | #: gtk3/im_dialog.c:168 75 | msgid "Search Input Method" 76 | msgstr "" 77 | 78 | #: gtk3/im_dialog.c:256 gtk3/im_dialog.c:258 gtk3/im_widget.c:259 79 | #: gtk3/im_widget.c:261 gtk/im_widget.c:314 gtk/im_widget.c:316 80 | msgid "Unknown" 81 | msgstr "" 82 | 83 | #: gtk3/keygrab.c:66 gtk3/keygrab.c:181 gtk/keygrab.c:138 84 | msgid "Empty" 85 | msgstr "" 86 | 87 | #: gtk3/keygrab.c:80 gtk/keygrab.c:74 88 | msgid "Please press the new key combination" 89 | msgstr "" 90 | 91 | #: gtk3/main_window.c:106 gtk/main_window.c:149 92 | msgid "Input Method Configuration" 93 | msgstr "" 94 | 95 | #: gtk3/main_window.c:203 gtk/main_window.c:294 96 | msgid "Global Config" 97 | msgstr "" 98 | 99 | #: gtk3/main_window.c:209 gtk/im_widget.c:102 gtk/im_widget.c:153 100 | #: gtk/main_window.c:300 gtk3/im_dialog.ui:74 gtk3/im_widget.ui:63 101 | msgid "Input Method" 102 | msgstr "" 103 | 104 | #: gtk3/main_window.c:221 105 | msgid "Appearance" 106 | msgstr "" 107 | 108 | #: gtk3/main_window.c:283 109 | msgid "Advanced" 110 | msgstr "" 111 | 112 | #: gtk3/main_window.c:294 113 | msgid "Search Addon" 114 | msgstr "" 115 | 116 | #: gtk3/main_window.c:357 gtk/main_window.c:360 117 | msgid "Configure" 118 | msgstr "" 119 | 120 | #: gtk3/main_window.c:374 gtk/main_window.c:375 121 | msgid "Addon" 122 | msgstr "" 123 | 124 | #: gtk3/sub_config_widget.c:287 125 | msgid "Didn't install related component." 126 | msgstr "" 127 | 128 | #: gtk3/ui_widget.c:48 129 | msgid "Cannot load currently used user interface info" 130 | msgstr "" 131 | 132 | #: gtk3/ui_widget.c:106 133 | #, c-format 134 | msgid "No configuration option for %s." 135 | msgstr "" 136 | 137 | #: gtk/im_widget.c:92 138 | msgid "Available Input Method" 139 | msgstr "" 140 | 141 | #: gtk/im_widget.c:115 gtk3/im_dialog.ui:106 142 | msgid "Only Show Current Language" 143 | msgstr "" 144 | 145 | #: gtk/im_widget.c:146 146 | msgid "Current Input Method" 147 | msgstr "" 148 | 149 | #: gtk/im_widget.c:192 gtk3/im_widget.ui:115 150 | msgid "" 151 | "The first input method will be inactive state. Usually you need to put " 152 | "Keyboard or Keyboard - layout name in the first place." 153 | msgstr "" 154 | 155 | #: gtk3/im_dialog.ui:86 gtk3/im_widget.ui:75 156 | msgid "Language" 157 | msgstr "" 158 | -------------------------------------------------------------------------------- /po/ja.po: -------------------------------------------------------------------------------- 1 | # SOME DESCRIPTIVE TITLE. 2 | # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER 3 | # This file is distributed under the same license as the PACKAGE package. 4 | # 5 | # Translators: 6 | # しろう <>, 2013 7 | # あわしろいくや , 2014 8 | # あわしろいくや , 2017 9 | # shirou - しろう , 2013 10 | # csslayer , 2013 11 | msgid "" 12 | msgstr "" 13 | "Project-Id-Version: fcitx\n" 14 | "Report-Msgid-Bugs-To: fcitx-dev@googlegroups.com\n" 15 | "POT-Creation-Date: 2017-10-28 08:03-0700\n" 16 | "PO-Revision-Date: 2017-10-28 08:05+0000\n" 17 | "Last-Translator: あわしろいくや \n" 18 | "Language-Team: Japanese (http://www.transifex.com/fcitx/fcitx/language/ja/)\n" 19 | "Language: ja\n" 20 | "MIME-Version: 1.0\n" 21 | "Content-Type: text/plain; charset=UTF-8\n" 22 | "Content-Transfer-Encoding: 8bit\n" 23 | "Plural-Forms: nplurals=1; plural=0;\n" 24 | 25 | #: gtk3/im_dialog.c:124 26 | msgid "Add input method" 27 | msgstr "入力メソッドの追加" 28 | 29 | #: gtk3/main_window.c:372 gtk/main_window.c:375 30 | msgid "Addon" 31 | msgstr "アドオン" 32 | 33 | #: gtk3/main_window.c:283 34 | msgid "Advanced" 35 | msgstr "拡張" 36 | 37 | #: gtk3/main_window.c:221 38 | msgid "Appearance" 39 | msgstr "外観" 40 | 41 | #: gtk/im_widget.c:92 42 | msgid "Available Input Method" 43 | msgstr "存在する入力メソッド" 44 | 45 | #: gtk3/ui_widget.c:48 46 | msgid "Cannot load currently used user interface info" 47 | msgstr "現在のユーザーインターフェース設定が読み込めません" 48 | 49 | #: gtk3/config_widget.c:239 gtk/config_widget.c:192 50 | msgid "Clear font setting" 51 | msgstr "設定をクリア" 52 | 53 | #: gtk3/main_window.c:355 gtk/main_window.c:360 54 | msgid "Configure" 55 | msgstr "設定" 56 | 57 | #: gtk/im_widget.c:146 58 | msgid "Current Input Method" 59 | msgstr "現在の入力メソッド" 60 | 61 | #: gtk3/im_config_dialog.c:160 62 | msgid "Default" 63 | msgstr "既定" 64 | 65 | #: gtk3/im_config_dialog.c:128 66 | msgid "Default keyboard layout" 67 | msgstr "既定のキーボードレイアウト" 68 | 69 | #: gtk3/sub_config_widget.c:310 70 | msgid "Didn't install related component." 71 | msgstr "関連コンポーネントがインストールされていません" 72 | 73 | #: gtk3/keygrab.c:66 gtk3/keygrab.c:172 gtk/keygrab.c:138 74 | msgid "Empty" 75 | msgstr "空" 76 | 77 | #: gtk3/main_window.c:203 gtk/main_window.c:294 78 | msgid "Global Config" 79 | msgstr "全体の設定" 80 | 81 | #: gtk3/main_window.c:209 gtk/im_widget.c:102 gtk/im_widget.c:153 82 | #: gtk/main_window.c:300 gtk3/im_dialog.ui:46 gtk3/im_widget.ui:35 83 | msgid "Input Method" 84 | msgstr "入力メソッド" 85 | 86 | #: gtk3/main_window.c:106 gtk/main_window.c:149 87 | msgid "Input Method Configuration" 88 | msgstr "入力メソッドの設定" 89 | 90 | #: gtk3/im_config_dialog.c:160 91 | msgid "Input Method Default" 92 | msgstr "既定の入力メソッド" 93 | 94 | #: gtk3/im_config_dialog.c:205 95 | msgid "Input method settings:" 96 | msgstr "入力メソッドの設定:" 97 | 98 | #: gtk3/im_config_dialog.c:188 99 | msgid "Keyboard layout to use when no input window:" 100 | msgstr "入力ウィンドウがない場合のキーボードレイアウト" 101 | 102 | #: gtk3/im_config_dialog.c:188 103 | msgid "Keyboard layout:" 104 | msgstr "キーボードレイアウト:" 105 | 106 | #: gtk3/im_dialog.ui:58 gtk3/im_widget.ui:47 107 | msgid "Language" 108 | msgstr "言語" 109 | 110 | #: gtk3/ui_widget.c:106 111 | #, c-format 112 | msgid "No configuration option for %s." 113 | msgstr "%s に設定オプションはありません" 114 | 115 | #: gtk/im_widget.c:115 gtk3/im_dialog.ui:78 116 | msgid "Only Show Current Language" 117 | msgstr "現在の言語のみ表示" 118 | 119 | #: gtk3/config_widget.c:432 gtk3/config_widget.c:529 gtk/config_widget.c:270 120 | msgid "Other" 121 | msgstr "その他" 122 | 123 | #: gtk3/keygrab.c:80 gtk/keygrab.c:74 124 | msgid "Please press the new key combination" 125 | msgstr "設定したいキーの組み合わせを押してください" 126 | 127 | #: gtk3/main_window.c:293 128 | msgid "Search Addon" 129 | msgstr "アドオンの検索" 130 | 131 | #: gtk3/im_dialog.c:165 132 | msgid "Search Input Method" 133 | msgstr "入力メソッドの検索" 134 | 135 | #: gtk3/config_widget.c:614 136 | msgid "Show Advanced Options" 137 | msgstr "拡張オプションの表示" 138 | 139 | #: gtk/im_widget.c:192 gtk3/im_widget.ui:87 140 | msgid "" 141 | "The first input method will be inactive state. Usually you need to put " 142 | "Keyboard or Keyboard - layout name in the first place." 143 | msgstr "" 144 | "最初の入力メソッドは [直接入力] のときに使用されます。通常は キーボード または キーボード-レイアウト名 を最上段に指定してください。" 146 | 147 | #: gtk3/im_dialog.c:253 gtk3/im_dialog.c:255 gtk3/im_widget.c:259 148 | #: gtk3/im_widget.c:261 gtk/im_widget.c:314 gtk/im_widget.c:316 149 | msgid "Unknown" 150 | msgstr "不明" 151 | 152 | #: gtk3/gdm-languages.c:697 gtk/gdm-languages.c:697 153 | msgid "Unspecified" 154 | msgstr "特定しない" 155 | 156 | #: gtk3/config_widget.c:929 gtk3/im_config_dialog.c:73 gtk3/im_dialog.c:128 157 | #: gtk3/sub_config_widget.c:168 158 | msgid "_Cancel" 159 | msgstr "キャンセル(_C)" 160 | 161 | #: gtk3/config_widget.c:931 gtk3/im_config_dialog.c:75 gtk3/im_dialog.c:130 162 | #: gtk3/sub_config_widget.c:170 163 | msgid "_OK" 164 | msgstr "OK(_O)" 165 | -------------------------------------------------------------------------------- /po/ko.po: -------------------------------------------------------------------------------- 1 | # SOME DESCRIPTIVE TITLE. 2 | # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER 3 | # This file is distributed under the same license as the PACKAGE package. 4 | # 5 | # Translators: 6 | # Bon Keun Seo , 2017 7 | # Junghee Lee , 2021 8 | # Junghee Lee , 2020 9 | # Junghee Lee , 2022 10 | # Junghee Lee , 2020,2022 11 | msgid "" 12 | msgstr "" 13 | "Project-Id-Version: fcitx\n" 14 | "Report-Msgid-Bugs-To: fcitx-dev@googlegroups.com\n" 15 | "POT-Creation-Date: 2022-04-10 20:28+0000\n" 16 | "PO-Revision-Date: 2011-11-16 06:53+0000\n" 17 | "Last-Translator: Junghee Lee , 2022\n" 18 | "Language-Team: Korean (http://www.transifex.com/fcitx/fcitx/language/ko/)\n" 19 | "Language: ko\n" 20 | "MIME-Version: 1.0\n" 21 | "Content-Type: text/plain; charset=UTF-8\n" 22 | "Content-Transfer-Encoding: 8bit\n" 23 | "Plural-Forms: nplurals=1; plural=0;\n" 24 | 25 | #: gtk3/im_dialog.c:124 26 | msgid "Add input method" 27 | msgstr "입력기 추가" 28 | 29 | #: gtk3/main_window.c:372 gtk/main_window.c:375 30 | msgid "Addon" 31 | msgstr "애드온" 32 | 33 | #: gtk3/main_window.c:283 34 | msgid "Advanced" 35 | msgstr "추가" 36 | 37 | #: gtk3/main_window.c:221 38 | msgid "Appearance" 39 | msgstr "모양새" 40 | 41 | #: gtk/im_widget.c:92 42 | msgid "Available Input Method" 43 | msgstr "사용가능한 입력기" 44 | 45 | #: gtk3/ui_widget.c:48 46 | msgid "Cannot load currently used user interface info" 47 | msgstr "현재 사용된 사용자 인터페이스 정보를 불러올 수 없음" 48 | 49 | #: gtk3/config_widget.c:239 gtk/config_widget.c:192 50 | msgid "Clear font setting" 51 | msgstr "글꼴 설정 지우기" 52 | 53 | #: gtk3/main_window.c:355 gtk/main_window.c:360 54 | msgid "Configure" 55 | msgstr "구성하기" 56 | 57 | #: gtk/im_widget.c:146 58 | msgid "Current Input Method" 59 | msgstr "현재 입력기" 60 | 61 | #: gtk3/im_config_dialog.c:160 62 | msgid "Default" 63 | msgstr "기본" 64 | 65 | #: gtk3/im_config_dialog.c:128 66 | msgid "Default keyboard layout" 67 | msgstr "기본 키보드 자판" 68 | 69 | #: gtk3/sub_config_widget.c:311 70 | msgid "Didn't install related component." 71 | msgstr "관련 구성요소 설치하지 않음" 72 | 73 | #: gtk3/keygrab.c:66 gtk3/keygrab.c:172 gtk/keygrab.c:138 74 | msgid "Empty" 75 | msgstr "비어있음" 76 | 77 | #: gtk3/main_window.c:203 gtk/main_window.c:294 78 | msgid "Global Config" 79 | msgstr "전역 구성" 80 | 81 | #: gtk3/main_window.c:209 gtk/im_widget.c:102 gtk/im_widget.c:153 82 | #: gtk/main_window.c:300 gtk3/im_dialog.ui:46 gtk3/im_widget.ui:35 83 | msgid "Input Method" 84 | msgstr "입력기" 85 | 86 | #: gtk3/main_window.c:106 gtk/main_window.c:149 87 | msgid "Input Method Configuration" 88 | msgstr "입력기 구성" 89 | 90 | #: gtk3/im_config_dialog.c:160 91 | msgid "Input Method Default" 92 | msgstr "기본 입력기" 93 | 94 | #: gtk3/im_config_dialog.c:205 95 | msgid "Input method settings:" 96 | msgstr "입력기 설정:" 97 | 98 | #: gtk3/im_config_dialog.c:188 99 | msgid "Keyboard layout to use when no input window:" 100 | msgstr "입력창이 없을 때 사용할 키보드 자판:" 101 | 102 | #: gtk3/im_config_dialog.c:188 103 | msgid "Keyboard layout:" 104 | msgstr "키보드 자판:" 105 | 106 | #: gtk3/im_dialog.ui:58 gtk3/im_widget.ui:47 107 | msgid "Language" 108 | msgstr "언어" 109 | 110 | #: gtk3/ui_widget.c:106 111 | #, c-format 112 | msgid "No configuration option for %s." 113 | msgstr "%s에 대한 구성 옵션이 없습니다." 114 | 115 | #: gtk/im_widget.c:115 gtk3/im_dialog.ui:78 116 | msgid "Only Show Current Language" 117 | msgstr "현재 언어만 표시" 118 | 119 | #: gtk3/config_widget.c:432 gtk3/config_widget.c:529 gtk/config_widget.c:270 120 | msgid "Other" 121 | msgstr "기타" 122 | 123 | #: gtk3/keygrab.c:80 gtk/keygrab.c:74 124 | msgid "Please press the new key combination" 125 | msgstr "새 키 조합을 입력하세요" 126 | 127 | #: gtk3/main_window.c:293 128 | msgid "Search Addon" 129 | msgstr "애드온 검색" 130 | 131 | #: gtk3/im_dialog.c:165 132 | msgid "Search Input Method" 133 | msgstr "입력기 검색" 134 | 135 | #: gtk3/config_widget.c:614 136 | msgid "Show Advanced Options" 137 | msgstr "고급 옵션 표시" 138 | 139 | #: gtk/im_widget.c:192 gtk3/im_widget.ui:87 140 | msgid "" 141 | "The first input method will be inactive state. Usually you need to put " 142 | "Keyboard or Keyboard - layout name in the first place." 143 | msgstr "" 144 | "첫번째 입력기가 비활성화 상태입니다. 대체로 키보드 또는 키보드 - " 145 | " 자판명 을 첫 항목으로 하여야 합니다." 146 | 147 | #: gtk3/im_dialog.c:253 gtk3/im_dialog.c:255 gtk3/im_widget.c:259 148 | #: gtk3/im_widget.c:261 gtk/im_widget.c:314 gtk/im_widget.c:316 149 | msgid "Unknown" 150 | msgstr "모름" 151 | 152 | #: gtk3/gdm-languages.c:697 gtk/gdm-languages.c:697 153 | msgid "Unspecified" 154 | msgstr "미지정됨" 155 | 156 | #: gtk3/config_widget.c:929 gtk3/im_config_dialog.c:73 gtk3/im_dialog.c:128 157 | #: gtk3/sub_config_widget.c:169 158 | msgid "_Cancel" 159 | msgstr "취소(_C)" 160 | 161 | #: gtk3/config_widget.c:931 gtk3/im_config_dialog.c:75 gtk3/im_dialog.c:130 162 | #: gtk3/sub_config_widget.c:171 163 | msgid "_OK" 164 | msgstr "선택(_O)" 165 | -------------------------------------------------------------------------------- /po/ru.po: -------------------------------------------------------------------------------- 1 | # SOME DESCRIPTIVE TITLE. 2 | # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER 3 | # This file is distributed under the same license as the PACKAGE package. 4 | # 5 | # Translators: 6 | # TotalCaesar659 , 2016-2017 7 | msgid "" 8 | msgstr "" 9 | "Project-Id-Version: fcitx\n" 10 | "Report-Msgid-Bugs-To: fcitx-dev@googlegroups.com\n" 11 | "POT-Creation-Date: 2022-06-02 20:29+0000\n" 12 | "PO-Revision-Date: 2011-11-16 06:53+0000\n" 13 | "Last-Translator: TotalCaesar659 , 2016-2017\n" 14 | "Language-Team: Russian (http://www.transifex.com/fcitx/fcitx/language/ru/)\n" 15 | "Language: ru\n" 16 | "MIME-Version: 1.0\n" 17 | "Content-Type: text/plain; charset=UTF-8\n" 18 | "Content-Transfer-Encoding: 8bit\n" 19 | "Plural-Forms: nplurals=4; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && " 20 | "n%10<=4 && (n%100<12 || n%100>14) ? 1 : n%10==0 || (n%10>=5 && n%10<=9) || " 21 | "(n%100>=11 && n%100<=14)? 2 : 3);\n" 22 | 23 | #: gtk3/im_dialog.c:124 24 | msgid "Add input method" 25 | msgstr "Добавить метод ввода" 26 | 27 | #: gtk3/main_window.c:372 gtk/main_window.c:375 28 | msgid "Addon" 29 | msgstr "Дополнения" 30 | 31 | #: gtk3/main_window.c:283 32 | msgid "Advanced" 33 | msgstr "Дополнительно" 34 | 35 | #: gtk3/main_window.c:221 36 | msgid "Appearance" 37 | msgstr "Внешний вид" 38 | 39 | #: gtk/im_widget.c:92 40 | msgid "Available Input Method" 41 | msgstr "Доступный метод ввода" 42 | 43 | #: gtk3/ui_widget.c:48 44 | msgid "Cannot load currently used user interface info" 45 | msgstr "" 46 | "Не удалось загрузить информацию об используемом пользовательском интерфейсе" 47 | 48 | #: gtk3/config_widget.c:239 gtk/config_widget.c:192 49 | msgid "Clear font setting" 50 | msgstr "Сбросить шрифт" 51 | 52 | #: gtk3/main_window.c:355 gtk/main_window.c:360 53 | msgid "Configure" 54 | msgstr "Настроить" 55 | 56 | #: gtk/im_widget.c:146 57 | msgid "Current Input Method" 58 | msgstr "Текущий метод ввода" 59 | 60 | #: gtk3/im_config_dialog.c:160 61 | msgid "Default" 62 | msgstr "По умолчанию" 63 | 64 | #: gtk3/im_config_dialog.c:128 65 | msgid "Default keyboard layout" 66 | msgstr "Раскладка клавиатуры по умолчанию" 67 | 68 | #: gtk3/sub_config_widget.c:311 69 | msgid "Didn't install related component." 70 | msgstr "Зависимый компонент не был установлен." 71 | 72 | #: gtk3/keygrab.c:66 gtk3/keygrab.c:172 gtk/keygrab.c:138 73 | msgid "Empty" 74 | msgstr "Отсутствует" 75 | 76 | #: gtk3/main_window.c:203 gtk/main_window.c:294 77 | msgid "Global Config" 78 | msgstr "Общие настройки" 79 | 80 | #: gtk3/main_window.c:209 gtk/im_widget.c:102 gtk/im_widget.c:153 81 | #: gtk/main_window.c:300 gtk3/im_dialog.ui:46 gtk3/im_widget.ui:35 82 | msgid "Input Method" 83 | msgstr "Метод ввода" 84 | 85 | #: gtk3/main_window.c:106 gtk/main_window.c:149 86 | msgid "Input Method Configuration" 87 | msgstr "Поиск дополнения" 88 | 89 | #: gtk3/im_config_dialog.c:160 90 | msgid "Input Method Default" 91 | msgstr "Метод ввода по умолчанию" 92 | 93 | #: gtk3/im_config_dialog.c:205 94 | msgid "Input method settings:" 95 | msgstr "Настройки метода ввода:" 96 | 97 | #: gtk3/im_config_dialog.c:188 98 | msgid "Keyboard layout to use when no input window:" 99 | msgstr "Если нет окна ввода, использовать следующую раскладку:" 100 | 101 | #: gtk3/im_config_dialog.c:188 102 | msgid "Keyboard layout:" 103 | msgstr "Раскладка клавиатуры:" 104 | 105 | #: gtk3/im_dialog.ui:58 gtk3/im_widget.ui:47 106 | msgid "Language" 107 | msgstr "Язык" 108 | 109 | #: gtk3/ui_widget.c:106 110 | #, c-format 111 | msgid "No configuration option for %s." 112 | msgstr "Отсутствует параметр конфигурации для %s." 113 | 114 | #: gtk/im_widget.c:115 gtk3/im_dialog.ui:78 115 | msgid "Only Show Current Language" 116 | msgstr "Показать только текущий язык" 117 | 118 | #: gtk3/config_widget.c:432 gtk3/config_widget.c:529 gtk/config_widget.c:270 119 | msgid "Other" 120 | msgstr "Другие" 121 | 122 | #: gtk3/keygrab.c:80 gtk/keygrab.c:74 123 | msgid "Please press the new key combination" 124 | msgstr "Нажмите новую комбинацию клавиш" 125 | 126 | #: gtk3/main_window.c:293 127 | msgid "Search Addon" 128 | msgstr "Поиск дополнения" 129 | 130 | #: gtk3/im_dialog.c:165 131 | msgid "Search Input Method" 132 | msgstr "Поиск метода ввода" 133 | 134 | #: gtk3/config_widget.c:614 135 | msgid "Show Advanced Options" 136 | msgstr "Показать дополнительные настройки" 137 | 138 | #: gtk/im_widget.c:192 gtk3/im_widget.ui:87 139 | msgid "" 140 | "The first input method will be inactive state. Usually you need to put " 141 | "Keyboard or Keyboard - layout name in the first place." 142 | msgstr "" 143 | "Первичный метод ввода будет в незадействованном состоянии. Обычно необходимо " 144 | "указывать первым пунктом в списке Клавиатура или Клавиатура - " 145 | "наименование раскладки." 146 | 147 | #: gtk3/im_dialog.c:253 gtk3/im_dialog.c:255 gtk3/im_widget.c:259 148 | #: gtk3/im_widget.c:261 gtk/im_widget.c:314 gtk/im_widget.c:316 149 | msgid "Unknown" 150 | msgstr "Неизвестно" 151 | 152 | #: gtk3/gdm-languages.c:697 gtk/gdm-languages.c:697 153 | msgid "Unspecified" 154 | msgstr "Не задано" 155 | 156 | #: gtk3/config_widget.c:929 gtk3/im_config_dialog.c:73 gtk3/im_dialog.c:128 157 | #: gtk3/sub_config_widget.c:169 158 | msgid "_Cancel" 159 | msgstr "О_тменить" 160 | 161 | #: gtk3/config_widget.c:931 gtk3/im_config_dialog.c:75 gtk3/im_dialog.c:130 162 | #: gtk3/sub_config_widget.c:171 163 | msgid "_OK" 164 | msgstr "_ОК" 165 | -------------------------------------------------------------------------------- /po/tr.po: -------------------------------------------------------------------------------- 1 | # SOME DESCRIPTIVE TITLE. 2 | # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER 3 | # This file is distributed under the same license as the PACKAGE package. 4 | # 5 | # Translators: 6 | # abc Def , 2020 7 | # Gökhan Kalayci , 2017 8 | msgid "" 9 | msgstr "" 10 | "Project-Id-Version: fcitx\n" 11 | "Report-Msgid-Bugs-To: fcitx-dev@googlegroups.com\n" 12 | "POT-Creation-Date: 2020-05-06 00:02-0700\n" 13 | "PO-Revision-Date: 2020-05-05 21:12+0000\n" 14 | "Last-Translator: abc Def \n" 15 | "Language-Team: Turkish (http://www.transifex.com/fcitx/fcitx/language/tr/)\n" 16 | "Language: tr\n" 17 | "MIME-Version: 1.0\n" 18 | "Content-Type: text/plain; charset=UTF-8\n" 19 | "Content-Transfer-Encoding: 8bit\n" 20 | "Plural-Forms: nplurals=2; plural=(n > 1);\n" 21 | 22 | #: gtk3/im_dialog.c:124 23 | msgid "Add input method" 24 | msgstr "Giriş yöntemi ekle" 25 | 26 | #: gtk3/main_window.c:372 gtk/main_window.c:375 27 | msgid "Addon" 28 | msgstr "Eklenti" 29 | 30 | #: gtk3/main_window.c:283 31 | msgid "Advanced" 32 | msgstr "Gelişmiş" 33 | 34 | #: gtk3/main_window.c:221 35 | msgid "Appearance" 36 | msgstr "Görünüm" 37 | 38 | #: gtk/im_widget.c:92 39 | msgid "Available Input Method" 40 | msgstr "Kullanılabilir Giriş Yöntemi" 41 | 42 | #: gtk3/ui_widget.c:48 43 | msgid "Cannot load currently used user interface info" 44 | msgstr "Şu anda kullanılan kullanıcı arabirimi bilgileri yüklenemiyor" 45 | 46 | #: gtk3/config_widget.c:239 gtk/config_widget.c:192 47 | msgid "Clear font setting" 48 | msgstr "Yazı tipi ayarını temizle" 49 | 50 | #: gtk3/main_window.c:355 gtk/main_window.c:360 51 | msgid "Configure" 52 | msgstr "Yapılandır" 53 | 54 | #: gtk/im_widget.c:146 55 | msgid "Current Input Method" 56 | msgstr "Geçerli Giriş Yöntemi" 57 | 58 | #: gtk3/im_config_dialog.c:160 59 | msgid "Default" 60 | msgstr "Varsayılan" 61 | 62 | #: gtk3/im_config_dialog.c:128 63 | msgid "Default keyboard layout" 64 | msgstr "Varsayılan klavye düzeni" 65 | 66 | #: gtk3/sub_config_widget.c:311 67 | msgid "Didn't install related component." 68 | msgstr "İlgili bileşen yüklemedi." 69 | 70 | #: gtk3/keygrab.c:66 gtk3/keygrab.c:172 gtk/keygrab.c:138 71 | msgid "Empty" 72 | msgstr "Boş" 73 | 74 | #: gtk3/main_window.c:203 gtk/main_window.c:294 75 | msgid "Global Config" 76 | msgstr "Küresel Yapılandırma" 77 | 78 | #: gtk3/main_window.c:209 gtk/im_widget.c:102 gtk/im_widget.c:153 79 | #: gtk/main_window.c:300 gtk3/im_dialog.ui:46 gtk3/im_widget.ui:35 80 | msgid "Input Method" 81 | msgstr "Giriş Yöntemi" 82 | 83 | #: gtk3/main_window.c:106 gtk/main_window.c:149 84 | msgid "Input Method Configuration" 85 | msgstr "Giriş Yöntemi Yapılandırması" 86 | 87 | #: gtk3/im_config_dialog.c:160 88 | msgid "Input Method Default" 89 | msgstr "Giriş Yöntemi Varsayılanı" 90 | 91 | #: gtk3/im_config_dialog.c:205 92 | msgid "Input method settings:" 93 | msgstr "Giriş Yöntemi Ayarları:" 94 | 95 | #: gtk3/im_config_dialog.c:188 96 | msgid "Keyboard layout to use when no input window:" 97 | msgstr "Giriş penceresi olmadığında kullanılacak klavye düzeni:" 98 | 99 | #: gtk3/im_config_dialog.c:188 100 | msgid "Keyboard layout:" 101 | msgstr "Klavye düzeni:" 102 | 103 | #: gtk3/im_dialog.ui:58 gtk3/im_widget.ui:47 104 | msgid "Language" 105 | msgstr "Dil" 106 | 107 | #: gtk3/ui_widget.c:106 108 | #, c-format 109 | msgid "No configuration option for %s." 110 | msgstr "%s için yapılandırma seçeneği yok." 111 | 112 | #: gtk/im_widget.c:115 gtk3/im_dialog.ui:78 113 | msgid "Only Show Current Language" 114 | msgstr "Sadece Geçerli Dili Göster" 115 | 116 | #: gtk3/config_widget.c:432 gtk3/config_widget.c:529 gtk/config_widget.c:270 117 | msgid "Other" 118 | msgstr "Diğer" 119 | 120 | #: gtk3/keygrab.c:80 gtk/keygrab.c:74 121 | msgid "Please press the new key combination" 122 | msgstr "ütfen yeni tuş kombinasyonuna basınız" 123 | 124 | #: gtk3/main_window.c:293 125 | msgid "Search Addon" 126 | msgstr "Arama Eklentisi" 127 | 128 | #: gtk3/im_dialog.c:165 129 | msgid "Search Input Method" 130 | msgstr "Giriş Yöntemi Ara" 131 | 132 | #: gtk3/config_widget.c:614 133 | msgid "Show Advanced Options" 134 | msgstr "Gelişmiş Seçenekleri Göster" 135 | 136 | #: gtk/im_widget.c:192 gtk3/im_widget.ui:87 137 | msgid "" 138 | "The first input method will be inactive state. Usually you need to put " 139 | "Keyboard or Keyboard - layout name in the first place." 140 | msgstr "" 141 | "İlk giriş yöntemi aktif değildirr. Genellikle Klavye veya " 142 | "Klavye - düzen adı koymanız gerekir." 143 | 144 | #: gtk3/im_dialog.c:253 gtk3/im_dialog.c:255 gtk3/im_widget.c:259 145 | #: gtk3/im_widget.c:261 gtk/im_widget.c:314 gtk/im_widget.c:316 146 | msgid "Unknown" 147 | msgstr "Bilinmeyen" 148 | 149 | #: gtk3/gdm-languages.c:697 gtk/gdm-languages.c:697 150 | msgid "Unspecified" 151 | msgstr "Belirtilmemiş" 152 | 153 | #: gtk3/config_widget.c:929 gtk3/im_config_dialog.c:73 gtk3/im_dialog.c:128 154 | #: gtk3/sub_config_widget.c:169 155 | msgid "_Cancel" 156 | msgstr "_İptal" 157 | 158 | #: gtk3/config_widget.c:931 gtk3/im_config_dialog.c:75 gtk3/im_dialog.c:130 159 | #: gtk3/sub_config_widget.c:171 160 | msgid "_OK" 161 | msgstr "_OK" 162 | -------------------------------------------------------------------------------- /po/zh_CN.po: -------------------------------------------------------------------------------- 1 | # SOME DESCRIPTIVE TITLE. 2 | # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER 3 | # This file is distributed under the same license as the PACKAGE package. 4 | # 5 | # Translators: 6 | # marguerite su , 2014 7 | # csslayer , 2013,2017 8 | # csslayer , 2010-2012 9 | # csslayer , 2013 10 | msgid "" 11 | msgstr "" 12 | "Project-Id-Version: fcitx\n" 13 | "Report-Msgid-Bugs-To: fcitx-dev@googlegroups.com\n" 14 | "POT-Creation-Date: 2017-06-09 11:12-0700\n" 15 | "PO-Revision-Date: 2017-06-09 18:05+0000\n" 16 | "Last-Translator: csslayer \n" 17 | "Language-Team: Chinese (China) (http://www.transifex.com/fcitx/fcitx/" 18 | "language/zh_CN/)\n" 19 | "Language: zh_CN\n" 20 | "MIME-Version: 1.0\n" 21 | "Content-Type: text/plain; charset=UTF-8\n" 22 | "Content-Transfer-Encoding: 8bit\n" 23 | "Plural-Forms: nplurals=1; plural=0;\n" 24 | 25 | #: gtk3/im_dialog.c:124 26 | msgid "Add input method" 27 | msgstr "添加输入法" 28 | 29 | #: gtk3/main_window.c:372 gtk/main_window.c:375 30 | msgid "Addon" 31 | msgstr "附加组件" 32 | 33 | #: gtk3/main_window.c:283 34 | msgid "Advanced" 35 | msgstr "高级" 36 | 37 | #: gtk3/main_window.c:221 38 | msgid "Appearance" 39 | msgstr "外观" 40 | 41 | #: gtk/im_widget.c:92 42 | msgid "Available Input Method" 43 | msgstr "可用输入法" 44 | 45 | #: gtk3/ui_widget.c:48 46 | msgid "Cannot load currently used user interface info" 47 | msgstr "无法加载当前所用用户界面信息" 48 | 49 | #: gtk3/config_widget.c:239 gtk/config_widget.c:192 50 | msgid "Clear font setting" 51 | msgstr "清除字体设置" 52 | 53 | #: gtk3/main_window.c:355 gtk/main_window.c:360 54 | msgid "Configure" 55 | msgstr "配置 " 56 | 57 | #: gtk/im_widget.c:146 58 | msgid "Current Input Method" 59 | msgstr "当前输入法" 60 | 61 | #: gtk3/im_config_dialog.c:160 62 | msgid "Default" 63 | msgstr "默认" 64 | 65 | #: gtk3/im_config_dialog.c:128 66 | msgid "Default keyboard layout" 67 | msgstr "默认键盘布局" 68 | 69 | #: gtk3/sub_config_widget.c:310 70 | msgid "Didn't install related component." 71 | msgstr "未安装相关组件。" 72 | 73 | #: gtk3/keygrab.c:66 gtk3/keygrab.c:172 gtk/keygrab.c:138 74 | msgid "Empty" 75 | msgstr "空" 76 | 77 | #: gtk3/main_window.c:203 gtk/main_window.c:294 78 | msgid "Global Config" 79 | msgstr "全局配置" 80 | 81 | #: gtk3/main_window.c:209 gtk/im_widget.c:102 gtk/im_widget.c:153 82 | #: gtk/main_window.c:300 gtk3/im_dialog.ui:46 gtk3/im_widget.ui:35 83 | msgid "Input Method" 84 | msgstr "输入法" 85 | 86 | #: gtk3/main_window.c:106 gtk/main_window.c:149 87 | msgid "Input Method Configuration" 88 | msgstr "输入法配置" 89 | 90 | #: gtk3/im_config_dialog.c:160 91 | msgid "Input Method Default" 92 | msgstr "输入法默认" 93 | 94 | #: gtk3/im_config_dialog.c:205 95 | msgid "Input method settings:" 96 | msgstr "输入法设置:" 97 | 98 | #: gtk3/im_config_dialog.c:188 99 | msgid "Keyboard layout to use when no input window:" 100 | msgstr "无输入窗口时使用的键盘布局:" 101 | 102 | #: gtk3/im_config_dialog.c:188 103 | msgid "Keyboard layout:" 104 | msgstr "键盘布局:" 105 | 106 | #: gtk3/im_dialog.ui:58 gtk3/im_widget.ui:47 107 | msgid "Language" 108 | msgstr "语言" 109 | 110 | #: gtk3/ui_widget.c:106 111 | #, c-format 112 | msgid "No configuration option for %s." 113 | msgstr "%s 无配置选项。" 114 | 115 | #: gtk/im_widget.c:115 gtk3/im_dialog.ui:78 116 | msgid "Only Show Current Language" 117 | msgstr "仅显示当前语言" 118 | 119 | #: gtk3/config_widget.c:432 gtk3/config_widget.c:529 gtk/config_widget.c:270 120 | msgid "Other" 121 | msgstr "其它" 122 | 123 | #: gtk3/keygrab.c:80 gtk/keygrab.c:74 124 | msgid "Please press the new key combination" 125 | msgstr "请按下新按键组合" 126 | 127 | #: gtk3/main_window.c:293 128 | msgid "Search Addon" 129 | msgstr "搜索附加组件" 130 | 131 | #: gtk3/im_dialog.c:165 132 | msgid "Search Input Method" 133 | msgstr "搜索输入法" 134 | 135 | #: gtk3/config_widget.c:614 136 | msgid "Show Advanced Options" 137 | msgstr "显示高级选项" 138 | 139 | #: gtk/im_widget.c:192 gtk3/im_widget.ui:87 140 | msgid "" 141 | "The first input method will be inactive state. Usually you need to put " 142 | "Keyboard or Keyboard - layout name in the first place." 143 | msgstr "" 144 | "第一个输入法将为非激活状态。通常您需要将键盘键盘 - 布局名称放在第一位。" 146 | 147 | #: gtk3/im_dialog.c:253 gtk3/im_dialog.c:255 gtk3/im_widget.c:259 148 | #: gtk3/im_widget.c:261 gtk/im_widget.c:314 gtk/im_widget.c:316 149 | msgid "Unknown" 150 | msgstr "未知" 151 | 152 | #: gtk3/gdm-languages.c:697 gtk/gdm-languages.c:697 153 | msgid "Unspecified" 154 | msgstr "未指定" 155 | 156 | #: gtk3/config_widget.c:929 gtk3/im_config_dialog.c:73 gtk3/im_dialog.c:128 157 | #: gtk3/sub_config_widget.c:168 158 | msgid "_Cancel" 159 | msgstr "取消(_C)" 160 | 161 | #: gtk3/config_widget.c:931 gtk3/im_config_dialog.c:75 gtk3/im_dialog.c:130 162 | #: gtk3/sub_config_widget.c:170 163 | msgid "_OK" 164 | msgstr "确认(_O)" 165 | -------------------------------------------------------------------------------- /po/zh_TW.po: -------------------------------------------------------------------------------- 1 | # SOME DESCRIPTIVE TITLE. 2 | # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER 3 | # This file is distributed under the same license as the PACKAGE package. 4 | # 5 | # Translators: 6 | # byStarTW (pan93412) , 2019 7 | # csslayer , 2013 8 | # PHLin , 2017 9 | # Hiunn-hué , 2012 10 | # Hiunn-hué , 2012 11 | # 黃柏諺 , 2015 12 | # PHLin , 2017 13 | # Walter Cheuk , 2019 14 | # csslayer , 2013 15 | # csslayer , 2012-2013 16 | msgid "" 17 | msgstr "" 18 | "Project-Id-Version: fcitx\n" 19 | "Report-Msgid-Bugs-To: fcitx-dev@googlegroups.com\n" 20 | "POT-Creation-Date: 2020-03-08 00:02-0800\n" 21 | "PO-Revision-Date: 2019-12-10 02:15+0000\n" 22 | "Last-Translator: Walter Cheuk \n" 23 | "Language-Team: Chinese (Taiwan) (http://www.transifex.com/fcitx/fcitx/" 24 | "language/zh_TW/)\n" 25 | "Language: zh_TW\n" 26 | "MIME-Version: 1.0\n" 27 | "Content-Type: text/plain; charset=UTF-8\n" 28 | "Content-Transfer-Encoding: 8bit\n" 29 | "Plural-Forms: nplurals=1; plural=0;\n" 30 | 31 | #: gtk3/im_dialog.c:124 32 | msgid "Add input method" 33 | msgstr "新增輸入法" 34 | 35 | #: gtk3/main_window.c:372 gtk/main_window.c:375 36 | msgid "Addon" 37 | msgstr "附加元件" 38 | 39 | #: gtk3/main_window.c:283 40 | msgid "Advanced" 41 | msgstr "進階" 42 | 43 | #: gtk3/main_window.c:221 44 | msgid "Appearance" 45 | msgstr "外觀" 46 | 47 | #: gtk/im_widget.c:92 48 | msgid "Available Input Method" 49 | msgstr "可用的輸入法" 50 | 51 | #: gtk3/ui_widget.c:48 52 | msgid "Cannot load currently used user interface info" 53 | msgstr "無法載入目前使用者界面訊息" 54 | 55 | #: gtk3/config_widget.c:239 gtk/config_widget.c:192 56 | msgid "Clear font setting" 57 | msgstr "清除字體設定" 58 | 59 | #: gtk3/main_window.c:355 gtk/main_window.c:360 60 | msgid "Configure" 61 | msgstr "設定" 62 | 63 | #: gtk/im_widget.c:146 64 | msgid "Current Input Method" 65 | msgstr "目前的輸入法" 66 | 67 | #: gtk3/im_config_dialog.c:160 68 | msgid "Default" 69 | msgstr "預設" 70 | 71 | #: gtk3/im_config_dialog.c:128 72 | msgid "Default keyboard layout" 73 | msgstr "預設鍵盤配置" 74 | 75 | #: gtk3/sub_config_widget.c:311 76 | msgid "Didn't install related component." 77 | msgstr "沒有安裝相關組件。" 78 | 79 | #: gtk3/keygrab.c:66 gtk3/keygrab.c:172 gtk/keygrab.c:138 80 | msgid "Empty" 81 | msgstr "空" 82 | 83 | #: gtk3/main_window.c:203 gtk/main_window.c:294 84 | msgid "Global Config" 85 | msgstr "全域設定" 86 | 87 | #: gtk3/main_window.c:209 gtk/im_widget.c:102 gtk/im_widget.c:153 88 | #: gtk/main_window.c:300 gtk3/im_dialog.ui:46 gtk3/im_widget.ui:35 89 | msgid "Input Method" 90 | msgstr "輸入法" 91 | 92 | #: gtk3/main_window.c:106 gtk/main_window.c:149 93 | msgid "Input Method Configuration" 94 | msgstr "輸入法設定" 95 | 96 | #: gtk3/im_config_dialog.c:160 97 | msgid "Input Method Default" 98 | msgstr "輸入法預設" 99 | 100 | #: gtk3/im_config_dialog.c:205 101 | msgid "Input method settings:" 102 | msgstr "輸入法設定:" 103 | 104 | #: gtk3/im_config_dialog.c:188 105 | msgid "Keyboard layout to use when no input window:" 106 | msgstr "無可輸入窗口時使用的鍵盤配置:" 107 | 108 | #: gtk3/im_config_dialog.c:188 109 | msgid "Keyboard layout:" 110 | msgstr "鍵盤配置:" 111 | 112 | #: gtk3/im_dialog.ui:58 gtk3/im_widget.ui:47 113 | msgid "Language" 114 | msgstr "語言" 115 | 116 | #: gtk3/ui_widget.c:106 117 | #, c-format 118 | msgid "No configuration option for %s." 119 | msgstr "%s 無設定選項。" 120 | 121 | #: gtk/im_widget.c:115 gtk3/im_dialog.ui:78 122 | msgid "Only Show Current Language" 123 | msgstr "僅顯示目前的語言" 124 | 125 | #: gtk3/config_widget.c:432 gtk3/config_widget.c:529 gtk/config_widget.c:270 126 | msgid "Other" 127 | msgstr "其他" 128 | 129 | #: gtk3/keygrab.c:80 gtk/keygrab.c:74 130 | msgid "Please press the new key combination" 131 | msgstr "請按下新按鍵組合" 132 | 133 | #: gtk3/main_window.c:293 134 | msgid "Search Addon" 135 | msgstr "搜索附加元件" 136 | 137 | #: gtk3/im_dialog.c:165 138 | msgid "Search Input Method" 139 | msgstr "搜尋輸入法" 140 | 141 | #: gtk3/config_widget.c:614 142 | msgid "Show Advanced Options" 143 | msgstr "顯示進階設定選項" 144 | 145 | #: gtk/im_widget.c:192 gtk3/im_widget.ui:87 146 | msgid "" 147 | "The first input method will be inactive state. Usually you need to put " 148 | "Keyboard or Keyboard - layout name in the first place." 149 | msgstr "" 150 | "第一個輸入法將作為非激活狀態。通常您要將鍵盤或者鍵盤 - 配置名稱" 151 | " 放在第一位。" 152 | 153 | #: gtk3/im_dialog.c:253 gtk3/im_dialog.c:255 gtk3/im_widget.c:259 154 | #: gtk3/im_widget.c:261 gtk/im_widget.c:314 gtk/im_widget.c:316 155 | msgid "Unknown" 156 | msgstr "未知" 157 | 158 | #: gtk3/gdm-languages.c:697 gtk/gdm-languages.c:697 159 | msgid "Unspecified" 160 | msgstr "未指定" 161 | 162 | #: gtk3/config_widget.c:929 gtk3/im_config_dialog.c:73 gtk3/im_dialog.c:128 163 | #: gtk3/sub_config_widget.c:169 164 | msgid "_Cancel" 165 | msgstr "取消(_C)" 166 | 167 | #: gtk3/config_widget.c:931 gtk3/im_config_dialog.c:75 gtk3/im_dialog.c:130 168 | #: gtk3/sub_config_widget.c:171 169 | msgid "_OK" 170 | msgstr "確定(_O)" 171 | --------------------------------------------------------------------------------