Shrink image size in About dialog and change commands for the buttons from Systemd to dbus

This commit is contained in:
Stig-Ørjan Smelror 2024-06-28 18:16:01 +02:00
parent 67bc3e0143
commit c9fed7e0b9

18
ssdd.c
View File

@ -62,6 +62,7 @@ static void show_about_dialog(GtkWidget *widget) {
gtk_container_add(GTK_CONTAINER(content_area), box); gtk_container_add(GTK_CONTAINER(content_area), box);
image = gtk_image_new_from_file("ssdd-icon.png"); image = gtk_image_new_from_file("ssdd-icon.png");
gtk_image_set_pixel_size(GTK_IMAGE(image), 250); // Assuming original size is 500x500
gtk_box_pack_start(GTK_BOX(box), image, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(box), image, FALSE, FALSE, 0);
label = gtk_label_new(NULL); label = gtk_label_new(NULL);
@ -84,9 +85,8 @@ static void button_clicked(GtkWidget *widget, gpointer data) {
return; return;
} }
if (g_strcmp0(command, "openbox --exit") == 0 || if (g_strcmp0(command, "dbus-send --system --print-reply --dest=org.freedesktop.login1 /org/freedesktop/login1 org.freedesktop.login1.Manager.Reboot boolean:true") == 0 ||
g_strcmp0(command, "systemctl reboot") == 0 || g_strcmp0(command, "dbus-send --system --print-reply --dest=org.freedesktop.login1 /org/freedesktop/login1 org.freedesktop.login1.Manager.PowerOff boolean:true") == 0) {
g_strcmp0(command, "systemctl poweroff") == 0) {
show_confirmation_dialog(widget, (gpointer) command); show_confirmation_dialog(widget, (gpointer) command);
} else if (g_strcmp0(command, "about") == 0) { } else if (g_strcmp0(command, "about") == 0) {
show_about_dialog(widget); show_about_dialog(widget);
@ -103,12 +103,12 @@ static void activate(GtkApplication *app, gpointer user_data) {
GtkWidget *box; GtkWidget *box;
GtkWidget *label; GtkWidget *label;
const gchar *buttons[] = { const gchar *buttons[] = {
"openbox --exit", "",
"systemctl reboot", "dbus-send --system --print-reply --dest=org.freedesktop.login1 /org/freedesktop/login1 org.freedesktop.login1.Manager.Reboot boolean:true",
"systemctl poweroff", "dbus-send --system --print-reply --dest=org.freedesktop.login1 /org/freedesktop/login1 org.freedesktop.login1.Manager.PowerOff boolean:true",
"dm-tool switch-to-greeter", "",
"systemctl suspend", "dbus-send --system --print-reply --dest=org.freedesktop.login1 /org/freedesktop/login1 org.freedesktop.login1.Manager.Suspend boolean:true",
"systemctl hibernate", "dbus-send --system --print-reply --dest=org.freedesktop.login1 /org/freedesktop/login1 org.freedesktop.login1.Manager.Hibernate boolean:true",
"about", "about",
"exit" "exit"
}; };