All pastes #980493 Raw Edit

Someone

public c v1 · immutable
·published 2008-04-11 01:20 UTC
rendered paste body
GtkWidget *windowing_startup(struct session *session){        PangoFontDescription *desc;        GtkWidget *hbox;        GtkWidget *hsep;        /* Do a theme */        if (session->s_settings != NULL)                if (session->s_settings->theme != NULL)                        gtk_rc_parse(session->s_settings->theme);        /* Create the session's window */        session->window = gtk_window_new(GTK_WINDOW_TOPLEVEL);        /* This is used for each screen's title, and the clock */        session->caption    = gtk_statusbar_new();        session->caption_id = gtk_statusbar_get_context_id(GTK_STATUSBAR(session->caption), "Title");        /* Remove the resize */        gtk_statusbar_set_has_resize_grip(GTK_STATUSBAR(session->caption), FALSE);        session->sclock     = gtk_statusbar_new();        session->sclock_id  = gtk_statusbar_get_context_id(GTK_STATUSBAR(session->sclock), "Time");        /* Get the company logo */        if (session->c_settings != NULL)                if (session->c_settings->path_to_logo != NULL)                        session->logo = gtk_image_new_from_file(session->c_settings->path_to_logo);                else                        session->logo = gtk_image_new_from_file("company_data/logo.png");        /* Push default messages to each */        gtk_statusbar_push(GTK_STATUSBAR(session->caption), session->caption_id, "ConcinnityPOS Version 1.0");        /* Set the time */        concinnity_time_set((gpointer)session);        /* Set the size of the clock since it'll always be that size, whereas the caption bar expands/shrinks */        gtk_widget_set_size_request(GTK_WIDGET(session->sclock), 250, -1);        /* Do some font modifications on the statusbar labels */        desc = pango_font_description_from_string("Sans 15");        gtk_widget_modify_font(GTK_STATUSBAR(session->sclock)->label, desc);        pango_font_description_free(desc);        desc = pango_font_description_from_string ("Sans 15");        gtk_widget_modify_font (GTK_STATUSBAR(session->caption)->label, desc);        pango_font_description_free (desc);        gtk_misc_set_alignment(GTK_MISC(GTK_STATUSBAR(session->sclock)->label), 0.5, 0.5);        /* Remove the resize */        gtk_statusbar_set_has_resize_grip(GTK_STATUSBAR(session->sclock), FALSE);        /* Create the hbox for the caption bar, and the clock */        hbox = gtk_hbox_new(FALSE, 0);        /* Pack the clock into the end of the hbox, do not expand */        gtk_box_pack_end(GTK_BOX(hbox), GTK_WIDGET(session->sclock), FALSE, FALSE, 0);        /* Put the caption bar in the beginning, expand to fill all space */        gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(session->caption), TRUE, TRUE, 0);        /* Make the global vbox for the screen */        session->g_vbox = gtk_vbox_new(FALSE, 0);        /* Put the logo in the top of the screen */        gtk_box_pack_start(GTK_BOX(session->g_vbox), GTK_WIDGET(session->logo), FALSE, FALSE, 10);        /* Separator that goes under the logo */        hsep = gtk_hseparator_new();        gtk_box_pack_start(GTK_BOX(session->g_vbox), GTK_WIDGET(hsep), FALSE, FALSE, 10);        /* Pack the hbox with clock and caption bar at the bottom of the screen */        gtk_box_pack_end(GTK_BOX(session->g_vbox), GTK_WIDGET(hbox), FALSE, FALSE, 0);        /* Put the g_vbox in the window */        gtk_container_add(GTK_CONTAINER(session->window), GTK_WIDGET(session->g_vbox));        if (session->s_settings != NULL)        {                switch (session->s_settings->mode)                {                        case STATION_FULLSCREEN_KEYBOARDMOUSE:                        case STATION_FULLSCREEN_TOUCHSCREEN:                                gtk_window_set_decorated(GTK_WINDOW(session->window),FALSE); /* Remove title bar, controls */                                break;                }        }        gtk_window_maximize(GTK_WINDOW(session->window));        /* Show window and children */        gtk_widget_show_all(GTK_WIDGET(session->window));        /* Make a timer to update the clock every second (may need increased) */        gtk_timeout_add(1000, concinnity_time_set, session);        /* Not needed */        return session->window;}