mirror of https://github.com/daleclack/My_GtkUi
Make DPI Settings useful
This commit is contained in:
parent
b01c2d8dcc
commit
3c36574c83
|
@ -96,6 +96,7 @@
|
|||
"state": "cpp",
|
||||
"stateset": "cpp",
|
||||
"observer_ptr": "cpp",
|
||||
"xlocale": "cpp"
|
||||
"xlocale": "cpp",
|
||||
"stack": "cpp"
|
||||
}
|
||||
}
|
|
@ -206,7 +206,7 @@ if(WIN32)
|
|||
set_property(SOURCE icon.rc APPEND PROPERTY
|
||||
OBJECT_DEPENDS ${PROJECT_SOURCE_DIR}/icon.ico
|
||||
)
|
||||
add_executable(My_GtkUI WIN32 ${app_WINRC} ${SOURCES} ${RESOURCE_FILE})
|
||||
add_executable(My_GtkUI ${app_WINRC} ${SOURCES} ${RESOURCE_FILE})
|
||||
else()
|
||||
add_executable(My_GtkUI ${SOURCES} ${RESOURCE_FILE})
|
||||
|
||||
|
|
|
@ -86,6 +86,7 @@ static void about_activated(GSimpleAction *action,
|
|||
|
||||
void create_main_stack(GtkWindow *win)
|
||||
{
|
||||
// Current enabled actions
|
||||
static GActionEntry entries[] = {
|
||||
{"logout", logout_activated, NULL, NULL, NULL},
|
||||
{"quit", quit_activated, NULL, NULL, NULL},
|
||||
|
@ -98,6 +99,8 @@ void create_main_stack(GtkWindow *win)
|
|||
// Get Widgets
|
||||
GtkWidget *stack = GTK_WIDGET(gtk_builder_get_object(builder, "main_stack"));
|
||||
GtkWidget *login_page = GTK_WIDGET(gtk_builder_get_object(builder, "login_page"));
|
||||
GtkWidget *user_image = GTK_WIDGET(gtk_builder_get_object(builder, "user_image"));
|
||||
GtkWidget *user_label = GTK_WIDGET(gtk_builder_get_object(builder, "user_label"));
|
||||
GtkWidget *login_overlay = GTK_WIDGET(gtk_builder_get_object(builder, "login_overlay"));
|
||||
GtkWidget *main_page = GTK_WIDGET(gtk_builder_get_object(builder, "main_page"));
|
||||
GtkWidget *btnlogin = GTK_WIDGET(gtk_builder_get_object(builder, "btnlogin"));
|
||||
|
@ -131,5 +134,12 @@ void create_main_stack(GtkWindow *win)
|
|||
MyPrefs *prefs = my_dock_get_prefs(MY_DOCK(dock));
|
||||
main_win_set_prefs(MAIN_WIN(win), prefs);
|
||||
|
||||
// Get DPI setting
|
||||
double dpi = my_prefs_get_dpi(prefs);
|
||||
gtk_widget_set_size_request(btnlogin, 60 * dpi, 25 * dpi);
|
||||
gtk_widget_set_size_request(user_label, 60 * dpi, 25 * dpi);
|
||||
gtk_image_set_pixel_size(GTK_IMAGE(user_image), 40 * dpi);
|
||||
// g_print("%f", dpi);
|
||||
|
||||
gtk_window_set_child(win, stack);
|
||||
}
|
||||
|
|
|
@ -989,10 +989,13 @@ static void my_prefs_init(MyPrefs *self)
|
|||
g_signal_connect(self->btnapply1, "clicked", G_CALLBACK(btnapply_clicked), self);
|
||||
|
||||
// Enable check area for different modes
|
||||
if (self->res_set >= 0){
|
||||
if (self->res_set >= 0)
|
||||
{
|
||||
gtk_check_button_set_active(GTK_CHECK_BUTTON(self->radio_default), TRUE);
|
||||
gtk_check_button_set_active(GTK_CHECK_BUTTON(self->radio_custom), FALSE);
|
||||
}else{
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_check_button_set_active(GTK_CHECK_BUTTON(self->radio_default), FALSE);
|
||||
gtk_check_button_set_active(GTK_CHECK_BUTTON(self->radio_custom), TRUE);
|
||||
}
|
||||
|
@ -1042,6 +1045,11 @@ void my_prefs_set_background(MyPrefs *prefs_win, GtkWidget *back)
|
|||
is_internal, prefs_win);
|
||||
}
|
||||
|
||||
double my_prefs_get_dpi(MyPrefs *self)
|
||||
{
|
||||
return dpi_values[self->dpi_set];
|
||||
}
|
||||
|
||||
MyPrefs *my_prefs_new()
|
||||
{
|
||||
// Create Prefs widget
|
||||
|
|
|
@ -21,4 +21,6 @@ DockPos my_prefs_get_dock_pos(MyPrefs *self);
|
|||
|
||||
void my_prefs_set_background(MyPrefs *prefs_win, GtkWidget *back);
|
||||
|
||||
double my_prefs_get_dpi(MyPrefs *self);
|
||||
|
||||
MyPrefs *my_prefs_new();
|
||||
|
|
Loading…
Reference in New Issue