Update gtk28
This commit is contained in:
parent
1d7d0e8ed4
commit
81037436a0
|
@ -0,0 +1 @@
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
#include "test.h"
|
||||
#include <stdio.h>
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
#include "360.xpm"
|
||||
#include "gtkwin.h"
|
||||
|
||||
void print(GtkWidget *widget,gpointer data){
|
||||
char str[57];
|
||||
FILE *config=NULL;
|
||||
config=fopen("config","r");
|
||||
fgets(str,57,config);
|
||||
freopen("config","r",stdin);
|
||||
fgets(str,57,stdin);
|
||||
g_print("%s",str);
|
||||
fclose(stdin);
|
||||
}
|
||||
|
@ -22,13 +22,14 @@ void about_activate(GtkWidget *widget,gpointer data){
|
|||
|
||||
void config_activate(GtkWidget *widget,gpointer data){
|
||||
const gchar *str;
|
||||
int response;
|
||||
GtkWidget *dialog=gtk_dialog_new();
|
||||
GtkWindow *_dialog=GTK_WINDOW(dialog);
|
||||
GtkDialog *dialog1=GTK_DIALOG(dialog);
|
||||
gtk_window_set_default_size(_dialog,300,150);
|
||||
gtk_window_set_position(_dialog,GTK_WIN_POS_CENTER);
|
||||
gtk_window_set_title(_dialog,"Change config");
|
||||
gtk_dialog_add_button(dialog1,"OK",GTK_RESPONSE_OK);
|
||||
gtk_dialog_add_buttons(dialog1,"Cancel",GTK_RESPONSE_CANCEL,"OK",GTK_RESPONSE_OK,NULL);
|
||||
|
||||
GtkWidget *content_area=gtk_dialog_get_content_area(GTK_DIALOG(_dialog));
|
||||
GtkContainer *_content_area=GTK_CONTAINER(content_area);
|
||||
|
@ -38,12 +39,17 @@ void config_activate(GtkWidget *widget,gpointer data){
|
|||
gtk_container_add(_content_area,label);
|
||||
gtk_container_add(_content_area,entry);
|
||||
gtk_widget_show_all(content_area);
|
||||
gtk_dialog_run(dialog1);
|
||||
str=gtk_entry_get_text(GTK_ENTRY(entry));
|
||||
freopen("config","w",stdout);
|
||||
g_print(str);
|
||||
fclose(stdout);
|
||||
response=gtk_dialog_run(dialog1);
|
||||
if(response==GTK_RESPONSE_OK){
|
||||
str=gtk_entry_get_text(GTK_ENTRY(entry));
|
||||
freopen("config","w",stdout);
|
||||
g_print(str);
|
||||
fclose(stdout);
|
||||
gtk_widget_destroy(dialog);
|
||||
MsgBox("Config changed!\nPlease Restart the application");
|
||||
}else{
|
||||
gtk_widget_destroy(dialog);
|
||||
}
|
||||
}
|
||||
|
||||
void MsgBox(const gchar *msg){
|
||||
|
|
Loading…
Reference in New Issue