Now using AgWindow instead of a simple GtkActionWindow

This commit is contained in:
Gergely Polonkai 2013-09-08 23:02:05 +02:00
parent 50fc3f6f70
commit cdcf486165
2 changed files with 5 additions and 43 deletions

View File

@ -1,6 +1,7 @@
#include <glib/gi18n.h> #include <glib/gi18n.h>
#include "ag-app.h" #include "ag-app.h"
#include "ag-window.h"
#include "config.h" #include "config.h"
struct _AgAppPrivate { struct _AgAppPrivate {
@ -48,7 +49,7 @@ new_window_cb(GSimpleAction *action, GVariant *parameter, gpointer user_data)
AgApp *self = AG_APP(user_data); AgApp *self = AG_APP(user_data);
GtkWidget *window; GtkWidget *window;
window = gtk_application_window_new(GTK_APPLICATION(self)); window = ag_window_new(self);
gtk_application_add_window(GTK_APPLICATION(self), GTK_WINDOW(window)); gtk_application_add_window(GTK_APPLICATION(self), GTK_WINDOW(window));
gtk_widget_show_all(window); gtk_widget_show_all(window);
} }

View File

@ -8,6 +8,7 @@
#include <swe-glib.h> #include <swe-glib.h>
#include "ag-app.h" #include "ag-app.h"
#include "ag-window.h"
#define UI_FILE PKGDATADIR "/astrognome.ui" #define UI_FILE PKGDATADIR "/astrognome.ui"
@ -497,48 +498,8 @@ run_action(AgApp *app, gboolean is_remote)
static void static void
application_activate_cb(GtkApplication *app, gpointer user_data) application_activate_cb(GtkApplication *app, gpointer user_data)
{ {
GError *err = NULL; ag_app_new_window(AG_APP(app));
GtkWidget *window, run_action(AG_APP(app), FALSE);
*grid,
*header_bar,
*menu_button;
builder = gtk_builder_new();
if (gtk_builder_add_from_file(builder, UI_FILE, &err) == 0) {
g_error("Builder error: %s", err->message);
}
window = gtk_application_window_new(app);
gtk_window_set_title(GTK_WINDOW(window), _("Astrognome"));
grid = gtk_grid_new();
gtk_container_add(GTK_CONTAINER(window), grid);
header_bar = gd_header_bar_new();
menu_button = gd_header_menu_button_new();
gd_header_button_set_symbolic_icon_name(GD_HEADER_BUTTON(menu_button), "emblem-system-symbolic");
gtk_actionable_set_action_name(GTK_ACTIONABLE(menu_button), "win.gear-menu");
gd_header_bar_pack_end(GD_HEADER_BAR(header_bar), menu_button);
gtk_grid_attach(GTK_GRID(grid), header_bar, 0, 0, 1, 1);
gtk_widget_show_all(window);
/*
gtk_init(&argc, &argv);
window_main = GTK_WIDGET(gtk_builder_get_object(builder, "window_main"));
gtk_window_set_title(GTK_WINDOW(window_main), "Astrognome");
gtk_builder_connect_signals(builder, NULL);
gtk_widget_show(window_main);
gtk_main();
return 0;
*/
} }
int int