forked from Ailur-Archives/GtkLoadSpinner
This commit is contained in:
parent
b44555d9d6
commit
d1288d9827
|
@ -1,5 +1,6 @@
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
gboolean on_timeout(gpointer data) {
|
gboolean on_timeout(gpointer data) {
|
||||||
gtk_widget_queue_draw(GTK_WIDGET(data));
|
gtk_widget_queue_draw(GTK_WIDGET(data));
|
||||||
|
@ -16,9 +17,10 @@ gboolean on_draw(GtkWidget *widget, cairo_t *cr, gpointer data) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void show_help() {
|
void show_help() {
|
||||||
g_print("Usage: loadspinner [TEXT] [FONTSIZE]\n");
|
g_print("Usage: loadspinner [TEXT] [FONTSIZE] [WAIT_TIME]\n");
|
||||||
g_print("TEXT: The text to display in the label.\n");
|
g_print("TEXT: The text to display in the label.\n");
|
||||||
g_print("FONTSIZE: The font size of the label.\n");
|
g_print("FONTSIZE: The font size of the label.\n");
|
||||||
|
g_print("WAIT_TIME: The wait time in milliseconds before showing the window.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
|
@ -27,7 +29,7 @@ int main(int argc, char *argv[]) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (argc != 3) {
|
if (argc != 4) {
|
||||||
g_print("Error: Invalid number of arguments.\n");
|
g_print("Error: Invalid number of arguments.\n");
|
||||||
g_print("Use './program_name --help' for usage information.\n");
|
g_print("Use './program_name --help' for usage information.\n");
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -41,6 +43,9 @@ int main(int argc, char *argv[]) {
|
||||||
|
|
||||||
gtk_init(&argc, &argv);
|
gtk_init(&argc, &argv);
|
||||||
|
|
||||||
|
unsigned int waitTime = atoi(argv[3]);
|
||||||
|
usleep(waitTime * 1000);
|
||||||
|
|
||||||
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
||||||
gtk_window_set_decorated(GTK_WINDOW(window), FALSE);
|
gtk_window_set_decorated(GTK_WINDOW(window), FALSE);
|
||||||
gtk_window_set_skip_taskbar_hint(GTK_WINDOW(window), TRUE);
|
gtk_window_set_skip_taskbar_hint(GTK_WINDOW(window), TRUE);
|
||||||
|
|
Loading…
Reference in New Issue