Add features to the mini window
This commit is contained in:
parent
d02e75689b
commit
f9905c57c8
@ -53,12 +53,7 @@ static void timer_application_activate(GApplication *app) {
|
|||||||
gtk_widget_destroy(msgDiag);
|
gtk_widget_destroy(msgDiag);
|
||||||
}
|
}
|
||||||
TimerMainWindow *win = timer_main_window_new(TIMER_APPLICATION(app));
|
TimerMainWindow *win = timer_main_window_new(TIMER_APPLICATION(app));
|
||||||
gtk_window_present(GTK_WINDOW(win));
|
timer_main_window_show_for_mode(win);
|
||||||
#ifdef IS_APPLE
|
|
||||||
if (timer_main_window_is_always_on_top(win)) {
|
|
||||||
gtk_window_set_keep_above(GTK_WINDOW(win), TRUE);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TimerApplication *timer_application_new() {
|
TimerApplication *timer_application_new() {
|
||||||
|
@ -35,11 +35,6 @@ struct _TimerMainWindow {
|
|||||||
/* time in seconds */
|
/* time in seconds */
|
||||||
gint64 currentTime;
|
gint64 currentTime;
|
||||||
GDateTime *startTime;
|
GDateTime *startTime;
|
||||||
|
|
||||||
int widthBuff;
|
|
||||||
int heightBuff;
|
|
||||||
int xBuff;
|
|
||||||
int yBuff;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
G_DEFINE_TYPE(TimerMainWindow, timer_main_window, GTK_TYPE_APPLICATION_WINDOW);
|
G_DEFINE_TYPE(TimerMainWindow, timer_main_window, GTK_TYPE_APPLICATION_WINDOW);
|
||||||
@ -131,6 +126,7 @@ static void timer_main_window_interpret_settings(TimerMainWindow *self) {
|
|||||||
self, "Settings", "Always on Top", FALSE));
|
self, "Settings", "Always on Top", FALSE));
|
||||||
|
|
||||||
gtk_combo_box_text_remove_all(GTK_COMBO_BOX_TEXT(self->nameBox));
|
gtk_combo_box_text_remove_all(GTK_COMBO_BOX_TEXT(self->nameBox));
|
||||||
|
gtk_combo_box_text_remove_all(timer_mini_window_get_name_box(self->miniWindow));
|
||||||
gsize len;
|
gsize len;
|
||||||
GError *err = NULL;
|
GError *err = NULL;
|
||||||
char **data = g_key_file_get_string_list(self->keyFile, "Settings", "Tasks",
|
char **data = g_key_file_get_string_list(self->keyFile, "Settings", "Tasks",
|
||||||
@ -142,6 +138,8 @@ static void timer_main_window_interpret_settings(TimerMainWindow *self) {
|
|||||||
for (i = 0; i < len; ++i) {
|
for (i = 0; i < len; ++i) {
|
||||||
gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(self->nameBox),
|
gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(self->nameBox),
|
||||||
data[i]);
|
data[i]);
|
||||||
|
gtk_combo_box_text_append_text(timer_mini_window_get_name_box(self->miniWindow),
|
||||||
|
data[i]);
|
||||||
g_free(data[i]);
|
g_free(data[i]);
|
||||||
}
|
}
|
||||||
g_free(data);
|
g_free(data);
|
||||||
@ -154,6 +152,8 @@ static void timer_main_window_interpret_settings(TimerMainWindow *self) {
|
|||||||
self, "Cache", "Current Name", "");
|
self, "Cache", "Current Name", "");
|
||||||
gtk_entry_set_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(self->nameBox))),
|
gtk_entry_set_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(self->nameBox))),
|
||||||
taskName);
|
taskName);
|
||||||
|
gtk_entry_set_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(
|
||||||
|
timer_mini_window_get_name_box(self->miniWindow)))), taskName);
|
||||||
g_free(taskName);
|
g_free(taskName);
|
||||||
int x = g_key_file_get_integer(self->keyFile, "Cache", "x", NULL);
|
int x = g_key_file_get_integer(self->keyFile, "Cache", "x", NULL);
|
||||||
int y = g_key_file_get_integer(self->keyFile, "Cache", "y", NULL);
|
int y = g_key_file_get_integer(self->keyFile, "Cache", "y", NULL);
|
||||||
@ -253,8 +253,8 @@ static void start_stop_button_callback(GtkButton *btn, TimerMainWindow *win) {
|
|||||||
gtk_button_set_label(GTK_BUTTON(win->startStopButton), "Stop");
|
gtk_button_set_label(GTK_BUTTON(win->startStopButton), "Stop");
|
||||||
gtk_button_set_label(timer_mini_window_get_start_stop_button(win->miniWindow), "Stop");
|
gtk_button_set_label(timer_mini_window_get_start_stop_button(win->miniWindow), "Stop");
|
||||||
gtk_widget_set_sensitive(win->resetButton, TRUE);
|
gtk_widget_set_sensitive(win->resetButton, TRUE);
|
||||||
gtk_widget_set_sensitive(GTK_WIDGET(timer_mini_window_get_reset_button(win->miniWindow)), TRUE);
|
|
||||||
gtk_widget_set_sensitive(win->saveButton, TRUE);
|
gtk_widget_set_sensitive(win->saveButton, TRUE);
|
||||||
|
gtk_widget_set_sensitive(GTK_WIDGET(timer_mini_window_get_save_button(win->miniWindow)), TRUE);
|
||||||
win->startTime = g_date_time_new_now_local();
|
win->startTime = g_date_time_new_now_local();
|
||||||
timer_main_window_update_time(win);
|
timer_main_window_update_time(win);
|
||||||
}
|
}
|
||||||
@ -269,8 +269,8 @@ static void reset_button_callback(GtkButton *btn, TimerMainWindow *win) {
|
|||||||
gtk_button_set_label(GTK_BUTTON(win->startStopButton), "Start");
|
gtk_button_set_label(GTK_BUTTON(win->startStopButton), "Start");
|
||||||
gtk_button_set_label(timer_mini_window_get_start_stop_button(win->miniWindow), "Start");
|
gtk_button_set_label(timer_mini_window_get_start_stop_button(win->miniWindow), "Start");
|
||||||
gtk_widget_set_sensitive(win->resetButton, FALSE);
|
gtk_widget_set_sensitive(win->resetButton, FALSE);
|
||||||
gtk_widget_set_sensitive(GTK_WIDGET(timer_mini_window_get_reset_button(win->miniWindow)), FALSE);
|
|
||||||
gtk_widget_set_sensitive(win->saveButton, FALSE);
|
gtk_widget_set_sensitive(win->saveButton, FALSE);
|
||||||
|
gtk_widget_set_sensitive(GTK_WIDGET(timer_mini_window_get_save_button(win->miniWindow)), FALSE);
|
||||||
g_date_time_unref(win->startTime);
|
g_date_time_unref(win->startTime);
|
||||||
win->startTime = NULL;
|
win->startTime = NULL;
|
||||||
}
|
}
|
||||||
@ -279,8 +279,12 @@ static void save_button_callback(GtkButton *btn, TimerMainWindow *win) {
|
|||||||
if (timer_clock_is_running(win->timerClock)) {
|
if (timer_clock_is_running(win->timerClock)) {
|
||||||
timer_clock_stop(win->timerClock);
|
timer_clock_stop(win->timerClock);
|
||||||
}
|
}
|
||||||
const char *text =
|
const char *text;
|
||||||
gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(win->nameBox));
|
if (win->miniWindowMode) {
|
||||||
|
text = gtk_combo_box_text_get_active_text(timer_mini_window_get_name_box(win->miniWindow));
|
||||||
|
} else {
|
||||||
|
text = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(win->nameBox));
|
||||||
|
}
|
||||||
timer_task_tree_add_task(TIMER_TASK_TREE(win->taskTree), win->startTime,
|
timer_task_tree_add_task(TIMER_TASK_TREE(win->taskTree), win->startTime,
|
||||||
strcmp(text, "") == 0 ? "Untitled" : text,
|
strcmp(text, "") == 0 ? "Untitled" : text,
|
||||||
win->currentTime);
|
win->currentTime);
|
||||||
@ -289,8 +293,10 @@ static void save_button_callback(GtkButton *btn, TimerMainWindow *win) {
|
|||||||
win->startTime = NULL;
|
win->startTime = NULL;
|
||||||
timer_main_window_update_time(win);
|
timer_main_window_update_time(win);
|
||||||
gtk_button_set_label(GTK_BUTTON(win->startStopButton), "Start");
|
gtk_button_set_label(GTK_BUTTON(win->startStopButton), "Start");
|
||||||
|
gtk_button_set_label(timer_mini_window_get_start_stop_button(win->miniWindow), "Start");
|
||||||
gtk_widget_set_sensitive(win->resetButton, FALSE);
|
gtk_widget_set_sensitive(win->resetButton, FALSE);
|
||||||
gtk_widget_set_sensitive(win->saveButton, FALSE);
|
gtk_widget_set_sensitive(win->saveButton, FALSE);
|
||||||
|
gtk_widget_set_sensitive(GTK_WIDGET(timer_mini_window_get_save_button(win->miniWindow)), FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void timer_button_callback(GtkButton *btn, TimerMainWindow *win) {
|
static void timer_button_callback(GtkButton *btn, TimerMainWindow *win) {
|
||||||
@ -298,6 +304,7 @@ static void timer_button_callback(GtkButton *btn, TimerMainWindow *win) {
|
|||||||
timer_clock_stop(win->timerClock);
|
timer_clock_stop(win->timerClock);
|
||||||
timer_main_window_update_time(win);
|
timer_main_window_update_time(win);
|
||||||
gtk_button_set_label(GTK_BUTTON(win->startStopButton), "Start");
|
gtk_button_set_label(GTK_BUTTON(win->startStopButton), "Start");
|
||||||
|
gtk_button_set_label(timer_mini_window_get_start_stop_button(win->miniWindow), "Start");
|
||||||
}
|
}
|
||||||
gsize optLen;
|
gsize optLen;
|
||||||
const char **names =
|
const char **names =
|
||||||
@ -323,6 +330,7 @@ static void timer_button_callback(GtkButton *btn, TimerMainWindow *win) {
|
|||||||
timer_main_window_update_time(win);
|
timer_main_window_update_time(win);
|
||||||
gtk_widget_set_sensitive(win->resetButton, TRUE);
|
gtk_widget_set_sensitive(win->resetButton, TRUE);
|
||||||
gtk_widget_set_sensitive(win->saveButton, TRUE);
|
gtk_widget_set_sensitive(win->saveButton, TRUE);
|
||||||
|
gtk_widget_set_sensitive(GTK_WIDGET(timer_mini_window_get_save_button(win->miniWindow)), TRUE);
|
||||||
}
|
}
|
||||||
gtk_widget_destroy(GTK_WIDGET(diag));
|
gtk_widget_destroy(GTK_WIDGET(diag));
|
||||||
}
|
}
|
||||||
@ -357,17 +365,21 @@ static void timer_main_window_get_defualt_label_color(TimerMainWindow *self) {
|
|||||||
(int)round(color.blue * 255));
|
(int)round(color.blue * 255));
|
||||||
}
|
}
|
||||||
|
|
||||||
void timer_main_window_save_mini_window_pos(TimerMainWindow *self, int x, int y) {
|
static void timer_main_window_save_mini_window_specs(TimerMainWindow *self, int x, int y, int w, int h) {
|
||||||
g_key_file_set_integer(self->keyFile, "Cache", "smallX", x);
|
g_key_file_set_integer(self->keyFile, "Cache", "smallX", x);
|
||||||
g_key_file_set_integer(self->keyFile, "Cache", "smallY", y);
|
g_key_file_set_integer(self->keyFile, "Cache", "smallY", y);
|
||||||
|
g_key_file_set_integer(self->keyFile, "Cache", "smallW", w);
|
||||||
|
g_key_file_set_integer(self->keyFile, "Cache", "smallH", h);
|
||||||
}
|
}
|
||||||
|
|
||||||
void timer_main_window_read_mini_window_pos(TimerMainWindow *self, int *x, int *y) {
|
static void timer_main_window_read_mini_window_specs(TimerMainWindow *self, int *x, int *y, int *w, int *h) {
|
||||||
*x = g_key_file_get_integer(self->keyFile, "Cache", "smallX", NULL);
|
*x = g_key_file_get_integer(self->keyFile, "Cache", "smallX", NULL);
|
||||||
*y = g_key_file_get_integer(self->keyFile, "Cache", "smallY", NULL);
|
*y = g_key_file_get_integer(self->keyFile, "Cache", "smallY", NULL);
|
||||||
|
*w = g_key_file_get_integer(self->keyFile, "Cache", "smallW", NULL);
|
||||||
|
*h = g_key_file_get_integer(self->keyFile, "Cache", "smallH", NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean window_configure_callback(TimerMainWindow *win, GdkEventConfigure event, gpointer ptr) {
|
static gboolean window_configure_callback(TimerMainWindow *win, GdkEvent *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);
|
||||||
@ -408,53 +420,83 @@ static gboolean window_delete_event(TimerMainWindow *win, GdkEvent *evt, gpointe
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean mini_window_configure_callback(TimerMiniWindow *win, GdkEventConfigure event, TimerMainWindow *main) {
|
static gboolean mini_window_configure_callback(TimerMiniWindow *win, GdkEvent *event, TimerMainWindow *main) {
|
||||||
if (main->miniWindowMode) {
|
if (main->miniWindowMode) {
|
||||||
int x, y;
|
int x, y, w, h;
|
||||||
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(main, x, y);
|
gtk_window_get_size(GTK_WINDOW(win), &w, &h);
|
||||||
|
timer_main_window_save_mini_window_specs(main, x, y, w, h);
|
||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean mini_window_delete_event(TimerMiniWindow *win, GdkEvent *evt, TimerMainWindow *main) {
|
static gboolean mini_window_delete_event(TimerMiniWindow *win, GdkEvent *evt, TimerMainWindow *main) {
|
||||||
|
if (main->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?");
|
||||||
|
gtk_window_set_position(GTK_WINDOW(diag), GTK_WIN_POS_MOUSE);
|
||||||
|
int resp = gtk_dialog_run(GTK_DIALOG(diag));
|
||||||
|
gtk_widget_destroy(diag);
|
||||||
|
if (resp != GTK_RESPONSE_NO) {
|
||||||
main->miniWindowMode = FALSE;
|
main->miniWindowMode = FALSE;
|
||||||
gtk_widget_hide(GTK_WIDGET(win));
|
gtk_widget_destroy(GTK_WIDGET(main));
|
||||||
gtk_widget_show_all(GTK_WIDGET(main));
|
}
|
||||||
return FALSE;
|
}
|
||||||
|
main->miniWindowMode = FALSE;
|
||||||
|
gtk_widget_destroy(GTK_WIDGET(main));
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void mini_window_expand_callback(GtkButton *btn, TimerMainWindow *win) {
|
static void mini_window_expand_callback(GtkButton *btn, TimerMainWindow *win) {
|
||||||
win->miniWindowMode = FALSE;
|
win->miniWindowMode = FALSE;
|
||||||
gtk_widget_hide(GTK_WIDGET(win->miniWindow));
|
gtk_widget_hide(GTK_WIDGET(win->miniWindow));
|
||||||
|
const char *text = gtk_combo_box_text_get_active_text(timer_mini_window_get_name_box(win->miniWindow));
|
||||||
|
gtk_entry_set_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(win->nameBox))), text);
|
||||||
|
if (timer_main_window_is_always_on_top(win)) {
|
||||||
|
gtk_window_set_keep_above(GTK_WINDOW(win), TRUE);
|
||||||
|
}
|
||||||
gtk_widget_show_all(GTK_WIDGET(win));
|
gtk_widget_show_all(GTK_WIDGET(win));
|
||||||
|
g_key_file_set_boolean(win->keyFile, "Cache", "isMini", FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void init_mini_window(TimerMainWindow *self) {
|
static void init_mini_window(TimerMainWindow *self) {
|
||||||
self->miniWindowFirstOpen = TRUE;
|
|
||||||
self->miniWindowMode = FALSE;
|
self->miniWindowMode = FALSE;
|
||||||
|
self->miniWindowFirstOpen = TRUE;
|
||||||
self->miniWindow = timer_mini_window_new();
|
self->miniWindow = timer_mini_window_new();
|
||||||
g_signal_connect(self->miniWindow, "configure-event", G_CALLBACK(mini_window_configure_callback), self);
|
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(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_save_button(self->miniWindow),
|
||||||
"clicked", G_CALLBACK(reset_button_callback), self);
|
"clicked", G_CALLBACK(save_button_callback), self);
|
||||||
g_signal_connect(timer_mini_window_get_expand_button(self->miniWindow),
|
g_signal_connect(timer_mini_window_get_expand_button(self->miniWindow),
|
||||||
"clicked", G_CALLBACK(mini_window_expand_callback), self);
|
"clicked", G_CALLBACK(mini_window_expand_callback), self);
|
||||||
|
g_signal_connect(timer_mini_window_get_timer_button(self->miniWindow),
|
||||||
|
"clicked", G_CALLBACK(timer_button_callback), 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));
|
const char *text = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(win->nameBox));
|
||||||
win->miniWindowMode = TRUE;
|
gtk_entry_set_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(timer_mini_window_get_name_box(win->miniWindow)))), text);
|
||||||
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;
|
gtk_widget_show_all(GTK_WIDGET(win->miniWindow));
|
||||||
timer_main_window_read_mini_window_pos(win, &x, &y);
|
if (win->miniWindowFirstOpen) {
|
||||||
|
int x, y, w, h;
|
||||||
|
timer_main_window_read_mini_window_specs(win, &x, &y, &w, &h);
|
||||||
gtk_window_move(GTK_WINDOW(win->miniWindow), x, y);
|
gtk_window_move(GTK_WINDOW(win->miniWindow), x, y);
|
||||||
|
gtk_window_resize(GTK_WINDOW(win->miniWindow), w, h);
|
||||||
win->miniWindowFirstOpen = FALSE;
|
win->miniWindowFirstOpen = FALSE;
|
||||||
}
|
}
|
||||||
|
win->miniWindowMode = TRUE;
|
||||||
|
g_key_file_set_boolean(win->keyFile, "Cache", "isMini", TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
void timer_main_window_show_for_mode(TimerMainWindow *self) {
|
||||||
|
if (g_key_file_get_boolean(self->keyFile, "Cache", "isMini", NULL)) {
|
||||||
|
main_window_collapse_callback(NULL, self);
|
||||||
|
} else {
|
||||||
|
mini_window_expand_callback(NULL, self);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void timer_main_window_finalize(GObject *self) {
|
static void timer_main_window_finalize(GObject *self) {
|
||||||
|
@ -17,8 +17,7 @@ TimerDataPoint *timer_main_window_get_task_data(TimerMainWindow *self, gsize *le
|
|||||||
TimerDataPoint *timer_main_window_get_day_data(TimerMainWindow *self, gsize *len);
|
TimerDataPoint *timer_main_window_get_day_data(TimerMainWindow *self, gsize *len);
|
||||||
gboolean timer_main_window_is_always_on_top(TimerMainWindow *self);
|
gboolean timer_main_window_is_always_on_top(TimerMainWindow *self);
|
||||||
GDateTime *timer_main_window_get_last_task_end(TimerMainWindow *self);
|
GDateTime *timer_main_window_get_last_task_end(TimerMainWindow *self);
|
||||||
void timer_main_window_save_mini_window_pos(TimerMainWindow *self, int x, int y);
|
void timer_main_window_show_for_mode(TimerMainWindow *self);
|
||||||
void timer_main_window_read_mini_window_pos(TimerMainWindow *self, int *x, int *y);
|
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
@ -4,9 +4,11 @@ struct _TimerMiniWindow {
|
|||||||
GtkWindow parent;
|
GtkWindow parent;
|
||||||
|
|
||||||
GtkWidget *startStopButton;
|
GtkWidget *startStopButton;
|
||||||
GtkWidget *resetButton;
|
GtkWidget *saveButton;
|
||||||
GtkWidget *expandButton;
|
GtkWidget *expandButton;
|
||||||
GtkWidget *timerLabel;
|
GtkWidget *timerLabel;
|
||||||
|
GtkWidget *timerButton;
|
||||||
|
GtkWidget *nameBox;
|
||||||
};
|
};
|
||||||
|
|
||||||
G_DEFINE_TYPE(TimerMiniWindow, timer_mini_window, GTK_TYPE_WINDOW);
|
G_DEFINE_TYPE(TimerMiniWindow, timer_mini_window, GTK_TYPE_WINDOW);
|
||||||
@ -19,29 +21,41 @@ GtkLabel *timer_mini_window_get_timer_label(TimerMiniWindow *self) {
|
|||||||
return GTK_LABEL(self->timerLabel);
|
return GTK_LABEL(self->timerLabel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GtkButton *timer_mini_window_get_timer_button(TimerMiniWindow *self) {
|
||||||
|
return GTK_BUTTON(self->timerButton);
|
||||||
|
}
|
||||||
|
|
||||||
GtkButton *timer_mini_window_get_start_stop_button(TimerMiniWindow *self) {
|
GtkButton *timer_mini_window_get_start_stop_button(TimerMiniWindow *self) {
|
||||||
return GTK_BUTTON(self->startStopButton);
|
return GTK_BUTTON(self->startStopButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
GtkButton *timer_mini_window_get_reset_button(TimerMiniWindow *self) {
|
GtkButton *timer_mini_window_get_save_button(TimerMiniWindow *self) {
|
||||||
return GTK_BUTTON(self->resetButton);
|
return GTK_BUTTON(self->saveButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
GtkButton *timer_mini_window_get_expand_button(TimerMiniWindow *self) {
|
GtkButton *timer_mini_window_get_expand_button(TimerMiniWindow *self) {
|
||||||
return GTK_BUTTON(self->expandButton);
|
return GTK_BUTTON(self->expandButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GtkComboBoxText *timer_mini_window_get_name_box(TimerMiniWindow *self) {
|
||||||
|
return GTK_COMBO_BOX_TEXT(self->nameBox);
|
||||||
|
}
|
||||||
|
|
||||||
void timer_mini_window_class_init(TimerMiniWindowClass *class) {
|
void timer_mini_window_class_init(TimerMiniWindowClass *class) {
|
||||||
gtk_widget_class_set_template_from_resource(
|
gtk_widget_class_set_template_from_resource(
|
||||||
GTK_WIDGET_CLASS(class), "/zander/practicetimer/ui/mini-window.glade");
|
GTK_WIDGET_CLASS(class), "/zander/practicetimer/ui/mini-window.glade");
|
||||||
gtk_widget_class_bind_template_child_internal(GTK_WIDGET_CLASS(class),
|
gtk_widget_class_bind_template_child_internal(GTK_WIDGET_CLASS(class),
|
||||||
TimerMiniWindow, startStopButton);
|
TimerMiniWindow, startStopButton);
|
||||||
gtk_widget_class_bind_template_child_internal(GTK_WIDGET_CLASS(class),
|
gtk_widget_class_bind_template_child_internal(GTK_WIDGET_CLASS(class),
|
||||||
TimerMiniWindow, resetButton);
|
TimerMiniWindow, saveButton);
|
||||||
gtk_widget_class_bind_template_child_internal(GTK_WIDGET_CLASS(class),
|
gtk_widget_class_bind_template_child_internal(GTK_WIDGET_CLASS(class),
|
||||||
TimerMiniWindow, expandButton);
|
TimerMiniWindow, expandButton);
|
||||||
gtk_widget_class_bind_template_child_internal(GTK_WIDGET_CLASS(class),
|
gtk_widget_class_bind_template_child_internal(GTK_WIDGET_CLASS(class),
|
||||||
TimerMiniWindow, timerLabel);
|
TimerMiniWindow, timerLabel);
|
||||||
|
gtk_widget_class_bind_template_child_internal(GTK_WIDGET_CLASS(class),
|
||||||
|
TimerMiniWindow, nameBox);
|
||||||
|
gtk_widget_class_bind_template_child_internal(GTK_WIDGET_CLASS(class),
|
||||||
|
TimerMiniWindow, timerButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
void timer_mini_window_init(TimerMiniWindow *self) {
|
void timer_mini_window_init(TimerMiniWindow *self) {
|
||||||
|
@ -10,9 +10,11 @@ G_DECLARE_FINAL_TYPE(TimerMiniWindow, timer_mini_window, TIMER, MINI_WINDOW, Gtk
|
|||||||
|
|
||||||
TimerMiniWindow *timer_mini_window_new();
|
TimerMiniWindow *timer_mini_window_new();
|
||||||
GtkLabel *timer_mini_window_get_timer_label(TimerMiniWindow *self);
|
GtkLabel *timer_mini_window_get_timer_label(TimerMiniWindow *self);
|
||||||
|
GtkButton *timer_mini_window_get_timer_button(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_save_button(TimerMiniWindow *self);
|
||||||
GtkButton *timer_mini_window_get_expand_button(TimerMiniWindow *self);
|
GtkButton *timer_mini_window_get_expand_button(TimerMiniWindow *self);
|
||||||
|
GtkComboBoxText *timer_mini_window_get_name_box(TimerMiniWindow *self);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
@ -4,13 +4,17 @@
|
|||||||
<requires lib="gtk+" version="3.24"/>
|
<requires lib="gtk+" version="3.24"/>
|
||||||
<template class="TimerMiniWindow" parent="GtkWindow">
|
<template class="TimerMiniWindow" parent="GtkWindow">
|
||||||
<property name="can-focus">False</property>
|
<property name="can-focus">False</property>
|
||||||
<property name="resizable">False</property>
|
|
||||||
<property name="type-hint">utility</property>
|
<property name="type-hint">utility</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkBox">
|
<object class="GtkBox">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can-focus">False</property>
|
<property name="can-focus">False</property>
|
||||||
<property name="orientation">vertical</property>
|
<property name="orientation">vertical</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkButton" id="timerButton">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">True</property>
|
||||||
|
<property name="receives-default">True</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkLabel" id="timerLabel">
|
<object class="GtkLabel" id="timerLabel">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
@ -20,10 +24,29 @@
|
|||||||
<attribute name="scale" value="2"/>
|
<attribute name="scale" value="2"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</object>
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">True</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkComboBoxText" id="nameBox">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="has-entry">True</property>
|
||||||
|
<child internal-child="entry">
|
||||||
|
<object class="GtkEntry">
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
<property name="fill">True</property>
|
<property name="fill">True</property>
|
||||||
<property name="position">0</property>
|
<property name="position">1</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
@ -44,8 +67,8 @@
|
|||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkButton" id="resetButton">
|
<object class="GtkButton" id="saveButton">
|
||||||
<property name="label" translatable="yes">Reset</property>
|
<property name="label" translatable="yes">Save</property>
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can-focus">True</property>
|
<property name="can-focus">True</property>
|
||||||
<property name="receives-default">True</property>
|
<property name="receives-default">True</property>
|
||||||
@ -79,7 +102,7 @@
|
|||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
<property name="fill">True</property>
|
<property name="fill">True</property>
|
||||||
<property name="position">1</property>
|
<property name="position">2</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
|
Loading…
Reference in New Issue
Block a user