示例#1
0
int
main(int argc, char** argv)
{
  GError* error = NULL;
  GConfClient* client = NULL;

  gtk_init(&argc, &argv);
  
  if (!gconf_init(argc, argv, &error))
    {
      g_assert(error != NULL);
      g_warning("GConf init failed:\n  %s", error->message);
      return 1;
    }

  g_assert(error == NULL);

  client = gconf_client_get_default();

  gconf_client_add_dir(client, "/apps/gnome/testgconfclient", GCONF_CLIENT_PRELOAD_NONE, NULL);

  create_controls(client);
  
  gtk_main();

  g_object_unref(G_OBJECT(client));
  
  return 0;
}
示例#2
0
static GConfClient*
get_global_client (void)
{
    GError *error = NULL;

    /* Initialize gconf if needed */
    if (!gconf_is_initialized ()) {
        char *argv[] = { "seahorse", NULL };

        if (!gconf_init (1, argv, &error)) {
            if (handle_error (&error))
                return NULL;
        }
    }

    if (global_gconf_client == NULL) {
        global_gconf_client = gconf_client_get_default ();

        if (global_gconf_client) {
            gconf_client_add_dir (global_gconf_client, SEAHORSE_DESKTOP_KEYS,
                                  GCONF_CLIENT_PRELOAD_NONE, &error);
            handle_error (&error);
            gconf_client_add_dir (global_gconf_client, SEAHORSE_SCHEMAS,
                                  GCONF_CLIENT_PRELOAD_NONE, &error);
            handle_error (&error);
        }

        atexit (global_client_free);
    }

    return global_gconf_client;
}
static void dasher_app_settings_init_gconf(DasherAppSettings *pSelf, int argc, char **argv) {
#ifdef WITH_GCONF
  DasherAppSettingsPrivate *pPrivate = (DasherAppSettingsPrivate*)(pSelf->private_data);

  GError *pGConfError;

  if(!gconf_init(argc, argv, &pGConfError))
    g_error("Failed to initialise gconf: %s", pGConfError->message);
  
    pPrivate->pGConfClient = gconf_client_get_default();
#endif
}
示例#4
0
int 
main (int argc, char** argv)
{
  GConfEngine* conf;
  GError* err = NULL;

  setlocale (LC_ALL, "");
  
  if (!gconf_init(argc, argv, &err))
    {
      g_assert(err != NULL);
      fprintf(stderr, "Failed to init GConf: %s\n", err->message);
      fflush(stderr);
      g_error_free(err);
      err = NULL;
      return 1;
    }
  
  conf = gconf_engine_get_default();

  check(conf != NULL, "create the default conf engine");

  printf("\nChecking list storage:");
  
  check_list_storage(conf);
  
  printf("\nChecking integer storage:");
  
  check_int_storage(conf);

  printf("\nChecking float storage:");
  
  check_float_storage(conf);

  printf("\nChecking string storage:");
  
  check_string_storage(conf);

  printf("\nChecking bool storage:");
  
  check_bool_storage(conf);
  
  gconf_engine_unref(conf);

  printf("\n\n");
  
  return 0;
}
int
main (int argc, char **argv)
{
  gtk_init(&argc, &argv);
  gconf_init(argc, argv, NULL);

  // TODO: take "listen-directory" as an argument
  // TODO: take "print-default-values" as a flag
  Listener listener;
  listen_init(&listener);

  // TODO: implement "press any key to quit"
  signal(SIGINT, termination_handler);
  signal(SIGHUP, termination_handler);
  signal(SIGTERM, termination_handler);
  gtk_main();

  listen_cleanup(&listener);
  return 0;
}
示例#6
0
文件: gconf.c 项目: Pidbip/egtkwave
void wave_gconf_init(int argc, char **argv)
{
if(!client)
	{
	char *ks = wave_alloca(WAVE_GCONF_DIR_LEN + 32 + 32 + 1);
	int len = sprintf(ks, WAVE_GCONF_DIR"/%d", wave_rpc_id);

	gconf_init(argc, argv, NULL);
	client = gconf_client_get_default();
	atexit(remove_client);

	gconf_client_add_dir(client,
		ks,
	        GCONF_CLIENT_PRELOAD_NONE,
	        NULL);

	strcpy(ks + len, "/open");
	gconf_client_notify_add(client, ks,
	                          open_callback,
	                          NULL, /* user data */
	                          NULL, NULL);

	strcpy(ks + len, "/quit");
	gconf_client_notify_add(client, ks,
	                          quit_callback,
	                          NULL, /* user data */
	                          NULL, NULL);
	
	strcpy(ks + len, "/writesave");
	gconf_client_notify_add(client, ks,
	                          writesave_callback,
	                          NULL, /* user data */
	                          NULL, NULL);
	
	strcpy(ks + len, "/reload");
	gconf_client_notify_add(client, ks,
	                          reload_callback,
	                          NULL, /* user data */
	                          NULL, NULL);
	}
}
示例#7
0
int
main(int argc, char** argv)
{
    GError* error = NULL;
    GConfClient* client = NULL;
    GtkWidget* main_window;

    gtk_init(&argc, &argv);

    /* If you pass NULL for error, then gconf_init() will simply print
       to stderr and exit if an error occurs. */
    if (!gconf_init(argc, argv, &error))
    {
        g_assert(error != NULL);
        g_warning("GConf init failed:\n  %s", error->message);
        /* These next two lines would be important if we weren't going to
           exit immediately */
        g_error_free(error);
        error = NULL;
        return 1;
    }

    g_assert(error == NULL);

    client = gconf_client_get_default();

    gconf_client_add_dir(client, "/apps/basic-gconf-app", GCONF_CLIENT_PRELOAD_NONE, NULL);

    main_window = create_main_window(client);

    gtk_widget_show_all(main_window);

    gtk_main();

    /* This ensures we cleanly detach from the GConf server (assuming
     * we hold the last reference)
     */
    g_object_unref(G_OBJECT(client));

    return 0;
}
示例#8
0
/* Public */
GConfClient *
eel_gconf_client_get_global (void)
{
    /* Initialize gconf if needed */
    if (!gconf_is_initialized ()) {
        char *argv[] = { "eel-preferences", NULL };
        GError *error = NULL;

        if (!gconf_init (1, argv, &error)) {
            if (eel_gconf_handle_error (&error)) {
                return NULL;
            }
        }
    }

    if (global_gconf_client == NULL) {
        global_gconf_client = gconf_client_get_default ();
        eel_debug_call_at_shutdown (global_client_free);
    }

    return global_gconf_client;
}
Bonobo_Unknown
bonobo_moniker_conf_indirect_resolve (BonoboMoniker *moniker,
				      const Bonobo_ResolveOptions *options,
				      const CORBA_char *requested_interface,
				      CORBA_Environment *ev)
{
	const char *key;
	char *oiid;
	Bonobo_Unknown object;
	GConfClient *conf_client;
	GError *err = NULL;

	/* retrieve the key contents from GConf */
	key = bonobo_moniker_get_name (moniker);

	if (!gconf_is_initialized ())
		gconf_init (0, NULL, NULL);

	conf_client = gconf_client_get_default ();
	oiid = gconf_client_get_string (conf_client, key, &err);
	g_object_unref (conf_client);

	if (!oiid) {
		bonobo_exception_general_error_set (
			ev, NULL,
			err ? err->message : _("Key %s not found in configuration"), key);
		g_error_free (err);
		return CORBA_OBJECT_NIL;
	}

	/* activate the object referenced in the GConf entry */
	object = bonobo_get_object ((const CORBA_char *) oiid,
				    requested_interface,
				    ev);
	g_free (oiid);

	return object;
}
static GConfClient *
gsearchtool_gconf_client_get_global (void)
{
	static GConfClient * global_gconf_client = NULL;

	/* Initialize gconf if needed */
	if (!gconf_is_initialized ()) {
		char *argv[] = { "gsearchtool-preferences", NULL };
		GError *error = NULL;

		if (!gconf_init (1, argv, &error)) {
			if (gsearchtool_gconf_handle_error (&error)) {
				return NULL;
			}
		}
	}

	if (global_gconf_client == NULL) {
		global_gconf_client = gconf_client_get_default ();
	}

	return global_gconf_client;
}
示例#11
0
void preferences_init (int argc, char **argv)
{
        gconf_init (argc, argv, NULL);
        preferences_engine = gconf_engine_get_default ();
}
示例#12
0
文件: gamine.c 项目: btong/gamine
gint
main (gint argc, gchar *argv[])
{
    Window root;
    //gettext
    bindtextdomain( "gamine", LOCALDIR );
    textdomain( "gamine" );
    gamine_t cb;
    GtkWidget *window;
    GdkWindow *gdkwindow;
    GtkWindow *gtkwindow;
    GdkScreen *screen;
    GdkPixbuf *cursor_pixbuf;
    GdkPixbuf *icon_pixbuf;
    GdkCursor *cursor;
    GdkColor bg_color;
    gchar *cursorfile;
    gchar *iconfile;

    cb.is_cairo = FALSE;
    gtk_init (&argc, &argv);
    gst_init (&argc, &argv);
    gconf_init(argc, argv, NULL);
    gst_play_background (cb.bus,
              "BachJSBrandenburgConcertNo2inFMajorBWV1047mvmt1.ogg", TRUE);

    window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
/* Create the drawing area and configuration */
    cb.da = gtk_drawing_area_new ();
    bg_color.red   = 65535;
    bg_color.green = 65535;
    bg_color.blue  = 65535;
    gtk_widget_modify_bg (cb.da, GTK_STATE_NORMAL, &bg_color);
    gtk_container_add (GTK_CONTAINER (window), cb.da);
    cb.gc = gconf_client_get_default();

    gtkwindow = GTK_WINDOW(window);
    gtk_window_set_title (gtkwindow, "Gamine");
    gtk_window_set_wmclass(gtkwindow, "gamine", "Gamine");
    gtk_container_set_border_width (GTK_CONTAINER (gtkwindow), 0);


/* Event signals */
    g_signal_connect (gtkwindow, "destroy",
         G_CALLBACK (gtk_main_quit), &gtkwindow);
    g_signal_connect (G_OBJECT (cb.da), "expose-event",
        G_CALLBACK (display_help), &cb);
    g_signal_connect (cb.da, "motion_notify_event",
        G_CALLBACK (draw_line), &cb);
    g_signal_connect (cb.da, "button_press_event",
        G_CALLBACK (draw_star), &cb);
    g_signal_connect (gtkwindow, "key-press-event",
        G_CALLBACK (gamine_on_key), &cb);
    gtk_widget_set_events (cb.da, gtk_widget_get_events (cb.da)
        | GDK_LEAVE_NOTIFY_MASK
        | GDK_BUTTON_PRESS_MASK
        | GDK_BUTTON_RELEASE_MASK
        | GDK_POINTER_MOTION_MASK
        | GDK_POINTER_MOTION_HINT_MASK);
/* Set fullscreen, grab mouse/keyboard, ...*/
    gtk_widget_show_all (GTK_WIDGET(gtkwindow));
    gdkwindow = GDK_WINDOW(GTK_WIDGET(gtkwindow)->window);
    screen = gtk_widget_get_screen (cb.da);
    gtk_window_present (gtkwindow);
    gtk_window_stick(gtkwindow);

    //gtk_window_set_keep_above (gtkwindow), True);
    //gtk_window_set_transient_for (gtkwindow, NULL);
    //set fullscreen
    gdk_window_fullscreen (gdkwindow);
    gtk_window_fullscreen (gtkwindow);
    gdk_window_raise (gdkwindow);
    //set full screen without window manager
    XMoveResizeWindow(GDK_WINDOW_XDISPLAY(gdkwindow), GDK_WINDOW_XID(gdkwindow),
        0, 0, gdk_screen_get_width (screen), gdk_screen_get_height (screen));
    root = DefaultRootWindow(GDK_WINDOW_XDISPLAY (gdkwindow));
    XGrabPointer(GDK_WINDOW_XDISPLAY (gdkwindow), root, True, PointerMotionMask,
        GrabModeAsync, GrabModeAsync, root, None, CurrentTime); 
    XGrabKeyboard(GDK_WINDOW_XDISPLAY (gdkwindow), root, True,
                    GrabModeAsync, GrabModeAsync, CurrentTime);
    //remove keyboard repeat
    XAutoRepeatOff(GDK_WINDOW_XDISPLAY (gdkwindow));
    gtk_window_has_toplevel_focus (gtkwindow);
/*cursor*/
    cursorfile = g_build_filename(DATADIR, "pencil.png", NULL);
    if (!g_file_test (cursorfile, G_FILE_TEST_EXISTS)) {
        printf(gettext("*** error: %s does not exists***\n"), cursorfile);
    } else {
        cursor_pixbuf = gdk_pixbuf_new_from_file(cursorfile, NULL);
        cursor = gdk_cursor_new_from_pixbuf(gdk_display_get_default(),
            cursor_pixbuf, 0, 38);
        gdk_window_set_cursor(gdkwindow, cursor);
        gdk_cursor_unref(cursor);
        gdk_pixbuf_unref(cursor_pixbuf);
    }
    g_free(cursorfile);
/*Set icon*/
    iconfile = g_build_filename(DATADIR, "gamine.png", NULL);
    if (!g_file_test (iconfile, G_FILE_TEST_EXISTS))
        printf(gettext("*** error: %s does not exists***\n"), iconfile);
    else {
        icon_pixbuf = gdk_pixbuf_new_from_file(iconfile, NULL);
        gtk_window_set_icon (gtkwindow, icon_pixbuf);
        gdk_pixbuf_unref (icon_pixbuf);
    }
    g_free(iconfile);

    load_conf(&cb);
    gtk_main ();
    //set keyboard repeat
    XAutoRepeatOn(GDK_WINDOW_XDISPLAY (gdkwindow));
    XCloseDisplay(GDK_WINDOW_XDISPLAY (gdkwindow));
    return 0;
}
示例#13
0
文件: misc.c 项目: IBwWG/systools
void systools_misc_initialize() {
	gtk_init(NULL,NULL);
	gconf_init(0,NULL,NULL);
}
示例#14
0
文件: main.c 项目: Debian/gpdftext
int
main (int argc, char *argv[])
{
	GError * error;
	gint num_args;
	GtkWidget *window;
	gchar **remaining_args;
	GOptionContext *option_context;
	Ebook * ebook;

	GOptionEntry option_entries[] = {
		/* option that collects filenames */
		{G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_FILENAME_ARRAY,
			&remaining_args, NULL, _("file")},
		{NULL, 0, 0, G_OPTION_ARG_NONE, NULL, NULL, NULL}
	};

#ifdef ENABLE_NLS
	bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
	textdomain (GETTEXT_PACKAGE);
#endif

	remaining_args = NULL;
	num_args = 0;
	error = NULL;
	// deprecated and useless for glib >= 2.36 but needed before.
#ifndef GLIB_DEPRECATED_IN_2_36
	g_type_init ();
#endif
	option_context = g_option_context_new ("");
	g_option_context_add_main_entries (option_context,
		option_entries, GETTEXT_PACKAGE);
	g_option_context_parse (option_context, &argc, &argv, NULL);

	/* GConf setup */
	if (gconf_init (argc, argv, &error) == FALSE)
	{
		g_assert (error != NULL);
		g_message (_("GConf init failed: %s"), error->message);
		g_error_free (error);
		return 1;
	}
	
	/* create a context struct here and pass it around. */
	ebook = new_ebook ();

	gtk_init (&argc, &argv);

	window = create_window (ebook);
	if (!window)
		return 2;
	if (remaining_args != NULL)
		num_args = g_strv_length (remaining_args);
	if (num_args >= 1)
	{
		gchar * filename;
		filename = g_strdup (remaining_args[num_args - 1]);
		open_file (ebook, filename);
	}
	gtk_widget_show (window);
	gtk_main ();
	return 0;
}
示例#15
0
文件: gtetrinet.c 项目: nwf/gtetrinet
int main (int argc, char *argv[])
{
    GtkWidget *label;
    GdkPixbuf *icon_pixbuf;
    GError *err = NULL;
    
    bindtextdomain(PACKAGE, LOCALEDIR);
    bind_textdomain_codeset(PACKAGE, "UTF-8");
    textdomain(PACKAGE);

    srand (time(NULL));

    gnome_program_init (APPID, APPVERSION, LIBGNOMEUI_MODULE,
                        argc, argv, GNOME_PARAM_POPT_TABLE, options,
                        GNOME_PARAM_NONE);

    textbox_setup (); /* needs to be done before text boxes are created */
    
    /* Initialize the GConf library */
    if (!gconf_init (argc, argv, &err))
    {
      fprintf (stderr, _("Failed to init GConf: %s\n"), err->message);
      g_error_free (err); 
      err = NULL;
    }
  
    /* Start a GConf client */
    gconf_client = gconf_client_get_default ();
  
    /* Add the GTetrinet directories to the list of directories that GConf client must watch */
    gconf_client_add_dir (gconf_client, "/apps/gtetrinet/sound",
                          GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
    
    gconf_client_add_dir (gconf_client, "/apps/gtetrinet/themes",
                          GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
  
    gconf_client_add_dir (gconf_client, "/apps/gtetrinet/keys",
                          GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);

    gconf_client_add_dir (gconf_client, "/apps/gtetrinet/partyline",
                          GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);

    /* Request notification of change for these gconf keys */
    gconf_client_notify_add (gconf_client, "/apps/gtetrinet/sound/midi_player",
                             (GConfClientNotifyFunc) sound_midi_player_changed,
			     NULL, NULL, NULL);
                             
    gconf_client_notify_add (gconf_client, "/apps/gtetrinet/sound/enable_sound",
                             (GConfClientNotifyFunc) sound_enable_sound_changed,
			     NULL, NULL, NULL);
                             
    gconf_client_notify_add (gconf_client, "/apps/gtetrinet/sound/enable_midi",
                             (GConfClientNotifyFunc) sound_enable_midi_changed,
			     NULL, NULL, NULL);
                             
    gconf_client_notify_add (gconf_client, "/apps/gtetrinet/themes/theme_dir",
                             (GConfClientNotifyFunc) themes_theme_dir_changed,
			     NULL, NULL, NULL);

    gconf_client_notify_add (gconf_client, "/apps/gtetrinet/keys/down",
                             (GConfClientNotifyFunc) keys_down_changed, NULL, NULL, NULL);

    gconf_client_notify_add (gconf_client, "/apps/gtetrinet/keys/left",
                             (GConfClientNotifyFunc) keys_left_changed,
			     NULL, NULL, NULL);

    gconf_client_notify_add (gconf_client, "/apps/gtetrinet/keys/right",
                             (GConfClientNotifyFunc) keys_right_changed,
			     NULL, NULL, NULL);

    gconf_client_notify_add (gconf_client, "/apps/gtetrinet/keys/rotate_left",
                             (GConfClientNotifyFunc) keys_rotate_left_changed,
			     NULL, NULL, NULL);

    gconf_client_notify_add (gconf_client, "/apps/gtetrinet/keys/rotate_right",
                             (GConfClientNotifyFunc) keys_rotate_right_changed,
			     NULL, NULL, NULL);

    gconf_client_notify_add (gconf_client, "/apps/gtetrinet/keys/drop",
                             (GConfClientNotifyFunc) keys_drop_changed, NULL,
			     NULL, NULL);

    gconf_client_notify_add (gconf_client, "/apps/gtetrinet/keys/message",
			     (GConfClientNotifyFunc) keys_message_changed,
			     NULL, NULL, NULL);

    gconf_client_notify_add (gconf_client, "/apps/gtetrinet/keys/discard",
			     (GConfClientNotifyFunc) keys_discard_changed,
			     NULL, NULL, NULL);

    gconf_client_notify_add (gconf_client, "/apps/gtetrinet/keys/special1",
                             (GConfClientNotifyFunc) keys_special1_changed,
			     NULL, NULL, NULL);

    gconf_client_notify_add (gconf_client, "/apps/gtetrinet/keys/special2",
                             (GConfClientNotifyFunc) keys_special2_changed,
			     NULL, NULL, NULL);

    gconf_client_notify_add (gconf_client, "/apps/gtetrinet/keys/special3",
                             (GConfClientNotifyFunc) keys_special3_changed,
			     NULL, NULL, NULL);

    gconf_client_notify_add (gconf_client, "/apps/gtetrinet/keys/special4",
                             (GConfClientNotifyFunc) keys_special4_changed,
			     NULL, NULL, NULL);

    gconf_client_notify_add (gconf_client, "/apps/gtetrinet/keys/special5",
                             (GConfClientNotifyFunc) keys_special5_changed,
			     NULL, NULL, NULL);

    gconf_client_notify_add (gconf_client, "/apps/gtetrinet/keys/special6",
                             (GConfClientNotifyFunc) keys_special6_changed,
			     NULL, NULL, NULL);

    gconf_client_notify_add (gconf_client, "/apps/gtetrinet/keys/special_self",
                             (GConfClientNotifyFunc) keys_special_self_changed,
                            NULL, NULL, NULL);

    gconf_client_notify_add (gconf_client, "/apps/gtetrinet/partyline/enable_timestamps",
                             (GConfClientNotifyFunc) partyline_enable_timestamps_changed,
			     NULL, NULL, NULL);
    
    gconf_client_notify_add (gconf_client, "/apps/gtetrinet/partyline/enable_channel_list",
                             (GConfClientNotifyFunc) partyline_enable_channel_list_changed,
			     NULL, NULL, NULL);

    /* load settings */
    config_loadconfig ();

    /* initialise some stuff */
    fields_init ();
    if (!g_thread_supported()) g_thread_init (NULL);

    /* first set up the display */

    /* create the main window */
    app = gnome_app_new (APPID, APPNAME);

    g_signal_connect (G_OBJECT(app), "destroy",
                        GTK_SIGNAL_FUNC(destroymain), NULL);
    keypress_signal = g_signal_connect (G_OBJECT(app), "key-press-event",
                                        GTK_SIGNAL_FUNC(keypress), NULL);
    g_signal_connect (G_OBJECT(app), "key-release-event",
                        GTK_SIGNAL_FUNC(keyrelease), NULL);
    gtk_widget_set_events (app, GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK);

    gtk_window_set_resizable (GTK_WINDOW (app), TRUE);
    
    /* create and set the window icon */
    icon_pixbuf = gdk_pixbuf_new_from_file (PIXMAPSDIR "/gtetrinet.png", NULL);
    if (icon_pixbuf)
    {
      gtk_window_set_icon (GTK_WINDOW (app), icon_pixbuf);
      gdk_pixbuf_unref (icon_pixbuf);
    }

    /* create the notebook */
    notebook = gtk_notebook_new ();
    gtk_notebook_set_tab_pos (GTK_NOTEBOOK(notebook), GTK_POS_TOP);

    /* put it in the main window */
    gnome_app_set_contents (GNOME_APP(app), notebook);

    /* make menus + toolbar */
    make_menus (GNOME_APP(app));

    /* create the pages in the notebook */
    fieldswidget = fields_page_new ();
    gtk_widget_set_sensitive (fieldswidget, TRUE);
    gtk_widget_show (fieldswidget);
    pfields = gtk_hbox_new (FALSE, 0);
    gtk_container_set_border_width (GTK_CONTAINER(pfields), 0);
    gtk_container_add (GTK_CONTAINER(pfields), fieldswidget);
    gtk_widget_show (pfields);
    g_object_set_data (G_OBJECT(fieldswidget), "title", "Playing Fields"); // FIXME
    label = pixmapdata_label (fields_xpm, _("Playing Fields"));
    gtk_widget_show (label);
    gtk_notebook_append_page (GTK_NOTEBOOK(notebook), pfields, label);

    partywidget = partyline_page_new ();
    gtk_widget_show (partywidget);
    pparty = gtk_hbox_new (FALSE, 0);
    gtk_container_set_border_width (GTK_CONTAINER(pparty), 0);
    gtk_container_add (GTK_CONTAINER(pparty), partywidget);
    gtk_widget_show (pparty);
    g_object_set_data (G_OBJECT(partywidget), "title", "Partyline"); // FIXME
    label = pixmapdata_label (partyline_xpm, _("Partyline"));
    gtk_widget_show (label);
    gtk_notebook_append_page (GTK_NOTEBOOK(notebook), pparty, label);

    winlistwidget = winlist_page_new ();
    gtk_widget_show (winlistwidget);
    pwinlist = gtk_hbox_new (FALSE, 0);
    gtk_container_set_border_width (GTK_CONTAINER(pwinlist), 0);
    gtk_container_add (GTK_CONTAINER(pwinlist), winlistwidget);
    gtk_widget_show (pwinlist);
    g_object_set_data (G_OBJECT(winlistwidget), "title", "Winlist"); // FIXME
    label = pixmapdata_label (winlist_xpm, _("Winlist"));
    gtk_widget_show (label);
    gtk_notebook_append_page (GTK_NOTEBOOK(notebook), pwinlist, label);

    /* add signal to focus the text entry when switching to the partyline page*/
    g_signal_connect_after(G_OBJECT (notebook), "switch-page",
		           GTK_SIGNAL_FUNC (switch_focus),
		           NULL);

    gtk_widget_show (notebook);
    g_object_set (G_OBJECT (notebook), "can-focus", FALSE, NULL);

    partyline_show_channel_list (list_enabled);
    gtk_widget_show (app);

//    gtk_widget_set_size_request (partywidget, 480, 360);
//    gtk_widget_set_size_request (winlistwidget, 480, 360);

    /* initialise some stuff */
    commands_checkstate ();

    /* check command line params */
#ifdef DEBUG
    printf ("option_connect: %s\n"
            "option_nick: %s\n"
            "option_team: %s\n"
            "option_pass: %s\n"
            "option_spec: %i\n",
            option_connect, option_nick, option_team,
            option_pass, option_spec);
#endif
    if (option_nick) GTET_O_STRCPY(nick, option_nick);
    if (option_team) GTET_O_STRCPY(team, option_team);
    if (option_pass) GTET_O_STRCPY(specpassword, option_pass);
    if (option_spec) spectating = TRUE;
    if (option_connect) {
        client_init (option_connect, nick);
    }

    /* Don't schedule if data is ready, glib should do this itself,
     * but welcome to anything that works... */
    g_main_context_set_poll_func(NULL, gtetrinet_poll_func);

    /* gtk_main() */
    gtk_main ();

    client_disconnect ();
    /* cleanup */
    fields_cleanup ();
    sound_stopmidi ();

    return 0;
}
示例#16
0
文件: main.c 项目: GNOME/phonemgr
int
main (int argc, char **argv)
{
	MyApp *app;
	GOptionContext *context;
	GError *error = NULL;

	bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
	textdomain (GETTEXT_PACKAGE);

	context = g_option_context_new (N_("- Manage your mobile phone"));
	g_option_context_add_main_entries (context, options, GETTEXT_PACKAGE);
	g_option_context_set_translation_domain(context, GETTEXT_PACKAGE);

	g_option_context_add_group (context, gtk_get_option_group (TRUE));
	if (g_option_context_parse (context, &argc, &argv, &error) == FALSE) {
		g_error ("Couldn't parse options: %s", error->message);
		g_error_free (error);
		g_option_context_free (context);
		return 1;
	}
	g_option_context_free (context);

	if (version != FALSE) {
		g_print (_("gnome-phone-manager version %s\n"), VERSION);
		return 0;
	}

	if (bdaddr_ident != NULL) {
		phonemgr_utils_tell_driver (bdaddr_ident);
		return 0;
	}
	if (bdaddr_config != NULL) {
		phonemgr_utils_write_gnokii_config (bdaddr_config);
		return 0;
	}

	gconf_init (argc, argv, NULL);

	app = g_new0 (MyApp, 1);

	/* Setup the D-Bus object */
	app->object = g_object_new (phonemgr_object_get_type (), NULL);

	app->client = gconf_client_get_default ();
	gconf_client_add_dir (app->client, CONFBASE,
			      GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);

	/* Setup the listener */
	app->listener = phonemgr_listener_new (debug);

	initialise_connection (app);

	ui_init (app);
	construct_menu (app);
	tray_icon_init (app);

	reconnect_phone (app);
	gtk_main ();

	tray_icon_hide (app);
	ui_hide (app);
	free_connection (app);
	g_object_unref (app->listener);
	g_object_unref (app->client);
	g_object_unref (app->object);
	g_free (app);

	return 0;
}