Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update my_application.cc #279

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,42 @@ Supported Booru engines:
![github-small](https://raw.githubusercontent.com/NO-ob/LoliSnatcher_Droid/master/sancucku.png)


To build the LoliSnatcher_Droid project using CMake, you'll need to follow several steps, especially since some users have reported specific issues with the build process. Here's a general outline of the instructions:

Clone the repository:
Start by cloning the repository from GitHub:

git clone https://github.com/NO-ob/LoliSnatcher_Droid.git
cd LoliSnatcher_Droid

Install dependencies:

Ensure you have Flutter and CMake installed. The project is a Flutter-based Android application, so you may also need the Android SDK.
Additionally, install any necessary plugins or dependencies using:


flutter pub get

Linux-specific builds:
If you're building for Linux, note that there have been issues with missing directories for some Flutter plugins. You may need to regenerate or fix paths in the CMakeLists.txt file by ensuring that plugins like awesome_notifications and url_launcher have the correct paths​


Build the project:

Run the following command to trigger the CMake build:


cmake .
make

Troubleshooting:

If you encounter issues with missing resources or other errors like CMake Error at flutter/generated_plugins.cmake, make sure the flutter directory is correctly set up with all necessary files. Regenerating the CMake build files can help:



rm -rf build
cmake .
make

These steps should guide you in building the project successfully, though you may need to adapt them based on the environment or specific errors you encounter
16 changes: 16 additions & 0 deletions linux/main.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,22 @@
#include "my_application.h"

/**
* main:
* @argc: The number of command-line arguments.
* @argv: The array of command-line arguments.
*
* The entry point of the application. It creates a new instance of
* #MyApplication and runs the application using `g_application_run`.
* This function manages the lifecycle of the application, including
* command-line arguments and the main GTK event loop.
*
* Returns: The exit status of the application (0 for success).
*/
int main(int argc, char** argv) {
// Automatically handles memory management for 'app' by using g_autoptr.
g_autoptr(MyApplication) app = my_application_new();

// Run the application and start the main event loop.
// The exit status will be returned when the application finishes.
return g_application_run(G_APPLICATION(app), argc, argv);
}
5 changes: 3 additions & 2 deletions linux/my_application.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ static void my_application_activate(GApplication* application) {
// Use a header bar when running in GNOME as this is the common style used
// by applications and is the setup most users will be using (e.g. Ubuntu
// desktop).
// If running on X and not using GNOME then just use a traditional title bar
// If running on X and not using GNOME or KDE, just use a traditional title bar
// in case the window manager does more exotic layout, e.g. tiling.
// If running on Wayland assume the header bar will work (may need changing
// if future cases occur).
Expand All @@ -32,7 +32,8 @@ static void my_application_activate(GApplication* application) {
GdkScreen* screen = gtk_window_get_screen(window);
if (GDK_IS_X11_SCREEN(screen)) {
const gchar* wm_name = gdk_x11_screen_get_window_manager_name(screen);
if (g_strcmp0(wm_name, "GNOME Shell") != 0) {
// Don't use a header bar if the window manager is not GNOME or KDE
if (g_strcmp0(wm_name, "GNOME Shell") != 0 && g_strcmp0(wm_name, "KWin") != 0) {
use_header_bar = FALSE;
}
}
Expand Down
20 changes: 15 additions & 5 deletions linux/my_application.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,25 @@

#include <gtk/gtk.h>

G_DECLARE_FINAL_TYPE(MyApplication, my_application, MY, APPLICATION,
GtkApplication)
G_DECLARE_FINAL_TYPE(MyApplication, my_application, MY, APPLICATION, GtkApplication)

/**
* my_application_new:
* MyApplication:
*
* Creates a new Flutter-based application.
* This is a custom GTK application that integrates Flutter within a
* GTK-based window. It provides a way to run Flutter-based content
* inside a native Linux GTK application.
*/

/**
* my_application_new:
*
* Creates a new instance of #MyApplication, which is a GTK application
* designed to run Flutter-based content. This function sets up the
* application with the required initialization parameters and ensures
* proper integration with the Flutter rendering engine.
*
* Returns: a new #MyApplication.
* Returns: (transfer full): A newly created instance of #MyApplication.
*/
MyApplication* my_application_new();

Expand Down