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.
ublexec/source/ublexec.h

121 lines
3.7 KiB

#include <gtk/gtk.h>
#include <gtk/gtkx.h>
#include <gtk/gtkspinbutton.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 WIKI_LINK "https://wiki.ublinux.ru/software/programs_and_utilities/all/ublexec"
#define _(String) gettext(String)
#define glade_path "/com/ublinux/ui/ublexec.glade"
#define banner_path "/com/ublinux/images/ublexec-banner.png"
#define CssPath "/com/ublinux/css/ublexec.css"
#define icon_path "com.ublinux.ublexec"
#define config_path yon_char_unite(yon_ubl_user_get_home_directory(),"/.config/",LocaleName,"/",LocaleName,".conf",NULL)
#define get_user_id_min_command "grep \"^UID_MIN\" /etc/login.defs |grep -vE '(nologin|false)$' | sed -e 's/\t/ /g' -e 's/ */ /g'|grep -oE \"[0-9]{1,}\""
#define get_user_id_max_command "grep \"^UID_MAX\" /etc/login.defs | sed -e 's/\t/ /g' -e 's/ */ /g'|grep -oE \"[0-9]{1,}\""
#define get_users_command "getent passwd |cut -d: -f1,3"
#define get_terminals_info_command "ublexec-cli -l|sed -e 's/\t/ /g' -e 's/^ *//g' -e 's/ */:/g'|cut -d':' -f1,2,3"
#define get_run_command_command "ublexec-cli -q"
#define LocalePath "/usr/share/locale"
#define LocaleName "ublexec"
typedef char* string;
string version_application;
char *local;
typedef struct {
template_config_fields;
int save_config;
config_str launch_arguments;
int launch_size;
int user_id_min;
int user_id_max;
dictionary *terminals;
} config;
typedef struct {
char *name;
char *name_simple;
char *exec;
} terminal_info;
typedef struct {
//Standard
template_window_fields;
GtkWidget *TargetNameEntry;
GtkWidget *targetNameEntry;
GtkWidget *chooseFileButton;
GtkWidget *chooseDesktopButton;
GtkWidget *runWithTerminalCheck;
GtkWidget *runWithTerminalCombo;
GtkWidget *runWithUserCheck;
GtkWidget *runWithUserPkexecCheck;
GtkWidget *runWithUserSuCheck;
GtkWidget *runWithUserSudoCheck;
GtkWidget *runWithUserCombo;
GtkWidget *priorityCheck;
GtkWidget *priorityScale;
GtkWidget *prioritySpinEntry;
GtkWidget *prioritySpinIncreaseButton;
GtkWidget *prioritySpinDecreaseButton;
GtkWidget *highestPriorityLabel;
GtkWidget *commandCheck;
GtkWidget *commandEntry;
GtkWidget *runButton;
// Custom
} main_window;
typedef struct {
GtkWidget *Window;
GtkWidget *HatText;
GtkWidget *HeaderText;
GtkWidget *InfoText;
GtkWidget *AlwaysOpenCheck;
GtkWidget *CloseButton;
GtkWidget *AcceptButton;
} documentation_confirmation_window;
main_window *setup_window();
void on_save_done(main_window *, config_str output, int size);
void on_file_chooser_open(GtkWidget *self, main_window *widgets);
void on_application_chooser_open(GtkWidget *self, main_window *widgets);
void on_user_changed(GtkWidget *self, main_window *widgets);
void on_su_sudo_activate(GtkWidget *self, main_window *widgets);
void on_user_activate(GtkToggleButton *self, main_window *widgets);
void on_user_switching(GtkToggleButton *self, main_window *widgets);
void on_setup_command(GtkWidget *self, main_window *widgets);
void on_command_run(GtkWidget *self, main_window *widgets);
void config_init();
void on_adjustment_changed(GtkAdjustment *self, main_window *widgets);
void on_adjustment_increase(GtkWidget *self, main_window *widgets);
void on_adjustment_decrease(GtkWidget *self, main_window *widgets);
main_window *yon_main_window_complete(main_window *widgets);
gboolean yon_interface_update(main_window *);
int main(int argc, char *argv[]);