Compare commits

..

2 Commits

Author SHA1 Message Date
73868c81b0 Removed debug comment 2017-02-18 17:05:52 +01:00
cfd4531dde App menu now works properly 2017-02-18 17:04:39 +01:00
3 changed files with 9 additions and 7 deletions

View File

@ -78,7 +78,6 @@
<property name="width_request">720</property> <property name="width_request">720</property>
<property name="height_request">405</property> <property name="height_request">405</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<signal name="destroy" handler="gtk_main_quit" swapped="no"/>
<child> <child>
<object class="GtkPaned" id="mainPane"> <object class="GtkPaned" id="mainPane">
<property name="visible">True</property> <property name="visible">True</property>

View File

@ -7,12 +7,15 @@
static void quit_cb(GSimpleAction *action, GVariant *parameter, gpointer user_data) static void quit_cb(GSimpleAction *action, GVariant *parameter, gpointer user_data)
{ {
g_print("TODO\n"); struct mainWindow *mainWindow = *((struct mainWindow **) user_data);
gtk_window_close(GTK_WINDOW(mainWindow->mainWindow));
} }
static void settings_cb(GSimpleAction *action, GVariant *parameter, gpointer user_data) static void settings_cb(GSimpleAction *action, GVariant *parameter, gpointer user_data)
{ {
struct mainWindow *mainWindow = *((struct mainWindow **) user_data);
g_print("nTODO\n"); g_print("nTODO\n");
} }
@ -23,7 +26,7 @@ const GActionEntry app_actions[] = {
static void activate(GApplication *app, gpointer user_data) static void activate(GApplication *app, gpointer user_data)
{ {
struct mainWindow *mainWindow; struct mainWindow *mainWindow = *((struct mainWindow **) user_data);
struct mdiary_settings *settings; struct mdiary_settings *settings;
gchar *settings_path; gchar *settings_path;
@ -43,6 +46,7 @@ static void activate(GApplication *app, gpointer user_data)
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
struct mainWindow *mainWindow;
GtkApplication *app; GtkApplication *app;
GMenu *app_menu; GMenu *app_menu;
GMenu *p1; GMenu *p1;
@ -50,8 +54,8 @@ int main(int argc, char *argv[])
int status; int status;
app = gtk_application_new("net.notsyncing.mdiary", G_APPLICATION_FLAGS_NONE); app = gtk_application_new("net.notsyncing.mdiary", G_APPLICATION_FLAGS_NONE);
g_application_register(GTK_APPLICATION(app), NULL, NULL); g_application_register(G_APPLICATION(app), NULL, NULL);
g_signal_connect(app, "activate", G_CALLBACK(activate), NULL); g_signal_connect(app, "activate", G_CALLBACK(activate), &mainWindow);
app_menu = g_menu_new(); app_menu = g_menu_new();
p1 = g_menu_new(); p1 = g_menu_new();
@ -61,7 +65,7 @@ int main(int argc, char *argv[])
g_menu_append_section(app_menu, NULL, G_MENU_MODEL(p1)); g_menu_append_section(app_menu, NULL, G_MENU_MODEL(p1));
g_menu_append_section(app_menu, NULL, G_MENU_MODEL(p2)); g_menu_append_section(app_menu, NULL, G_MENU_MODEL(p2));
gtk_application_set_app_menu(app, G_MENU_MODEL(app_menu)); gtk_application_set_app_menu(app, G_MENU_MODEL(app_menu));
g_action_map_add_action_entries(G_ACTION_MAP(app), app_actions, G_N_ELEMENTS(app_actions), app); g_action_map_add_action_entries(G_ACTION_MAP(app), app_actions, G_N_ELEMENTS(app_actions), &mainWindow);
gtk_application_set_app_menu(GTK_APPLICATION(app), G_MENU_MODEL(app_menu)); gtk_application_set_app_menu(GTK_APPLICATION(app), G_MENU_MODEL(app_menu));
g_object_unref(p1); g_object_unref(p1);
g_object_unref(p2); g_object_unref(p2);

View File

@ -670,7 +670,6 @@ void mainWindow_entrySelected(GtkWidget *widget, gpointer user_data)
g_free(summary); g_free(summary);
g_free(temp); g_free(temp);
} else { } else {
//gtk_text_buffer_set_text(mainWindow->textBuffer, "", 0);
mainWindow_set_text(mainWindow, ""); mainWindow_set_text(mainWindow, "");
gtk_label_set_text(GTK_LABEL(mainWindow->labelSummary), "Please select an entry in the list above."); gtk_label_set_text(GTK_LABEL(mainWindow->labelSummary), "Please select an entry in the list above.");
} }