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.
281 lines
10 KiB
281 lines
10 KiB
#ifndef UBL_SETTINGS_MANAGER
|
|
#define UBL_SETTINGS_MANAGER
|
|
|
|
#include <gtk/gtk.h>
|
|
#include <time.h>
|
|
#include <getopt.h>
|
|
#include "ubl-settings-manager-cm.h"
|
|
#ifdef WEBKIT_FOUND
|
|
#include <webkit2/webkit2.h>
|
|
#endif
|
|
|
|
#define UBLINUX_WIKI_COMMAND "xdg-open http://wiki.ublinux.ru"
|
|
#define UBLINUX_WIKI_LINK " http://wiki.ublinux.ru"
|
|
|
|
#define cmdVersionText yon_char_get_augumented(yon_char_get_augumented(_("Version: "),version_application),"\n")
|
|
#define cmdHelpText yon_char_get_augumented(yon_char_get_augumented(_("ubl-settings-manager version: "),version_application),_("\nGTK settings manager for UBLinux\nUsage: ubl-settings-manager [OPTIONS...]\nOptions:\n -h, --help Show this help\n -V, --version Show package version\n --lock-settings Lock menu settings\n"))
|
|
#define GladePath "/usr/share/ubl-settings-manager/ui/ubl-settings-manager.glade"
|
|
#define CssPath "/usr/share/ubl-settings-manager/css/ubl-settings-manager.css"
|
|
#define GlobalConfigPath "/etc/xdg/ubl-settings-manager/ubl-settings-manager.conf"
|
|
#define UserConfigPath "/.config/ubl-settings-manager/ubl-settings-manager.conf"
|
|
#define AppIconPath "com.ublinux.ubl-settings-manager"
|
|
#define AppBannerPath "/usr/share/ubl-settings-manager/images/ubl-settings-manager-banner.png"
|
|
#define DesktopPath "/usr/share/applications/"
|
|
#define IconPicturesPath "/usr/share/icons/hicolor/scalable/apps/"
|
|
#define ublinux_logo "/usr/share/ubl-settings-manager/images/ublinux-logo.svg"
|
|
#define LocalePath "/usr/share/locale"
|
|
#define LocaleName "ubl-settings-manager"
|
|
#define ubl_settings_infoPath "ubl-settings-info"
|
|
#define ubl_settings_infoPathLaunch "ubl-settings-info --socket-id="
|
|
typedef char* string;
|
|
string version_application = "1.3";
|
|
|
|
#define UBL_SETTINGS_MANAGER_TITLE _("UBLinux Settings Manager")
|
|
#define UBL_SETTINGS_MANAGER_ABOUT_TITLE _("About UBLinux Settings Manager")
|
|
#define ABOUT_PROJECT_HOME_PAGE_LABEL _("Project Home Page")
|
|
#define ABOUT_PROJECT_COMMENTS_LABEL _("Settings manager for UBLinux")
|
|
#define CONFIG_LOAD_ERROR _("Config loading failed!\n")
|
|
#define DOUBLE_CLICK_SELECTION_LABEL _("Double click selection")
|
|
#define SECTIONS_MANAGEMENT_LABEL _("Sections management")
|
|
#define UNDERSTOOD_LABEL _("Understood")
|
|
#define ABOUT_LABEL _("About...")
|
|
#define DOCUMENTATION_LABEL _("Documentation")
|
|
#define SETTINGS_LABEL _("Settings")
|
|
#define ALWAYS_REDIRECT_LABEL _("Always redirect")
|
|
#define APPLY_LABEL _("Apply")
|
|
#define SAVE_AND_APPLY_LABEL _("Save and apply")
|
|
#define CLOSE_LABEL _("Close")
|
|
#define CANCEL_LABEL _("Cancel")
|
|
#define READ_ONLINE_LABEL _("Read online")
|
|
#define REDIRECTION_COMMENT_LABEL _("You will be redirected to documentation site, where user help pages are translated and supported by community.")
|
|
#define REDIRECTION_LABEL _("Would you like to read documentation in the Web?")
|
|
#define WINDOW_THEME_LABEL _("Window theme")
|
|
#define ICON_SIZE_LABEL _("Icon size")
|
|
#define BACK_TO_ALL_SETTINGS_LABEL _("Back to all settings")
|
|
|
|
|
|
typedef struct apps{
|
|
char *Name;
|
|
int Type;
|
|
char *Categories;
|
|
char *Exec;
|
|
char *Icon;
|
|
int Pluggable;
|
|
int DualPluggable;
|
|
} apps;
|
|
|
|
typedef struct {
|
|
char *command;
|
|
int *exitcode;
|
|
} thread_output;
|
|
|
|
typedef struct dictionary {
|
|
char *key;
|
|
void *data;
|
|
struct dictionary *next;
|
|
struct dictionary *prev;
|
|
struct dictionary *first;
|
|
} dictionary;
|
|
|
|
typedef struct IVGrapgicals{
|
|
char *sectionName;
|
|
char *categories;
|
|
GtkListStore *LV;
|
|
GtkWidget *Box;
|
|
GtkWidget *IV;
|
|
GtkWidget *label;
|
|
GtkWidget *sep;
|
|
GtkCellRendererPixbuf *iconRender;
|
|
} IVGraphicals;
|
|
|
|
typedef struct IconSection{
|
|
char *section;
|
|
char *categories;
|
|
} IconSection;
|
|
|
|
typedef struct {
|
|
int windowWidth;
|
|
int windowHeight;
|
|
int windowPosX;
|
|
int windowPosY;
|
|
int WindowTheme;
|
|
char *curThemeName;
|
|
int Mainiconsize;
|
|
int Gnomeiconsize;
|
|
int iconSegmentSize;
|
|
dictionary *sections;
|
|
int MainlabelSize;
|
|
int GnomelabelSize;
|
|
int *currentThemeLabelSize;
|
|
int *currentThemeIconSize;
|
|
int labelDensity;
|
|
char *lastUser;
|
|
int changed;
|
|
int fullscreen;
|
|
int lock_settings;
|
|
int GnomeDoubleClick;
|
|
int MainDoubleClick;
|
|
int *currentDoubleClick;
|
|
dictionary *SettingsSections;
|
|
int BannerHidden;
|
|
} config;
|
|
|
|
typedef struct {
|
|
GtkWidget *MainFrame;
|
|
GtkWidget *MainBox;
|
|
GtkWidget *ElemBox;
|
|
GtkWidget *DragButtonBox;
|
|
GtkWidget *DragUpButton;
|
|
GtkWidget *DragDownButton;
|
|
GtkWidget *NameBox;
|
|
GtkWidget *CategoriesBox;
|
|
GtkWidget *OptionBox;
|
|
GtkWidget *NameEntry;
|
|
GtkWidget *NameLabel;
|
|
GtkWidget *CategoriesEntry;
|
|
GtkWidget *CategoriesLabel;
|
|
GtkWidget *EditButtonBox;
|
|
GtkWidget *EditButtonAccept;
|
|
GtkWidget *EditButtonCancel;
|
|
GtkWidget *ButtonEdit;
|
|
GtkWidget *ButtonDelete;
|
|
GtkWidget *DeleditBox;
|
|
} SectionSettingSegment;
|
|
|
|
typedef struct {
|
|
GtkBuilder *builder;
|
|
GtkWidget *window;
|
|
dictionary *ICSys;
|
|
GtkWidget *DesktopBasic;
|
|
GtkWidget *DesktopSocket;
|
|
GtkWidget *ButtonBackToMain;
|
|
GtkWidget *DialogOpenDocumentation;
|
|
GtkWidget *CancelHelpButton;
|
|
GtkWidget *ReadHelpButton;
|
|
GtkWidget *AlwaysOpenDocumentation;
|
|
GtkWidget *helpHeader;
|
|
GtkWidget *helpText;
|
|
GtkWidget *appSettings;
|
|
GtkWidget *SettingsWindow;
|
|
GtkWidget *settingsSizeSlider;
|
|
GtkWidget *settingsSizeInfoLabel;
|
|
GtkWidget *settingsThemeChooser;
|
|
GtkWidget *settingsCancel;
|
|
GtkWidget *settingsAccept;
|
|
GtkWidget *settingsIcon;
|
|
GtkWidget *socket;
|
|
GtkWidget *socketplace;
|
|
GtkWidget *HideWhileLaunch;
|
|
GtkWidget *MenuItemSettings;
|
|
GtkWidget *MenuItemDocumentation;
|
|
GtkWidget *MenuItemAboutSystem;
|
|
GtkWidget *LabelTitle;
|
|
GtkWidget *settingsSubmenuLabelSize;
|
|
GtkWidget *settingsSubmenuLabelTheme;
|
|
GtkWidget *GnomePaned;
|
|
GtkWidget *GnomeInfoLabel;
|
|
GtkWidget *workingwindow;
|
|
GtkWidget *settingsSectionsSettingsButton;
|
|
GtkWidget *SectionSettingsWindow;
|
|
GtkWidget *SectionSettingsPack;
|
|
dictionary *SettingsSections;
|
|
GtkWidget *SectionSettingAddButton;
|
|
GtkWidget *SectionSettingAddNameEntry;
|
|
GtkWidget *SectionSettingAddCategoriesEntry;
|
|
GtkWidget *SectionSettingsClearEntryButton;
|
|
GtkWidget *SectionSettingsSaveButton;
|
|
GtkWidget *SectionSettingsCloseButton;
|
|
GtkWidget *GnomeInfoDetailsLabel;
|
|
GtkWidget *CautionWindow;
|
|
GtkWidget *CautionUnderstandButton;
|
|
GtkWidget *socketbuttonplace;
|
|
GtkWidget *socketbutton;
|
|
GtkWidget *Overlay;
|
|
GtkWidget *ThirdSocketPlace;
|
|
GtkWidget *ThirdSocket;
|
|
int appssize;
|
|
apps *applist;
|
|
GtkWidget *icvpack;
|
|
GtkWidget *infoWarningWindow;
|
|
GtkWidget *infoWarningButton;
|
|
GtkWidget *infoWarningLabel;
|
|
GtkWidget *BannerRevealer;
|
|
GtkWidget *Revealer;
|
|
GtkWidget *settingsDoubleClickSwitch;
|
|
GtkWidget *settingsDoubleClickLabel;
|
|
GtkWidget *BackToSettingsLabel;
|
|
|
|
} actionWidgets;
|
|
|
|
typedef enum {
|
|
ACTIONWIDGETS,
|
|
ICONSECTION,
|
|
IVGRAPHICALS,
|
|
OTHER
|
|
|
|
} DICT_TYPE;
|
|
|
|
void on_plug_added(GtkSocket* self, actionWidgets *builder);
|
|
void on_plug_removed(GtkSocket* self, actionWidgets *widgets);
|
|
void on_Item_activated(GtkIconView* self, GtkTreePath* path, actionWidgets *applist);
|
|
void on_gnome_Item_activated(GtkIconView* self, GtkTreePath* path, actionWidgets *applist);
|
|
void on_item_selection_changed(GtkIconView *IV, actionWidgets *widgets);
|
|
void on_ButtonOpenHelp_activated(GtkWidget *button, GtkBuilder *builder);
|
|
void on_backToSettingsButton_clicked(GtkWidget *button,actionWidgets *sctb);
|
|
void on_CancelHelpButton_activated(GtkWidget *button,GtkBuilder *builder);
|
|
void on_ReadHelpButton_activated(GtkWidget *button, GtkBuilder *builder);
|
|
int launch_app_with_arguments(char *name, char *args);
|
|
int launch_app(char *name);
|
|
int py_launch_app(char *name,char *args);
|
|
int on_settings_accept(GtkWidget *button, dictionary **widgetsDs);
|
|
void on_paned_move(GtkPaned* self, GtkScrollType* scroll_type, actionWidgets *widgets);
|
|
int on_settingsOpen(GtkWidget *button, actionWidgets *widgets);
|
|
int on_settings_icon_size_changed(GtkWidget* self, actionWidgets *widgets);
|
|
int on_settings_cancel(GtkWidget *button, actionWidgets *widgets);
|
|
apps *get_app_by_name(apps *applist,char *name, int size);
|
|
int reload_list(IVGraphicals *section);
|
|
int load_apps(IVGraphicals *section, apps *applist, int size);
|
|
int load_apps_with_clear(IVGraphicals *section, apps *applist, int size);
|
|
int hide_if_unfound(dictionary *widgetsDc);
|
|
GtkWidget *create_socket(actionWidgets *builder);
|
|
void sort_apps(apps *applist,int size);
|
|
apps *find_apps(int *sizef);
|
|
int check_categories(apps app, char *catstocheck);
|
|
int setup_config();
|
|
void update_double_clicks(dictionary *widgetsD);
|
|
void yon_icv_resize_item(dictionary *icdict, GtkWidget *paned);
|
|
dictionary *yon_theme_new(dictionary **widgetss, GtkBuilder *builder, char *theme_id, apps *applist, int appsize);
|
|
char *yon_char_get_augumented(char *source, char *append);
|
|
char *yon_cut(char *source, int size, int startpos);
|
|
int yon_set_sections(IconSection *section);
|
|
void yon_set_default_sections(dictionary *section);
|
|
char *yon_char_divide_search(char *source, char* dividepos, int delete_divider);
|
|
char *yon_char_divide(char *source, int dividepos);
|
|
dictionary *yon_section_new(dictionary *section, char *section_name, char *categories);
|
|
void yon_switch_theme(dictionary **dict, dictionary *newone);
|
|
dictionary *yon_dictionary_find(dictionary **dict, char *key);
|
|
void yon_segment_show(actionWidgets *widgets, SectionSettingSegment *sgm);
|
|
dictionary *yon_dictionary_create_empty();
|
|
dictionary *yon_dictionary_rip(dictionary *dict);
|
|
dictionary *yon_dictionary_get_last(dictionary *dict);
|
|
dictionary *yon_dictionary_switch_places(dictionary *dict,int aim);
|
|
dictionary *yon_dictionary_create_with_data(char *key, void *data);
|
|
dictionary *yon_dictionary_create_with_data_connected(dictionary *dict, char *key, void *data);
|
|
dictionary *yon_dictionary_connect(dictionary *old, dictionary *toconnect);
|
|
SectionSettingSegment *yon_create_section_setting(char *name, char *categories);
|
|
void yon_segments_show(actionWidgets *widgets);
|
|
void yon_segments_hide(actionWidgets *widgets);
|
|
void yon_dictionary_make_first(dictionary *dict);
|
|
dictionary *yon_create_icon_section_list(dictionary *sections);
|
|
int yon_show_icon_views(dictionary *IVS,actionWidgets *widgets);
|
|
void yon_icon_size_convert(int mode);
|
|
char *yon_char_new(char *chr);
|
|
int launch(thread_output *thread);
|
|
float yon_time_average(dictionary *times);
|
|
void yon_time_reg_for_average(dictionary *listofregs, int size, time_t tm);
|
|
void yon_dictionary_switch_to_last(dictionary **dict);
|
|
dictionary *yon_dictionary_create_conneced(dictionary *targetdict);
|
|
int yon_get_icon_size(int size);
|
|
char *yon_char_from_int(int int_to_convert);
|
|
|
|
#endif |