Skip to content

Commit

Permalink
Merge pull request #770 from mjakeman/various-tweaks
Browse files Browse the repository at this point in the history
Adaptability and UI tweaks
  • Loading branch information
oscfdezdz authored Feb 1, 2025
2 parents bfaf7a8 + e8e9c7e commit ddd783a
Show file tree
Hide file tree
Showing 35 changed files with 685 additions and 395 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
options: --privileged
steps:
- uses: actions/checkout@v4.2.2
- uses: bilelmoussaoui/flatpak-github-actions/flatpak-builder@v6.3
- uses: flathub-infra/flatpak-github-actions/flatpak-builder@master
with:
bundle: extension-manager.flatpak
manifest-path: build-aux/com.mattjakeman.ExtensionManager.Devel.json
Expand Down
2 changes: 1 addition & 1 deletion build-aux/com.mattjakeman.ExtensionManager.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
{
"type" : "git",
"url" : "https://github.com/ianlancetaylor/libbacktrace.git",
"commit" : "9ae4f4ae4481b1e69d38ed810980d33103544613"
"commit" : "78af4ffa26e15532847c1ba854ece7b3bacc6b1a"
}
]
},
Expand Down
Binary file modified data/screenshot-installed-dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified data/screenshot-installed-light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
59 changes: 43 additions & 16 deletions src/exm-application.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,39 +36,57 @@ struct _ExmApplication
G_DEFINE_TYPE (ExmApplication, exm_application, ADW_TYPE_APPLICATION)

ExmApplication *
exm_application_new (gchar *application_id,
exm_application_new (gchar *application_id,
GApplicationFlags flags)
{
return g_object_new (EXM_TYPE_APPLICATION,
"application-id", application_id,
"flags", flags,
NULL);
"application-id", application_id,
"flags", flags,
NULL);
}

static void
save_window_state (GtkWindow *self,
gpointer user_data G_GNUC_UNUSED)
{
GSettings *settings;
gint default_width, default_height;
gboolean maximized;

settings = g_settings_new (APP_ID);

g_object_get (self, "default-width", &default_width, NULL);
g_object_get (self, "default-height", &default_height, NULL);
g_object_get (self, "maximized", &maximized, NULL);

g_settings_set_int (settings, "width", default_width);
g_settings_set_int (settings, "height", default_height);
g_settings_set_boolean (settings, "is-maximized", maximized);

g_object_unref (settings);
}

static ExmWindow *
get_current_window (GApplication *app)
{
GtkWindow *window;
GSettings *settings;
GtkWindow *window;

settings = g_settings_new (APP_ID);

/* Get the current window or create one if necessary. */
window = gtk_application_get_active_window (GTK_APPLICATION (app));
if (window == NULL)
{
window = g_object_new (EXM_TYPE_WINDOW,
"application", app,
"default-width", g_settings_get_int (settings, "width"),
"default-height", g_settings_get_int (settings, "height"),
"maximized", g_settings_get_boolean (settings, "is-maximized"),
NULL);

settings = g_settings_new (APP_ID);

g_settings_bind (settings, "width",
window, "default-width",
G_SETTINGS_BIND_DEFAULT);
g_settings_bind (settings, "height",
window, "default-height",
G_SETTINGS_BIND_DEFAULT);
g_settings_bind (settings, "is-maximized",
window, "maximized",
G_SETTINGS_BIND_DEFAULT);
g_signal_connect (window, "close-request", G_CALLBACK (save_window_state), NULL);
}

g_object_unref (settings);

Expand Down Expand Up @@ -132,6 +150,13 @@ exm_application_open (GApplication *app,
gtk_widget_activate_action (GTK_WIDGET (window), "win.show-detail", "s", uuid);
}

static void
exm_application_shutdown (GApplication *app)
{
save_window_state (GTK_WINDOW (get_current_window (app)), NULL);

G_APPLICATION_CLASS (exm_application_parent_class)->shutdown (app);
}

static void
exm_application_class_init (ExmApplicationClass *klass)
Expand All @@ -146,6 +171,7 @@ exm_application_class_init (ExmApplicationClass *klass)
*/
app_class->activate = exm_application_activate;
app_class->open = exm_application_open;
app_class->shutdown = exm_application_shutdown;
}

static void
Expand All @@ -169,6 +195,7 @@ exm_application_show_about (GSimpleAction *action G_GNUC_UNUSED,
adw_about_dialog_set_version (ADW_ABOUT_DIALOG (about_dialog), APP_VERSION);
adw_about_dialog_set_comments (ADW_ABOUT_DIALOG (about_dialog), _("Browse, install, and manage GNOME Shell Extensions."));
adw_about_dialog_set_developers (ADW_ABOUT_DIALOG (about_dialog), authors);
// Translators: Use 'Name email@domain.com' or 'Name https://website.example' (without single quotes). Do not delete existing names, write yours on a new line.
adw_about_dialog_set_translator_credits (ADW_ABOUT_DIALOG (about_dialog), _("translator-credits"));
adw_about_dialog_set_copyright (ADW_ABOUT_DIALOG (about_dialog), "© 2022-2025 Matthew Jakeman");

Expand Down
10 changes: 6 additions & 4 deletions src/exm-application.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* exm-application.h
/*
* exm-application.h
*
* Copyright 2022 Matthew Jakeman
* Copyright 2022-2025 Matthew Jakeman <mjakeman26@outlook.co.nz>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand All @@ -14,11 +15,12 @@
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/

#pragma once

#include <gtk/gtk.h>
#include <adwaita.h>

G_BEGIN_DECLS
Expand All @@ -27,7 +29,7 @@ G_BEGIN_DECLS

G_DECLARE_FINAL_TYPE (ExmApplication, exm_application, EXM, APPLICATION, AdwApplication)

ExmApplication *exm_application_new (gchar *application_id,
ExmApplication *exm_application_new (gchar *application_id,
GApplicationFlags flags);

G_END_DECLS
Loading

0 comments on commit ddd783a

Please sign in to comment.