Back to index

bamf  0.2.120
main.c File Reference
#include "config.h"
#include "bamf-daemon.h"
#include "bamf-legacy-screen.h"
#include "main.h"

Go to the source code of this file.


int main (int argc, char **argv)

Function Documentation

int main ( int  argc,
char **  argv 

Definition at line 28 of file main.c.

  BamfDaemon *daemon;
  GOptionContext *options;
  GError *error = NULL;
  char *state_file = NULL;

  gtk_init (&argc, &argv);
  glibtop_init ();

  options = g_option_context_new ("");
  g_option_context_set_help_enabled (options, TRUE);
  g_option_context_set_summary (options, "It's one, and so are we...");

  GOptionEntry entries[] =
    {"load-file", 'l', 0, G_OPTION_ARG_STRING, &state_file, "Load bamf state from file instead of the system", NULL },

  g_option_context_add_main_entries (options, entries, NULL);
  g_option_context_add_group (options, gtk_get_option_group (FALSE));
  g_option_context_parse (options, &argc, &argv, &error);

  if (error)
      g_print ("%s, error: %s\n", g_option_context_get_help (options, TRUE, NULL), error->message);
      g_clear_error (&error);
      exit (1);

  if (state_file)
      bamf_legacy_screen_set_state_file (bamf_legacy_screen_get_default (), state_file);

  daemon = bamf_daemon_get_default ();
  bamf_daemon_start (daemon);

  g_object_unref (daemon);

  return 0;

Here is the call graph for this function: