diff --git a/.gitignore b/.gitignore index f9e7ad0..e5cfa56 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,5 @@ build .vscode src/cmake-build-debug src/ui/resources.c -wifih.ui~ \ No newline at end of file +wifih.ui~ +about.glade~ \ No newline at end of file diff --git a/src/ui/about_ui.c b/src/ui/about_ui.c new file mode 100644 index 0000000..3ff7cb7 --- /dev/null +++ b/src/ui/about_ui.c @@ -0,0 +1,55 @@ +// +// Created by lakinduakash on 13/04/19. +// +/* +Copyright (c) 2021, lakinduaksh + All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this +list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation +and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + */ + + + +#include +#include "about_ui.h" + +static GtkBuilder *builder; +static GError *error = NULL; + +void show_info(GtkWidget *widget, gpointer root) { + + builder = gtk_builder_new(); + //Load ui description from built resource - need to generate compiled source with glib-compile-resource + gtk_builder_add_from_resource(builder,"/org/gtk/wihotspot/about.glade",&error); + + root = gtk_builder_get_object(builder, "about_dialog"); + + GtkAboutDialog* dialog= GTK_ABOUT_DIALOG(root); + + gtk_dialog_run(GTK_DIALOG(dialog)); + + gtk_widget_destroy(GTK_WIDGET( dialog)); + + g_signal_connect (dialog, "destroy", G_CALLBACK(gtk_main_quit), NULL); + +} \ No newline at end of file diff --git a/src/ui/about_ui.h b/src/ui/about_ui.h new file mode 100644 index 0000000..8729628 --- /dev/null +++ b/src/ui/about_ui.h @@ -0,0 +1,11 @@ + +#ifndef WIHOTSPOT_UI_ABOUT +#define WIHOTSPOT_UI_ABOUT + + +#include + + +void show_info(GtkWidget *widget, gpointer window); + +#endif \ No newline at end of file diff --git a/src/ui/glade/about.glade b/src/ui/glade/about.glade new file mode 100644 index 0000000..58ab420 --- /dev/null +++ b/src/ui/glade/about.glade @@ -0,0 +1,79 @@ + + + + + + False + center-on-parent + True + dialog + center + Linux Wifi Hotspot + 3.6.8 + (c) lakinduakash 2021 + For more info visit +https://github.com/lakinduakash/linux-wifi-hotspot + https://github.com/lakinduakash/linux-wifi-hotspot + Star on Github + Copyright (c) 2020, lakinduaksh +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + Lakindu Akash +Oblique +Open source community + Freepik from www.flaticon.com + wihotspot + custom + + + + + + False + vertical + 2 + + + False + end + + + + + + + + + False + False + 0 + + + + + + + + + diff --git a/src/ui/glade/wifih.gresource.xml b/src/ui/glade/wifih.gresource.xml index 0d1bd5d..98722f9 100644 --- a/src/ui/glade/wifih.gresource.xml +++ b/src/ui/glade/wifih.gresource.xml @@ -3,6 +3,11 @@ wifih.ui + + + about.glade + + style.css diff --git a/src/ui/glade/wifih.ui b/src/ui/glade/wifih.ui index 138cf7e..3d893bd 100644 --- a/src/ui/glade/wifih.ui +++ b/src/ui/glade/wifih.ui @@ -523,33 +523,16 @@ False end - - Help? + + About True True - False True - https://github.com/lakinduakash/linux-wifi-hotspot False True - 10 - 0 - - - - - Stop - True - True - True - end - - - False - True - 10 + 48 1 @@ -569,6 +552,21 @@ 2 + + + Stop + True + True + True + end + + + False + True + 10 + 3 + + False diff --git a/src/ui/ui.c b/src/ui/ui.c index 909393f..4bab3cc 100644 --- a/src/ui/ui.c +++ b/src/ui/ui.c @@ -39,6 +39,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "ui.h" #include "read_config.h" #include "util.h" +#include "about_ui.h" #define BUFSIZE 512 #define AP_ENABLED "AP-ENABLED" @@ -55,6 +56,7 @@ GtkBuilder *builder; GObject *window; GtkButton *button_create_hp; GtkButton *button_stop_hp; +GtkButton *button_about; GtkEntry *entry_ssd; GtkEntry *entry_pass; @@ -146,6 +148,11 @@ static void on_stop_hp_clicked(GtkWidget *widget, gpointer data) { } +static void on_about_open_click(GtkWidget *widget, gpointer data){ + + show_info(widget,data); +} + static void loadStyles(){ provider = gtk_css_provider_new(); @@ -352,6 +359,7 @@ int initUi(int argc, char *argv[]){ button_create_hp = (GtkButton *) gtk_builder_get_object(builder, "button_create_hp"); button_stop_hp = (GtkButton *) gtk_builder_get_object(builder, "button_stop_hp"); + button_about = (GtkButton *) gtk_builder_get_object(builder, "button_about"); entry_ssd = (GtkEntry *) gtk_builder_get_object(builder, "entry_ssid"); entry_pass = (GtkEntry *) gtk_builder_get_object(builder, "entry_pass"); @@ -394,6 +402,7 @@ int initUi(int argc, char *argv[]){ g_signal_connect (button_create_hp, "clicked", G_CALLBACK(on_create_hp_clicked), NULL); g_signal_connect (button_stop_hp, "clicked", G_CALLBACK(on_stop_hp_clicked), NULL); + g_signal_connect (button_about, "clicked", G_CALLBACK(on_about_open_click), NULL); g_signal_connect (entry_mac, "changed", G_CALLBACK(entry_mac_warn), NULL); g_signal_connect (entry_ssd, "changed", G_CALLBACK(entry_ssid_warn), NULL);