#Farm Managing Application GUI

6 messages · Page 1 of 1 (latest)

sullen spindle
#

main.c

#include <gtk/gtk.h>

GtkBuilder *builder;
GtkApplication *app;
GtkWidget *window;
GtkWidget *cropbutton;

void on_activate(GtkApplication* app) {
    GtkCssProvider *provider;
    GdkDisplay *display;

    // Create a new CSS Provider
    provider = gtk_css_provider_new();

    // Load the CSS file named "style.css" from the current directory
    gtk_css_provider_load_from_path(provider, "styles.css");

    // Get the default display
    display = gdk_display_get_default();

    // Add provider for display in priority FALLBACK
    gtk_style_context_add_provider_for_display(display, GTK_STYLE_PROVIDER(provider), GTK_STYLE_PROVIDER_PRIORITY_FALLBACK);

    g_object_unref(provider);

    builder = gtk_builder_new_from_file("window.glade");

    window = GTK_WIDGET(gtk_builder_get_object(builder, "window"));

    gtk_window_set_application(GTK_WINDOW(window), app);
    gtk_widget_show(GTK_WIDGET(window));
    gtk_window_maximize(GTK_WINDOW(window));
    gtk_window_set_title(GTK_WINDOW(window), "Farm Manager Application"); 
}

int main(int argc, char *argv[]) {

    // Creating new app
    app = gtk_application_new(NULL, G_APPLICATION_FLAGS_NONE);

    // Connecting app with on_activate function
    g_signal_connect(app, "activate", G_CALLBACK(on_activate), NULL);

    int status = g_application_run(G_APPLICATION(app), argc, argv);

    g_object_unref(app);

    return status;
}
#

styles.css

.homescreenbuttons {
    font-family: Arial, sans-serif;
    font-size: 15px;
    font-weight: bold;
}
#

It needs a ton of work (doesn't currently fully function) but I find it neat that you can build advanced GUI applications in C.

#

The idea is to create an application that farmers can customize to their needs. The two most basic concepts I could think of currently are crop management and cattle management (could just be livestock management). When the crop management button is pressed the blank space to the right lists fields based on a shape that the farmer entered. When the farmer clicks on one of the fields it has certain data such as acres, the crop that it is growing, etc. Calculations can also be preformed in the crop management section such as bushels per acre. I have yet to decide what happens to the livestock portion of the program. I'm thinking I add the same thing as fields but instead pastures with various data when you click on one also.

near axle
#

Good luck! 🫡