コード例 #1
0
ファイル: tray.c プロジェクト: Drahoslav7/trayhost
void init(const char* name, int desktop)
{
    int argc = 0;
    char *argv[] = { "" };
    gtk_init(&argc, (char***)&argv);

    tray_name = strdup(name);
    reset_menu();

    if (desktop == 2) { //GNOME
      init_gtk();
    }

    if (desktop == 3) { //Unity
      init_indicator();
    }

    if (desktop == 4) { //generic
      if (init_indicator() != 0) {
        init_gtk();
      }
    }
}
コード例 #2
0
ファイル: uManage.c プロジェクト: jcolag/uManage
int main (int argc, char *argv[]) {
#ifdef GUI
    void               *status;
    char                path[256];
    pthread_t           thr_menu;
#endif

    /*
     * Program setup
     *     Handle user interrupt and alarm
     *     Get program options
     *     Open report file for logging if needed
     *     Initialize UI
     */
    signal(SIGINT, handle_break);
    signal(SIGALRM, handle_alarm);
    alarm(1);

    get_configuration(&opts);
    if (parse_options(argc, argv, &opts)) {
        return 1;
    }
    if (opts.save_options) {
        save_configuration(&opts);
    }

    if (opts.text_out) {
        report = fopen(opts.filename, "a");
        if(report == NULL) {
            report = stdout;
        }
    }

    init_idle();
    init_winmgmt(&opts);
    window_state_init(&current);
#ifdef GUI
    get_executable_path(path, sizeof(path));
    init_indicator(argc, argv, path, &opts);
    if (opts.menu_items != NULL) {
        add_menu_items(opts.menu_items);
    }
    fflush(NULL);
    pthread_create(&thr_menu, NULL, run_indicator, &current.force);
#endif
    if (opts.use_database) {
        open_database(opts.dbname);
    }

    while(poll_continue || current.force) {
        sleep(1);                       /* Just wait for program close */
    }
    /*
     * Clean up
     */
    alarm(1);                           /* Last hurrah */
    sleep(1);
#ifdef GUI
    pthread_join(thr_menu, &status);
#endif
    if (report != stdout && opts.text_out) {
        fclose(report);
    }
    if (opts.use_database) {
        close_database();
    }
    return 0;
}