Template update

pull/158/head
parent cb1f99682c
commit 0c33cc8bf2

@ -12,17 +12,17 @@ pkg_check_modules(VTE291 REQUIRED vte-2.91)
include_directories(${VTE291_INCLUDE_DIRS})
link_directories(${VTE291_LIBRARY_DIRS})
add_definitions(${VTE291_CFLAGS_OTHER})
add_definitions(-DVTE_INCLUDE)
pkg_check_modules(POLKIT REQUIRED polkit-gobject-1)
include_directories(${POLKIT_INCLUDE_DIRS})
link_directories(${POLKIT_LIBRARY_DIRS})
add_definitions(${POLKIT_CFLAGS_OTHER})
# pkg_check_modules(POLKIT REQUIRED polkit-gobject-1)
# include_directories(${POLKIT_INCLUDE_DIRS})
# link_directories(${POLKIT_LIBRARY_DIRS})
# add_definitions(${POLKIT_CFLAGS_OTHER})
find_library(WEBKIT_LIBRARIES_FOUND webkit2gtk-4.0 webkit2gtk-web-extension-4.0)
option(WEBKIT_FOUND "No" OFF)
if(WEBKIT_LIBRARIES_FOUND)
option(WEBKIT_FOUND "Yes" ON)
add_definitions(-DWEBKIT_INCLUDE)
PKG_CHECK_MODULES(WEBKIT REQUIRED webkit2gtk-4.0 webkit2gtk-web-extension-4.0)
include_directories(${WEBKIT_INCLUDE_DIRS})
link_directories(${WEBKIT_LIBRARY_DIRS})

@ -2936,73 +2936,73 @@ void on_enable_disable_clicked(GtkButton *, main_window *widgets){
}
// standard functions
gboolean on_unelevate(main_window* widgets);
gboolean on_unelevate(main_window* widgets){
yon_ubl_status_box_render(UNAUTHTORIZED_LABEL,BACKGROUND_IMAGE_INFO_TYPE);
gtk_widget_set_sensitive(widgets->UpgradePermissionsMenuItem,1);
g_object_unref(main_config.authorization_result);
main_config.authorization_result=NULL;
return G_SOURCE_REMOVE;
}
gboolean yon_timeoutcheck_authtorization(gpointer widgets);
gboolean yon_timeoutcheck_authtorization(gpointer widgets){
if (!polkit_authorization_result_get_is_authorized(main_config.authorization_result)){
gdk_threads_add_idle((GSourceFunc)on_unelevate,widgets);
return G_SOURCE_REMOVE;
}
return G_SOURCE_CONTINUE;
}
void *yon_authorized_loop(void*);
void *yon_authorized_loop(void*){
while (polkit_authorization_result_get_is_authorized(main_config.authorization_result)){
g_mutex_lock(&main_config.authorized_mutex);
if (main_config.queue){
for (int i=0;i<main_config.queue_size;i++){
G_SOURCE_FUNC(main_config.queue[i]->func)(main_config.queue[i]->data);
}
free(main_config.queue);
main_config.queue=NULL;
main_config.queue_size=0;
}
g_mutex_unlock(&main_config.authorized_mutex);
}
return NULL;
}
// gboolean on_unelevate(main_window* widgets);
// gboolean on_unelevate(main_window* widgets){
// yon_ubl_status_box_render(UNAUTHTORIZED_LABEL,BACKGROUND_IMAGE_INFO_TYPE);
// gtk_widget_set_sensitive(widgets->UpgradePermissionsMenuItem,1);
// g_object_unref(main_config.authorization_result);
// main_config.authorization_result=NULL;
// return G_SOURCE_REMOVE;
// }
// gboolean yon_timeoutcheck_authtorization(gpointer widgets);
// gboolean yon_timeoutcheck_authtorization(gpointer widgets){
// if (!polkit_authorization_result_get_is_authorized(main_config.authorization_result)){
// gdk_threads_add_idle((GSourceFunc)on_unelevate,widgets);
// return G_SOURCE_REMOVE;
// }
// return G_SOURCE_CONTINUE;
// }
void authorize_callback(GObject *source, GAsyncResult *res, main_window *widgets);
void authorize_callback(GObject *source, GAsyncResult *res, main_window *widgets){
GError *err = NULL;
main_config.authorization_result = polkit_authority_check_authorization_finish(POLKIT_AUTHORITY(source),res,&err);
if (err){
// void *yon_authorized_loop(void*);
// void *yon_authorized_loop(void*){
// while (polkit_authorization_result_get_is_authorized(main_config.authorization_result)){
// g_mutex_lock(&main_config.authorized_mutex);
// if (main_config.queue){
// for (int i=0;i<main_config.queue_size;i++){
// G_SOURCE_FUNC(main_config.queue[i]->func)(main_config.queue[i]->data);
// }
// free(main_config.queue);
// main_config.queue=NULL;
// main_config.queue_size=0;
// }
// g_mutex_unlock(&main_config.authorized_mutex);
// }
// return NULL;
// }
}
// void authorize_callback(GObject *source, GAsyncResult *res, main_window *widgets);
// void authorize_callback(GObject *source, GAsyncResult *res, main_window *widgets){
// GError *err = NULL;
// main_config.authorization_result = polkit_authority_check_authorization_finish(POLKIT_AUTHORITY(source),res,&err);
// if (err){
g_thread_new("auth_loop",(GThreadFunc)yon_authorized_loop,NULL);
yon_ubl_status_box_render(AUTHTORIZED_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE);
g_timeout_add(10000, (GSourceFunc)yon_timeoutcheck_authtorization,widgets);
// }
// g_thread_new("auth_loop",(GThreadFunc)yon_authorized_loop,NULL);
// yon_ubl_status_box_render(AUTHTORIZED_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE);
// g_timeout_add(10000, (GSourceFunc)yon_timeoutcheck_authtorization,widgets);
}
// }
void on_permissions_changed(GtkMenuItem *,main_window *widgets){
PolkitAuthority *authority;
GError *error = NULL;
authority = polkit_authority_get_sync(NULL,&error);
if (!authority){
return;
}
polkit_authority_check_authorization(
authority,
main_config.process,
"org.freedesktop.policykit.exec",
NULL,
POLKIT_CHECK_AUTHORIZATION_FLAGS_ALLOW_USER_INTERACTION,
NULL,
(GAsyncReadyCallback)authorize_callback,
widgets
);
}
// void on_permissions_changed(GtkMenuItem *,main_window *widgets){
// PolkitAuthority *authority;
// GError *error = NULL;
// authority = polkit_authority_get_sync(NULL,&error);
// if (!authority){
// return;
// }
// polkit_authority_check_authorization(
// authority,
// main_config.process,
// "org.freedesktop.policykit.exec",
// NULL,
// POLKIT_CHECK_AUTHORIZATION_FLAGS_ALLOW_USER_INTERACTION,
// NULL,
// (GAsyncReadyCallback)authorize_callback,
// widgets
// );
// }
void config_init(){
main_config.always_open_documentation=0;
@ -3019,7 +3019,7 @@ void config_init(){
main_config.save_config=1;
main_config.queue=NULL;
main_config.queue_size=0;
main_config.process = polkit_unix_process_new_for_owner(getpid(),0,getuid());
// main_config.process = polkit_unix_process_new_for_owner(getpid(),0,getuid());
pid_t parent_pid;
parent_pid = getppid ();
if (parent_pid == 1)
@ -3228,7 +3228,7 @@ void yon_main_window_complete(template_main_window **window){
g_signal_connect(G_OBJECT(widgets->LoadLocalMenuItem),"activate",G_CALLBACK(on_load_local),NULL);
g_signal_connect(G_OBJECT(widgets->LoadCustomMenuItem),"activate",G_CALLBACK(on_config_custom_load),NULL);
g_signal_connect(G_OBJECT(widgets->UpgradePermissionsMenuItem),"activate",G_CALLBACK(on_permissions_changed),widgets);
// g_signal_connect(G_OBJECT(widgets->UpgradePermissionsMenuItem),"activate",G_CALLBACK(on_permissions_changed),widgets);
g_signal_connect(G_OBJECT(widgets->MainTree),"cursor-changed",G_CALLBACK(on_main_window_tree_selection_changed),widgets);
g_signal_connect(G_OBJECT(widgets->ServicesTree),"cursor-changed",G_CALLBACK(on_main_window_services_tree_selection_changed),widgets);

@ -14,11 +14,11 @@
#include <libublsettings.h>
#include <libublsettings-gtk3.h>
#include <libublsettingsui-gtk3.h>
#ifdef WEBKIT_FOUND
#ifdef WEBKIT_INCLUDE
#include <webkit2/webkit2.h>
#endif
#include "ubl-strings.h"
#include <polkit/polkit.h>
// #include <polkit/polkit.h>
#define WIKI_LINK "https://wiki.ublinux.ru/software/programs_and_utilities/all/ubl-settings-logging"
@ -126,8 +126,8 @@ typedef struct {
pthread_t inspector_thread;
int remove_thread;
PolkitAuthorizationResult *authorization_result;
PolkitSubject *process;
// PolkitAuthorizationResult *authorization_result;
// PolkitSubject *process;
queue_func** queue;
int queue_size;

Loading…
Cancel
Save