Esempio n. 1
0
gint _vala_main (char** args, int args_length1) {
	gint result = 0;
	GError * _inner_error_;
	GOptionContext* context;
	gint retval;
	_inner_error_ = NULL;
	g_setenv ("GLOBALMENU_MATE_ARGS", "--disable", TRUE);
	bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
	textdomain (GETTEXT_PACKAGE);
	context = g_option_context_new ("- GlobalMenu.MatePanelApplet");
	g_option_context_set_help_enabled (context, TRUE);
	g_option_context_add_main_entries (context, options, NULL);
	g_option_context_add_group (context, gtk_get_option_group (TRUE));
	g_option_context_add_group (context, matecomponent_activation_get_goption_group ());
	{
		g_option_context_parse (context, &args_length1, &args, &_inner_error_);
		if (_inner_error_ != NULL) {
			goto __catch20_g_error;
		}
	}
	goto __finally20;
	__catch20_g_error:
	{
		GError * e;
		e = _inner_error_;
		_inner_error_ = NULL;
		{
			g_error ("main.vala:25: parsing options failed: %s", e->message);
			_g_error_free0 (e);
		}
	}
	__finally20:
	if (_inner_error_ != NULL) {
		_g_option_context_free0 (context);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
		g_clear_error (&_inner_error_);
		return 0;
	}
	if (!verbose) {
		GLogFunc _tmp0_;
		GDestroyNotify handler_target_destroy_notify = NULL;
		void* handler_target = NULL;
		GLogFunc handler;
		handler = (_tmp0_ = __lambda7__glog_func, handler_target = NULL, handler_target_destroy_notify = NULL, _tmp0_);
		g_log_set_handler ("libmatenu", G_LOG_LEVEL_DEBUG, handler, handler_target);
		g_log_set_handler (NULL, G_LOG_LEVEL_DEBUG, handler, handler_target);
		(handler_target_destroy_notify == NULL) ? NULL : (handler_target_destroy_notify (handler_target), NULL);
		handler = NULL;
		handler_target = NULL;
		handler_target_destroy_notify = NULL;
	}
	gtk_rc_parse_string ("\n" \
"\t\tstyle \"globalmenu_event_box_style\"\n" \
"\t\t{\n" \
"\t\t\tGtkWidget::focus-line-width=0\n" \
"\t\t\tGtkWidget::focus-padding=0\n" \
"\t\t}\n" \
"\t\tstyle \"globalmenu_menu_bar_style\"\n" \
"\t\t{\n" \
"\t\t\tythickness = 0\n" \
"\t\t\tGtkMenuBar::shadow-type = none\n" \
"\t\t\tGtkMenuBar::internal-padding = 0\n" \
"\t\t}\n" \
"\t\tclass \"GtkEventBox\" style \"globalmenu_event_box_style\"\n" \
"\t\tclass \"MatenuMenuBar\" style:highest \"globalmenu_menu_bar_style" \
"\"\n");
	gtk_init (&args_length1, &args);
	if (!matecomponent_init (&args_length1, args)) {
		g_error ("main.vala:52: Cannot initialize matecomponent.");
	}
	retval = mate_panel_applet_factory_main (FACTORY_IID, TYPE_APPLET, __lambda8__mate_panel_applet_factory_callback, NULL);
	result = retval;
	_g_option_context_free0 (context);
	return result;
}
int
main (int argc, char *argv[])
{
	PortableServer_ObjectId *objid;
	PortableServer_POA poa;
	GOptionContext *ctx;
	GOptionGroup *goption_group;
	GError *error = NULL;
        GMainLoop *loop;

	CORBA_Environment ev;
	CORBA_ORB orb;
	GSList *reg_env = NULL;

	signal (SIGINT, do_exit);
	signal (SIGTERM, do_exit);

        g_thread_init (NULL);

	CORBA_exception_init (&ev);
	orb = matecomponent_activation_init (argc, argv);

	g_set_prgname ("matecomponent-activation-empty-server");
	ctx = g_option_context_new (NULL);
	goption_group = matecomponent_activation_get_goption_group ();
	g_option_context_set_main_group (ctx, goption_group);
	if (!g_option_context_parse (ctx, &argc, &argv, &error)) {
		g_printerr ("%s\n", error->message);
		g_error_free (error);
		exit (1);
	}
	g_option_context_free (ctx);

	POA_Empty__init (&poa_empty_servant, &ev);

	poa = (PortableServer_POA)
		CORBA_ORB_resolve_initial_references (orb, "RootPOA", &ev);
	objid = PortableServer_POA_activate_object (poa, &poa_empty_servant, &ev);

	empty_client = PortableServer_POA_servant_to_reference (poa,
								&poa_empty_servant,
								&ev);
	if (!empty_client) {
		printf ("Cannot get objref\n");
		return 1;
	}

#ifndef G_OS_WIN32
	reg_env = matecomponent_activation_registration_env_set (
			reg_env, "DISPLAY", getenv ("DISPLAY"));
	reg_env = matecomponent_activation_registration_env_set (
			reg_env, "SESSION_MANAGER", getenv ("SESSION_MANAGER"));
	reg_env = matecomponent_activation_registration_env_set (
			reg_env, "AUDIODEV", getenv ("AUDIODEV"));
#endif
	reg_env = matecomponent_activation_registration_env_set (
			reg_env, "LANG", getenv ("LANG"));

        /*
         * NB. It is imperative to register the server that is being
         * requested last - or we can still race in the activation daemon.
         */
	matecomponent_activation_register_active_server ("OAFIID:Empty2:19991025", empty_client, reg_env);
        g_usleep (500000); /* 1/2 sec */
	matecomponent_activation_register_active_server ("OAFIID:Empty:19991025", empty_client, reg_env);

	matecomponent_activation_registration_env_free (reg_env);

	PortableServer_POAManager_activate
		(PortableServer_POA__get_the_POAManager (poa, &ev), &ev);

        /* run the CORBA main loop for a couple of seconds then quit */
        loop = g_main_loop_new (NULL, FALSE);
        g_timeout_add (1000, (GSourceFunc) g_main_loop_quit, loop);
        g_main_loop_run (loop);

	matecomponent_activation_active_server_unregister ("OAFIID:Empty:19991025", empty_client);
	matecomponent_activation_active_server_unregister ("OAFIID:Empty2:19991025", empty_client);

	PortableServer_POA_deactivate_object (poa, objid, &ev);

	return 0;
}