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

Add about dialog #144

Merged
merged 5 commits into from
Feb 20, 2021
Merged
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
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ build
.vscode
src/cmake-build-debug
src/ui/resources.c
wifih.ui~
wifih.ui~
about.glade~
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2020, lakinduaksh
Copyright (c) 2021, lakinduaksh
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down
19 changes: 13 additions & 6 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ GLIB_COMPILE_RESOURCES = $(shell $(PKGCONFIG) --variable=glib_compile_resources

BUILT_SRC = resources.c

_OBJ = main.o ui.o h_prop.o util.o read_config.o $(BUILT_SRC:.c=.o)
_OBJ = main.o ui.o h_prop.o util.o read_config.o about_ui.o $(BUILT_SRC:.c=.o)
OBJ = $(patsubst %,$(ODIR)/%,$(_OBJ))

# Determine this makefile's path.
Expand All @@ -41,22 +41,29 @@ wihotspot-gui: $(OBJ)
$(CC) -o $(ODIR)/$@ $^ $(CFLAGS) $(LIBS)

install: $(ODIR)/wihotspot-gui
install -Dm644 desktop/hotspot.png $(DESTDIR)$(PREFIX)/share/pixmaps/wihotspot.png
install -Dm644 desktop/icons/hotspot@64.png $(DESTDIR)$(PREFIX)/share/pixmaps/wihotspot.png
install -Dm644 desktop/icons/hotspot@48.png $(DESTDIR)$(PREFIX)/share/icons/hicolor/48x48/apps/wihotspot.png
install -Dm644 desktop/icons/hotspot@64.png $(DESTDIR)$(PREFIX)/share/icons/hicolor/64x64/apps/wihotspot.png
install -Dm644 desktop/icons/hotspot@256.png $(DESTDIR)$(PREFIX)/share/icons/hicolor/256x256/apps/wihotspot.png
install -Dm644 desktop/icons/hotspot@512.png $(DESTDIR)$(PREFIX)/share/icons/hicolor/512x512/apps/wihotspot.png
install -Dm644 desktop/icons/hotspot.svg $(DESTDIR)$(PREFIX)/share/icons/hicolor/scalable/apps/wihotspot.svg
install -Dm644 desktop/wifihotspot.desktop $(DESTDIR)$(PREFIX)/share/applications/$(APP_NAME).desktop
install -Dm755 $(ODIR)/wihotspot-gui $(DESTDIR)$(BINDIR)/$(APP_GUI_BINARY)
cd scripts && $(MAKE) install

uninstall:
rm -f $(DESTDIR)$(PREFIX)/share/pixmaps/wihotspot.png
rm -f $(DESTDIR)$(PREFIX)/share/icons/hicolor/48x48/apps/wihotspot.png
rm -f $(DESTDIR)$(PREFIX)/share/icons/hicolor/64x64/apps/wihotspot.png
rm -f $(DESTDIR)$(PREFIX)/share/icons/hicolor/256x256/apps/wihotspot.png
rm -f $(DESTDIR)$(PREFIX)/share/icons/hicolor/512x512/apps/wihotspot.png
rm -f $(DESTDIR)$(PREFIX)/share/icons/hicolor/scalable/apps/wihotspot.svg
rm -f $(DESTDIR)$(PREFIX)/share/applications/$(APP_NAME).desktop
rm -f $(DESTDIR)$(BINDIR)/$(APP_GUI_BINARY)
cd scripts && $(MAKE) uninstall

clean-old:
rm -rf $(DESTDIR)/usr/share/wihotspot_gui
rm -rf $(DESTDIR)/usr/share/wihotspot
rm -f $(DESTDIR)/usr/bin/wihotspot_gui
rm -f $(DESTDIR)/usr/bin/wihotspot
rm -f $(DESTDIR)$(PREFIX)/share/pixmaps/wihotspot.png

clean:
rm -f $(ODIR)/*.o
Expand Down
1 change: 1 addition & 0 deletions src/desktop/icons/hotspot.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/desktop/icons/hotspot@256.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 added src/desktop/icons/hotspot@48.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
Binary file added src/desktop/icons/hotspot@64.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/scripts/LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

*All modification to this software is under following licence

Copyright (c) 2019, lakinduaksh
Copyright (c) 2021, lakinduaksh
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down
55 changes: 55 additions & 0 deletions src/ui/about_ui.c
Original file line number Diff line number Diff line change
@@ -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 <gtk/gtk.h>
#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);

}
11 changes: 11 additions & 0 deletions src/ui/about_ui.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

#ifndef WIHOTSPOT_UI_ABOUT
#define WIHOTSPOT_UI_ABOUT


#include <gtk/gtk.h>


void show_info(GtkWidget *widget, gpointer window);

#endif
79 changes: 79 additions & 0 deletions src/ui/glade/about.glade
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.22.2 -->
<interface>
<requires lib="gtk+" version="3.20"/>
<object class="GtkAboutDialog" id="about_dialog">
<property name="can_focus">False</property>
<property name="window_position">center-on-parent</property>
<property name="destroy_with_parent">True</property>
<property name="type_hint">dialog</property>
<property name="gravity">center</property>
<property name="program_name">Linux Wifi Hotspot</property>
<property name="version">3.7.0</property>
<property name="copyright" translatable="yes">(c) lakinduakash 2021</property>
<property name="comments" translatable="yes">For more info visit
https://github.com/lakinduakash/linux-wifi-hotspot</property>
<property name="website">https://github.com/lakinduakash/linux-wifi-hotspot</property>
<property name="website_label" translatable="yes">Star on Github</property>
<property name="license" translatable="yes">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.
</property>
<property name="authors">Lakindu Akash
Oblique
Open source community</property>
<property name="artists">Freepik from www.flaticon.com</property>
<property name="logo_icon_name">wihotspot</property>
<property name="license_type">custom</property>
<child type="titlebar">
<placeholder/>
</child>
<child internal-child="vbox">
<object class="GtkBox">
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">2</property>
<child internal-child="action_area">
<object class="GtkButtonBox">
<property name="can_focus">False</property>
<property name="layout_style">end</property>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<placeholder/>
</child>
</object>
</child>
</object>
</interface>
5 changes: 5 additions & 0 deletions src/ui/glade/wifih.gresource.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
<gresource prefix="/org/gtk/wihotspot">
<file preprocess="xml-stripblanks">wifih.ui</file>
</gresource>

<gresource prefix="/org/gtk/wihotspot">
<file preprocess="xml-stripblanks">about.glade</file>
</gresource>

<gresource prefix="/css">
<file>style.css</file>
</gresource>
Expand Down
24 changes: 11 additions & 13 deletions src/ui/glade/wifih.ui
Original file line number Diff line number Diff line change
Expand Up @@ -523,24 +523,22 @@
<property name="can_focus">False</property>
<property name="halign">end</property>
<child>
<object class="GtkLinkButton">
<property name="label" translatable="yes">Help?</property>
<object class="GtkButton" id="button_about">
<property name="label" translatable="yes">About</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="focus_on_click">False</property>
<property name="receives_default">True</property>
<property name="uri">https://github.com/lakinduakash/linux-wifi-hotspot</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="padding">10</property>
<property name="position">0</property>
<property name="padding">48</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="button_stop_hp">
<property name="label" translatable="yes">Stop</property>
<object class="GtkButton" id="button_create_hp">
<property name="label" translatable="yes">Create hotspot</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
Expand All @@ -550,12 +548,13 @@
<property name="expand">False</property>
<property name="fill">True</property>
<property name="padding">10</property>
<property name="position">1</property>
<property name="pack_type">end</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkButton" id="button_create_hp">
<property name="label" translatable="yes">Create hotspot</property>
<object class="GtkButton" id="button_stop_hp">
<property name="label" translatable="yes">Stop</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
Expand All @@ -565,8 +564,7 @@
<property name="expand">False</property>
<property name="fill">True</property>
<property name="padding">10</property>
<property name="pack_type">end</property>
<property name="position">2</property>
<property name="position">3</property>
</packing>
</child>
</object>
Expand Down
9 changes: 9 additions & 0 deletions src/ui/ui.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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;
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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);
Expand Down