void
mcharmap_settings_shutdown (void)
{
  mateconf_client_remove_dir (client, MATECONF_PREFIX, NULL);
  g_object_unref(client);
  client = NULL;
}
static void
calendar_sources_finalize_source_data (CalendarSources    *sources,
				       CalendarSourceData *source_data)
{
  if (source_data->loaded)
    {
      GSList *l;

      if (source_data->selected_sources_dir)
	{
	  mateconf_client_remove_dir (sources->priv->mateconf_client,
				   source_data->selected_sources_dir,
				   NULL);

	  g_free (source_data->selected_sources_dir);
	  source_data->selected_sources_dir = NULL;
	}

      if (source_data->selected_sources_listener)
	{
	  mateconf_client_notify_remove (sources->priv->mateconf_client,
				      source_data->selected_sources_listener);
	  source_data->selected_sources_listener = 0;
	}

      for (l = source_data->clients; l; l = l->next)
        {
          g_signal_handlers_disconnect_by_func (G_OBJECT (l->data),
                                                G_CALLBACK (backend_died_cb),
                                                source_data);
          g_object_unref (l->data);
        }
      g_slist_free (source_data->clients);
      source_data->clients = NULL;

      if (source_data->esource_list)
        {
          g_signal_handlers_disconnect_by_func (source_data->esource_list,
                                                G_CALLBACK (calendar_sources_esource_list_changed),
                                                source_data);
          g_object_unref (source_data->esource_list);
	}
      source_data->esource_list = NULL;

      for (l = source_data->selected_sources; l; l = l->next)
	g_free (l->data);
      g_slist_free (source_data->selected_sources);
      source_data->selected_sources = NULL;

      if (source_data->timeout_id != 0)
        {
          g_source_remove (source_data->timeout_id);
          source_data->timeout_id = 0;
        }

      source_data->loaded = FALSE;
    }
}
void
matecomponent_ui_preferences_remove_engine (MateComponentUIEngine *engine)
{
	if (!g_slist_find (engine_list, engine))
		return;

	engine_list = g_slist_remove (engine_list, engine);

	if (engine_list == NULL) {
		/* Remove notification */
		mateconf_client_remove_dir (client, GLOBAL_INTERFACE_KEY, NULL);
		mateconf_client_notify_remove (client, desktop_notify_id);
		desktop_notify_id = 0;
	}
}
static void
panel_menu_button_disconnect_from_mateconf (PanelMenuButton *button)
{
	MateConfClient *client;
	const char  *key;

	if (!button->priv->mateconf_notify)
		return;

	client  = panel_mateconf_get_client ();

	key = panel_mateconf_sprintf (PANEL_CONFIG_DIR "/objects/%s",
				   button->priv->applet_id);

	mateconf_client_notify_remove (client, button->priv->mateconf_notify);
	button->priv->mateconf_notify = 0;

	mateconf_client_remove_dir (client, key, NULL);
}
static void
mateconf_bookmarks_dialog_destroy (GtkObject *object)
{
	MateConfClient *client;
	MateConfBookmarksDialog *dialog;
	
	client = mateconf_client_get_default ();
	dialog = MATECONF_BOOKMARKS_DIALOG (object);
	
	if (dialog->notify_id != 0) {
		mateconf_client_notify_remove (client, dialog->notify_id);
		mateconf_client_remove_dir (client, BOOKMARKS_KEY, NULL);
		dialog->notify_id = 0;
	}

	g_object_unref (client);
	
	if (GTK_OBJECT_CLASS (mateconf_bookmarks_dialog_parent_class)->destroy) {
		(* GTK_OBJECT_CLASS (mateconf_bookmarks_dialog_parent_class)->destroy) (object);
	}
}
int
main (int argc, char **argv)
{
	char           *desktopfile;
	GOptionContext *context;
	GError         *error;

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

	/* We will register explicitly when we're ready -- see panel-session.c */
	egg_sm_client_set_mode (EGG_SM_CLIENT_MODE_DISABLED);

	g_set_prgname ("mate-panel");

	desktopfile = panel_g_lookup_in_applications_dirs ("mate-panel.desktop");
	if (desktopfile) {
		egg_set_desktop_file (desktopfile);
		g_free (desktopfile);
	}

	context = g_option_context_new ("");
	g_option_context_add_group (context,
				    egg_sm_client_get_option_group ());
	g_option_context_add_group (context, gtk_get_option_group (TRUE));
	g_option_context_add_main_entries (context, options, GETTEXT_PACKAGE);

	gtk_init (&argc, &argv);

	error = NULL;
	if (!g_option_context_parse (context, &argc, &argv, &error)) {
		g_printerr ("%s\n", error->message);
		g_error_free (error);
		g_option_context_free (context);

		return 1;
	}

	g_option_context_free (context);

	/* reset the configuration and exit. */
	if (reset == TRUE)
	{
		panel_reset();
		return 0;
	}


	if (!egg_get_desktop_file ()) {
		g_set_application_name (_("Panel"));
		gtk_window_set_default_icon_name (PANEL_ICON_PANEL);
	}

	if (!panel_shell_register (replace)) {
		panel_cleanup_do ();
		return -1;
	}

	panel_action_protocol_init ();
	panel_multiscreen_init ();
	panel_init_stock_icons_and_items ();

	mateconf_client_add_dir (panel_mateconf_get_client (),
			      "/desktop/mate/interface",
			      MATECONF_CLIENT_PRELOAD_NONE,
			      NULL);

	panel_global_config_load ();
	panel_lockdown_init ();
	panel_profile_load ();

	/*add forbidden lists to ALL panels*/
	g_slist_foreach (panels,
			 (GFunc)panel_widget_add_forbidden,
			 NULL);

	xstuff_init ();

	/* Flush to make sure our struts are seen by everyone starting
	 * immediate after (eg, the caja desktop). */
	gdk_flush ();

	/* Do this at the end, to be sure that we're really ready when
	 * connecting to the session manager */
	panel_session_init ();

	gtk_main ();

	panel_lockdown_finalize ();

	mateconf_client_remove_dir (panel_mateconf_get_client (),
				 "/desktop/mate/interface",
				 NULL);

	panel_cleanup_do ();

	return 0;
}