You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
142 lines
4.9 KiB
142 lines
4.9 KiB
#include <gtk/gtk.h>
|
|
#include <gtk/gtkx.h>
|
|
#include <locale.h>
|
|
#include <stdio.h>
|
|
#include <unistd.h>
|
|
#include <stdlib.h>
|
|
#include <libintl.h>
|
|
#include <getopt.h>
|
|
#include <libublsettings.h>
|
|
#include <libublsettings-gtk3.h>
|
|
#include <libublsettingsui-gtk3.h>
|
|
#ifdef WEBKIT_FOUND
|
|
#include <webkit2/webkit2.h>
|
|
#endif
|
|
#include "ubl-strings.h"
|
|
|
|
#define _(String) gettext(String)
|
|
|
|
|
|
|
|
#define glade_path "/com/ublinux/ui/ubl-settings-keyboard.glade"
|
|
#define glade_layouts_path "/com/ublinux/ui/ubl-settings-keyboard-layouts.glade"
|
|
#define glade_options_path "/com/ublinux/ui/ubl-settings-keyboard-options.glade"
|
|
#define banner_path "/com/ublinux/images/ubl-settings-keyboard-banner.png"
|
|
#define CssPath "/com/ublinux/css/ubl-settings-keyboard.css"
|
|
#define config_path yon_char_unite(yon_ubl_user_get_home_directory(),"/.config/",LocaleName,"/",LocaleName,".conf",NULL)
|
|
#define icon_path "com.ublinux.ubl-settings-keyboard"
|
|
|
|
#define LocaleName "ubl-settings-keyboard"
|
|
|
|
#define model_parameter "XKBMODEL"
|
|
#define model_parameter_command "ubconfig --source global get keyboard XKBMODEL"
|
|
#define keyboard_layout_parameter "XKBLAYOUT"
|
|
#define keyboard_layout_parameter_command "ubconfig --source global get keyboard XKBLAYOUT"
|
|
#define options_parameter "XKBOPTIONS"
|
|
#define options_parameter_command "ubconfig --source global get keyboard XKBOPTIONS"
|
|
#define num_lock_boot_parameter "NUMLOCK"
|
|
#define num_lock_boot_parameter_command "ubconfig --source global get keyboard NUMLOCK"
|
|
|
|
#define yon_config_get_custom_command(target) yon_char_unite("ubconfig --source ",target," get keyboard XKBMODEL XKBLAYOUT XKBOPTIONS NUMLOCK",NULL)
|
|
#define config_get_local_command "ubconfig --source global get keyboard XKBMODEL XKBLAYOUT XKBOPTIONS NUMLOCK"
|
|
#define config_get_global_command "ubconfig --source global get keyboard XKBMODEL XKBLAYOUT XKBOPTIONS NUMLOCK"
|
|
#define config_get_default_command ""
|
|
|
|
#define config_get_global_only_parameters ""
|
|
#define config_get_local_only_parameters ""
|
|
|
|
|
|
#define get_options_command "grep -E \"grp:.*toggle|grp_led:.*toggle|compose:.*toggle\" /usr/share/X11/xkb/rules/base.lst|sed -e 's/^ *//g' -e 's/\t//g' -e 's/toggle */toggle;/g'"
|
|
#define get_models_command "sed '/<\\/modelList>/q' /usr/share/X11/xkb/rules/base.xml | grep -E '^ {8,8}<name>|^ {8,8}<description>'|sed -e 's/ *<name>//g' -e 's,</name>,,g' -e 's/ *<description>//g' -e 's,</description>,,g'"
|
|
#define layouts_path "resource:///com/ublinux/csv/layouts.csv"
|
|
|
|
typedef char* string;
|
|
|
|
__attribute__((unused)) static \
|
|
string version_application;
|
|
|
|
typedef struct {
|
|
template_config_fields
|
|
int save_config;
|
|
config_str launch_arguments;
|
|
int launch_size;
|
|
char *options;
|
|
GtkListStore *layouts_list;
|
|
GtkListStore *options_list;
|
|
} config;
|
|
|
|
typedef struct {
|
|
template_window_fields
|
|
|
|
GtkWidget *NumLockCombo;
|
|
GtkWidget *ModelCombo;
|
|
GtkWidget *keyboard;
|
|
GtkWidget *keytable;
|
|
GtkWidget *grp_toggle;
|
|
GtkWidget *OptionsEntry;
|
|
GtkWidget *OptionsButton;
|
|
GtkWidget *LayoutsTree;
|
|
GtkWidget *MoveUpButton;
|
|
GtkWidget *MoveDownButton;
|
|
GtkWidget *AddButton;
|
|
GtkWidget *RemoveButton;
|
|
GtkTreeModelFilter *layoutsFilter;
|
|
GtkListStore *layoutsList;
|
|
GtkListStore *modelsList;
|
|
} main_window;
|
|
|
|
|
|
typedef struct {
|
|
GtkWidget *Window;
|
|
|
|
GtkWidget *HatText;
|
|
GtkWidget *HeaderText;
|
|
GtkWidget *InfoText;
|
|
GtkWidget *AlwaysOpenCheck;
|
|
|
|
GtkWidget *CloseButton;
|
|
GtkWidget *AcceptButton;
|
|
} documentation_confirmation_window;
|
|
|
|
typedef struct {
|
|
GtkWidget *Window;
|
|
GtkWidget *MainTree;
|
|
GtkWidget *CancelButton;
|
|
GtkWidget *AcceptButton;
|
|
GtkListStore *list;
|
|
} layouts_window;
|
|
|
|
typedef struct {
|
|
GtkWidget *Window;
|
|
GtkWidget *CancelButton;
|
|
GtkWidget *AcceptButton;
|
|
} options_window;
|
|
|
|
void on_save_done(main_window *, config_str output, int size);
|
|
void on_config_global_local_save(GtkWidget *, main_window *);
|
|
void on_config_local_save(GtkWidget *, main_window *);
|
|
void on_config_global_save(GtkWidget *, main_window *);
|
|
void on_config_custom_save(GtkWidget *, main_window *);
|
|
void on_config_local_load(GtkWidget *,main_window *);
|
|
void on_config_global_load(GtkWidget *,main_window *);
|
|
void on_config_custom_load(GtkWidget *,main_window *);
|
|
|
|
void yon_load_proceed(YON_CONFIG_TYPE type);
|
|
|
|
gboolean yon_interface_update(main_window *);
|
|
|
|
void on_save_done(main_window *widgets, config_str output, int size);
|
|
|
|
void config_init();
|
|
|
|
void yon_main_window_complete(main_window *widgets);
|
|
void on_move_down(GtkWidget *self, main_window *widgets);
|
|
void on_move_up(GtkWidget *self, main_window *widgets);
|
|
void on_layouts_add(GtkWidget *self, main_window *widgets);
|
|
void on_layouts_accept(GtkWidget *self, dictionary *dict);
|
|
void on_options_open(GtkWidget *self, main_window *widgets);
|
|
void on_options_accept(GtkWidget *self, dictionary *dict);
|
|
void on_model_changed(GtkComboBoxText *self, main_window *widgets);
|
|
void on_num_lock_changed(GtkComboBox *self, main_window *widgets);
|
|
void on_layouts_remove(GtkWidget *, main_window *widgets);
|
|
void yon_layouts_save(main_window *widgets); |