Make the previous problems worese
This commit is contained in:
parent
d8d47a5f83
commit
d02e75689b
@ -26,6 +26,7 @@ struct _TimerMainWindow {
|
|||||||
|
|
||||||
TimerMiniWindow *miniWindow;
|
TimerMiniWindow *miniWindow;
|
||||||
int miniWindowFirstOpen;
|
int miniWindowFirstOpen;
|
||||||
|
int miniWindowMode;
|
||||||
|
|
||||||
char *labelColorString;
|
char *labelColorString;
|
||||||
|
|
||||||
@ -366,7 +367,7 @@ void timer_main_window_read_mini_window_pos(TimerMainWindow *self, int *x, int *
|
|||||||
*y = g_key_file_get_integer(self->keyFile, "Cache", "smallY", NULL);
|
*y = g_key_file_get_integer(self->keyFile, "Cache", "smallY", NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean window_configure_callback(TimerMainWindow *win) {
|
static gboolean window_configure_callback(TimerMainWindow *win, GdkEventConfigure event, gpointer ptr) {
|
||||||
int x, y, w, h;
|
int x, y, w, h;
|
||||||
gtk_window_get_size(GTK_WINDOW(win), &w, &h);
|
gtk_window_get_size(GTK_WINDOW(win), &w, &h);
|
||||||
gtk_window_get_position(GTK_WINDOW(win), &x, &y);
|
gtk_window_get_position(GTK_WINDOW(win), &x, &y);
|
||||||
@ -377,7 +378,7 @@ static gboolean window_configure_callback(TimerMainWindow *win) {
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void window_destroy_callback(TimerMainWindow *win) {
|
static void window_destroy_callback(TimerMainWindow *win, gpointer ptr) {
|
||||||
g_key_file_set_string(win->keyFile, "Cache", "Current Name",
|
g_key_file_set_string(win->keyFile, "Cache", "Current Name",
|
||||||
gtk_entry_get_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(win->nameBox)))));
|
gtk_entry_get_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(win->nameBox)))));
|
||||||
GError *err = NULL;
|
GError *err = NULL;
|
||||||
@ -396,7 +397,7 @@ static void window_destroy_callback(TimerMainWindow *win) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean window_delete_event(TimerMainWindow *win, GdkEvent *evt) {
|
static gboolean window_delete_event(TimerMainWindow *win, GdkEvent *evt, gpointer ptr) {
|
||||||
if (win->startTime != NULL) {
|
if (win->startTime != NULL) {
|
||||||
GtkWidget *diag = gtk_message_dialog_new(GTK_WINDOW(win), GTK_DIALOG_MODAL, GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO, "Are you sure you would like to exit?");
|
GtkWidget *diag = gtk_message_dialog_new(GTK_WINDOW(win), GTK_DIALOG_MODAL, GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO, "Are you sure you would like to exit?");
|
||||||
gtk_window_set_position(GTK_WINDOW(diag), GTK_WIN_POS_MOUSE);
|
gtk_window_set_position(GTK_WINDOW(diag), GTK_WIN_POS_MOUSE);
|
||||||
@ -407,30 +408,34 @@ static gboolean window_delete_event(TimerMainWindow *win, GdkEvent *evt) {
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean mini_window_configure_callback(TimerMiniWindow *win) {
|
static gboolean mini_window_configure_callback(TimerMiniWindow *win, GdkEventConfigure event, TimerMainWindow *main) {
|
||||||
|
if (main->miniWindowMode) {
|
||||||
int x, y;
|
int x, y;
|
||||||
gtk_window_get_position(GTK_WINDOW(win), &x, &y);
|
gtk_window_get_position(GTK_WINDOW(win), &x, &y);
|
||||||
timer_main_window_save_mini_window_pos(
|
timer_main_window_save_mini_window_pos(main, x, y);
|
||||||
TIMER_MAIN_WINDOW(timer_mini_window_get_parent(win)), x, y);
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean mini_window_delete_event(TimerMiniWindow *win, GdkEvent *evt) {
|
static gboolean mini_window_delete_event(TimerMiniWindow *win, GdkEvent *evt, TimerMainWindow *main) {
|
||||||
|
main->miniWindowMode = FALSE;
|
||||||
gtk_widget_hide(GTK_WIDGET(win));
|
gtk_widget_hide(GTK_WIDGET(win));
|
||||||
gtk_widget_show_all(GTK_WIDGET(timer_mini_window_get_parent(win)));
|
gtk_widget_show_all(GTK_WIDGET(main));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void mini_window_expand_callback(GtkButton *btn, TimerMainWindow *win) {
|
static void mini_window_expand_callback(GtkButton *btn, TimerMainWindow *win) {
|
||||||
|
win->miniWindowMode = FALSE;
|
||||||
gtk_widget_hide(GTK_WIDGET(win->miniWindow));
|
gtk_widget_hide(GTK_WIDGET(win->miniWindow));
|
||||||
gtk_widget_show_all(GTK_WIDGET(win));
|
gtk_widget_show_all(GTK_WIDGET(win));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void init_mini_window(TimerMainWindow *self) {
|
static void init_mini_window(TimerMainWindow *self) {
|
||||||
self->miniWindowFirstOpen = TRUE;
|
self->miniWindowFirstOpen = TRUE;
|
||||||
self->miniWindow = timer_mini_window_new(GTK_WINDOW(self));
|
self->miniWindowMode = FALSE;
|
||||||
g_signal_connect(self->miniWindow, "configure-event", G_CALLBACK(mini_window_configure_callback), NULL);
|
self->miniWindow = timer_mini_window_new();
|
||||||
g_signal_connect(self->miniWindow, "delete-event", G_CALLBACK(mini_window_delete_event), NULL);
|
g_signal_connect(self->miniWindow, "configure-event", G_CALLBACK(mini_window_configure_callback), self);
|
||||||
|
g_signal_connect(self->miniWindow, "delete-event", G_CALLBACK(mini_window_delete_event), self);
|
||||||
g_signal_connect(timer_mini_window_get_start_stop_button(self->miniWindow),
|
g_signal_connect(timer_mini_window_get_start_stop_button(self->miniWindow),
|
||||||
"clicked", G_CALLBACK(start_stop_button_callback), self);
|
"clicked", G_CALLBACK(start_stop_button_callback), self);
|
||||||
g_signal_connect(timer_mini_window_get_reset_button(self->miniWindow),
|
g_signal_connect(timer_mini_window_get_reset_button(self->miniWindow),
|
||||||
@ -442,6 +447,7 @@ static void init_mini_window(TimerMainWindow *self) {
|
|||||||
static void main_window_collapse_callback(GtkButton *btn, TimerMainWindow *win) {
|
static void main_window_collapse_callback(GtkButton *btn, TimerMainWindow *win) {
|
||||||
gtk_widget_hide(GTK_WIDGET(win));
|
gtk_widget_hide(GTK_WIDGET(win));
|
||||||
gtk_widget_show_all(GTK_WIDGET(win->miniWindow));
|
gtk_widget_show_all(GTK_WIDGET(win->miniWindow));
|
||||||
|
win->miniWindowMode = TRUE;
|
||||||
if (win->miniWindowFirstOpen) {
|
if (win->miniWindowFirstOpen) {
|
||||||
gtk_window_set_keep_above(GTK_WINDOW(win->miniWindow), TRUE);
|
gtk_window_set_keep_above(GTK_WINDOW(win->miniWindow), TRUE);
|
||||||
int x, y;
|
int x, y;
|
||||||
@ -455,6 +461,7 @@ static void timer_main_window_finalize(GObject *self) {
|
|||||||
g_free(TIMER_MAIN_WINDOW(self)->labelColorString);
|
g_free(TIMER_MAIN_WINDOW(self)->labelColorString);
|
||||||
g_object_unref(TIMER_MAIN_WINDOW(self)->timerClock);
|
g_object_unref(TIMER_MAIN_WINDOW(self)->timerClock);
|
||||||
g_object_unref(TIMER_MAIN_WINDOW(self)->updateClock);
|
g_object_unref(TIMER_MAIN_WINDOW(self)->updateClock);
|
||||||
|
gtk_widget_destroy(GTK_WIDGET(TIMER_MAIN_WINDOW(self)->miniWindow));
|
||||||
if (TIMER_MAIN_WINDOW(self)->lastUpdateTime != NULL) {
|
if (TIMER_MAIN_WINDOW(self)->lastUpdateTime != NULL) {
|
||||||
g_date_time_unref(TIMER_MAIN_WINDOW(self)->lastUpdateTime);
|
g_date_time_unref(TIMER_MAIN_WINDOW(self)->lastUpdateTime);
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
struct _TimerMiniWindow {
|
struct _TimerMiniWindow {
|
||||||
GtkWindow parent;
|
GtkWindow parent;
|
||||||
|
|
||||||
GtkWindow *parentWindow;
|
|
||||||
GtkWidget *startStopButton;
|
GtkWidget *startStopButton;
|
||||||
GtkWidget *resetButton;
|
GtkWidget *resetButton;
|
||||||
GtkWidget *expandButton;
|
GtkWidget *expandButton;
|
||||||
@ -12,14 +11,8 @@ struct _TimerMiniWindow {
|
|||||||
|
|
||||||
G_DEFINE_TYPE(TimerMiniWindow, timer_mini_window, GTK_TYPE_WINDOW);
|
G_DEFINE_TYPE(TimerMiniWindow, timer_mini_window, GTK_TYPE_WINDOW);
|
||||||
|
|
||||||
TimerMiniWindow *timer_mini_window_new(GtkWindow *parent) {
|
TimerMiniWindow *timer_mini_window_new() {
|
||||||
TimerMiniWindow *self = g_object_new(TIMER_TYPE_MINI_WINDOW, NULL);
|
return g_object_new(TIMER_TYPE_MINI_WINDOW, NULL);
|
||||||
self->parentWindow = parent;
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
GtkWindow *timer_mini_window_get_parent(TimerMiniWindow *self) {
|
|
||||||
return self->parentWindow;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GtkLabel *timer_mini_window_get_timer_label(TimerMiniWindow *self) {
|
GtkLabel *timer_mini_window_get_timer_label(TimerMiniWindow *self) {
|
||||||
|
@ -8,8 +8,7 @@ G_BEGIN_DECLS
|
|||||||
#define TIMER_TYPE_MINI_WINDOW timer_mini_window_get_type()
|
#define TIMER_TYPE_MINI_WINDOW timer_mini_window_get_type()
|
||||||
G_DECLARE_FINAL_TYPE(TimerMiniWindow, timer_mini_window, TIMER, MINI_WINDOW, GtkWindow)
|
G_DECLARE_FINAL_TYPE(TimerMiniWindow, timer_mini_window, TIMER, MINI_WINDOW, GtkWindow)
|
||||||
|
|
||||||
TimerMiniWindow *timer_mini_window_new(GtkWindow *parent);
|
TimerMiniWindow *timer_mini_window_new();
|
||||||
GtkWindow *timer_mini_window_get_parent(TimerMiniWindow *self);
|
|
||||||
GtkLabel *timer_mini_window_get_timer_label(TimerMiniWindow *self);
|
GtkLabel *timer_mini_window_get_timer_label(TimerMiniWindow *self);
|
||||||
GtkButton *timer_mini_window_get_start_stop_button(TimerMiniWindow *self);
|
GtkButton *timer_mini_window_get_start_stop_button(TimerMiniWindow *self);
|
||||||
GtkButton *timer_mini_window_get_reset_button(TimerMiniWindow *self);
|
GtkButton *timer_mini_window_get_reset_button(TimerMiniWindow *self);
|
||||||
|
Loading…
Reference in New Issue
Block a user